Compare commits

...

5 Commits
2.4.0 ... 2.4.1

Author SHA1 Message Date
2a930720be Merge branch 'release/2.4.1' 2020-03-24 08:06:09 +00:00
2b1cb7856f update version
this release contains for #31 and #14
2020-03-24 08:05:55 +00:00
f1d080983a fix #32 2020-03-24 06:43:10 +00:00
767b083a22 fix preferences storage 2020-03-21 15:17:34 +01:00
348ffe20d6 Merge branch 'release/2.4.0' into develop 2020-03-21 11:35:52 +01:00
9 changed files with 92 additions and 32 deletions

View File

@ -4,6 +4,7 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
@ -11,8 +12,6 @@ import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Widget;
import com.minres.scviewer.database.swt.Constants;
@ -76,11 +75,15 @@ class ToolTipHandler {
if (tip != null && !tip.isDisposed ()) tip.dispose ();
tip = new Shell (parentShell, SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
tip.setBackground (display.getSystemColor (SWT.COLOR_INFO_BACKGROUND));
RowLayout layout=new RowLayout(SWT.VERTICAL);
layout.fill=true;
GridLayout layout = new GridLayout(1, true);
layout.verticalSpacing=0;
layout.horizontalSpacing=0;
layout.marginWidth = 0;
layout.marginHeight = 0;
tip.setLayout(layout);
boolean visible = provider.createContent(tip, pt);
tip.pack();
tip.setSize(tip.computeSize(SWT.DEFAULT, SWT.DEFAULT));
setHoverLocation(tip, tipPosition);
tip.setVisible (visible);
if(visible)

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
Bundle-Version: 2.4.0.qualifier
Bundle-Version: 2.4.1.qualifier
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: javax.inject;bundle-version="1.0.0",
org.eclipse.core.runtime;bundle-version="3.11.1",

View File

@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>com.minres.scviewer.e4.application</artifactId>
<version>2.4.0-SNAPSHOT</version>
<version>2.4.1-SNAPSHOT</version>
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>

View File

@ -31,6 +31,7 @@ import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import org.eclipse.core.internal.preferences.InstancePreferences;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
@ -41,9 +42,11 @@ import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.core.runtime.jobs.JobGroup;
import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.di.extensions.Preference;
import org.eclipse.e4.core.services.events.IEventBroker;
@ -72,6 +75,7 @@ import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
@ -81,6 +85,7 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Widget;
import org.osgi.service.prefs.BackingStoreException;
import com.minres.scviewer.database.DataType;
import com.minres.scviewer.database.ITx;
@ -192,9 +197,9 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
/** The prefs. */
@Inject
@Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE)
IEclipsePreferences prefs;
@Preference(value = ConfigurationScope.SCOPE, nodePath = PreferenceConstants.PREFERENCES_SCOPE)
protected IEclipsePreferences prefs;
@Inject @Optional DesignBrowser designBrowser;
/** The database. */
@ -240,7 +245,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
@PostConstruct
public void createComposite(MPart part, Composite parent, IWaveformDbFactory dbFactory) {
disposeListenerNumber += 1;
myPart = part;
myParent = parent;
database = dbFactory.getDatabase();
@ -399,18 +404,26 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
final Font font = new Font(Display.getCurrent(), "Terminal", 10, SWT.NORMAL);
final Label label = new Label(parent, SWT.NONE);
label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
// label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
// label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
label.setText(tx.toString());
label.setFont(font);
GridData labelGridData = new GridData();
labelGridData.horizontalAlignment = GridData.FILL;
labelGridData.grabExcessHorizontalSpace = true;
label.setLayoutData(labelGridData);
final Table table = new Table(parent, SWT.NONE);
table.setHeaderVisible(true);
table.setLinesVisible(true);
table.setFont(font);
table.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
table.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
// table.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
// table.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
table.setRedraw(false);
GridData tableGridData = new GridData();
tableGridData.horizontalAlignment = GridData.FILL;
tableGridData.grabExcessHorizontalSpace = true;
table.setLayoutData(tableGridData);
final TableColumn nameCol = new TableColumn(table, SWT.LEFT);
nameCol.setText("Attribute");
@ -428,8 +441,12 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
item.setText(0, iTxAttribute.getName());
item.setText(1, value);
}
TableItem item = new TableItem(table, SWT.NONE);
item.setText(0, "");
item.setText(1, "");
nameCol.pack();
valueCol.pack();
table.pack();
table.setRedraw(true);
parent.addPaintListener(new PaintListener() {
@ -449,10 +466,14 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
final Font font = new Font(Display.getCurrent(), "Terminal", 10, SWT.NORMAL);
final Label label = new Label(parent, SWT.NONE);
label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
//label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
//label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
label.setText(te.waveform.getFullName());
label.setFont(font);
GridData labelGridData = new GridData();
labelGridData.horizontalAlignment = GridData.FILL;
labelGridData.grabExcessHorizontalSpace = true;
label.setLayoutData(labelGridData);
return true;
}
return false;
@ -465,17 +486,21 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
*/
@Override
public void preferenceChange(PreferenceChangeEvent event) {
InstancePreferences pref = (InstancePreferences)event.getSource();
if (PreferenceConstants.DATABASE_RELOAD.equals(event.getKey())) {
checkForUpdates = (Boolean) event.getNewValue();
checkForUpdates = pref.getBoolean(PreferenceConstants.DATABASE_RELOAD, true);
fileChecker = null;
if (checkForUpdates)
fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad,
FILE_CHECK_INTERVAL);
else
fileMonitor.removeFileChangeListener(this);
} else {
} else if (!PreferenceConstants.SHOW_HOVER.equals(event.getKey())){
setupColors();
}
try {
pref.flush();
} catch (BackingStoreException e) { }
}
/**

View File

@ -11,15 +11,14 @@
package com.minres.scviewer.e4.application.preferences;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jface.resource.StringConverter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.wb.swt.SWTResourceManager;
import com.minres.scviewer.database.ui.WaveformColors;
import com.opcoach.e4.preferences.ScopedPreferenceStore;
/**
* The Class DefaultValuesInitializer.
@ -64,13 +63,22 @@ public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
*/
@Override
public void initializeDefaultPreferences() {
IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
store.setDefault(PreferenceConstants.DATABASE_RELOAD, true);
store.setDefault(PreferenceConstants.SHOW_HOVER, true);
for (WaveformColors c : WaveformColors.values()) {
store.setDefault(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
}
IEclipsePreferences node = DefaultScope.INSTANCE.getNode(PreferenceConstants.PREFERENCES_SCOPE);
if (node != null)
{
node.putBoolean(PreferenceConstants.DATABASE_RELOAD, true);
node.putBoolean(PreferenceConstants.SHOW_HOVER, true);
for (WaveformColors c : WaveformColors.values()) {
node.put(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
}
}
// IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
//
// store.setDefault(PreferenceConstants.DATABASE_RELOAD, true);
// store.setDefault(PreferenceConstants.SHOW_HOVER, true);
// for (WaveformColors c : WaveformColors.values()) {
// store.setDefault(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
// }
}
}

View File

@ -0,0 +1,18 @@
package com.minres.scviewer.e4.application.preferences;
import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.jface.preference.IPreferenceStore;
import com.opcoach.e4.preferences.IPreferenceStoreProvider;
import com.opcoach.e4.preferences.ScopedPreferenceStore;
public class PreferencesStoreProvider implements IPreferenceStoreProvider{
public PreferencesStoreProvider(){
}
@Override
public IPreferenceStore getPreferenceStore() {
return new ScopedPreferenceStore(ConfigurationScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
}
}

View File

@ -10,7 +10,7 @@
<relativePath>../com.minres.scviewer.parent</relativePath>
</parent>
<artifactId>com.minres.scviewer.e4.product</artifactId>
<version>2.4.0-SNAPSHOT</version>
<version>2.4.1-SNAPSHOT</version>
<packaging>eclipse-repository</packaging>
<groupId>com.minres.scviewer</groupId>
<build>

View File

@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
<product name="SCViewer" uid="scviewer" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.4.0.qualifier" useFeatures="false" includeLaunchers="true">
<product name="SCViewer" uid="scviewer" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.4.1.qualifier" useFeatures="false" includeLaunchers="true">
<configIni use="default">
</configIni>
<launcherArgs>
<programArgs>-clearPersistedState -data @none
<programArgs>-clearPersistedState
</programArgs>
<vmArgs>-Xmx2G
</vmArgs>
@ -33,6 +34,7 @@
</win>
</launcher>
<vm>
<linux include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8</linux>
<macos include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8</macos>

View File

@ -46,6 +46,7 @@ public class E4PreferenceRegistry
public static final String PREFS_PAGE_XP = "com.opcoach.e4.preferences.e4PreferencePages"; // $NON-NLS-1$
public static final String PREF_STORE_PROVIDER = "com.opcoach.e4.preferences.e4PreferenceStoreProvider"; // $NON-NLS-1$
public static final String KEY_PREF_STORE_PROVIDERS = "com.opcoach.e4.preferences.e4PreferenceStoreProviders"; // $NON-NLS-1$
protected static final String ELMT_PAGE = "page"; // $NON-NLS-1$
protected static final String ATTR_ID = "id"; // $NON-NLS-1$
protected static final String ATTR_CATEGORY = "category"; // $NON-NLS-1$
@ -235,6 +236,7 @@ public class E4PreferenceRegistry
IContributionFactory factory = context.get(IContributionFactory.class);
psProviders = new HashMap<String, Object>();
IExtensionRegistry registry = context.get(IExtensionRegistry.class);
// Read extensions and fill the map...
for (IConfigurationElement elmt : registry.getConfigurationElementsFor(PREF_STORE_PROVIDER))
@ -261,7 +263,7 @@ public class E4PreferenceRegistry
Object data = objectId;
if (classname != null)
{
data = factory.create(classname, context);
data = factory.create("bundleclass://"+declaringBundle+"/"+classname, context);
if (!(data instanceof IPreferenceStoreProvider))
{
logger.warn("In extension " + PREF_STORE_PROVIDER + " the class must implements IPreferenceStoreProvider. Check the plugin " + declaringBundle);
@ -272,6 +274,8 @@ public class E4PreferenceRegistry
psProviders.put(pluginId, data);
}
context.set(KEY_PREF_STORE_PROVIDERS, psProviders);
}
}