Merge branch 'release/2.6'
This commit is contained in:
commit
ae3dcb51ad
@ -9,7 +9,6 @@ Import-Package: org.osgi.framework;version="1.3.0"
|
|||||||
Automatic-Module-Name: com.minres.scviewer.database.leveldb
|
Automatic-Module-Name: com.minres.scviewer.database.leveldb
|
||||||
Service-Component: OSGI-INF/*.xml
|
Service-Component: OSGI-INF/*.xml
|
||||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
|
||||||
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
||||||
org.eclipse.osgi.services;bundle-version="3.4.0"
|
org.eclipse.osgi.services;bundle-version="3.4.0"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
|
@ -64,7 +64,7 @@ public class LevelDBLoader implements IWaveformDbLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<IWaveform> getAllWaves() {
|
public Collection<IWaveform> getAllWaves() {
|
||||||
List<IWaveform> streams=new ArrayList<IWaveform>();
|
List<IWaveform> streams=new ArrayList<IWaveform>();
|
||||||
SeekingIterator<String, String> it = levelDb.iterator();
|
SeekingIterator<String, String> it = levelDb.iterator();
|
||||||
it.seek("s~");
|
it.seek("s~");
|
||||||
|
@ -61,7 +61,7 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<IWaveform> getAllWaves() {
|
public Collection<IWaveform> getAllWaves() {
|
||||||
SQLiteDatabaseSelectHandler<ScvStream> handler = new SQLiteDatabaseSelectHandler<ScvStream>(ScvStream.class, database);
|
SQLiteDatabaseSelectHandler<ScvStream> handler = new SQLiteDatabaseSelectHandler<ScvStream>(ScvStream.class, database);
|
||||||
List<IWaveform> streams=new ArrayList<IWaveform>();
|
List<IWaveform> streams=new ArrayList<IWaveform>();
|
||||||
try {
|
try {
|
||||||
@ -81,6 +81,7 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean load(IWaveformDb db, File file) throws Exception {
|
public boolean load(IWaveformDb db, File file) throws Exception {
|
||||||
|
if(file.isDirectory() || !file.exists()) return false;
|
||||||
this.db=db;
|
this.db=db;
|
||||||
try {
|
try {
|
||||||
FileInputStream fis = new FileInputStream(file);
|
FileInputStream fis = new FileInputStream(file);
|
||||||
|
@ -1,46 +1,104 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
|
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
|
||||||
<booleanAttribute key="append.args" value="true"/>
|
<booleanAttribute key="append.args" value="true"/>
|
||||||
<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
|
<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
|
||||||
<booleanAttribute key="askclear" value="false"/>
|
<booleanAttribute key="askclear" value="false"/>
|
||||||
<booleanAttribute key="automaticAdd" value="true"/>
|
<booleanAttribute key="automaticAdd" value="true"/>
|
||||||
<booleanAttribute key="automaticValidate" value="false"/>
|
<booleanAttribute key="automaticValidate" value="false"/>
|
||||||
<stringAttribute key="bootstrap" value=""/>
|
<stringAttribute key="bootstrap" value=""/>
|
||||||
<stringAttribute key="checked" value="[NONE]"/>
|
<stringAttribute key="checked" value="[NONE]"/>
|
||||||
<booleanAttribute key="clearConfig" value="true"/>
|
<booleanAttribute key="clearConfig" value="true"/>
|
||||||
<booleanAttribute key="clearws" value="true"/>
|
<booleanAttribute key="clearws" value="true"/>
|
||||||
<booleanAttribute key="clearwslog" value="false"/>
|
<booleanAttribute key="clearwslog" value="false"/>
|
||||||
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
|
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
|
||||||
<booleanAttribute key="default" value="true"/>
|
<booleanAttribute key="default" value="true"/>
|
||||||
<stringAttribute key="deselected_workspace_plugins" value="com.minres.scviewer.e4.application,com.minres.scviewer.ui"/>
|
<setAttribute key="deselected_workspace_bundles">
|
||||||
<booleanAttribute key="includeOptional" value="true"/>
|
<setEntry value="com.minres.scviewer.e4.application"/>
|
||||||
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
|
<setEntry value="com.minres.scviewer.ui"/>
|
||||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
</setAttribute>
|
||||||
<listEntry value="/com.minres.scviewer.database.test"/>
|
<booleanAttribute key="includeOptional" value="true"/>
|
||||||
</listAttribute>
|
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
|
||||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||||
<listEntry value="4"/>
|
<listEntry value="/com.minres.scviewer.database.test"/>
|
||||||
</listAttribute>
|
</listAttribute>
|
||||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.minres.scviewer.database.test"/>
|
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
<listEntry value="4"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
</listAttribute>
|
||||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.minres.scviewer.database.test"/>
|
||||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
|
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
|
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.minres.scviewer.database.test"/>
|
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx512m"/>
|
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
|
||||||
<stringAttribute key="pde.version" value="3.3"/>
|
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.minres.scviewer.database.test"/>
|
||||||
<stringAttribute key="product" value="com.minres.scviewer.e4.product"/>
|
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
||||||
<booleanAttribute key="run_in_ui_thread" value="true"/>
|
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx512m"/>
|
||||||
<stringAttribute key="selected_target_plugins" value="com.google.guava@default:default,javax.annotation@default:default,javax.inject@default:default,javax.servlet@default:default,org.apache.ant@default:default,org.apache.commons.jxpath@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.codehaus.groovy@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.e4.core.contexts@default:default,org.eclipse.e4.core.di.annotations@default:default,org.eclipse.e4.core.di.extensions@default:default,org.eclipse.e4.core.di@default:default,org.eclipse.e4.core.services@default:default,org.eclipse.e4.emf.xpath@default:default,org.eclipse.e4.ui.di@default:default,org.eclipse.e4.ui.model.workbench@default:default,org.eclipse.e4.ui.services@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.bidi@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.jface@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.eclipse.swt@default:default,org.hamcrest.core@default:default,org.junit@default:default"/>
|
<stringAttribute key="pde.version" value="3.3"/>
|
||||||
<stringAttribute key="selected_workspace_plugins" value="com.minres.scviewer.database.sqlite@default:true,com.minres.scviewer.database.test@default:default,com.minres.scviewer.database.text@default:true,com.minres.scviewer.database.ui.swt@default:default,com.minres.scviewer.database.ui@default:default,com.minres.scviewer.database.vcd@default:default,com.minres.scviewer.database@default:true,com.opcoach.e4.preferences@default:default"/>
|
<stringAttribute key="product" value="com.minres.scviewer.e4.product"/>
|
||||||
<booleanAttribute key="show_selected_only" value="false"/>
|
<booleanAttribute key="run_in_ui_thread" value="true"/>
|
||||||
<booleanAttribute key="tracing" value="false"/>
|
<setAttribute key="selected_target_bundles">
|
||||||
<booleanAttribute key="useCustomFeatures" value="false"/>
|
<setEntry value="com.google.guava@default:default"/>
|
||||||
<booleanAttribute key="useDefaultConfig" value="true"/>
|
<setEntry value="javax.annotation@default:default"/>
|
||||||
<booleanAttribute key="useDefaultConfigArea" value="false"/>
|
<setEntry value="javax.inject@default:default"/>
|
||||||
<booleanAttribute key="useProduct" value="false"/>
|
<setEntry value="javax.servlet@default:default"/>
|
||||||
|
<setEntry value="org.apache.ant@default:default"/>
|
||||||
|
<setEntry value="org.apache.commons.jxpath@default:default"/>
|
||||||
|
<setEntry value="org.apache.felix.gogo.command@default:default"/>
|
||||||
|
<setEntry value="org.apache.felix.gogo.runtime@default:default"/>
|
||||||
|
<setEntry value="org.codehaus.groovy@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.ant.core@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.core.commands@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.core.contenttype@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.core.expressions@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.core.filesystem.macosx@default:false"/>
|
||||||
|
<setEntry value="org.eclipse.core.filesystem@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.core.jobs@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.core.resources@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.core.runtime@default:true"/>
|
||||||
|
<setEntry value="org.eclipse.core.variables@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.e4.core.contexts@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.e4.core.di.annotations@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.e4.core.di.extensions@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.e4.core.di@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.e4.core.services@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.e4.emf.xpath@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.e4.ui.di@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.e4.ui.model.workbench@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.e4.ui.services@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.emf.common@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.emf.ecore@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.equinox.app@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.equinox.bidi@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.equinox.common@2:true"/>
|
||||||
|
<setEntry value="org.eclipse.equinox.ds@1:true"/>
|
||||||
|
<setEntry value="org.eclipse.equinox.preferences@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.equinox.registry@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.equinox.util@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.jface@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.osgi.compatibility.state@default:false"/>
|
||||||
|
<setEntry value="org.eclipse.osgi.services@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.osgi@-1:true"/>
|
||||||
|
<setEntry value="org.eclipse.swt.cocoa.macosx.x86_64@default:false"/>
|
||||||
|
<setEntry value="org.eclipse.swt@default:default"/>
|
||||||
|
<setEntry value="org.hamcrest.core@default:default"/>
|
||||||
|
<setEntry value="org.junit@default:default"/>
|
||||||
|
</setAttribute>
|
||||||
|
<setAttribute key="selected_workspace_bundles">
|
||||||
|
<setEntry value="com.minres.scviewer.database.sqlite@default:true"/>
|
||||||
|
<setEntry value="com.minres.scviewer.database.test@default:default"/>
|
||||||
|
<setEntry value="com.minres.scviewer.database.text@default:true"/>
|
||||||
|
<setEntry value="com.minres.scviewer.database.ui.swt@default:default"/>
|
||||||
|
<setEntry value="com.minres.scviewer.database.ui@default:default"/>
|
||||||
|
<setEntry value="com.minres.scviewer.database.vcd@default:default"/>
|
||||||
|
<setEntry value="com.minres.scviewer.database@default:true"/>
|
||||||
|
<setEntry value="com.opcoach.e4.preferences@default:default"/>
|
||||||
|
</setAttribute>
|
||||||
|
<booleanAttribute key="show_selected_only" value="false"/>
|
||||||
|
<booleanAttribute key="tracing" value="false"/>
|
||||||
|
<booleanAttribute key="useCustomFeatures" value="false"/>
|
||||||
|
<booleanAttribute key="useDefaultConfig" value="true"/>
|
||||||
|
<booleanAttribute key="useDefaultConfigArea" value="false"/>
|
||||||
|
<booleanAttribute key="useProduct" value="false"/>
|
||||||
</launchConfiguration>
|
</launchConfiguration>
|
||||||
|
@ -8,7 +8,6 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
|||||||
Import-Package: org.osgi.framework;version="1.3.0"
|
Import-Package: org.osgi.framework;version="1.3.0"
|
||||||
Require-Bundle: com.minres.scviewer.database,
|
Require-Bundle: com.minres.scviewer.database,
|
||||||
org.codehaus.groovy;bundle-version="2.5.8",
|
org.codehaus.groovy;bundle-version="2.5.8",
|
||||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
|
||||||
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
||||||
org.eclipse.osgi.services;bundle-version="3.4.0",
|
org.eclipse.osgi.services;bundle-version="3.4.0",
|
||||||
com.google.guava;bundle-version="15.0.0"
|
com.google.guava;bundle-version="15.0.0"
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
</compilerArguments>
|
</compilerArguments>
|
||||||
<!-- set verbose to be true if you want lots of uninteresting messages -->
|
<!-- set verbose to be true if you want lots of uninteresting messages -->
|
||||||
<!-- <verbose>true</verbose> -->
|
<!-- <verbose>true</verbose> -->
|
||||||
<source>1.7</source>
|
<source>1.8</source>
|
||||||
<target>1.7</target>
|
<target>1.8</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -50,8 +50,8 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<IWaveform> getAllWaves() {
|
public Collection<IWaveform> getAllWaves() {
|
||||||
return new LinkedList<IWaveform>(streams);
|
return streams;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Long, ITxGenerator> getGeneratorsById() {
|
public Map<Long, ITxGenerator> getGeneratorsById() {
|
||||||
@ -64,6 +64,7 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean load(IWaveformDb db, File file) throws Exception {
|
boolean load(IWaveformDb db, File file) throws Exception {
|
||||||
|
if(file.isDirectory() || !file.exists()) return false;
|
||||||
this.db=db
|
this.db=db
|
||||||
this.streams=[]
|
this.streams=[]
|
||||||
try {
|
try {
|
||||||
@ -82,7 +83,7 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
.make()
|
.make()
|
||||||
// NPE here --->
|
// NPE here --->
|
||||||
parseInput(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))
|
parseInput(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))
|
||||||
calculateConcurrencyIndicees()
|
streams.each{ TxStream stream -> stream.getMaxConcurrency() }
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
} catch (IndexOutOfBoundsException e) {
|
} catch (IndexOutOfBoundsException e) {
|
||||||
@ -135,7 +136,7 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
case "ms":return 1000000000000L
|
case "ms":return 1000000000000L
|
||||||
case "s": return 1000000000000000L
|
case "s": return 1000000000000000L
|
||||||
}
|
}
|
||||||
return "fs"
|
return 1L
|
||||||
}
|
}
|
||||||
|
|
||||||
private def parseInput(InputStream inputStream){
|
private def parseInput(InputStream inputStream){
|
||||||
@ -152,23 +153,29 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
def tokens = line.split(/\s+/) as ArrayList
|
def tokens = line.split(/\s+/) as ArrayList
|
||||||
switch(tokens[0]){
|
switch(tokens[0]){
|
||||||
case "scv_tr_stream":
|
case "scv_tr_stream":
|
||||||
case "scv_tr_generator":
|
|
||||||
case "begin_attribute":
|
|
||||||
case "end_attribute":
|
|
||||||
if ((matcher = line =~ /^scv_tr_stream\s+\(ID (\d+),\s+name\s+"([^"]+)",\s+kind\s+"([^"]+)"\)$/)) {
|
if ((matcher = line =~ /^scv_tr_stream\s+\(ID (\d+),\s+name\s+"([^"]+)",\s+kind\s+"([^"]+)"\)$/)) {
|
||||||
def id = Integer.parseInt(matcher[0][1])
|
def id = Integer.parseInt(matcher[0][1])
|
||||||
def stream = new TxStream(this, id, matcher[0][2], matcher[0][3])
|
def stream = new TxStream(this, id, matcher[0][2], matcher[0][3])
|
||||||
streams<<stream
|
streams<<stream
|
||||||
streamsById[id]=stream
|
streamsById[id]=stream
|
||||||
} else if ((matcher = line =~ /^scv_tr_generator\s+\(ID\s+(\d+),\s+name\s+"([^"]+)",\s+scv_tr_stream\s+(\d+),$/)) {
|
}
|
||||||
|
break;
|
||||||
|
case "scv_tr_generator":
|
||||||
|
if ((matcher = line =~ /^scv_tr_generator\s+\(ID\s+(\d+),\s+name\s+"([^"]+)",\s+scv_tr_stream\s+(\d+),$/)) {
|
||||||
def id = Integer.parseInt(matcher[0][1])
|
def id = Integer.parseInt(matcher[0][1])
|
||||||
ITxStream stream=streamsById[Integer.parseInt(matcher[0][3])]
|
ITxStream stream=streamsById[Integer.parseInt(matcher[0][3])]
|
||||||
generator=new TxGenerator(id, stream, matcher[0][2])
|
generator=new TxGenerator(id, stream, matcher[0][2])
|
||||||
stream.generators<<generator
|
stream.generators<<generator
|
||||||
generatorsById[id]=generator
|
generatorsById[id]=generator
|
||||||
} else if ((matcher = line =~ /^begin_attribute \(ID (\d+), name "([^"]+)", type "([^"]+)"\)$/)) {
|
}
|
||||||
|
break;
|
||||||
|
case "begin_attribute":
|
||||||
|
if ((matcher = line =~ /^begin_attribute \(ID (\d+), name "([^"]+)", type "([^"]+)"\)$/)) {
|
||||||
generator.begin_attrs << TxAttributeType.getAttrType(matcher[0][2], DataType.valueOf(matcher[0][3]), AssociationType.BEGIN)
|
generator.begin_attrs << TxAttributeType.getAttrType(matcher[0][2], DataType.valueOf(matcher[0][3]), AssociationType.BEGIN)
|
||||||
} else if ((matcher = line =~ /^end_attribute \(ID (\d+), name "([^"]+)", type "([^"]+)"\)$/)) {
|
}
|
||||||
|
break;
|
||||||
|
case "end_attribute":
|
||||||
|
if ((matcher = line =~ /^end_attribute \(ID (\d+), name "([^"]+)", type "([^"]+)"\)$/)) {
|
||||||
generator.end_attrs << TxAttributeType.getAttrType(matcher[0][2], DataType.valueOf(matcher[0][3]), AssociationType.END)
|
generator.end_attrs << TxAttributeType.getAttrType(matcher[0][2], DataType.valueOf(matcher[0][3]), AssociationType.END)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -227,31 +234,6 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private def toDataType(String str){
|
|
||||||
switch (str)
|
|
||||||
{
|
|
||||||
case "BOOLEAN": return DataType. BOOLEAN
|
|
||||||
case "ENUMERATION": return DataType. ENUMERATION
|
|
||||||
case "INTEGER": return DataType. INTEGER
|
|
||||||
case "UNSIGNED": return DataType. UNSIGNED
|
|
||||||
case "FLOATING_POINT_NUMBER": return DataType. FLOATING_POINT_NUMBER
|
|
||||||
case "BIT_VECTOR": return DataType. BIT_VECTOR
|
|
||||||
case "LOGIC_VECTOR": return DataType. LOGIC_VECTOR
|
|
||||||
case "FIXED_POINT_INTEGER": return DataType. FIXED_POINT_INTEGER
|
|
||||||
case "UNSIGNED_FIXED_POINT_INTEGER": return DataType. UNSIGNED_FIXED_POINT_INTEGER
|
|
||||||
case "RECORD": return DataType. RECORD
|
|
||||||
case "POINTER": return DataType. POINTER
|
|
||||||
case "ARRAY": return DataType. ARRAY
|
|
||||||
case "STRING": return DataType. STRING
|
|
||||||
default: return DataType.INTEGER
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private def calculateConcurrencyIndicees(){
|
|
||||||
streams.each{ TxStream stream -> stream.getMaxConcurrency() }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Collection<RelationType> getAllRelationTypes(){
|
public Collection<RelationType> getAllRelationTypes(){
|
||||||
return relationTypes.values();
|
return relationTypes.values();
|
||||||
}
|
}
|
||||||
|
@ -4,15 +4,13 @@ import org.eclipse.swt.SWT;
|
|||||||
import org.eclipse.swt.graphics.Point;
|
import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
import org.eclipse.swt.layout.FillLayout;
|
import org.eclipse.swt.layout.FillLayout;
|
||||||
import org.eclipse.swt.layout.RowLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.swt.widgets.Event;
|
import org.eclipse.swt.widgets.Event;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Listener;
|
import org.eclipse.swt.widgets.Listener;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
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 org.eclipse.swt.widgets.Widget;
|
||||||
|
|
||||||
import com.minres.scviewer.database.swt.Constants;
|
import com.minres.scviewer.database.swt.Constants;
|
||||||
@ -74,13 +72,17 @@ class ToolTipHandler {
|
|||||||
Point pt = new Point (event.x, event.y);
|
Point pt = new Point (event.x, event.y);
|
||||||
tipPosition = control.toDisplay(pt);
|
tipPosition = control.toDisplay(pt);
|
||||||
if (tip != null && !tip.isDisposed ()) tip.dispose ();
|
if (tip != null && !tip.isDisposed ()) tip.dispose ();
|
||||||
tip = new Shell (parentShell, SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
|
tip = new Shell (parentShell, SWT.NO_FOCUS | SWT.TOOL);
|
||||||
tip.setBackground (display.getSystemColor (SWT.COLOR_INFO_BACKGROUND));
|
tip.setBackground (display.getSystemColor (SWT.COLOR_INFO_BACKGROUND));
|
||||||
RowLayout layout=new RowLayout(SWT.VERTICAL);
|
GridLayout layout = new GridLayout(1, true);
|
||||||
layout.fill=true;
|
layout.verticalSpacing=0;
|
||||||
|
layout.horizontalSpacing=0;
|
||||||
|
layout.marginWidth = 0;
|
||||||
|
layout.marginHeight = 0;
|
||||||
tip.setLayout(layout);
|
tip.setLayout(layout);
|
||||||
boolean visible = provider.createContent(tip, pt);
|
boolean visible = provider.createContent(tip, pt);
|
||||||
tip.pack();
|
tip.pack();
|
||||||
|
tip.setSize(tip.computeSize(SWT.DEFAULT, SWT.DEFAULT));
|
||||||
setHoverLocation(tip, tipPosition);
|
setHoverLocation(tip, tipPosition);
|
||||||
tip.setVisible (visible);
|
tip.setVisible (visible);
|
||||||
if(visible)
|
if(visible)
|
||||||
|
@ -7,5 +7,6 @@ Bundle-Vendor: MINRES Technologies GmbH
|
|||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Export-Package: com.minres.scviewer.database.ui
|
Export-Package: com.minres.scviewer.database.ui
|
||||||
Require-Bundle: com.minres.scviewer.database,
|
Require-Bundle: com.minres.scviewer.database,
|
||||||
org.eclipse.jface
|
org.eclipse.jface,
|
||||||
|
org.eclipse.swt
|
||||||
Automatic-Module-Name: com.minres.scviewer.database.ui
|
Automatic-Module-Name: com.minres.scviewer.database.ui
|
||||||
|
@ -52,31 +52,12 @@ public class TrackEntry {
|
|||||||
result[0] = fallback;
|
result[0] = fallback;
|
||||||
result[1] = highlightedFallback;
|
result[1] = highlightedFallback;
|
||||||
|
|
||||||
// assign colors to standard values
|
|
||||||
if (streamValue.contains("read")){
|
|
||||||
result[0] = new Color(86,174,53);
|
|
||||||
result[1] = new Color (86,194,53);
|
|
||||||
}else if (streamValue.contains("rdata")){
|
|
||||||
result[0] = new Color(138,151,71);
|
|
||||||
result[1] = new Color (138,171,71);
|
|
||||||
}else if (streamValue.contains("addr")){
|
|
||||||
result[0] = new Color(233,187,68);
|
|
||||||
result[1] = new Color (233,207,68);
|
|
||||||
}else if (streamValue.contains("write")){
|
|
||||||
result[0] = new Color(1,128,191);
|
|
||||||
result[1] = new Color (1,128,211);
|
|
||||||
}else if (streamValue.contains("wdata")){
|
|
||||||
result[0] = new Color(2,181,160);
|
|
||||||
result[1] = new Color (2,201,160);
|
|
||||||
|
|
||||||
}else {
|
|
||||||
// assign "random" color here, one name always results in the same color!
|
// assign "random" color here, one name always results in the same color!
|
||||||
if( randomColors.length > 0 ) {
|
if( streamValue!=null && randomColors.length > 0 ) {
|
||||||
int index = Math.abs(streamValue.hashCode()) % randomColors.length;
|
int index = Math.abs(streamValue.hashCode()) % randomColors.length;
|
||||||
result[0] = randomColors[index][0];
|
result[0] = randomColors[index][0];
|
||||||
result[1] = randomColors[index][1];
|
result[1] = randomColors[index][1];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ Bundle-Version: 2.0.2.qualifier
|
|||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
|
||||||
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
||||||
org.eclipse.osgi.services;bundle-version="3.4.0",
|
org.eclipse.osgi.services;bundle-version="3.4.0",
|
||||||
com.google.guava;bundle-version="15.0.0"
|
com.google.guava;bundle-version="15.0.0"
|
||||||
|
@ -79,6 +79,7 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public boolean load(IWaveformDb db, File file) throws Exception {
|
public boolean load(IWaveformDb db, File file) throws Exception {
|
||||||
|
if(file.isDirectory() || !file.exists()) return false;
|
||||||
this.db=db;
|
this.db=db;
|
||||||
this.maxTime=0;
|
this.maxTime=0;
|
||||||
String name = file.getCanonicalFile().getName();
|
String name = file.getCanonicalFile().getName();
|
||||||
@ -127,7 +128,7 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
|||||||
* @see com.minres.scviewer.database.ITrDb#getAllWaves()
|
* @see com.minres.scviewer.database.ITrDb#getAllWaves()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<IWaveform> getAllWaves() {
|
public Collection<IWaveform> getAllWaves() {
|
||||||
return signals;
|
return signals;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ package com.minres.scviewer.database;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface IWaveformDbLoader {
|
public interface IWaveformDbLoader {
|
||||||
|
|
||||||
@ -20,7 +19,7 @@ public interface IWaveformDbLoader {
|
|||||||
|
|
||||||
public Long getMaxTime();
|
public Long getMaxTime();
|
||||||
|
|
||||||
public List<IWaveform> getAllWaves() ;
|
public Collection<IWaveform> getAllWaves() ;
|
||||||
|
|
||||||
public Collection<RelationType> getAllRelationTypes() ;
|
public Collection<RelationType> getAllRelationTypes() ;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %Bundle-Name
|
Bundle-Name: %Bundle-Name
|
||||||
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
|
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
|
||||||
Bundle-Version: 2.4.0.qualifier
|
Bundle-Version: 2.6.0.qualifier
|
||||||
Bundle-Vendor: %Bundle-Vendor
|
Bundle-Vendor: %Bundle-Vendor
|
||||||
Require-Bundle: javax.inject;bundle-version="1.0.0",
|
Require-Bundle: javax.inject;bundle-version="1.0.0",
|
||||||
org.eclipse.core.runtime;bundle-version="3.11.1",
|
org.eclipse.core.runtime;bundle-version="3.11.1",
|
||||||
@ -18,7 +18,6 @@ Require-Bundle: javax.inject;bundle-version="1.0.0",
|
|||||||
com.minres.scviewer.database.ui,
|
com.minres.scviewer.database.ui,
|
||||||
com.minres.scviewer.database;bundle-version="1.0.0",
|
com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
org.eclipse.equinox.ds;bundle-version="1.4.300",
|
org.eclipse.equinox.ds;bundle-version="1.4.300",
|
||||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
|
||||||
org.eclipse.osgi.services;bundle-version="3.5.0",
|
org.eclipse.osgi.services;bundle-version="3.5.0",
|
||||||
org.eclipse.e4.core.services;bundle-version="2.0.0",
|
org.eclipse.e4.core.services;bundle-version="2.0.0",
|
||||||
org.eclipse.osgi.services;bundle-version="3.5.0",
|
org.eclipse.osgi.services;bundle-version="3.5.0",
|
||||||
@ -31,7 +30,9 @@ Require-Bundle: javax.inject;bundle-version="1.0.0",
|
|||||||
org.eclipse.e4.ui.workbench.addons.swt,
|
org.eclipse.e4.ui.workbench.addons.swt,
|
||||||
com.opcoach.e4.preferences,
|
com.opcoach.e4.preferences,
|
||||||
org.eclipse.e4.core.di.extensions,
|
org.eclipse.e4.core.di.extensions,
|
||||||
org.eclipse.e4.ui.css.swt.theme;bundle-version="0.10.0"
|
org.eclipse.e4.ui.css.swt.theme;bundle-version="0.10.0",
|
||||||
|
org.eclipse.core.resources;bundle-version="3.13.0",
|
||||||
|
com.opcoach.e4.preferences.mainmenu;bundle-version="1.2.0"
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Import-Package: com.minres.scviewer.database,
|
Import-Package: com.minres.scviewer.database,
|
||||||
javax.inject;version="1.0.0"
|
javax.inject;version="1.0.0"
|
||||||
|
BIN
com.minres.scviewer.e4.application/icons/arrow_up.png
Normal file
BIN
com.minres.scviewer.e4.application/icons/arrow_up.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 372 B |
BIN
com.minres.scviewer.e4.application/icons/page_white.png
Normal file
BIN
com.minres.scviewer.e4.application/icons/page_white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 294 B |
@ -84,5 +84,12 @@
|
|||||||
category="com.minres.scviewer.e4.application.preferences.scviewer">
|
category="com.minres.scviewer.e4.application.preferences.scviewer">
|
||||||
</page>
|
</page>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="com.opcoach.e4.preferences.e4PreferenceStoreProvider">
|
||||||
|
<preferenceStoreProvider
|
||||||
|
class="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.preferences.PreferencesStoreProvider"
|
||||||
|
pluginId="com.minres.scviewer.e4.application">
|
||||||
|
</preferenceStoreProvider>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
@ -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">
|
<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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>com.minres.scviewer.e4.application</artifactId>
|
<artifactId>com.minres.scviewer.e4.application</artifactId>
|
||||||
<version>2.4.0-SNAPSHOT</version>
|
<version>2.6.0-SNAPSHOT</version>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
|
@ -11,10 +11,12 @@
|
|||||||
package com.minres.scviewer.e4.application;
|
package com.minres.scviewer.e4.application;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
|
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
|
||||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||||
import org.eclipse.e4.core.services.events.IEventBroker;
|
import org.eclipse.e4.core.services.events.IEventBroker;
|
||||||
@ -30,6 +32,7 @@ import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
|||||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||||
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
|
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
|
||||||
import org.eclipse.equinox.app.IApplicationContext;
|
import org.eclipse.equinox.app.IApplicationContext;
|
||||||
|
import org.eclipse.osgi.service.datalocation.Location;
|
||||||
import org.osgi.service.event.Event;
|
import org.osgi.service.event.Event;
|
||||||
import org.osgi.service.event.EventHandler;
|
import org.osgi.service.event.EventHandler;
|
||||||
|
|
||||||
@ -91,6 +94,20 @@ public class E4LifeCycle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
eventBroker.subscribe(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE, new EventHandler() {
|
||||||
|
@Override
|
||||||
|
public void handleEvent(Event event) {
|
||||||
|
Location instanceLocation = Platform.getInstanceLocation();
|
||||||
|
try {
|
||||||
|
boolean isLocked = instanceLocation.isLocked();
|
||||||
|
if(isLocked)
|
||||||
|
instanceLocation.release();
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,26 +7,22 @@ import java.util.List;
|
|||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||||
import org.eclipse.e4.core.contexts.Active;
|
import org.eclipse.e4.core.contexts.Active;
|
||||||
import org.eclipse.e4.core.di.annotations.Execute;
|
import org.eclipse.e4.core.di.annotations.Execute;
|
||||||
import org.eclipse.e4.core.di.extensions.Preference;
|
|
||||||
import org.eclipse.e4.ui.model.application.MApplication;
|
import org.eclipse.e4.ui.model.application.MApplication;
|
||||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||||
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
|
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
|
||||||
import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem;
|
import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem;
|
||||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||||
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
|
|
||||||
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
||||||
|
import com.opcoach.e4.preferences.ScopedPreferenceStore;
|
||||||
|
|
||||||
@SuppressWarnings("restriction")
|
|
||||||
public class EnableHover {
|
public class EnableHover {
|
||||||
static final String TAG_NAME = "EnableHover"; //$NON-NLS-1$
|
static final String TAG_NAME = "EnableHover"; //$NON-NLS-1$
|
||||||
|
|
||||||
@Inject
|
|
||||||
@Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE)
|
|
||||||
IEclipsePreferences prefs;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
MApplication application;
|
MApplication application;
|
||||||
|
|
||||||
@ -36,14 +32,17 @@ public class EnableHover {
|
|||||||
tags.add(TAG_NAME);
|
tags.add(TAG_NAME);
|
||||||
List<MHandledItem> elements = modelService.findElements(application, null, MHandledItem.class, tags );
|
List<MHandledItem> elements = modelService.findElements(application, null, MHandledItem.class, tags );
|
||||||
// cover initialization stuff, sync it with code
|
// cover initialization stuff, sync it with code
|
||||||
|
IPreferenceStore store = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||||
|
boolean state = store.getBoolean(PreferenceConstants.SHOW_HOVER);
|
||||||
for( MHandledItem hi : elements ){
|
for( MHandledItem hi : elements ){
|
||||||
hi.setSelected(prefs.getBoolean(PreferenceConstants.SHOW_HOVER, true));
|
hi.setSelected(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Execute
|
@Execute
|
||||||
public void execute(@Active MPart part, @Active MWindow window, MHandledItem handledItem, EModelService modelService ) {
|
public void execute(@Active MPart part, @Active MWindow window, MHandledItem handledItem, EModelService modelService ) {
|
||||||
prefs.putBoolean(PreferenceConstants.SHOW_HOVER, handledItem.isSelected());
|
IPreferenceStore store = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||||
|
store.setValue(PreferenceConstants.SHOW_HOVER, handledItem.isSelected());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -11,7 +11,7 @@
|
|||||||
package com.minres.scviewer.e4.application.handlers;
|
package com.minres.scviewer.e4.application.handlers;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||||
import org.eclipse.e4.core.di.annotations.Execute;
|
import org.eclipse.e4.core.di.annotations.Execute;
|
||||||
@ -21,27 +21,20 @@ import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
|
|||||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||||
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
|
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.jface.window.Window;
|
||||||
import org.eclipse.swt.widgets.FileDialog;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
import com.minres.scviewer.e4.application.Messages;
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
|
import com.minres.scviewer.e4.application.parts.FileBrowserDialog;
|
||||||
public class OpenHandler {
|
public class OpenHandler {
|
||||||
|
|
||||||
@Execute
|
@Execute
|
||||||
public void execute(Shell shell, MApplication app, EModelService modelService, EPartService partService){
|
public void execute(Shell shell, MApplication app, EModelService modelService, EPartService partService){
|
||||||
FileDialog dialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
|
FileBrowserDialog dlg = new FileBrowserDialog(shell);
|
||||||
dialog.setFilterExtensions (new String []{Messages.OpenHandler_0});
|
//dlg.create();
|
||||||
String ret = dialog.open();
|
dlg.setFilterExtensions (new String []{Messages.OpenHandler_0, "*"});
|
||||||
if(ret==null)
|
if (dlg.open() != Window.OK) return;
|
||||||
return;
|
List<File> files = dlg.getSelectedFiles();
|
||||||
String path = dialog.getFilterPath();
|
|
||||||
ArrayList<File> files = new ArrayList<File>();
|
|
||||||
for(String fileName: dialog.getFileNames()){
|
|
||||||
File file = new File(path+File.separator+fileName);
|
|
||||||
if(file.exists())
|
|
||||||
files.add(file);
|
|
||||||
}
|
|
||||||
MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
|
MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
|
||||||
part.setLabel(files.get(0).getName());
|
part.setLabel(files.get(0).getName());
|
||||||
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
AboutDialog_0=\nSCViewer - a SystemC waveform viewer\n\nVersion: {0}\n
|
AboutDialog_0=\nSCViewer - a SystemC waveform viewer\n\nVersion: {0}\n
|
||||||
AboutDialog_1=\nCopyright (c) 2015, 2019 MINRES Technologies GmbH and others.\n\nAll rights reserved. MINRES and the MINRES logo are trademarks of MINRES Technologies GmbH, http://www.minres.com/. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html\n\nParts of the software are governed by the Apache License Version 2.0 available at http://www.apache.org/licenses/. These are namely org.mapdb and org.sqlite JDBC driver\n\nSource code is hosted at https://git.minres.com/VP-Tools/SCViewer and the master branch is mirrored to GitHub: https://github.com/minres/SCViewer\n
|
AboutDialog_1=\nCopyright (c) 2015, 2019, 2020 MINRES Technologies GmbH and others.\n\nAll rights reserved. MINRES and the MINRES logo are trademarks of MINRES Technologies GmbH, http://www.minres.com/. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html\n\nParts of the software are governed by the Apache License Version 2.0 available at http://www.apache.org/licenses/. These are namely org.mapdb and org.sqlite JDBC driver\n\nSource code is hosted at https://git.minres.com/VP-Tools/SCViewer and the master branch is mirrored to GitHub: https://github.com/minres/SCViewer\n
|
||||||
DesignBrowser_12=Append all after
|
DesignBrowser_12=Append all after
|
||||||
DesignBrowser_16=Insert all before
|
DesignBrowser_16=Insert all before
|
||||||
DesignBrowser_2=Enter text to filter waveforms
|
DesignBrowser_2=Enter text to filter waveforms
|
||||||
@ -9,7 +9,7 @@ DesignBrowser_8=Insert before
|
|||||||
LoadingWaveformDb_0=Database loading...
|
LoadingWaveformDb_0=Database loading...
|
||||||
LoadStoreSettingsHandler_2=*.scview
|
LoadStoreSettingsHandler_2=*.scview
|
||||||
LoadStoreSettingsHandler_3=SCViewer.scview
|
LoadStoreSettingsHandler_3=SCViewer.scview
|
||||||
OpenHandler_0=*.vcd;*.txdb;*.txlog;CURRENT
|
OpenHandler_0=*.vcd;*.txdb;*.txlog;*.fbrdb
|
||||||
QuitHandler_0=Confirmation
|
QuitHandler_0=Confirmation
|
||||||
QuitHandler_1=Do you want to exit?
|
QuitHandler_1=Do you want to exit?
|
||||||
RelationTypeToolControl_0=------------
|
RelationTypeToolControl_0=------------
|
||||||
@ -45,7 +45,7 @@ WaveformViewer_18=Would you like to reload the database?
|
|||||||
WaveformViewer_19=vcd
|
WaveformViewer_19=vcd
|
||||||
WaveformViewer_20=txdb
|
WaveformViewer_20=txdb
|
||||||
WaveformViewer_21=txlog
|
WaveformViewer_21=txlog
|
||||||
WaveformViewer_22=txldb
|
WaveformViewer_22=fbrdb
|
||||||
WaveformViewer_37=Database open
|
WaveformViewer_37=Database open
|
||||||
WaveformViewer_38=Would you like to open the adjacent database
|
WaveformViewer_38=Would you like to open the adjacent database
|
||||||
WaveformViewer_39=\ as well?
|
WaveformViewer_39=\ as well?
|
||||||
|
@ -328,6 +328,7 @@ public class DesignBrowser {
|
|||||||
*/
|
*/
|
||||||
@Focus
|
@Focus
|
||||||
public void setFocus() {
|
public void setFocus() {
|
||||||
|
if(txTableViewer!=null) {
|
||||||
txTableViewer.getTable().setFocus();
|
txTableViewer.getTable().setFocus();
|
||||||
IStructuredSelection selection = (IStructuredSelection)txTableViewer.getSelection();
|
IStructuredSelection selection = (IStructuredSelection)txTableViewer.getSelection();
|
||||||
if(selection.size()==0){
|
if(selection.size()==0){
|
||||||
@ -335,6 +336,7 @@ public class DesignBrowser {
|
|||||||
}
|
}
|
||||||
selectionService.setSelection(selection);
|
selectionService.setSelection(selection);
|
||||||
thisSelectionCount=selection.toList().size();
|
thisSelectionCount=selection.toList().size();
|
||||||
|
}
|
||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,482 @@
|
|||||||
|
package com.minres.scviewer.e4.application.parts;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.nio.file.FileSystems;
|
||||||
|
import java.nio.file.PathMatcher;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
|
import org.eclipse.jface.dialogs.TrayDialog;
|
||||||
|
import org.eclipse.jface.viewers.ArrayContentProvider;
|
||||||
|
import org.eclipse.jface.viewers.ColumnLabelProvider;
|
||||||
|
import org.eclipse.jface.viewers.ILabelProvider;
|
||||||
|
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||||
|
import org.eclipse.jface.viewers.TableViewer;
|
||||||
|
import org.eclipse.jface.viewers.TableViewerColumn;
|
||||||
|
import org.eclipse.jface.viewers.TreePath;
|
||||||
|
import org.eclipse.jface.viewers.TreeSelection;
|
||||||
|
import org.eclipse.jface.viewers.TreeViewer;
|
||||||
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
|
import org.eclipse.jface.viewers.ViewerComparator;
|
||||||
|
import org.eclipse.jface.viewers.ViewerFilter;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.custom.SashForm;
|
||||||
|
import org.eclipse.swt.events.MouseAdapter;
|
||||||
|
import org.eclipse.swt.events.MouseEvent;
|
||||||
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.graphics.Color;
|
||||||
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
import org.eclipse.swt.graphics.Point;
|
||||||
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Combo;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.swt.widgets.Table;
|
||||||
|
import org.eclipse.swt.widgets.TableColumn;
|
||||||
|
import org.eclipse.swt.widgets.TableItem;
|
||||||
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
import org.eclipse.swt.widgets.ToolBar;
|
||||||
|
import org.eclipse.swt.widgets.ToolItem;
|
||||||
|
import org.eclipse.wb.swt.ResourceManager;
|
||||||
|
|
||||||
|
public class FileBrowserDialog extends TrayDialog {
|
||||||
|
|
||||||
|
private Image folderImage;
|
||||||
|
|
||||||
|
private Image fileImage;
|
||||||
|
|
||||||
|
private Image dbImage;
|
||||||
|
|
||||||
|
File currentDirFile;
|
||||||
|
|
||||||
|
TreeViewer dirTreeViewer;
|
||||||
|
|
||||||
|
TableViewer tableViewer;
|
||||||
|
|
||||||
|
Text fileNameEntry;
|
||||||
|
|
||||||
|
Combo filterCombo;
|
||||||
|
|
||||||
|
FileTableComparator fileTableComparator;
|
||||||
|
|
||||||
|
private FileGlobber globber = new FileGlobber();
|
||||||
|
|
||||||
|
private FileGlobber imageGlobber = new FileGlobber();
|
||||||
|
|
||||||
|
private File selectedDir;
|
||||||
|
|
||||||
|
private List<File> selectedFiles;
|
||||||
|
|
||||||
|
String[] filterStrings = new String[] {"*"};
|
||||||
|
|
||||||
|
public FileBrowserDialog(Shell parentShell) {
|
||||||
|
super(parentShell);
|
||||||
|
folderImage=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/folder.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
dbImage=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/database.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
fileImage=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/page_white.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
currentDirFile = new File(".");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFilterExtensions(String[] filterStrings) {
|
||||||
|
if(filterStrings.length==0){
|
||||||
|
globber = new FileGlobber();
|
||||||
|
} else {
|
||||||
|
globber= new FileGlobber(filterStrings[0]);
|
||||||
|
imageGlobber = new FileGlobber(filterStrings[0]);
|
||||||
|
if(filterCombo!=null) {
|
||||||
|
filterCombo.setItems(filterStrings);
|
||||||
|
filterCombo.select(0);
|
||||||
|
filterCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.filterStrings=filterStrings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<File> getSelectedFiles(){
|
||||||
|
return selectedFiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Control createContents(Composite parent) {
|
||||||
|
Control ret = super.createContents(parent);
|
||||||
|
setDirSelection(currentDirFile.getAbsoluteFile().getParentFile());
|
||||||
|
getButton(IDialogConstants.OK_ID).setEnabled(!tableViewer.getSelection().isEmpty());
|
||||||
|
if(parent instanceof Shell) {
|
||||||
|
Point size = ((Shell)parent).computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||||
|
((Shell)parent).setSize(size.x, 400);
|
||||||
|
((Shell)parent).setText("Select database");
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Control createDialogArea(Composite parent) {
|
||||||
|
Composite area = (Composite) super.createDialogArea(parent);
|
||||||
|
final SashForm sashForm = new SashForm(area, SWT.HORIZONTAL);
|
||||||
|
sashForm.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
|
||||||
|
|
||||||
|
dirTreeViewer = new TreeViewer(sashForm);
|
||||||
|
dirTreeViewer.setContentProvider(new FileTreeContentProvider());
|
||||||
|
dirTreeViewer.setLabelProvider(new FileTreeLabelProvider());
|
||||||
|
dirTreeViewer.addSelectionChangedListener(event -> {
|
||||||
|
IStructuredSelection sel = event.getStructuredSelection();
|
||||||
|
File entry = (File) sel.getFirstElement();
|
||||||
|
if(entry!=null && entry.isDirectory()) {
|
||||||
|
selectedDir = entry;
|
||||||
|
tableViewer.setInput(selectedDir.listFiles());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dirTreeViewer.setInput("root");
|
||||||
|
|
||||||
|
final Composite tableViewerParent = new Composite(sashForm, SWT.NONE);
|
||||||
|
GridLayout gridLayout = new GridLayout(1, true);
|
||||||
|
gridLayout.horizontalSpacing=0;
|
||||||
|
gridLayout.verticalSpacing=5;
|
||||||
|
gridLayout.marginHeight=0;
|
||||||
|
gridLayout.marginHeight=0;
|
||||||
|
tableViewerParent.setLayout(gridLayout);
|
||||||
|
final ToolBar toolBar = new ToolBar(tableViewerParent, SWT.HORIZONTAL |SWT.SHADOW_OUT);
|
||||||
|
toolBar.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||||
|
final ToolItem toolbarItemUp = new ToolItem(toolBar, SWT.PUSH);
|
||||||
|
toolbarItemUp.setToolTipText("up one level");
|
||||||
|
toolbarItemUp.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/arrow_up.png")); //$NON-NLS-1$ //$NON-NLS-2$);
|
||||||
|
toolbarItemUp.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
if(selectedDir.getParentFile()!=null) {
|
||||||
|
selectedDir=selectedDir.getParentFile();
|
||||||
|
tableViewer.setInput(selectedDir.listFiles());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tableViewer = new TableViewer(tableViewerParent, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
|
||||||
|
tableViewer.getTable().setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||||
|
tableViewer.addSelectionChangedListener(event -> {
|
||||||
|
IStructuredSelection sel = event.getStructuredSelection();
|
||||||
|
getButton(IDialogConstants.OK_ID).setEnabled(!sel.isEmpty());
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
Object text = sel.toList().stream().map(e -> ((File)e).getName()).collect(Collectors.joining(";"));
|
||||||
|
fileNameEntry.setText(text.toString());
|
||||||
|
});
|
||||||
|
tableViewer.addDoubleClickListener(event -> {
|
||||||
|
IStructuredSelection sel = tableViewer.getStructuredSelection();
|
||||||
|
if(sel.isEmpty()) return;
|
||||||
|
if(sel.size()==1) {
|
||||||
|
File elem = (File) sel.getFirstElement();
|
||||||
|
if(globber.matches(elem))
|
||||||
|
buttonPressed(IDialogConstants.OK_ID);
|
||||||
|
else if(elem.isDirectory())
|
||||||
|
setDirSelection(elem);
|
||||||
|
} else
|
||||||
|
buttonPressed(IDialogConstants.OK_ID);
|
||||||
|
});
|
||||||
|
tableViewer.setContentProvider(ArrayContentProvider.getInstance());
|
||||||
|
tableViewer.getTable().setHeaderVisible(true);
|
||||||
|
tableViewer.getTable().setLinesVisible(true);
|
||||||
|
tableViewer.getTable().addMouseListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mouseDown(MouseEvent e) { mouseUp(e); }
|
||||||
|
@Override
|
||||||
|
public void mouseUp(MouseEvent e) {
|
||||||
|
TableItem element = (TableItem)tableViewer.getTable().getItem(new Point(e.x, e.y));
|
||||||
|
final Table table = tableViewer.getTable();
|
||||||
|
if (element == null )//&& (e.stateMask&SWT.MODIFIER_MASK)!=0)
|
||||||
|
table.deselectAll();
|
||||||
|
else {
|
||||||
|
int[] indices = table.getSelectionIndices();
|
||||||
|
if(indices.length==1) {
|
||||||
|
TableItem ti = table.getItem(indices[0]);
|
||||||
|
if(!globber.matches(ti.getData()) && !((File)ti.getData()).isDirectory())
|
||||||
|
table.deselect(indices[0]);
|
||||||
|
} else {
|
||||||
|
for (int idx : indices) {
|
||||||
|
TableItem ti = table.getItem(idx);
|
||||||
|
if(!globber.matches(ti.getData()))
|
||||||
|
table.deselect(idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
TableViewerColumn colName = new TableViewerColumn(tableViewer, SWT.NONE);
|
||||||
|
colName.setLabelProvider(new FileTableLabelProvider() {
|
||||||
|
@Override public String getText(Object element) { return ((File) element).getName(); }
|
||||||
|
@Override public Image getImage(Object element){
|
||||||
|
if(imageGlobber.matches(element)) return dbImage;
|
||||||
|
return ((File) element).isDirectory()?folderImage:fileImage;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
colName.getColumn().setWidth(300);
|
||||||
|
colName.getColumn().setText("Name");
|
||||||
|
colName.getColumn().addSelectionListener(getSelectionAdapter(colName.getColumn(), 0));
|
||||||
|
|
||||||
|
TableViewerColumn colSize = new TableViewerColumn(tableViewer, SWT.RIGHT);
|
||||||
|
colSize.setLabelProvider(new FileTableLabelProvider() {
|
||||||
|
@Override public String getText(Object element) { return String.format("%d", ((File) element).length()); }
|
||||||
|
});
|
||||||
|
colSize.getColumn().setWidth(100);
|
||||||
|
colSize.getColumn().setText("Size");
|
||||||
|
colSize.getColumn().addSelectionListener(getSelectionAdapter(colSize.getColumn(), 1));
|
||||||
|
|
||||||
|
TableViewerColumn colEmpty = new TableViewerColumn(tableViewer, SWT.CENTER);
|
||||||
|
colEmpty.setLabelProvider(new FileTableLabelProvider() {
|
||||||
|
@Override public String getText(Object element) { return ""; }
|
||||||
|
});
|
||||||
|
//colEmpty.getColumn().setWidth(200);
|
||||||
|
colEmpty.getColumn().setText("");
|
||||||
|
|
||||||
|
fileTableComparator = new FileTableComparator();
|
||||||
|
tableViewer.setComparator(fileTableComparator);
|
||||||
|
tableViewer.addFilter(new FileTableFilter());
|
||||||
|
|
||||||
|
Composite bottomBar = new Composite(tableViewerParent, SWT.NONE);
|
||||||
|
bottomBar.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||||
|
GridLayout gridLayoutBottom = new GridLayout(2, false);
|
||||||
|
gridLayoutBottom.horizontalSpacing=0;
|
||||||
|
gridLayoutBottom.verticalSpacing=0;
|
||||||
|
gridLayoutBottom.marginHeight=0;
|
||||||
|
gridLayoutBottom.marginWidth=0;
|
||||||
|
bottomBar.setLayout(gridLayoutBottom);
|
||||||
|
|
||||||
|
fileNameEntry = new Text(bottomBar, SWT.BORDER);
|
||||||
|
fileNameEntry.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||||
|
fileNameEntry.setEditable(false); //TODO: temporary disabled
|
||||||
|
fileNameEntry.setEnabled(false);
|
||||||
|
|
||||||
|
filterCombo = new Combo(bottomBar, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
|
||||||
|
filterCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
|
||||||
|
filterCombo.setItems(filterStrings);
|
||||||
|
filterCombo.select(0);
|
||||||
|
filterCombo.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
globber= new FileGlobber(filterCombo.getText());
|
||||||
|
tableViewer.setInput(selectedDir.listFiles());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
sashForm.setWeights(new int[]{3, 3});
|
||||||
|
return area;
|
||||||
|
}
|
||||||
|
|
||||||
|
private SelectionAdapter getSelectionAdapter(final TableColumn column, final int index) {
|
||||||
|
SelectionAdapter selectionAdapter = new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
fileTableComparator.setColumn(index);
|
||||||
|
int dir = fileTableComparator.getDirection();
|
||||||
|
tableViewer.getTable().setSortDirection(dir);
|
||||||
|
tableViewer.getTable().setSortColumn(column);
|
||||||
|
tableViewer.refresh();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return selectionAdapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setDirSelection(File f) {
|
||||||
|
ArrayList<File> fileTree = getParentDirList(f);
|
||||||
|
TreeSelection selection = new TreeSelection(new TreePath(fileTree.toArray()));
|
||||||
|
dirTreeViewer.setSelection(selection, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<File> getParentDirList(File actual){
|
||||||
|
if(actual==null)
|
||||||
|
return new ArrayList<>();
|
||||||
|
else {
|
||||||
|
ArrayList<File> l = getParentDirList(actual.getParentFile());
|
||||||
|
l.add(actual);
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isResizable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// save content of the Text fields because they get disposed
|
||||||
|
// as soon as the Dialog closes
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private void saveInput() {
|
||||||
|
selectedFiles= tableViewer.getStructuredSelection().toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void okPressed() {
|
||||||
|
saveInput();
|
||||||
|
super.okPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
class FileGlobber {
|
||||||
|
|
||||||
|
List<PathMatcher> matchers;
|
||||||
|
|
||||||
|
public FileGlobber() {
|
||||||
|
matchers = new ArrayList<>(); }
|
||||||
|
|
||||||
|
public FileGlobber(String expr) {
|
||||||
|
ArrayList<PathMatcher> m = new ArrayList<>();
|
||||||
|
if(expr.length()>0) {
|
||||||
|
String[] tok = expr.split(";");
|
||||||
|
for (String string : tok) {
|
||||||
|
m.add(FileSystems.getDefault().getPathMatcher("glob:**/"+string));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
matchers = m;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean matches(Object f) {
|
||||||
|
assert(f instanceof File);
|
||||||
|
if(matchers.size()==0) return true;
|
||||||
|
for (PathMatcher m : matchers) {
|
||||||
|
if(m.matches(((File)f).toPath())) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class FileTreeContentProvider implements ITreeContentProvider {
|
||||||
|
public Object[] getChildren(Object arg0) {
|
||||||
|
File[] entries = ((File) arg0).listFiles();
|
||||||
|
if(entries != null) {
|
||||||
|
List<File> res = Arrays.stream(entries)
|
||||||
|
.filter(file -> !(file.isFile()||file.getName().startsWith(".") ||globber.matches(file)))
|
||||||
|
.sorted(new Comparator<File>(){
|
||||||
|
public int compare(File f1, File f2){return f1.getName().compareTo(f2.getName());}
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList()); ;
|
||||||
|
return res.toArray();
|
||||||
|
} else
|
||||||
|
return new Object[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getParent(Object arg0) {
|
||||||
|
return ((File) arg0).getParentFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasChildren(Object arg0) {
|
||||||
|
Object[] obj = getChildren(arg0);
|
||||||
|
return obj == null ? false : obj.length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object[] getElements(Object arg0) {
|
||||||
|
return File.listRoots();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class FileTreeLabelProvider implements ILabelProvider {
|
||||||
|
private List<ILabelProviderListener> listeners;
|
||||||
|
|
||||||
|
private Image file;
|
||||||
|
|
||||||
|
private Image dir;
|
||||||
|
|
||||||
|
public FileTreeLabelProvider() {
|
||||||
|
listeners = new ArrayList<ILabelProviderListener>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Image getImage(Object arg0) {
|
||||||
|
return ((File) arg0).isDirectory() ? folderImage : file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText(Object arg0) {
|
||||||
|
File f = (File)arg0;
|
||||||
|
return f.getName().length() == 0? f.getPath() : f.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addListener(ILabelProviderListener arg0) {
|
||||||
|
listeners.add(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
// Dispose the images
|
||||||
|
if (dir != null)
|
||||||
|
dir.dispose();
|
||||||
|
if (file != null)
|
||||||
|
file.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLabelProperty(Object arg0, String arg1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeListener(ILabelProviderListener arg0) {
|
||||||
|
listeners.remove(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FileTableFilter extends ViewerFilter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||||
|
File p = (File) element;
|
||||||
|
return !p.getName().startsWith(".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FileTableComparator extends ViewerComparator {
|
||||||
|
private int propertyIndex = 0;
|
||||||
|
private boolean descending = false;
|
||||||
|
|
||||||
|
public FileTableComparator() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDirection() {
|
||||||
|
return descending ? SWT.DOWN : SWT.UP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColumn(int column) {
|
||||||
|
descending = column == this.propertyIndex?!descending : false;
|
||||||
|
this.propertyIndex = column;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(Viewer viewer, Object e1, Object e2) {
|
||||||
|
File p1 = (File) e1;
|
||||||
|
File p2 = (File) e2;
|
||||||
|
int rc = 0;
|
||||||
|
switch (propertyIndex) {
|
||||||
|
case 0:
|
||||||
|
rc = p1.getName().compareTo(p2.getName());
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
rc = Long.valueOf(p1.length()).compareTo(p2.length());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rc = 0;
|
||||||
|
}
|
||||||
|
// If descending order, flip the direction
|
||||||
|
return descending? -rc : rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FileTableLabelProvider extends ColumnLabelProvider {
|
||||||
|
@Override
|
||||||
|
public Color getBackground(Object element) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getForeground(Object element) {
|
||||||
|
return globber.matches(element) || ((File)element).isDirectory()? null: ResourceManager.getColor(SWT.COLOR_GRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -10,8 +10,14 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.e4.application.parts;
|
package com.minres.scviewer.e4.application.parts;
|
||||||
|
|
||||||
|
import java.util.AbstractMap;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
import java.util.regex.PatternSyntaxException;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@ -477,12 +483,19 @@ public class TransactionDetails {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(element instanceof ITxAttribute){
|
if(element instanceof ITxAttribute){
|
||||||
|
try {
|
||||||
return (((ITxAttribute) element).getName().toLowerCase().matches(searchString.toLowerCase()));
|
return (((ITxAttribute) element).getName().toLowerCase().matches(searchString.toLowerCase()));
|
||||||
|
} catch (PatternSyntaxException e) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(element instanceof Object[]) {
|
if(element instanceof Object[]) {
|
||||||
|
try {
|
||||||
return (((Object[])element)[0]).toString().toLowerCase().matches(searchString.toLowerCase());
|
return (((Object[])element)[0]).toString().toLowerCase().matches(searchString.toLowerCase());
|
||||||
|
} catch (PatternSyntaxException e) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -490,11 +503,13 @@ public class TransactionDetails {
|
|||||||
/**
|
/**
|
||||||
* The Enum Type.
|
* The Enum Type.
|
||||||
*/
|
*/
|
||||||
enum Type {/** The props. */
|
enum Type {
|
||||||
PROPS, /** The attrs. */
|
PROPS, /** The props. */
|
||||||
ATTRS, /** The in rel. */
|
ATTRS, /** The attrs. */
|
||||||
IN_REL, /** The out rel. */
|
IN_REL, /** The in rel. */
|
||||||
OUT_REL}
|
OUT_REL,/** The out rel. */
|
||||||
|
HIER
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class TreeNode.
|
* The Class TreeNode.
|
||||||
@ -507,6 +522,7 @@ public class TransactionDetails {
|
|||||||
/** The element. */
|
/** The element. */
|
||||||
public ITx element;
|
public ITx element;
|
||||||
|
|
||||||
|
private String hier_path;
|
||||||
/**
|
/**
|
||||||
* Instantiates a new tree node.
|
* Instantiates a new tree node.
|
||||||
*
|
*
|
||||||
@ -516,6 +532,13 @@ public class TransactionDetails {
|
|||||||
public TreeNode(ITx element, Type type){
|
public TreeNode(ITx element, Type type){
|
||||||
this.element=element;
|
this.element=element;
|
||||||
this.type=type;
|
this.type=type;
|
||||||
|
this.hier_path="";
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeNode(ITx element, String path){
|
||||||
|
this.element=element;
|
||||||
|
this.type=Type.HIER;
|
||||||
|
this.hier_path=path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@ -527,9 +550,33 @@ public class TransactionDetails {
|
|||||||
case ATTRS: return Messages.TransactionDetails_11;
|
case ATTRS: return Messages.TransactionDetails_11;
|
||||||
case IN_REL: return Messages.TransactionDetails_12;
|
case IN_REL: return Messages.TransactionDetails_12;
|
||||||
case OUT_REL: return Messages.TransactionDetails_13;
|
case OUT_REL: return Messages.TransactionDetails_13;
|
||||||
|
case HIER:{
|
||||||
|
String[] tokens = hier_path.split("\\.");
|
||||||
|
return tokens[tokens.length-1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object[] getAttributeListForHier() {
|
||||||
|
if(childs==null) {
|
||||||
|
Map<String, Object> res = element.getAttributes().stream()
|
||||||
|
.filter(txAttr -> txAttr.getName().startsWith(hier_path))
|
||||||
|
.map(txAttr -> {
|
||||||
|
String target = hier_path.length()==0?txAttr.getName():txAttr.getName().replace(hier_path+'.', "");
|
||||||
|
String[] tokens = target.split("\\.");
|
||||||
|
if(tokens.length==1)
|
||||||
|
return new AbstractMap.SimpleEntry<>(tokens[0], txAttr);
|
||||||
|
else
|
||||||
|
return new AbstractMap.SimpleEntry<>(tokens[0], new TreeNode(element, hier_path.length()>0?hier_path+"."+tokens[0]:tokens[0]));
|
||||||
|
})
|
||||||
|
.collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue(), (first, second) -> first));
|
||||||
|
childs = new TreeMap<String, Object>(res).values().toArray();
|
||||||
|
}
|
||||||
|
return childs;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object[] childs=null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -577,8 +624,8 @@ public class TransactionDetails {
|
|||||||
{Messages.TransactionDetails_19, Messages.TransactionDetails_20, timeToString(propertyHolder.element.getBeginTime())},
|
{Messages.TransactionDetails_19, Messages.TransactionDetails_20, timeToString(propertyHolder.element.getBeginTime())},
|
||||||
{Messages.TransactionDetails_21, Messages.TransactionDetails_20, timeToString(propertyHolder.element.getEndTime())}
|
{Messages.TransactionDetails_21, Messages.TransactionDetails_20, timeToString(propertyHolder.element.getEndTime())}
|
||||||
};
|
};
|
||||||
}else if(propertyHolder.type == Type.ATTRS)
|
}else if(propertyHolder.type == Type.ATTRS || propertyHolder.type == Type.HIER)
|
||||||
return propertyHolder.element.getAttributes().toArray();
|
return propertyHolder.getAttributeListForHier();
|
||||||
else if(propertyHolder.type == Type.IN_REL){
|
else if(propertyHolder.type == Type.IN_REL){
|
||||||
Vector<Object[] > res = new Vector<>();
|
Vector<Object[] > res = new Vector<>();
|
||||||
for(ITxRelation rel:propertyHolder.element.getIncomingRelations()){
|
for(ITxRelation rel:propertyHolder.element.getIncomingRelations()){
|
||||||
@ -655,7 +702,8 @@ public class TransactionDetails {
|
|||||||
case NAME:
|
case NAME:
|
||||||
if (element instanceof ITxAttribute) {
|
if (element instanceof ITxAttribute) {
|
||||||
ITxAttribute attribute = (ITxAttribute) element;
|
ITxAttribute attribute = (ITxAttribute) element;
|
||||||
return new StyledString(attribute.getName());
|
String[] tokens = attribute.getName().split("\\.");
|
||||||
|
return new StyledString(tokens[tokens.length-1]);
|
||||||
}else if (element instanceof ITxRelation) {
|
}else if (element instanceof ITxRelation) {
|
||||||
return new StyledString(Messages.TransactionDetails_4);
|
return new StyledString(Messages.TransactionDetails_4);
|
||||||
}else if(element instanceof Object[]){
|
}else if(element instanceof Object[]){
|
||||||
|
@ -31,6 +31,7 @@ import javax.annotation.PostConstruct;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import org.eclipse.core.internal.preferences.InstancePreferences;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.MultiStatus;
|
import org.eclipse.core.runtime.MultiStatus;
|
||||||
@ -41,11 +42,10 @@ import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
|||||||
import org.eclipse.core.runtime.jobs.Job;
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
||||||
import org.eclipse.core.runtime.jobs.JobGroup;
|
import org.eclipse.core.runtime.jobs.JobGroup;
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
|
||||||
import org.eclipse.e4.core.di.annotations.Optional;
|
import org.eclipse.e4.core.di.annotations.Optional;
|
||||||
import org.eclipse.e4.core.di.extensions.Preference;
|
|
||||||
import org.eclipse.e4.core.services.events.IEventBroker;
|
import org.eclipse.e4.core.services.events.IEventBroker;
|
||||||
import org.eclipse.e4.ui.di.Focus;
|
import org.eclipse.e4.ui.di.Focus;
|
||||||
import org.eclipse.e4.ui.di.PersistState;
|
import org.eclipse.e4.ui.di.PersistState;
|
||||||
@ -56,7 +56,9 @@ import org.eclipse.e4.ui.services.EMenuService;
|
|||||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.jface.resource.StringConverter;
|
import org.eclipse.jface.resource.StringConverter;
|
||||||
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
@ -72,6 +74,7 @@ import org.eclipse.swt.graphics.Font;
|
|||||||
import org.eclipse.swt.graphics.Point;
|
import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.graphics.RGB;
|
import org.eclipse.swt.graphics.RGB;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.swt.widgets.Event;
|
import org.eclipse.swt.widgets.Event;
|
||||||
@ -81,6 +84,7 @@ import org.eclipse.swt.widgets.Table;
|
|||||||
import org.eclipse.swt.widgets.TableColumn;
|
import org.eclipse.swt.widgets.TableColumn;
|
||||||
import org.eclipse.swt.widgets.TableItem;
|
import org.eclipse.swt.widgets.TableItem;
|
||||||
import org.eclipse.swt.widgets.Widget;
|
import org.eclipse.swt.widgets.Widget;
|
||||||
|
import org.osgi.service.prefs.BackingStoreException;
|
||||||
|
|
||||||
import com.minres.scviewer.database.DataType;
|
import com.minres.scviewer.database.DataType;
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
@ -107,8 +111,8 @@ import com.minres.scviewer.e4.application.internal.status.WaveStatusBarControl;
|
|||||||
import com.minres.scviewer.e4.application.internal.util.FileMonitor;
|
import com.minres.scviewer.e4.application.internal.util.FileMonitor;
|
||||||
import com.minres.scviewer.e4.application.internal.util.IFileChangeListener;
|
import com.minres.scviewer.e4.application.internal.util.IFileChangeListener;
|
||||||
import com.minres.scviewer.e4.application.internal.util.IModificationChecker;
|
import com.minres.scviewer.e4.application.internal.util.IModificationChecker;
|
||||||
import com.minres.scviewer.e4.application.preferences.DefaultValuesInitializer;
|
|
||||||
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
||||||
|
import com.opcoach.e4.preferences.ScopedPreferenceStore;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class WaveformViewerPart.
|
* The Class WaveformViewerPart.
|
||||||
@ -190,10 +194,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
@Inject
|
@Inject
|
||||||
EPartService ePartService;
|
EPartService ePartService;
|
||||||
|
|
||||||
/** The prefs. */
|
IPreferenceStore store = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||||
@Inject
|
|
||||||
@Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE)
|
|
||||||
IEclipsePreferences prefs;
|
|
||||||
|
|
||||||
@Inject @Optional DesignBrowser designBrowser;
|
@Inject @Optional DesignBrowser designBrowser;
|
||||||
|
|
||||||
@ -348,7 +349,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
|
|
||||||
zoomLevel = waveformPane.getZoomLevels();
|
zoomLevel = waveformPane.getZoomLevels();
|
||||||
setupColors();
|
setupColors();
|
||||||
checkForUpdates = prefs.getBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
checkForUpdates = store.getBoolean(PreferenceConstants.DATABASE_RELOAD);
|
||||||
filesToLoad = new ArrayList<File>();
|
filesToLoad = new ArrayList<File>();
|
||||||
persistedState = part.getPersistedState();
|
persistedState = part.getPersistedState();
|
||||||
Integer files = persistedState.containsKey(DATABASE_FILE + "S") //$NON-NLS-1$
|
Integer files = persistedState.containsKey(DATABASE_FILE + "S") //$NON-NLS-1$
|
||||||
@ -377,7 +378,22 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
prefs.addPreferenceChangeListener(this);
|
store.addPropertyChangeListener(new IPropertyChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void propertyChange(org.eclipse.jface.util.PropertyChangeEvent event) {
|
||||||
|
if (PreferenceConstants.DATABASE_RELOAD.equals(event.getProperty())) {
|
||||||
|
checkForUpdates = (Boolean)event.getNewValue();
|
||||||
|
fileChecker = null;
|
||||||
|
if (checkForUpdates)
|
||||||
|
fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad,
|
||||||
|
FILE_CHECK_INTERVAL);
|
||||||
|
else
|
||||||
|
fileMonitor.removeFileChangeListener(WaveformViewer.this);
|
||||||
|
} else if (!PreferenceConstants.SHOW_HOVER.equals(event.getProperty())){
|
||||||
|
setupColors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
waveformPane.addDisposeListener(this);
|
waveformPane.addDisposeListener(this);
|
||||||
|
|
||||||
@ -390,7 +406,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
waveformPane.getWaveformControl().setData(Constants.CONTENT_PROVIDER_TAG, new ToolTipContentProvider() {
|
waveformPane.getWaveformControl().setData(Constants.CONTENT_PROVIDER_TAG, new ToolTipContentProvider() {
|
||||||
@Override
|
@Override
|
||||||
public boolean createContent(Composite parent, Point pt) {
|
public boolean createContent(Composite parent, Point pt) {
|
||||||
if(!prefs.getBoolean(PreferenceConstants.SHOW_HOVER, true)) return false;
|
if(!store.getBoolean(PreferenceConstants.SHOW_HOVER)) return false;
|
||||||
List<Object> res = waveformPane.getElementsAt(pt);
|
List<Object> res = waveformPane.getElementsAt(pt);
|
||||||
if(res.size()>0)
|
if(res.size()>0)
|
||||||
if(res.get(0) instanceof ITx) {
|
if(res.get(0) instanceof ITx) {
|
||||||
@ -398,19 +414,26 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
final Display display = parent.getDisplay();
|
final Display display = parent.getDisplay();
|
||||||
final Font font = new Font(Display.getCurrent(), "Terminal", 10, SWT.NORMAL);
|
final Font font = new Font(Display.getCurrent(), "Terminal", 10, SWT.NORMAL);
|
||||||
|
|
||||||
final Label label = new Label(parent, SWT.NONE);
|
final Label label = new Label(parent, SWT.SHADOW_IN);
|
||||||
label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
|
label.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
|
||||||
label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
|
label.setBackground(display.getSystemColor(SWT.COLOR_GRAY));
|
||||||
label.setText(tx.toString());
|
label.setText(tx.toString());
|
||||||
label.setFont(font);
|
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);
|
final Table table = new Table(parent, SWT.NONE);
|
||||||
table.setHeaderVisible(true);
|
table.setHeaderVisible(true);
|
||||||
table.setLinesVisible(true);
|
table.setLinesVisible(true);
|
||||||
table.setFont(font);
|
table.setFont(font);
|
||||||
table.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
|
label.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
|
||||||
table.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
|
label.setBackground(display.getSystemColor(SWT.COLOR_GRAY));
|
||||||
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);
|
final TableColumn nameCol = new TableColumn(table, SWT.LEFT);
|
||||||
nameCol.setText("Attribute");
|
nameCol.setText("Attribute");
|
||||||
@ -428,10 +451,15 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
item.setText(0, iTxAttribute.getName());
|
item.setText(0, iTxAttribute.getName());
|
||||||
item.setText(1, value);
|
item.setText(1, value);
|
||||||
}
|
}
|
||||||
|
if(table.getHeaderVisible()) {
|
||||||
|
// add dummy row to get make last row visible
|
||||||
|
TableItem item = new TableItem(table, SWT.NONE);
|
||||||
|
item.setText(0, "");
|
||||||
|
item.setText(1, "");
|
||||||
|
}
|
||||||
nameCol.pack();
|
nameCol.pack();
|
||||||
valueCol.pack();
|
valueCol.pack();
|
||||||
table.setRedraw(true);
|
table.setSize(table.computeSize(SWT.DEFAULT, SWT.DEFAULT));
|
||||||
|
|
||||||
parent.addPaintListener(new PaintListener() {
|
parent.addPaintListener(new PaintListener() {
|
||||||
@Override
|
@Override
|
||||||
public void paintControl(PaintEvent e) {
|
public void paintControl(PaintEvent e) {
|
||||||
@ -445,14 +473,17 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
return true;
|
return true;
|
||||||
} else if(res.get(0) instanceof TrackEntry) {
|
} else if(res.get(0) instanceof TrackEntry) {
|
||||||
TrackEntry te = (TrackEntry)res.get(0);
|
TrackEntry te = (TrackEntry)res.get(0);
|
||||||
final Display display = parent.getDisplay();
|
|
||||||
final Font font = new Font(Display.getCurrent(), "Terminal", 10, SWT.NORMAL);
|
final Font font = new Font(Display.getCurrent(), "Terminal", 10, SWT.NORMAL);
|
||||||
|
|
||||||
final Label label = new Label(parent, SWT.NONE);
|
final Label label = new Label(parent, SWT.NONE);
|
||||||
label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
|
//label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
|
||||||
label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
|
//label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
|
||||||
label.setText(te.waveform.getFullName());
|
label.setText(te.waveform.getFullName());
|
||||||
label.setFont(font);
|
label.setFont(font);
|
||||||
|
GridData labelGridData = new GridData();
|
||||||
|
labelGridData.horizontalAlignment = GridData.FILL;
|
||||||
|
labelGridData.grabExcessHorizontalSpace = true;
|
||||||
|
label.setLayoutData(labelGridData);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -465,28 +496,30 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void preferenceChange(PreferenceChangeEvent event) {
|
public void preferenceChange(PreferenceChangeEvent event) {
|
||||||
|
InstancePreferences pref = (InstancePreferences)event.getSource();
|
||||||
if (PreferenceConstants.DATABASE_RELOAD.equals(event.getKey())) {
|
if (PreferenceConstants.DATABASE_RELOAD.equals(event.getKey())) {
|
||||||
checkForUpdates = (Boolean) event.getNewValue();
|
checkForUpdates = pref.getBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
||||||
fileChecker = null;
|
fileChecker = null;
|
||||||
if (checkForUpdates)
|
if (checkForUpdates)
|
||||||
fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad,
|
fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad,
|
||||||
FILE_CHECK_INTERVAL);
|
FILE_CHECK_INTERVAL);
|
||||||
else
|
else
|
||||||
fileMonitor.removeFileChangeListener(this);
|
fileMonitor.removeFileChangeListener(this);
|
||||||
} else {
|
} else if (!PreferenceConstants.SHOW_HOVER.equals(event.getKey())){
|
||||||
setupColors();
|
setupColors();
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
pref.flush();
|
||||||
|
} catch (BackingStoreException e) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup colors.
|
* Setup colors.
|
||||||
*/
|
*/
|
||||||
protected void setupColors() {
|
protected void setupColors() {
|
||||||
DefaultValuesInitializer initializer = new DefaultValuesInitializer();
|
|
||||||
HashMap<WaveformColors, RGB> colorPref = new HashMap<>();
|
HashMap<WaveformColors, RGB> colorPref = new HashMap<>();
|
||||||
for (WaveformColors c : WaveformColors.values()) {
|
for (WaveformColors c : WaveformColors.values()) {
|
||||||
String prefValue = prefs.get(c.name() + "_COLOR", //$NON-NLS-1$
|
String prefValue = store.getString(c.name() + "_COLOR"); //$NON-NLS-1$
|
||||||
StringConverter.asString(initializer.colors[c.ordinal()].getRGB()));
|
|
||||||
RGB rgb = StringConverter.asRGB(prefValue);
|
RGB rgb = StringConverter.asRGB(prefValue);
|
||||||
colorPref.put(c, rgb);
|
colorPref.put(c, rgb);
|
||||||
}
|
}
|
||||||
@ -636,7 +669,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
}
|
}
|
||||||
if (filesToLoad.size() > 0)
|
if (filesToLoad.size() > 0)
|
||||||
loadDatabase(persistedState);
|
loadDatabase(persistedState);
|
||||||
if(partConfig instanceof String) {
|
if(partConfig instanceof String && ((String)partConfig).length()>0) {
|
||||||
loadState((String) partConfig);
|
loadState((String) partConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
package com.minres.scviewer.e4.application.preferences;
|
package com.minres.scviewer.e4.application.preferences;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
|
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
|
||||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
import org.eclipse.core.runtime.preferences.DefaultScope;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.jface.resource.StringConverter;
|
import org.eclipse.jface.resource.StringConverter;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
@ -64,7 +64,16 @@ public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void initializeDefaultPreferences() {
|
public void initializeDefaultPreferences() {
|
||||||
IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
// 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(DefaultScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||||
|
|
||||||
store.setDefault(PreferenceConstants.DATABASE_RELOAD, true);
|
store.setDefault(PreferenceConstants.DATABASE_RELOAD, true);
|
||||||
store.setDefault(PreferenceConstants.SHOW_HOVER, true);
|
store.setDefault(PreferenceConstants.SHOW_HOVER, true);
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -10,7 +10,7 @@
|
|||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>com.minres.scviewer.e4.product</artifactId>
|
<artifactId>com.minres.scviewer.e4.product</artifactId>
|
||||||
<version>2.4.0-SNAPSHOT</version>
|
<version>2.6.0-SNAPSHOT</version>
|
||||||
<packaging>eclipse-repository</packaging>
|
<packaging>eclipse-repository</packaging>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<build>
|
<build>
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<?pde version="3.5"?>
|
<?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.6.0.qualifier" useFeatures="false" includeLaunchers="true">
|
||||||
|
|
||||||
<configIni use="default">
|
<configIni use="default">
|
||||||
</configIni>
|
</configIni>
|
||||||
|
|
||||||
<launcherArgs>
|
<launcherArgs>
|
||||||
<programArgs>-clearPersistedState -data @none
|
<programArgs>-clearPersistedState
|
||||||
</programArgs>
|
</programArgs>
|
||||||
<vmArgs>-Xmx2G
|
<vmArgs>-Xmx2G
|
||||||
|
-Dosgi.instance.area=@user.home/.scviewer
|
||||||
|
-Dosgi.instance.area.default=@user.home/.scviewer
|
||||||
</vmArgs>
|
</vmArgs>
|
||||||
<vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
|
<vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
|
||||||
</vmArgsMac>
|
</vmArgsMac>
|
||||||
@ -54,6 +56,7 @@
|
|||||||
<plugin id="com.minres.scviewer.database.vcd"/>
|
<plugin id="com.minres.scviewer.database.vcd"/>
|
||||||
<plugin id="com.minres.scviewer.e4.application"/>
|
<plugin id="com.minres.scviewer.e4.application"/>
|
||||||
<plugin id="com.opcoach.e4.preferences"/>
|
<plugin id="com.opcoach.e4.preferences"/>
|
||||||
|
<plugin id="com.opcoach.e4.preferences.mainmenu"/>
|
||||||
<plugin id="javax.annotation"/>
|
<plugin id="javax.annotation"/>
|
||||||
<plugin id="javax.inject"/>
|
<plugin id="javax.inject"/>
|
||||||
<plugin id="org.apache.batik.constants"/>
|
<plugin id="org.apache.batik.constants"/>
|
||||||
@ -111,7 +114,6 @@
|
|||||||
<plugin id="org.eclipse.equinox.app"/>
|
<plugin id="org.eclipse.equinox.app"/>
|
||||||
<plugin id="org.eclipse.equinox.common"/>
|
<plugin id="org.eclipse.equinox.common"/>
|
||||||
<plugin id="org.eclipse.equinox.concurrent"/>
|
<plugin id="org.eclipse.equinox.concurrent"/>
|
||||||
<plugin id="org.eclipse.equinox.ds"/>
|
|
||||||
<plugin id="org.eclipse.equinox.event"/>
|
<plugin id="org.eclipse.equinox.event"/>
|
||||||
<plugin id="org.eclipse.equinox.preferences"/>
|
<plugin id="org.eclipse.equinox.preferences"/>
|
||||||
<plugin id="org.eclipse.equinox.registry"/>
|
<plugin id="org.eclipse.equinox.registry"/>
|
||||||
@ -140,4 +142,11 @@
|
|||||||
<plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
|
<plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
|
||||||
</configurations>
|
</configurations>
|
||||||
|
|
||||||
|
<preferencesInfo>
|
||||||
|
<targetfile overwrite="false"/>
|
||||||
|
</preferencesInfo>
|
||||||
|
|
||||||
|
<cssInfo>
|
||||||
|
</cssInfo>
|
||||||
|
|
||||||
</product>
|
</product>
|
||||||
|
@ -30,11 +30,12 @@ http://www.eclipse.org/legal/epl-v10.html
|
|||||||
|
|
||||||
<requires>
|
<requires>
|
||||||
<import plugin="org.eclipse.equinox.ds" version="1.4.200" match="greaterOrEqual"/>
|
<import plugin="org.eclipse.equinox.ds" version="1.4.200" match="greaterOrEqual"/>
|
||||||
<import plugin="org.eclipse.equinox.util" version="1.0.500" match="greaterOrEqual"/>
|
|
||||||
<import plugin="org.eclipse.osgi.services" version="3.4.0" match="greaterOrEqual"/>
|
<import plugin="org.eclipse.osgi.services" version="3.4.0" match="greaterOrEqual"/>
|
||||||
<import plugin="com.minres.scviewer.database" version="1.0.0" match="greaterOrEqual"/>
|
<import plugin="com.google.guava" version="15.0.0" match="greaterOrEqual"/>
|
||||||
<import plugin="org.codehaus.groovy" version="1.8.6" match="greaterOrEqual"/>
|
|
||||||
<import plugin="org.eclipse.osgi"/>
|
<import plugin="org.eclipse.osgi"/>
|
||||||
|
<import plugin="com.minres.scviewer.database" version="1.0.0" match="greaterOrEqual"/>
|
||||||
|
<import plugin="com.minres.scviewer.database.ui" version="1.0.0" match="greaterOrEqual"/>
|
||||||
|
<import plugin="com.minres.scviewer.database.ui.swt" version="1.0.0" match="greaterOrEqual"/>
|
||||||
<import plugin="org.eclipse.core.runtime"/>
|
<import plugin="org.eclipse.core.runtime"/>
|
||||||
<import plugin="org.eclipse.core.resources"/>
|
<import plugin="org.eclipse.core.resources"/>
|
||||||
<import plugin="org.eclipse.jface.text"/>
|
<import plugin="org.eclipse.jface.text"/>
|
||||||
@ -43,15 +44,12 @@ http://www.eclipse.org/legal/epl-v10.html
|
|||||||
<import plugin="org.eclipse.ui.ide"/>
|
<import plugin="org.eclipse.ui.ide"/>
|
||||||
<import plugin="org.eclipse.ui.views.properties.tabbed"/>
|
<import plugin="org.eclipse.ui.views.properties.tabbed"/>
|
||||||
<import plugin="org.eclipse.swt"/>
|
<import plugin="org.eclipse.swt"/>
|
||||||
<import plugin="org.apache.ant"/>
|
|
||||||
<import plugin="com.google.guava" version="15.0.0" match="greaterOrEqual"/>
|
|
||||||
<import plugin="com.minres.scviewer.database.ui" version="1.0.0" match="greaterOrEqual"/>
|
|
||||||
<import plugin="com.minres.scviewer.database.ui.swt" version="1.0.0" match="greaterOrEqual"/>
|
|
||||||
<import plugin="org.eclipse.core.expressions" version="3.4.600" match="greaterOrEqual"/>
|
<import plugin="org.eclipse.core.expressions" version="3.4.600" match="greaterOrEqual"/>
|
||||||
<import plugin="org.eclipse.jface"/>
|
<import plugin="org.eclipse.jface"/>
|
||||||
<import plugin="org.junit"/>
|
|
||||||
<import plugin="org.eclipse.swt" version="3.103.1" match="greaterOrEqual"/>
|
<import plugin="org.eclipse.swt" version="3.103.1" match="greaterOrEqual"/>
|
||||||
<import plugin="org.eclipse.equinox.registry"/>
|
<import plugin="org.eclipse.equinox.registry"/>
|
||||||
|
<import plugin="org.codehaus.groovy" version="2.5.8" match="greaterOrEqual"/>
|
||||||
|
<import plugin="org.hamcrest.core" version="1.3.0" match="greaterOrEqual"/>
|
||||||
</requires>
|
</requires>
|
||||||
|
|
||||||
<plugin
|
<plugin
|
||||||
|
@ -12,11 +12,9 @@
|
|||||||
<module>../com.minres.scviewer.database.sqlite</module>
|
<module>../com.minres.scviewer.database.sqlite</module>
|
||||||
<module>../com.minres.scviewer.database.text</module>
|
<module>../com.minres.scviewer.database.text</module>
|
||||||
<module>../com.minres.scviewer.database.vcd</module>
|
<module>../com.minres.scviewer.database.vcd</module>
|
||||||
<!-- <module>../com.minres.scviewer.database.leveldb</module> -->
|
|
||||||
<module>../com.minres.scviewer.database.test</module>
|
<module>../com.minres.scviewer.database.test</module>
|
||||||
<module>../com.minres.scviewer.database.ui</module>
|
<module>../com.minres.scviewer.database.ui</module>
|
||||||
<module>../com.minres.scviewer.database.ui.swt</module>
|
<module>../com.minres.scviewer.database.ui.swt</module>
|
||||||
<module>../com.opcoach.e4.preferences</module>
|
|
||||||
<module>../com.minres.scviewer.e4.application</module>
|
<module>../com.minres.scviewer.e4.application</module>
|
||||||
<module>../com.minres.scviewer.ui</module>
|
<module>../com.minres.scviewer.ui</module>
|
||||||
<module>../com.minres.scviewer.feature</module>
|
<module>../com.minres.scviewer.feature</module>
|
||||||
@ -26,8 +24,8 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<tycho-version>1.5.0</tycho-version>
|
<tycho-version>1.5.0</tycho-version>
|
||||||
<groovy-eclipse-compiler-version>3.5.0</groovy-eclipse-compiler-version>
|
<groovy-eclipse-compiler-version>3.6.0-03</groovy-eclipse-compiler-version>
|
||||||
<groovy-eclipse-batch-version>2.5.8-03</groovy-eclipse-batch-version>
|
<groovy-eclipse-batch-version>3.0.3-01</groovy-eclipse-batch-version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -17,6 +17,10 @@
|
|||||||
<repository location="http://dist.springsource.org/snapshot/GRECLIPSE/e4.8/"/>
|
<repository location="http://dist.springsource.org/snapshot/GRECLIPSE/e4.8/"/>
|
||||||
<unit id="org.codehaus.groovy25.feature.feature.group" version="3.5.1.v201909291550-e48"/>
|
<unit id="org.codehaus.groovy25.feature.feature.group" version="3.5.1.v201909291550-e48"/>
|
||||||
</location>
|
</location>
|
||||||
|
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
|
||||||
|
<repository location="https://www.opcoach.com/repository/2018-12"/>
|
||||||
|
<unit id="com.opcoach.e4.preferences.feature.feature.group" version="1.3.0.201903181741"/>
|
||||||
|
</location>
|
||||||
</locations>
|
</locations>
|
||||||
<environment>
|
<environment>
|
||||||
<arch>x86_64</arch>
|
<arch>x86_64</arch>
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
|
||||||
</classpath>
|
|
2
com.opcoach.e4.preferences/.gitignore
vendored
2
com.opcoach.e4.preferences/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
/target/
|
|
||||||
/bin/
|
|
@ -1,28 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>com.opcoach.e4.preferences</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.pde.PluginNature</nature>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
@ -1,12 +0,0 @@
|
|||||||
eclipse.preferences.version=1
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
|
||||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
|
||||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
|
||||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
|
@ -1,19 +0,0 @@
|
|||||||
Manifest-Version: 1.0
|
|
||||||
Bundle-ManifestVersion: 2
|
|
||||||
Bundle-Name: Preferences
|
|
||||||
Bundle-SymbolicName: com.opcoach.e4.preferences;singleton:=true
|
|
||||||
Bundle-Version: 1.0.0.qualifier
|
|
||||||
Bundle-Vendor: OPCOACH
|
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
|
||||||
Require-Bundle: javax.inject,
|
|
||||||
org.eclipse.core.runtime;bundle-version="3.9.0",
|
|
||||||
org.eclipse.jface;bundle-version="3.9.0",
|
|
||||||
org.eclipse.e4.core.di;bundle-version="1.3.0",
|
|
||||||
org.eclipse.e4.ui.model.workbench;bundle-version="1.0.0",
|
|
||||||
org.eclipse.e4.core.services;bundle-version="1.1.0",
|
|
||||||
org.eclipse.e4.core.contexts;bundle-version="1.3.0",
|
|
||||||
org.eclipse.e4.ui.services;bundle-version="1.0.0"
|
|
||||||
Export-Package: com.opcoach.e4.preferences,
|
|
||||||
com.opcoach.e4.preferences.handlers
|
|
||||||
Bundle-ActivationPolicy: lazy
|
|
||||||
Automatic-Module-Name: com.opcoach.e4.preferences
|
|
@ -1,5 +0,0 @@
|
|||||||
source.. = src/
|
|
||||||
output.. = bin/
|
|
||||||
bin.includes = META-INF/,\
|
|
||||||
.,\
|
|
||||||
plugin.xml
|
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<?eclipse version="3.4"?>
|
|
||||||
<plugin>
|
|
||||||
<extension-point id="e4PreferencePages" name="e4PreferencePages" schema="schema/e4PreferencePages.exsd"/>
|
|
||||||
<extension-point id="e4PreferenceStoreProvider" name="e4PreferenceStoreProvider" schema="schema/e4PreferenceStoreProvider.exsd"/>
|
|
||||||
</plugin>
|
|
@ -1,13 +0,0 @@
|
|||||||
<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.opcoach.e4.preferences</artifactId>
|
|
||||||
<parent>
|
|
||||||
<groupId>com.minres.scviewer</groupId>
|
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
|
||||||
</parent>
|
|
||||||
<packaging>eclipse-plugin</packaging>
|
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
|
||||||
<groupId>com.minres.scviewer</groupId>
|
|
||||||
</project>
|
|
@ -1,163 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
|
||||||
<!-- Schema file written by PDE -->
|
|
||||||
<schema targetNamespace="com.opcoach.e4.preferences" xmlns="http://www.w3.org/2001/XMLSchema">
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.schema plugin="com.opcoach.e4.preferences" id="e4PreferencePages" name="e4PreferencePages"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter description of this extension point.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<element name="extension">
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.element />
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
<complexType>
|
|
||||||
<sequence>
|
|
||||||
<element ref="page" minOccurs="0" maxOccurs="unbounded"/>
|
|
||||||
</sequence>
|
|
||||||
<attribute name="point" type="string" use="required">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
a fully qualified identifier of the target extension point
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="id" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
an optional identifier of the extension instance
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="name" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
an optional name of the extension instance
|
|
||||||
</documentation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.attribute translatable="true"/>
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
</complexType>
|
|
||||||
</element>
|
|
||||||
|
|
||||||
<element name="page">
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.element labelAttribute="name"/>
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
<complexType>
|
|
||||||
<sequence>
|
|
||||||
<element ref="keywordReference" minOccurs="0" maxOccurs="unbounded"/>
|
|
||||||
</sequence>
|
|
||||||
<attribute name="id" type="string" use="required">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
a unique name that will be used to identify this page.
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="name" type="string" use="required">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
a translatable name that will be used in the UI for this page.
|
|
||||||
</documentation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.attribute translatable="true"/>
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="class" type="string" use="required">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
a name of the fully qualified class that implements
|
|
||||||
<samp>org.eclipse.jface.preference.IPreferencePage</samp>.
|
|
||||||
|
|
||||||
IT IS EASYER to extend FieldEditorPreferencePage
|
|
||||||
|
|
||||||
If this class extends directly org.eclipse.jface.preference.FieldEditorPreferencePage preferenceStore is automatically set on it.
|
|
||||||
</documentation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.attribute kind="java" basedOn="org.eclipse.jface.preference.FieldEditorPreferencePage:"/>
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="category" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
a path indicating the location of the page in the preference tree. The path may either be a parent node ID or a sequence
|
|
||||||
of IDs separated by '/', representing the full path from the root node.
|
|
||||||
</documentation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.attribute kind="identifier" basedOn="com.opcoach.e4.preferences.e4PreferencePages/page/@id"/>
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
</complexType>
|
|
||||||
</element>
|
|
||||||
|
|
||||||
<element name="keywordReference">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
A reference by a preference page to a keyword. See the keywords extension point.
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
<complexType>
|
|
||||||
<attribute name="id" type="string" use="required">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
The id of the keyword being referred to.
|
|
||||||
</documentation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.attribute kind="identifier" basedOn="org.eclipse.ui.keywords/keyword/@id"/>
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
</complexType>
|
|
||||||
</element>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="since"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter the first release in which this extension point appears.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="examples"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter extension point usage example here.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="apiinfo"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter API information here.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="implementation"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter information about supplied implementation of this extension point.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
|
|
||||||
</schema>
|
|
@ -1,149 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
|
||||||
<!-- Schema file written by PDE -->
|
|
||||||
<schema targetNamespace="com.opcoach.e4.preferences" xmlns="http://www.w3.org/2001/XMLSchema">
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.schema plugin="com.opcoach.e4.preferences" id="e4PreferenceStoreProvider" name="e4PreferenceStoreProvider"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
This extension point is used to associate a preference store to a plugin.
|
|
||||||
You can choose either to implement the IPreferenceStoreProvider interface or to give the ID of the IPreferenceStore to use (stored in the workbench context of your E4 application).
|
|
||||||
If this extension point is not used, a default ScopedPreferenceStore will be used for the preference page.
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<element name="extension">
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.element />
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
<complexType>
|
|
||||||
<sequence>
|
|
||||||
<element ref="preferenceStoreProvider" minOccurs="1" maxOccurs="unbounded"/>
|
|
||||||
</sequence>
|
|
||||||
<attribute name="point" type="string" use="required">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="id" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="name" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.attribute translatable="true"/>
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
</complexType>
|
|
||||||
</element>
|
|
||||||
|
|
||||||
<element name="preferenceStoreProvider">
|
|
||||||
<complexType>
|
|
||||||
<attribute name="pluginId" type="string" use="required">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
Set here the plugin Id concerned by this extension.
|
|
||||||
Must be a valid plugin ID (control will be done at runtime)
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="class" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
Set a class to get the IPreferenceStore for the defined pluginID.
|
|
||||||
This parameter is optional if you use the contextId attribute.
|
|
||||||
</documentation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.attribute kind="java" basedOn=":com.opcoach.e4.preferences.IPreferenceStoreProvider"/>
|
|
||||||
</appinfo>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="idInWorkbenchContext" type="string">
|
|
||||||
<annotation>
|
|
||||||
<documentation>
|
|
||||||
If no class is defined, you can set here the ID of the IPreferenceStore available in the context.
|
|
||||||
This object must be set in the workbenchContext using an Addon for instance, with the following code (in addon):
|
|
||||||
|
|
||||||
@PostContextCreate
|
|
||||||
public void initMyAddon(IEclipseContext ctx)
|
|
||||||
{
|
|
||||||
IPreferenceStore ps = new ... . // The code to create your pref store
|
|
||||||
ctx.set(ID set in this extension, ps);
|
|
||||||
}
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
</attribute>
|
|
||||||
</complexType>
|
|
||||||
</element>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="since"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter the first release in which this extension point appears.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="examples"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
The definition could be like the following :
|
|
||||||
|
|
||||||
pluginId="yourPluginID"
|
|
||||||
provider="a class implementing IPreferenceStoreProvider"
|
|
||||||
|
|
||||||
|
|
||||||
Or using the key in context (usefull to share the same preference store between plugins) :
|
|
||||||
|
|
||||||
pluginId="yourPluginID"
|
|
||||||
keyInContext="the key of the IPreferenceStore stored in context"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="apiinfo"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter API information here.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="implementation"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
[Enter information about supplied implementation of this extension point.]
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
<annotation>
|
|
||||||
<appinfo>
|
|
||||||
<meta.section type="copyright"/>
|
|
||||||
</appinfo>
|
|
||||||
<documentation>
|
|
||||||
@OPCoach 2014
|
|
||||||
</documentation>
|
|
||||||
</annotation>
|
|
||||||
|
|
||||||
</schema>
|
|
@ -1,25 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2014 OPCoach.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* OPCoach - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package com.opcoach.e4.preferences;
|
|
||||||
|
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
|
||||||
|
|
||||||
/** This interface can be implemented to provide a PreferenceStore for a given plugin.
|
|
||||||
* This associatino must be done in the e4PreferenceStoreProvider extension point.
|
|
||||||
* @author olivier
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface IPreferenceStoreProvider
|
|
||||||
{
|
|
||||||
/** Must be implemented to return a preference store */
|
|
||||||
public IPreferenceStore getPreferenceStore();
|
|
||||||
|
|
||||||
}
|
|
@ -1,861 +0,0 @@
|
|||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2014 OPCoach.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Eclipse - copy of the implementation coming from jface
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
package com.opcoach.e4.preferences;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.eclipse.core.commands.common.EventManager;
|
|
||||||
import org.eclipse.core.runtime.Assert;
|
|
||||||
import org.eclipse.core.runtime.Platform;
|
|
||||||
import org.eclipse.core.runtime.Plugin;
|
|
||||||
import org.eclipse.core.runtime.SafeRunner;
|
|
||||||
import org.eclipse.core.runtime.preferences.DefaultScope;
|
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
|
||||||
import org.eclipse.core.runtime.preferences.IScopeContext;
|
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener;
|
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent;
|
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
|
|
||||||
import org.eclipse.jface.preference.IPersistentPreferenceStore;
|
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
|
||||||
import org.eclipse.jface.resource.JFaceResources;
|
|
||||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
|
||||||
import org.eclipse.jface.util.SafeRunnable;
|
|
||||||
import org.osgi.service.prefs.BackingStoreException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The ScopedPreferenceStore is an IPreferenceStore that uses the scopes
|
|
||||||
* provided in org.eclipse.core.runtime.preferences.
|
|
||||||
* <p>
|
|
||||||
* A ScopedPreferenceStore does the lookup of a preference based on it's search
|
|
||||||
* scopes and sets the value of the preference based on its store scope.
|
|
||||||
* </p>
|
|
||||||
* <p>
|
|
||||||
* The default scope is always included in the search scopes when searching for
|
|
||||||
* preference values.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @see org.eclipse.core.runtime.preferences
|
|
||||||
* @since 3.1
|
|
||||||
*/
|
|
||||||
public class ScopedPreferenceStore extends EventManager implements
|
|
||||||
IPreferenceStore, IPersistentPreferenceStore {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The storeContext is the context where values will stored with the
|
|
||||||
* setValue methods. If there are no searchContexts this will be the search
|
|
||||||
* context. (along with the "default" context)
|
|
||||||
*/
|
|
||||||
private IScopeContext storeContext;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The searchContext is the array of contexts that will be used by the get
|
|
||||||
* methods for searching for values.
|
|
||||||
*/
|
|
||||||
private IScopeContext[] searchContexts;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A boolean to indicate the property changes should not be propagated.
|
|
||||||
*/
|
|
||||||
protected boolean silentRunning = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The listener on the IEclipsePreferences. This is used to forward updates
|
|
||||||
* to the property change listeners on the preference store.
|
|
||||||
*/
|
|
||||||
IEclipsePreferences.IPreferenceChangeListener preferencesListener;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default context is the context where getDefault and setDefault
|
|
||||||
* methods will search. This context is also used in the search.
|
|
||||||
*/
|
|
||||||
private IScopeContext defaultContext = DefaultScope.INSTANCE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The nodeQualifer is the string used to look up the node in the contexts.
|
|
||||||
*/
|
|
||||||
String nodeQualifier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The defaultQualifier is the string used to look up the default node.
|
|
||||||
*/
|
|
||||||
String defaultQualifier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Boolean value indicating whether or not this store has changes to be
|
|
||||||
* saved.
|
|
||||||
*/
|
|
||||||
private boolean dirty;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new instance of the receiver. Store the values in context in the
|
|
||||||
* node looked up by qualifier. <strong>NOTE:</strong> Any instance of
|
|
||||||
* ScopedPreferenceStore should call
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
* the scope to store to
|
|
||||||
* @param qualifier
|
|
||||||
* the qualifier used to look up the preference node
|
|
||||||
* @param defaultQualifierPath
|
|
||||||
* the qualifier used when looking up the defaults
|
|
||||||
*/
|
|
||||||
public ScopedPreferenceStore(IScopeContext context, String qualifier,
|
|
||||||
String defaultQualifierPath) {
|
|
||||||
this(context, qualifier);
|
|
||||||
this.defaultQualifier = defaultQualifierPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new instance of the receiver. Store the values in context in the
|
|
||||||
* node looked up by qualifier.
|
|
||||||
*
|
|
||||||
* @param context
|
|
||||||
* the scope to store to
|
|
||||||
* @param qualifier
|
|
||||||
* the qualifer used to look up the preference node
|
|
||||||
*/
|
|
||||||
public ScopedPreferenceStore(IScopeContext context, String qualifier) {
|
|
||||||
storeContext = context;
|
|
||||||
this.nodeQualifier = qualifier;
|
|
||||||
this.defaultQualifier = qualifier;
|
|
||||||
|
|
||||||
((IEclipsePreferences) getStorePreferences().parent())
|
|
||||||
.addNodeChangeListener(getNodeChangeListener());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a node change listener that adds a removes the receiver when nodes
|
|
||||||
* change.
|
|
||||||
*
|
|
||||||
* @return INodeChangeListener
|
|
||||||
*/
|
|
||||||
private INodeChangeListener getNodeChangeListener() {
|
|
||||||
return new IEclipsePreferences.INodeChangeListener() {
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#added(org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent)
|
|
||||||
*/
|
|
||||||
public void added(NodeChangeEvent event) {
|
|
||||||
if (nodeQualifier.equals(event.getChild().name())
|
|
||||||
&& isListenerAttached()) {
|
|
||||||
getStorePreferences().addPreferenceChangeListener(
|
|
||||||
preferencesListener);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#removed(org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent)
|
|
||||||
*/
|
|
||||||
public void removed(NodeChangeEvent event) {
|
|
||||||
// Do nothing as there are no events from removed node
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the preferences listener.
|
|
||||||
*/
|
|
||||||
private void initializePreferencesListener() {
|
|
||||||
if (preferencesListener == null) {
|
|
||||||
preferencesListener = new IEclipsePreferences.IPreferenceChangeListener() {
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent)
|
|
||||||
*/
|
|
||||||
public void preferenceChange(PreferenceChangeEvent event) {
|
|
||||||
|
|
||||||
if (silentRunning) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Object oldValue = event.getOldValue();
|
|
||||||
Object newValue = event.getNewValue();
|
|
||||||
String key = event.getKey();
|
|
||||||
if (newValue == null) {
|
|
||||||
newValue = getDefault(key, oldValue);
|
|
||||||
} else if (oldValue == null) {
|
|
||||||
oldValue = getDefault(key, newValue);
|
|
||||||
}
|
|
||||||
firePropertyChangeEvent(event.getKey(), oldValue, newValue);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
getStorePreferences().addPreferenceChangeListener(
|
|
||||||
preferencesListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Does its best at determining the default value for the given key. Checks
|
|
||||||
* the given object's type and then looks in the list of defaults to see if
|
|
||||||
* a value exists. If not or if there is a problem converting the value, the
|
|
||||||
* default default value for that type is returned.
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* the key to search
|
|
||||||
* @param obj
|
|
||||||
* the object who default we are looking for
|
|
||||||
* @return Object or <code>null</code>
|
|
||||||
*/
|
|
||||||
Object getDefault(String key, Object obj) {
|
|
||||||
IEclipsePreferences defaults = getDefaultPreferences();
|
|
||||||
if (obj instanceof String) {
|
|
||||||
return defaults.get(key, STRING_DEFAULT_DEFAULT);
|
|
||||||
} else if (obj instanceof Integer) {
|
|
||||||
return new Integer(defaults.getInt(key, INT_DEFAULT_DEFAULT));
|
|
||||||
} else if (obj instanceof Double) {
|
|
||||||
return new Double(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT));
|
|
||||||
} else if (obj instanceof Float) {
|
|
||||||
return new Float(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT));
|
|
||||||
} else if (obj instanceof Long) {
|
|
||||||
return new Long(defaults.getLong(key, LONG_DEFAULT_DEFAULT));
|
|
||||||
} else if (obj instanceof Boolean) {
|
|
||||||
return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE
|
|
||||||
: Boolean.FALSE;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the IEclipsePreferences node associated with this store.
|
|
||||||
*
|
|
||||||
* @return the preference node for this store
|
|
||||||
*/
|
|
||||||
IEclipsePreferences getStorePreferences() {
|
|
||||||
return storeContext.getNode(nodeQualifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the default IEclipsePreferences for this store.
|
|
||||||
*
|
|
||||||
* @return this store's default preference node
|
|
||||||
*/
|
|
||||||
private IEclipsePreferences getDefaultPreferences() {
|
|
||||||
return defaultContext.getNode(defaultQualifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
|
|
||||||
*/
|
|
||||||
public void addPropertyChangeListener(IPropertyChangeListener listener) {
|
|
||||||
initializePreferencesListener();// Create the preferences listener if it
|
|
||||||
// does not exist
|
|
||||||
addListenerObject(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the preference path to search preferences on. This is the list of
|
|
||||||
* preference nodes based on the scope contexts for this store. If there are
|
|
||||||
* no search contexts set, then return this store's context.
|
|
||||||
* <p>
|
|
||||||
* Whether or not the default context should be included in the resulting
|
|
||||||
* list is specified by the <code>includeDefault</code> parameter.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param includeDefault
|
|
||||||
* <code>true</code> if the default context should be included
|
|
||||||
* and <code>false</code> otherwise
|
|
||||||
* @return IEclipsePreferences[]
|
|
||||||
* @since 3.4 public, was added in 3.1 as private method
|
|
||||||
*/
|
|
||||||
public IEclipsePreferences[] getPreferenceNodes(boolean includeDefault) {
|
|
||||||
// if the user didn't specify a search order, then return the scope that
|
|
||||||
// this store was created on. (and optionally the default)
|
|
||||||
if (searchContexts == null) {
|
|
||||||
if (includeDefault) {
|
|
||||||
return new IEclipsePreferences[] { getStorePreferences(),
|
|
||||||
getDefaultPreferences() };
|
|
||||||
}
|
|
||||||
return new IEclipsePreferences[] { getStorePreferences() };
|
|
||||||
}
|
|
||||||
// otherwise the user specified a search order so return the appropriate
|
|
||||||
// nodes based on it
|
|
||||||
int length = searchContexts.length;
|
|
||||||
if (includeDefault) {
|
|
||||||
length++;
|
|
||||||
}
|
|
||||||
IEclipsePreferences[] preferences = new IEclipsePreferences[length];
|
|
||||||
for (int i = 0; i < searchContexts.length; i++) {
|
|
||||||
preferences[i] = searchContexts[i].getNode(nodeQualifier);
|
|
||||||
}
|
|
||||||
if (includeDefault) {
|
|
||||||
preferences[length - 1] = getDefaultPreferences();
|
|
||||||
}
|
|
||||||
return preferences;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the search contexts to scopes. When searching for a value the seach
|
|
||||||
* will be done in the order of scope contexts and will not search the
|
|
||||||
* storeContext unless it is in this list.
|
|
||||||
* <p>
|
|
||||||
* If the given list is <code>null</code>, then clear this store's search
|
|
||||||
* contexts. This means that only this store's scope context and default
|
|
||||||
* scope will be used during preference value searching.
|
|
||||||
* </p>
|
|
||||||
* <p>
|
|
||||||
* The defaultContext will be added to the end of this list automatically
|
|
||||||
* and <em>MUST NOT</em> be included by the user.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param scopes
|
|
||||||
* a list of scope contexts to use when searching, or
|
|
||||||
* <code>null</code>
|
|
||||||
*/
|
|
||||||
public void setSearchContexts(IScopeContext[] scopes) {
|
|
||||||
this.searchContexts = scopes;
|
|
||||||
if (scopes == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assert that the default was not included (we automatically add it to
|
|
||||||
// the end)
|
|
||||||
for (int i = 0; i < scopes.length; i++) {
|
|
||||||
if (scopes[i].equals(defaultContext)) {
|
|
||||||
Assert
|
|
||||||
.isTrue(
|
|
||||||
false,
|
|
||||||
"Do not add the default to the search contexts");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#contains(java.lang.String)
|
|
||||||
*/
|
|
||||||
public boolean contains(String name) {
|
|
||||||
if (name == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return (Platform.getPreferencesService().get(name, null,
|
|
||||||
getPreferenceNodes(true))) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#firePropertyChangeEvent(java.lang.String,
|
|
||||||
* java.lang.Object, java.lang.Object)
|
|
||||||
*/
|
|
||||||
public void firePropertyChangeEvent(String name, Object oldValue,
|
|
||||||
Object newValue) {
|
|
||||||
// important: create intermediate array to protect against listeners
|
|
||||||
// being added/removed during the notification
|
|
||||||
final Object[] list = getListeners();
|
|
||||||
if (list.length == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final PropertyChangeEvent event = new PropertyChangeEvent(this, name,
|
|
||||||
oldValue, newValue);
|
|
||||||
for (int i = 0; i < list.length; i++) {
|
|
||||||
final IPropertyChangeListener listener = (IPropertyChangeListener) list[i];
|
|
||||||
SafeRunner.run(new SafeRunnable(JFaceResources
|
|
||||||
.getString("PreferenceStore.changeError")) { //$NON-NLS-1$
|
|
||||||
public void run() {
|
|
||||||
listener.propertyChange(event);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getBoolean(java.lang.String)
|
|
||||||
*/
|
|
||||||
public boolean getBoolean(String name) {
|
|
||||||
String value = internalGet(name);
|
|
||||||
return value == null ? BOOLEAN_DEFAULT_DEFAULT : Boolean.valueOf(value)
|
|
||||||
.booleanValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultBoolean(java.lang.String)
|
|
||||||
*/
|
|
||||||
public boolean getDefaultBoolean(String name) {
|
|
||||||
return getDefaultPreferences()
|
|
||||||
.getBoolean(name, BOOLEAN_DEFAULT_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultDouble(java.lang.String)
|
|
||||||
*/
|
|
||||||
public double getDefaultDouble(String name) {
|
|
||||||
return getDefaultPreferences().getDouble(name, DOUBLE_DEFAULT_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultFloat(java.lang.String)
|
|
||||||
*/
|
|
||||||
public float getDefaultFloat(String name) {
|
|
||||||
return getDefaultPreferences().getFloat(name, FLOAT_DEFAULT_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultInt(java.lang.String)
|
|
||||||
*/
|
|
||||||
public int getDefaultInt(String name) {
|
|
||||||
return getDefaultPreferences().getInt(name, INT_DEFAULT_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultLong(java.lang.String)
|
|
||||||
*/
|
|
||||||
public long getDefaultLong(String name) {
|
|
||||||
return getDefaultPreferences().getLong(name, LONG_DEFAULT_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultString(java.lang.String)
|
|
||||||
*/
|
|
||||||
public String getDefaultString(String name) {
|
|
||||||
return getDefaultPreferences().get(name, STRING_DEFAULT_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getDouble(java.lang.String)
|
|
||||||
*/
|
|
||||||
public double getDouble(String name) {
|
|
||||||
String value = internalGet(name);
|
|
||||||
if (value == null) {
|
|
||||||
return DOUBLE_DEFAULT_DEFAULT;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return Double.parseDouble(value);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
return DOUBLE_DEFAULT_DEFAULT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the string value for the specified key. Look in the nodes which
|
|
||||||
* are specified by this object's list of search scopes. If the value does
|
|
||||||
* not exist then return <code>null</code>.
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* the key to search with
|
|
||||||
* @return String or <code>null</code> if the value does not exist.
|
|
||||||
*/
|
|
||||||
private String internalGet(String key) {
|
|
||||||
return Platform.getPreferencesService().get(key, null,
|
|
||||||
getPreferenceNodes(true));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getFloat(java.lang.String)
|
|
||||||
*/
|
|
||||||
public float getFloat(String name) {
|
|
||||||
String value = internalGet(name);
|
|
||||||
if (value == null) {
|
|
||||||
return FLOAT_DEFAULT_DEFAULT;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return Float.parseFloat(value);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
return FLOAT_DEFAULT_DEFAULT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getInt(java.lang.String)
|
|
||||||
*/
|
|
||||||
public int getInt(String name) {
|
|
||||||
String value = internalGet(name);
|
|
||||||
if (value == null) {
|
|
||||||
return INT_DEFAULT_DEFAULT;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return Integer.parseInt(value);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
return INT_DEFAULT_DEFAULT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getLong(java.lang.String)
|
|
||||||
*/
|
|
||||||
public long getLong(String name) {
|
|
||||||
String value = internalGet(name);
|
|
||||||
if (value == null) {
|
|
||||||
return LONG_DEFAULT_DEFAULT;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return Long.parseLong(value);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
return LONG_DEFAULT_DEFAULT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#getString(java.lang.String)
|
|
||||||
*/
|
|
||||||
public String getString(String name) {
|
|
||||||
String value = internalGet(name);
|
|
||||||
return value == null ? STRING_DEFAULT_DEFAULT : value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#isDefault(java.lang.String)
|
|
||||||
*/
|
|
||||||
public boolean isDefault(String name) {
|
|
||||||
if (name == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return (Platform.getPreferencesService().get(name, null,
|
|
||||||
getPreferenceNodes(false))) == null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#needsSaving()
|
|
||||||
*/
|
|
||||||
public boolean needsSaving() {
|
|
||||||
return dirty;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#putValue(java.lang.String,
|
|
||||||
* java.lang.String)
|
|
||||||
*/
|
|
||||||
public void putValue(String name, String value) {
|
|
||||||
try {
|
|
||||||
// Do not notify listeners
|
|
||||||
silentRunning = true;
|
|
||||||
getStorePreferences().put(name, value);
|
|
||||||
} finally {
|
|
||||||
// Be sure that an exception does not stop property updates
|
|
||||||
silentRunning = false;
|
|
||||||
dirty = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
|
|
||||||
*/
|
|
||||||
public void removePropertyChangeListener(IPropertyChangeListener listener) {
|
|
||||||
removeListenerObject(listener);
|
|
||||||
if (!isListenerAttached()) {
|
|
||||||
disposePreferenceStoreListener();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
|
|
||||||
* double)
|
|
||||||
*/
|
|
||||||
public void setDefault(String name, double value) {
|
|
||||||
getDefaultPreferences().putDouble(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
|
|
||||||
* float)
|
|
||||||
*/
|
|
||||||
public void setDefault(String name, float value) {
|
|
||||||
getDefaultPreferences().putFloat(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
|
|
||||||
* int)
|
|
||||||
*/
|
|
||||||
public void setDefault(String name, int value) {
|
|
||||||
getDefaultPreferences().putInt(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
|
|
||||||
* long)
|
|
||||||
*/
|
|
||||||
public void setDefault(String name, long value) {
|
|
||||||
getDefaultPreferences().putLong(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
|
|
||||||
* java.lang.String)
|
|
||||||
*/
|
|
||||||
public void setDefault(String name, String defaultObject) {
|
|
||||||
getDefaultPreferences().put(name, defaultObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
|
|
||||||
* boolean)
|
|
||||||
*/
|
|
||||||
public void setDefault(String name, boolean value) {
|
|
||||||
getDefaultPreferences().putBoolean(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setToDefault(java.lang.String)
|
|
||||||
*/
|
|
||||||
public void setToDefault(String name) {
|
|
||||||
|
|
||||||
String oldValue = getString(name);
|
|
||||||
String defaultValue = getDefaultString(name);
|
|
||||||
try {
|
|
||||||
silentRunning = true;// Turn off updates from the store
|
|
||||||
// removing a non-existing preference is a no-op so call the Core
|
|
||||||
// API directly
|
|
||||||
getStorePreferences().remove(name);
|
|
||||||
if (oldValue != defaultValue){
|
|
||||||
dirty = true;
|
|
||||||
firePropertyChangeEvent(name, oldValue, defaultValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
} finally {
|
|
||||||
silentRunning = false;// Restart listening to preferences
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
|
|
||||||
* double)
|
|
||||||
*/
|
|
||||||
public void setValue(String name, double value) {
|
|
||||||
double oldValue = getDouble(name);
|
|
||||||
if (oldValue == value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
silentRunning = true;// Turn off updates from the store
|
|
||||||
if (getDefaultDouble(name) == value) {
|
|
||||||
getStorePreferences().remove(name);
|
|
||||||
} else {
|
|
||||||
getStorePreferences().putDouble(name, value);
|
|
||||||
}
|
|
||||||
dirty = true;
|
|
||||||
firePropertyChangeEvent(name, new Double(oldValue), new Double(
|
|
||||||
value));
|
|
||||||
} finally {
|
|
||||||
silentRunning = false;// Restart listening to preferences
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
|
|
||||||
* float)
|
|
||||||
*/
|
|
||||||
public void setValue(String name, float value) {
|
|
||||||
float oldValue = getFloat(name);
|
|
||||||
if (oldValue == value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
silentRunning = true;// Turn off updates from the store
|
|
||||||
if (getDefaultFloat(name) == value) {
|
|
||||||
getStorePreferences().remove(name);
|
|
||||||
} else {
|
|
||||||
getStorePreferences().putFloat(name, value);
|
|
||||||
}
|
|
||||||
dirty = true;
|
|
||||||
firePropertyChangeEvent(name, new Float(oldValue), new Float(value));
|
|
||||||
} finally {
|
|
||||||
silentRunning = false;// Restart listening to preferences
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
|
|
||||||
* int)
|
|
||||||
*/
|
|
||||||
public void setValue(String name, int value) {
|
|
||||||
int oldValue = getInt(name);
|
|
||||||
if (oldValue == value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
silentRunning = true;// Turn off updates from the store
|
|
||||||
if (getDefaultInt(name) == value) {
|
|
||||||
getStorePreferences().remove(name);
|
|
||||||
} else {
|
|
||||||
getStorePreferences().putInt(name, value);
|
|
||||||
}
|
|
||||||
dirty = true;
|
|
||||||
firePropertyChangeEvent(name, new Integer(oldValue), new Integer(
|
|
||||||
value));
|
|
||||||
} finally {
|
|
||||||
silentRunning = false;// Restart listening to preferences
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
|
|
||||||
* long)
|
|
||||||
*/
|
|
||||||
public void setValue(String name, long value) {
|
|
||||||
long oldValue = getLong(name);
|
|
||||||
if (oldValue == value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
silentRunning = true;// Turn off updates from the store
|
|
||||||
if (getDefaultLong(name) == value) {
|
|
||||||
getStorePreferences().remove(name);
|
|
||||||
} else {
|
|
||||||
getStorePreferences().putLong(name, value);
|
|
||||||
}
|
|
||||||
dirty = true;
|
|
||||||
firePropertyChangeEvent(name, new Long(oldValue), new Long(value));
|
|
||||||
} finally {
|
|
||||||
silentRunning = false;// Restart listening to preferences
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
|
|
||||||
* java.lang.String)
|
|
||||||
*/
|
|
||||||
public void setValue(String name, String value) {
|
|
||||||
// Do not turn on silent running here as Strings are propagated
|
|
||||||
if (getDefaultString(name).equals(value)) {
|
|
||||||
getStorePreferences().remove(name);
|
|
||||||
} else {
|
|
||||||
getStorePreferences().put(name, value);
|
|
||||||
}
|
|
||||||
dirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
|
|
||||||
* boolean)
|
|
||||||
*/
|
|
||||||
public void setValue(String name, boolean value) {
|
|
||||||
boolean oldValue = getBoolean(name);
|
|
||||||
if (oldValue == value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
silentRunning = true;// Turn off updates from the store
|
|
||||||
if (getDefaultBoolean(name) == value) {
|
|
||||||
getStorePreferences().remove(name);
|
|
||||||
} else {
|
|
||||||
getStorePreferences().putBoolean(name, value);
|
|
||||||
}
|
|
||||||
dirty = true;
|
|
||||||
firePropertyChangeEvent(name, oldValue ? Boolean.TRUE
|
|
||||||
: Boolean.FALSE, value ? Boolean.TRUE : Boolean.FALSE);
|
|
||||||
} finally {
|
|
||||||
silentRunning = false;// Restart listening to preferences
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.IPersistentPreferenceStore#save()
|
|
||||||
*/
|
|
||||||
public void save() throws IOException {
|
|
||||||
try {
|
|
||||||
getStorePreferences().flush();
|
|
||||||
dirty = false;
|
|
||||||
} catch (BackingStoreException e) {
|
|
||||||
throw new IOException(e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dispose the receiver.
|
|
||||||
*/
|
|
||||||
private void disposePreferenceStoreListener() {
|
|
||||||
|
|
||||||
IEclipsePreferences root = (IEclipsePreferences) Platform
|
|
||||||
.getPreferencesService().getRootNode().node(
|
|
||||||
Plugin.PLUGIN_PREFERENCE_SCOPE);
|
|
||||||
try {
|
|
||||||
if (!(root.nodeExists(nodeQualifier))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch (BackingStoreException e) {
|
|
||||||
return;// No need to report here as the node won't have the
|
|
||||||
// listener
|
|
||||||
}
|
|
||||||
|
|
||||||
IEclipsePreferences preferences = getStorePreferences();
|
|
||||||
if (preferences == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (preferencesListener != null) {
|
|
||||||
preferences.removePreferenceChangeListener(preferencesListener);
|
|
||||||
preferencesListener = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2014 OPCoach.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Manumitting Technologies : Brian de Alwis for initial API and implementation
|
|
||||||
* OPCoach : O.Prouvost fix bugs on hierarchy
|
|
||||||
*******************************************************************************//*
|
|
||||||
* Handler to open up a configured preferences dialog.
|
|
||||||
* Written by Brian de Alwis, Manumitting Technologies.
|
|
||||||
* Placed in the public domain.
|
|
||||||
* This code comes from : http://www.eclipse.org/forums/index.php/fa/4347/
|
|
||||||
* and was referenced in the thread : http://www.eclipse.org/forums/index.php/m/750139/
|
|
||||||
*/
|
|
||||||
package com.opcoach.e4.preferences.handlers;
|
|
||||||
|
|
||||||
import javax.inject.Named;
|
|
||||||
|
|
||||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
|
||||||
import org.eclipse.e4.core.di.annotations.Execute;
|
|
||||||
import org.eclipse.e4.ui.services.IServiceConstants;
|
|
||||||
import org.eclipse.jface.preference.PreferenceDialog;
|
|
||||||
import org.eclipse.jface.preference.PreferenceManager;
|
|
||||||
import org.eclipse.jface.viewers.ViewerComparator;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
|
|
||||||
import com.opcoach.e4.preferences.internal.E4PreferenceRegistry;
|
|
||||||
|
|
||||||
|
|
||||||
public class E4PreferencesHandler
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
@CanExecute
|
|
||||||
public boolean canExecute()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Execute
|
|
||||||
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, E4PreferenceRegistry prefReg)
|
|
||||||
{
|
|
||||||
PreferenceManager pm = prefReg.getPreferenceManager();
|
|
||||||
PreferenceDialog dialog = new PreferenceDialog(shell, pm);
|
|
||||||
dialog.create();
|
|
||||||
dialog.getTreeViewer().setComparator(new ViewerComparator());
|
|
||||||
dialog.getTreeViewer().expandAll();
|
|
||||||
dialog.open();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -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 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 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 ELMT_PAGE = "page"; // $NON-NLS-1$
|
||||||
protected static final String ATTR_ID = "id"; // $NON-NLS-1$
|
protected static final String ATTR_ID = "id"; // $NON-NLS-1$
|
||||||
protected static final String ATTR_CATEGORY = "category"; // $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);
|
IContributionFactory factory = context.get(IContributionFactory.class);
|
||||||
|
|
||||||
psProviders = new HashMap<String, Object>();
|
psProviders = new HashMap<String, Object>();
|
||||||
|
IExtensionRegistry registry = context.get(IExtensionRegistry.class);
|
||||||
|
|
||||||
// Read extensions and fill the map...
|
// Read extensions and fill the map...
|
||||||
for (IConfigurationElement elmt : registry.getConfigurationElementsFor(PREF_STORE_PROVIDER))
|
for (IConfigurationElement elmt : registry.getConfigurationElementsFor(PREF_STORE_PROVIDER))
|
||||||
@ -261,7 +263,7 @@ public class E4PreferenceRegistry
|
|||||||
Object data = objectId;
|
Object data = objectId;
|
||||||
if (classname != null)
|
if (classname != null)
|
||||||
{
|
{
|
||||||
data = factory.create(classname, context);
|
data = factory.create("bundleclass://"+declaringBundle+"/"+classname, context);
|
||||||
if (!(data instanceof IPreferenceStoreProvider))
|
if (!(data instanceof IPreferenceStoreProvider))
|
||||||
{
|
{
|
||||||
logger.warn("In extension " + PREF_STORE_PROVIDER + " the class must implements IPreferenceStoreProvider. Check the plugin " + declaringBundle);
|
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);
|
psProviders.put(pluginId, data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context.set(KEY_PREF_STORE_PROVIDERS, psProviders);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user