This commit is contained in:
2020-05-09 12:50:28 +02:00
parent e88014ebba
commit 19ea1f0b6d
8 changed files with 174 additions and 66 deletions

View File

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

View File

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

View File

@ -1,5 +1,5 @@
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_16=Insert all before
DesignBrowser_2=Enter text to filter waveforms

View File

@ -328,13 +328,15 @@ public class DesignBrowser {
*/
@Focus
public void setFocus() {
txTableViewer.getTable().setFocus();
IStructuredSelection selection = (IStructuredSelection)txTableViewer.getSelection();
if(selection.size()==0){
appendItem.setEnabled(false);
if(txTableViewer!=null) {
txTableViewer.getTable().setFocus();
IStructuredSelection selection = (IStructuredSelection)txTableViewer.getSelection();
if(selection.size()==0){
appendItem.setEnabled(false);
}
selectionService.setSelection(selection);
thisSelectionCount=selection.toList().size();
}
selectionService.setSelection(selection);
thisSelectionCount=selection.toList().size();
updateButtons();
}

View File

@ -10,8 +10,14 @@
*******************************************************************************/
package com.minres.scviewer.e4.application.parts;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import java.util.Vector;
import java.util.regex.PatternSyntaxException;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
@ -477,12 +483,19 @@ public class TransactionDetails {
return true;
}
if(element instanceof ITxAttribute){
return (((ITxAttribute) element).getName().toLowerCase().matches(searchString.toLowerCase()));
try {
return (((ITxAttribute) element).getName().toLowerCase().matches(searchString.toLowerCase()));
} catch (PatternSyntaxException e) {
return true;
}
}
if(element instanceof Object[]) {
return (((Object[])element)[0]).toString().toLowerCase().matches(searchString.toLowerCase());
try {
return (((Object[])element)[0]).toString().toLowerCase().matches(searchString.toLowerCase());
} catch (PatternSyntaxException e) {
return true;
}
}
return false;
}
}
@ -490,11 +503,13 @@ public class TransactionDetails {
/**
* The Enum Type.
*/
enum Type {/** The props. */
PROPS, /** The attrs. */
ATTRS, /** The in rel. */
IN_REL, /** The out rel. */
OUT_REL}
enum Type {
PROPS, /** The props. */
ATTRS, /** The attrs. */
IN_REL, /** The in rel. */
OUT_REL,/** The out rel. */
HIER
}
/**
* The Class TreeNode.
@ -507,6 +522,7 @@ public class TransactionDetails {
/** The element. */
public ITx element;
private String hier_path;
/**
* Instantiates a new tree node.
*
@ -516,6 +532,13 @@ public class TransactionDetails {
public TreeNode(ITx element, Type type){
this.element=element;
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)
@ -527,9 +550,33 @@ public class TransactionDetails {
case ATTRS: return Messages.TransactionDetails_11;
case IN_REL: return Messages.TransactionDetails_12;
case OUT_REL: return Messages.TransactionDetails_13;
case HIER:{
String[] tokens = hier_path.split("\\.");
return tokens[tokens.length-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_21, Messages.TransactionDetails_20, timeToString(propertyHolder.element.getEndTime())}
};
}else if(propertyHolder.type == Type.ATTRS)
return propertyHolder.element.getAttributes().toArray();
}else if(propertyHolder.type == Type.ATTRS || propertyHolder.type == Type.HIER)
return propertyHolder.getAttributeListForHier();
else if(propertyHolder.type == Type.IN_REL){
Vector<Object[] > res = new Vector<>();
for(ITxRelation rel:propertyHolder.element.getIncomingRelations()){
@ -655,7 +702,8 @@ public class TransactionDetails {
case NAME:
if (element instanceof ITxAttribute) {
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) {
return new StyledString(Messages.TransactionDetails_4);
}else if(element instanceof Object[]){