From 19ea1f0b6d63476893e17878bb2081a8203acee7 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 9 May 2020 12:50:28 +0200 Subject: [PATCH] fix #33 --- .../DatabaseServicesTest.launch | 144 ++++++++++++------ .../META-INF/MANIFEST.MF | 2 +- com.minres.scviewer.e4.application/pom.xml | 2 +- .../e4/application/messages.properties | 2 +- .../e4/application/parts/DesignBrowser.java | 14 +- .../application/parts/TransactionDetails.java | 70 +++++++-- com.minres.scviewer.e4.product/pom.xml | 2 +- .../scviewer.product | 4 +- 8 files changed, 174 insertions(+), 66 deletions(-) diff --git a/com.minres.scviewer.database.test/DatabaseServicesTest.launch b/com.minres.scviewer.database.test/DatabaseServicesTest.launch index c44770d..f8e3594 100644 --- a/com.minres.scviewer.database.test/DatabaseServicesTest.launch +++ b/com.minres.scviewer.database.test/DatabaseServicesTest.launch @@ -1,46 +1,104 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF b/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF index 32d5ccc..7fcaa46 100644 --- a/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF +++ b/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF @@ -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", diff --git a/com.minres.scviewer.e4.application/pom.xml b/com.minres.scviewer.e4.application/pom.xml index e94b70a..4ab7a62 100644 --- a/com.minres.scviewer.e4.application/pom.xml +++ b/com.minres.scviewer.e4.application/pom.xml @@ -1,7 +1,7 @@ 4.0.0 com.minres.scviewer.e4.application - 2.5.0-SNAPSHOT + 2.6.0-SNAPSHOT com.minres.scviewer com.minres.scviewer.parent diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties index bde69ab..ea3c33b 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties @@ -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 diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/DesignBrowser.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/DesignBrowser.java index e49a360..37be256 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/DesignBrowser.java +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/DesignBrowser.java @@ -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(); } diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionDetails.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionDetails.java index a562c1e..db80d80 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionDetails.java +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionDetails.java @@ -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 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(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 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[]){ diff --git a/com.minres.scviewer.e4.product/pom.xml b/com.minres.scviewer.e4.product/pom.xml index edb91a5..f87674d 100644 --- a/com.minres.scviewer.e4.product/pom.xml +++ b/com.minres.scviewer.e4.product/pom.xml @@ -10,7 +10,7 @@ ../com.minres.scviewer.parent com.minres.scviewer.e4.product - 2.5.0-SNAPSHOT + 2.6.0-SNAPSHOT eclipse-repository com.minres.scviewer diff --git a/com.minres.scviewer.e4.product/scviewer.product b/com.minres.scviewer.e4.product/scviewer.product index 2d7cfdd..0e3f141 100644 --- a/com.minres.scviewer.e4.product/scviewer.product +++ b/com.minres.scviewer.e4.product/scviewer.product @@ -1,7 +1,7 @@ - + @@ -56,6 +56,7 @@ + @@ -113,7 +114,6 @@ -