Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
244f005ae6 | |||
701733e69d | |||
6b4a9c1e14 | |||
3abbc3e0e2 | |||
2a7b713ef2 | |||
593571ce10 | |||
979261432a | |||
e25f56a8a9 | |||
e8788e6ce0 | |||
8a8691a889 | |||
de15b84bef | |||
b78d8bea45 | |||
a49842a119 | |||
dbe5d603ed | |||
cde1835c74 | |||
b332eca891 | |||
960610bab2 | |||
9c09cf5f40 |
@ -84,7 +84,11 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
calculateConcurrencyIndicees()
|
calculateConcurrencyIndicees()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
} catch(Exception e) { }
|
} catch(EOFException e) {
|
||||||
|
return true;
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: VCD signal database
|
Bundle-Name: VCD signal database
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.vcd
|
Bundle-SymbolicName: com.minres.scviewer.database.vcd
|
||||||
Bundle-Version: 2.0.0.qualifier
|
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",
|
||||||
|
@ -1,6 +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.database.vcd</artifactId>
|
<artifactId>com.minres.scviewer.database.vcd</artifactId>
|
||||||
|
<version>2.0.2-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>
|
||||||
|
@ -13,6 +13,8 @@ package com.minres.scviewer.database.vcd;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -20,6 +22,7 @@ import java.util.NavigableMap;
|
|||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
import com.minres.scviewer.database.BitVector;
|
import com.minres.scviewer.database.BitVector;
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.ISignal;
|
||||||
@ -56,8 +59,20 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
|||||||
public VCDDbLoader() {
|
public VCDDbLoader() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The date bytes. */
|
private static boolean isGzipped(File f) {
|
||||||
private byte[] dateBytes = "$date".getBytes();
|
InputStream is = null;
|
||||||
|
try {
|
||||||
|
is = new FileInputStream(f);
|
||||||
|
byte [] signature = new byte[2];
|
||||||
|
int nread = is.read( signature ); //read the gzip signature
|
||||||
|
return nread == 2 && signature[ 0 ] == (byte) 0x1f && signature[ 1 ] == (byte) 0x8b;
|
||||||
|
} catch (IOException e) {
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
try { is.close();} catch (IOException e) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see com.minres.scviewer.database.ITrDb#load(java.io.File)
|
* @see com.minres.scviewer.database.ITrDb#load(java.io.File)
|
||||||
@ -67,22 +82,16 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
|||||||
public boolean load(IWaveformDb db, File file) throws Exception {
|
public boolean load(IWaveformDb db, File file) throws Exception {
|
||||||
this.db=db;
|
this.db=db;
|
||||||
this.maxTime=0;
|
this.maxTime=0;
|
||||||
try {
|
String name = file.getCanonicalFile().getName();
|
||||||
FileInputStream fis = new FileInputStream(file);
|
if(!(name.endsWith(".vcd") ||
|
||||||
byte[] buffer = new byte[dateBytes.length];
|
name.endsWith(".vcdz") ||
|
||||||
int read = fis.read(buffer, 0, dateBytes.length);
|
name.endsWith(".vcdgz") ||
|
||||||
fis.close();
|
name.endsWith(".vcd.gz")) )
|
||||||
if (read == dateBytes.length)
|
|
||||||
for (int i = 0; i < dateBytes.length; i++)
|
|
||||||
if (buffer[i] != dateBytes[i])
|
|
||||||
return false;
|
|
||||||
} catch(FileNotFoundException e) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
signals = new Vector<IWaveform>();
|
signals = new Vector<IWaveform>();
|
||||||
moduleStack= new Stack<String>();
|
moduleStack= new Stack<String>();
|
||||||
boolean res = new VCDFileParser(false).load(new FileInputStream(file), this);
|
FileInputStream fis = new FileInputStream(file);
|
||||||
|
boolean res = new VCDFileParser(false).load(isGzipped(file)?new GZIPInputStream(fis):fis, this);
|
||||||
moduleStack=null;
|
moduleStack=null;
|
||||||
if(!res) throw new InputFormatException();
|
if(!res) throw new InputFormatException();
|
||||||
// calculate max time of database
|
// calculate max time of database
|
||||||
|
@ -22,10 +22,12 @@ class VCDFileParser {
|
|||||||
private HashMap<String, Integer> nameToNetMap = new HashMap<String, Integer>();
|
private HashMap<String, Integer> nameToNetMap = new HashMap<String, Integer>();
|
||||||
private long picoSecondsPerIncrement;
|
private long picoSecondsPerIncrement;
|
||||||
private boolean stripNetWidth;
|
private boolean stripNetWidth;
|
||||||
|
private boolean replaceColon;
|
||||||
long currentTime;
|
long currentTime;
|
||||||
|
|
||||||
public VCDFileParser(boolean stripNetWidth) {
|
public VCDFileParser(boolean stripNetWidth) {
|
||||||
this.stripNetWidth=stripNetWidth;
|
this.stripNetWidth=stripNetWidth;
|
||||||
|
this.replaceColon=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean load(InputStream is, IVCDDatabaseBuilder builder) {
|
public boolean load(InputStream is, IVCDDatabaseBuilder builder) {
|
||||||
@ -76,11 +78,17 @@ class VCDFileParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Integer net = nameToNetMap.get(id);
|
Integer net = nameToNetMap.get(id);
|
||||||
if (net == null) {
|
if (net == null) { // We've never seen this net before
|
||||||
// We've never seen this net before
|
int openBracket = netName.indexOf('[');
|
||||||
if(stripNetWidth){
|
if(stripNetWidth){
|
||||||
int openBracket = netName.indexOf('[');
|
|
||||||
if (openBracket != -1) netName = netName.substring(0, openBracket);
|
if (openBracket != -1) netName = netName.substring(0, openBracket);
|
||||||
|
openBracket = -1;
|
||||||
|
}
|
||||||
|
if(replaceColon) {
|
||||||
|
if (openBracket != -1) {
|
||||||
|
netName = netName.substring(0, openBracket).replaceAll(":", ".")+netName.substring(openBracket);
|
||||||
|
} else
|
||||||
|
netName=netName.replaceAll(":", ".");
|
||||||
}
|
}
|
||||||
nameToNetMap.put(id, traceBuilder.newNet(netName, -1, width));
|
nameToNetMap.put(id, traceBuilder.newNet(netName, -1, width));
|
||||||
} else {
|
} else {
|
||||||
@ -89,6 +97,17 @@ class VCDFileParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void parseComment() throws Exception {
|
||||||
|
nextToken();
|
||||||
|
String s = tokenizer.sval;
|
||||||
|
nextToken();
|
||||||
|
while(!tokenizer.sval.equals("$end")){
|
||||||
|
s+=" "+tokenizer.sval;
|
||||||
|
nextToken();
|
||||||
|
}
|
||||||
|
replaceColon|=s.contains("ARTERIS Architecture");
|
||||||
|
}
|
||||||
|
|
||||||
private void parseTimescale() throws Exception {
|
private void parseTimescale() throws Exception {
|
||||||
nextToken();
|
nextToken();
|
||||||
String s = tokenizer.sval;
|
String s = tokenizer.sval;
|
||||||
@ -132,6 +151,8 @@ class VCDFileParser {
|
|||||||
parseUpscope();
|
parseUpscope();
|
||||||
else if (tokenizer.sval.equals("$timescale"))
|
else if (tokenizer.sval.equals("$timescale"))
|
||||||
parseTimescale();
|
parseTimescale();
|
||||||
|
else if (tokenizer.sval.equals("$comment"))
|
||||||
|
parseComment();
|
||||||
else if (tokenizer.sval.equals("$enddefinitions")) {
|
else if (tokenizer.sval.equals("$enddefinitions")) {
|
||||||
match("$end");
|
match("$end");
|
||||||
return false;
|
return false;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
</children>
|
</children>
|
||||||
</children>
|
</children>
|
||||||
</children>
|
</children>
|
||||||
|
<children xsi:type="basic:Part" xmi:id="__VNlAIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dialog.aboutscviewer" toBeRendered="false" visible="false" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.AboutDialog" label="About SCViewer"/>
|
||||||
<mainMenu xmi:id="_95PfyXNmEeWBq8z1Dv39LA" elementId="menu:org.eclipse.ui.main.menu">
|
<mainMenu xmi:id="_95PfyXNmEeWBq8z1Dv39LA" elementId="menu:org.eclipse.ui.main.menu">
|
||||||
<children xsi:type="menu:Menu" xmi:id="_95QGwHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.menu.file" label="File">
|
<children xsi:type="menu:Menu" xmi:id="_95QGwHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.menu.file" label="File">
|
||||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_VJG3YHgvEeWwZ-9vrAR2UQ" elementId="" label="Open Database" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_database.png" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
<children xsi:type="menu:HandledMenuItem" xmi:id="_VJG3YHgvEeWwZ-9vrAR2UQ" elementId="" label="Open Database" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_database.png" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
||||||
@ -142,9 +143,6 @@
|
|||||||
</children>
|
</children>
|
||||||
</trimBars>
|
</trimBars>
|
||||||
</children>
|
</children>
|
||||||
<children xsi:type="basic:Window" xmi:id="_8BTkQIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dialog.aboutscviewer" toBeRendered="false" visible="false" selectedElement="__VNlAIytEeWid7xO48ZBXw" label="About SCViewer" x="200" y="200">
|
|
||||||
<children xsi:type="basic:Part" xmi:id="__VNlAIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.part.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.AboutDialog"/>
|
|
||||||
</children>
|
|
||||||
<handlers xmi:id="_95PfvXNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.quitCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.QuitHandler" command="_95PfvHNmEeWBq8z1Dv39LA"/>
|
<handlers xmi:id="_95PfvXNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.quitCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.QuitHandler" command="_95PfvHNmEeWBq8z1Dv39LA"/>
|
||||||
<handlers xmi:id="_95PfwXNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.openCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.OpenHandler" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
<handlers xmi:id="_95PfwXNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.openCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.OpenHandler" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
||||||
<handlers xmi:id="_95PfxHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.saveCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SaveHandler" command="_95Pfw3NmEeWBq8z1Dv39LA"/>
|
<handlers xmi:id="_95PfxHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.saveCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SaveHandler" command="_95Pfw3NmEeWBq8z1Dv39LA"/>
|
||||||
|
@ -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.0.0.qualifier
|
Bundle-Version: 2.0.4.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",
|
||||||
|
@ -1,6 +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.0.4-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>
|
||||||
|
@ -12,6 +12,7 @@ package com.minres.scviewer.e4.application.handlers;
|
|||||||
|
|
||||||
import org.eclipse.e4.core.di.annotations.Execute;
|
import org.eclipse.e4.core.di.annotations.Execute;
|
||||||
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.MWindow;
|
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
|
||||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
@ -22,9 +23,9 @@ public class AboutHandler {
|
|||||||
|
|
||||||
@Execute
|
@Execute
|
||||||
public void execute(Shell shell, MApplication app, MWindow window, EModelService ms /*@Named("mdialog01.dialog.0") MDialog dialog*/) {
|
public void execute(Shell shell, MApplication app, MWindow window, EModelService ms /*@Named("mdialog01.dialog.0") MDialog dialog*/) {
|
||||||
MWindow dialog = (MWindow) ms.find(DIALOG_ID, app); //$NON-NLS-1$
|
MPart mel = (MPart) ms.find(DIALOG_ID, app); //$NON-NLS-1$
|
||||||
dialog.setToBeRendered(true);
|
mel.setToBeRendered(true);
|
||||||
dialog.setToBeRendered(false);
|
mel.setToBeRendered(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
AboutDialog_0=\nSCViewer - a SystemC waveform viewer\n\nVersion: 2.0\n
|
AboutDialog_0=\nSCViewer - a SystemC waveform viewer\n\nVersion: {0}\n
|
||||||
AboutDialog_1=\nCopyright (c) 2015, 2018 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\nSources code is hosted at https://git.minres.com/VP/SCViewer and the master branch is mirrored to GitHub: https://git.com/minres/SCViewer\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/SCViewer and the master branch is mirrored to GitHub: https://git.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
|
||||||
|
@ -19,8 +19,10 @@ import java.util.regex.Pattern;
|
|||||||
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.jface.dialogs.Dialog;
|
import org.eclipse.jface.dialogs.Dialog;
|
||||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
|
import org.eclipse.osgi.util.NLS;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.custom.StyleRange;
|
import org.eclipse.swt.custom.StyleRange;
|
||||||
import org.eclipse.swt.custom.StyledText;
|
import org.eclipse.swt.custom.StyledText;
|
||||||
@ -39,6 +41,7 @@ import org.eclipse.swt.widgets.Listener;
|
|||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.wb.swt.ResourceManager;
|
import org.eclipse.wb.swt.ResourceManager;
|
||||||
import org.eclipse.wb.swt.SWTResourceManager;
|
import org.eclipse.wb.swt.SWTResourceManager;
|
||||||
|
import org.osgi.framework.Version;
|
||||||
|
|
||||||
import com.minres.scviewer.e4.application.Messages;
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
|
|
||||||
@ -75,7 +78,7 @@ public class AboutDialog extends Dialog {
|
|||||||
Composite composite = new Composite(parent, SWT.NONE);
|
Composite composite = new Composite(parent, SWT.NONE);
|
||||||
GridData gd_composite = new GridData(SWT.LEFT, SWT.FILL, true, true);
|
GridData gd_composite = new GridData(SWT.LEFT, SWT.FILL, true, true);
|
||||||
gd_composite.widthHint = 600;
|
gd_composite.widthHint = 600;
|
||||||
gd_composite.heightHint =250;
|
gd_composite.heightHint =300;
|
||||||
composite.setLayoutData(gd_composite);
|
composite.setLayoutData(gd_composite);
|
||||||
composite.setLayout(new GridLayout(2, false));
|
composite.setLayout(new GridLayout(2, false));
|
||||||
|
|
||||||
@ -86,7 +89,7 @@ public class AboutDialog extends Dialog {
|
|||||||
Canvas canvas = new Canvas(composite,SWT.NO_REDRAW_RESIZE);
|
Canvas canvas = new Canvas(composite,SWT.NO_REDRAW_RESIZE);
|
||||||
GridData gd_canvas = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
|
GridData gd_canvas = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
|
||||||
gd_canvas.widthHint = 200;
|
gd_canvas.widthHint = 200;
|
||||||
gd_canvas.heightHint =250;
|
gd_canvas.heightHint =300;
|
||||||
canvas.setLayoutData(gd_canvas);
|
canvas.setLayoutData(gd_canvas);
|
||||||
canvas.addPaintListener(new PaintListener() {
|
canvas.addPaintListener(new PaintListener() {
|
||||||
public void paintControl(PaintEvent e) {
|
public void paintControl(PaintEvent e) {
|
||||||
@ -97,11 +100,14 @@ public class AboutDialog extends Dialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
StyledText styledText = new StyledText(composite, SWT.BORDER);
|
StyledText styledText = new StyledText(composite, SWT.V_SCROLL | SWT.BORDER);
|
||||||
styledText.setEditable(false);
|
styledText.setEditable(false);
|
||||||
GridData gd_styledText = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
|
GridData gd_styledText = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
|
||||||
styledText.setLayoutData(gd_styledText);
|
styledText.setLayoutData(gd_styledText);
|
||||||
styledText.setText(productTitle+copyrightText);
|
Version version = Platform.getProduct().getDefiningBundle().getVersion();
|
||||||
|
String versionString = String.format("%d.%d.%d", version.getMajor(), version.getMinor(), version.getMicro());
|
||||||
|
String pt = NLS.bind(Messages.AboutDialog_0, versionString);
|
||||||
|
styledText.setText(pt+copyrightText);
|
||||||
styledText.setBackground(white);
|
styledText.setBackground(white);
|
||||||
styledText.setWordWrap(true);
|
styledText.setWordWrap(true);
|
||||||
styledText.setLeftMargin(5);
|
styledText.setLeftMargin(5);
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.e4.application.parts;
|
package com.minres.scviewer.e4.application.parts;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
@ -29,14 +30,16 @@ import org.eclipse.jface.viewers.IDoubleClickListener;
|
|||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||||
|
import org.eclipse.jface.viewers.ITreeViewerListener;
|
||||||
import org.eclipse.jface.viewers.LabelProvider;
|
import org.eclipse.jface.viewers.LabelProvider;
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
import org.eclipse.jface.viewers.StyledString;
|
import org.eclipse.jface.viewers.StyledString;
|
||||||
|
import org.eclipse.jface.viewers.TreeExpansionEvent;
|
||||||
import org.eclipse.jface.viewers.TreeViewer;
|
import org.eclipse.jface.viewers.TreeViewer;
|
||||||
import org.eclipse.jface.viewers.TreeViewerColumn;
|
import org.eclipse.jface.viewers.TreeViewerColumn;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
import org.eclipse.jface.viewers.ViewerFilter;
|
|
||||||
import org.eclipse.jface.viewers.ViewerComparator;
|
import org.eclipse.jface.viewers.ViewerComparator;
|
||||||
|
import org.eclipse.jface.viewers.ViewerFilter;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.ControlAdapter;
|
import org.eclipse.swt.events.ControlAdapter;
|
||||||
import org.eclipse.swt.events.ControlEvent;
|
import org.eclipse.swt.events.ControlEvent;
|
||||||
@ -51,11 +54,12 @@ import org.eclipse.swt.layout.GridLayout;
|
|||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
import org.eclipse.swt.widgets.Tree;
|
import org.eclipse.swt.widgets.Tree;
|
||||||
|
import org.eclipse.swt.widgets.TreeItem;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.DataType;
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.ITxAttribute;
|
import com.minres.scviewer.database.ITxAttribute;
|
||||||
import com.minres.scviewer.database.ITxRelation;
|
import com.minres.scviewer.database.ITxRelation;
|
||||||
import com.minres.scviewer.database.DataType;
|
|
||||||
import com.minres.scviewer.e4.application.Messages;
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
import com.minres.scviewer.e4.application.provider.TxPropertiesLabelProvider;
|
import com.minres.scviewer.e4.application.provider.TxPropertiesLabelProvider;
|
||||||
|
|
||||||
@ -129,6 +133,19 @@ public class TransactionDetails {
|
|||||||
treeViewer.addFilter(attributeFilter);
|
treeViewer.addFilter(attributeFilter);
|
||||||
treeViewer.setComparator(viewSorter);
|
treeViewer.setComparator(viewSorter);
|
||||||
treeViewer.setAutoExpandLevel(2);
|
treeViewer.setAutoExpandLevel(2);
|
||||||
|
treeViewer.addTreeListener(new ITreeViewerListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void treeCollapsed(TreeExpansionEvent event) {
|
||||||
|
treeViewer.getSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void treeExpanded(TreeExpansionEvent event) {
|
||||||
|
treeViewer.getSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
// Set up the table
|
// Set up the table
|
||||||
Tree tree = treeViewer.getTree();
|
Tree tree = treeViewer.getTree();
|
||||||
@ -187,7 +204,7 @@ public class TransactionDetails {
|
|||||||
Object[] selectedArray = (Object[]) selected;
|
Object[] selectedArray = (Object[]) selected;
|
||||||
if(selectedArray.length==3 && selectedArray[2] instanceof ITx){
|
if(selectedArray.length==3 && selectedArray[2] instanceof ITx){
|
||||||
waveformViewerPart.setSelection(new StructuredSelection(selectedArray[2]));
|
waveformViewerPart.setSelection(new StructuredSelection(selectedArray[2]));
|
||||||
treeViewer.setInput(selectedArray[2]);
|
setInput(selectedArray[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,6 +264,77 @@ public class TransactionDetails {
|
|||||||
this.waveformViewerPart=part;
|
this.waveformViewerPart=part;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setInput(Object object) {
|
||||||
|
if(object instanceof ITx){
|
||||||
|
ArrayList<String> names = new ArrayList<>();
|
||||||
|
int indexInParent=getTopItemHier(names);
|
||||||
|
ArrayList<Boolean> states = getExpandedState(treeViewer.getTree().getItems());
|
||||||
|
treeViewer.setInput(object);
|
||||||
|
setExpandedState(treeViewer.getTree().getItems(), states);
|
||||||
|
setTopItemFromHier(names, indexInParent);
|
||||||
|
} else {
|
||||||
|
treeViewer.setInput(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setExpandedState(TreeItem[] treeItems, ArrayList<Boolean> states) {
|
||||||
|
for (int i = 0; i < treeItems.length; i++) {
|
||||||
|
treeItems[i].setExpanded(states.size()>i?states.get(i):true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<Boolean> getExpandedState(TreeItem[] items){
|
||||||
|
ArrayList<Boolean> ret = new ArrayList<>();
|
||||||
|
for (TreeItem treeItem : items)
|
||||||
|
ret.add(treeItem.getItemCount()>0?treeItem.getExpanded():true);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getTopItemHier(ArrayList<String> names){
|
||||||
|
int indexInParent=-1;
|
||||||
|
TreeItem obj = treeViewer.getTree().getTopItem();
|
||||||
|
if(obj!=null) {
|
||||||
|
names.add(0, obj.getText(0));
|
||||||
|
if(obj.getParentItem()!=null) {
|
||||||
|
TreeItem pobj=obj.getParentItem();
|
||||||
|
names.add(0, pobj.getText(0));
|
||||||
|
TreeItem[] items = pobj.getItems();
|
||||||
|
for (int i = 0; i < items.length; i++) {
|
||||||
|
if(items[i]==obj) {
|
||||||
|
indexInParent=i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return indexInParent;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTopItemFromHier(ArrayList<String> names, int indexInParent) {
|
||||||
|
if(indexInParent<0 || names.size()==0 ) return;
|
||||||
|
TreeItem selItem=null;
|
||||||
|
for (TreeItem item : treeViewer.getTree().getItems()) { // find item from category
|
||||||
|
if(item.getText(0).equals(names.get(0))) {
|
||||||
|
if(names.size()>1) { // if we had an attribute as top item
|
||||||
|
TreeItem[] subItems=item.getItems();
|
||||||
|
for(TreeItem it : subItems) { // try to align by name
|
||||||
|
if(it.getText(0).equals(names.get(1))) {
|
||||||
|
selItem=it;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(selItem==null && indexInParent>=0 && subItems.length>0) // name based match failed so try to use position
|
||||||
|
selItem=subItems[subItems.length>indexInParent?indexInParent:subItems.length-1];
|
||||||
|
}
|
||||||
|
if(selItem==null) // no match in attributes so set the category as top item
|
||||||
|
selItem=item;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(selItem!=null)
|
||||||
|
treeViewer.getTree().setTopItem(selItem);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Sets the selection.
|
* Sets the selection.
|
||||||
*
|
*
|
||||||
@ -256,12 +344,7 @@ public class TransactionDetails {
|
|||||||
public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection){
|
public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection){
|
||||||
if(treeViewer!=null && selection!=null && !treeViewer.getTree().isDisposed()){
|
if(treeViewer!=null && selection!=null && !treeViewer.getTree().isDisposed()){
|
||||||
if( selection instanceof IStructuredSelection) {
|
if( selection instanceof IStructuredSelection) {
|
||||||
Object object= ((IStructuredSelection)selection).getFirstElement();
|
setInput(((IStructuredSelection)selection).getFirstElement());
|
||||||
if(object instanceof ITx){
|
|
||||||
treeViewer.setInput(object);
|
|
||||||
} else {
|
|
||||||
treeViewer.setInput(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +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.0.4-SNAPSHOT</version>
|
||||||
<packaging>eclipse-repository</packaging>
|
<packaging>eclipse-repository</packaging>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<build>
|
<build>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?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.0.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.0.4.qualifier" useFeatures="false" includeLaunchers="true">
|
||||||
|
|
||||||
<configIni use="default">
|
<configIni use="default">
|
||||||
</configIni>
|
</configIni>
|
||||||
|
Reference in New Issue
Block a user