Merge branch 'release/2.0.4'

This commit is contained in:
Eyck Jentzsch 2019-03-15 08:53:15 +01:00
commit 244f005ae6
7 changed files with 80 additions and 17 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.0.2.qualifier
Bundle-Version: 2.0.4.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.0.2-SNAPSHOT</version>
<version>2.0.4-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: 2.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\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
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/SCViewer and the master branch is mirrored to GitHub: https://git.com/minres/SCViewer\n
DesignBrowser_12=Append all after
DesignBrowser_16=Insert all before
DesignBrowser_2=Enter text to filter waveforms

View File

@ -19,8 +19,10 @@ import java.util.regex.Pattern;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
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.wb.swt.ResourceManager;
import org.eclipse.wb.swt.SWTResourceManager;
import org.osgi.framework.Version;
import com.minres.scviewer.e4.application.Messages;
@ -101,7 +104,10 @@ public class AboutDialog extends Dialog {
styledText.setEditable(false);
GridData gd_styledText = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
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.setWordWrap(true);
styledText.setLeftMargin(5);

View File

@ -10,6 +10,7 @@
*******************************************************************************/
package com.minres.scviewer.e4.application.parts;
import java.util.ArrayList;
import java.util.Vector;
import javax.annotation.PostConstruct;
@ -37,8 +38,8 @@ import org.eclipse.jface.viewers.TreeExpansionEvent;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.TreeViewerColumn;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
@ -55,10 +56,10 @@ import org.eclipse.swt.widgets.Text;
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.ITxAttribute;
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.provider.TxPropertiesLabelProvider;
@ -203,7 +204,7 @@ public class TransactionDetails {
Object[] selectedArray = (Object[]) selected;
if(selectedArray.length==3 && selectedArray[2] instanceof ITx){
waveformViewerPart.setSelection(new StructuredSelection(selectedArray[2]));
treeViewer.setInput(selectedArray[2]);
setInput(selectedArray[2]);
}
}
}
@ -265,19 +266,75 @@ public class TransactionDetails {
public void setInput(Object object) {
if(object instanceof ITx){
TreeItem obj = treeViewer.getTree().getTopItem();
Rectangle bounds = null;
if(obj!=null) bounds=obj.getBounds();
ArrayList<String> names = new ArrayList<>();
int indexInParent=getTopItemHier(names);
ArrayList<Boolean> states = getExpandedState(treeViewer.getTree().getItems());
treeViewer.setInput(object);
if(bounds!=null) {
TreeItem ti = treeViewer.getTree().getItem (new Point(bounds.x, bounds.y));
if(ti!=null) treeViewer.getTree().setTopItem(ti);
}
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.
*

View File

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

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
<product name="SCViewer" uid="scviewer" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.0.2.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>