From f3d8e34ed065dccc5a5c1fb37af880da875ce004 Mon Sep 17 00:00:00 2001 From: eyck Date: Tue, 27 Oct 2020 18:11:03 +0100 Subject: [PATCH 1/3] fix CLI handling --- .../scviewer/e4/application/E4LifeCycle.java | 116 +++++------------- 1 file changed, 29 insertions(+), 87 deletions(-) diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/E4LifeCycle.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/E4LifeCycle.java index 310323a..6f91a1d 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/E4LifeCycle.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/E4LifeCycle.java @@ -12,11 +12,14 @@ package com.minres.scviewer.e4.application; import java.io.File; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import javax.annotation.PostConstruct; import javax.inject.Inject; import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener; import org.eclipse.e4.core.contexts.ContextInjectionFactory; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.core.services.events.IEventBroker; @@ -64,9 +67,11 @@ public class E4LifeCycle { * @param eventBroker the event broker */ @PostContextCreate - void postContextCreate(IApplicationContext appContext, final IEventBroker eventBroker) { + void postContextCreate(IApplicationContext appContext, final IEventBroker eventBroker, + final IEclipseContext workbenchContext) { + final String[] args = (String[])appContext.getArguments().get(IApplicationContext.APPLICATION_ARGS); - Options opt = new Options(args, 0, 1); + final Options opt = new Options(args, 0, Integer.MAX_VALUE); opt.getSet() .addOption("clearPersistedState", Multiplicity.ZERO_OR_ONE) .addOption("c", Separator.BLANK, Multiplicity.ZERO_OR_ONE); @@ -77,22 +82,14 @@ public class E4LifeCycle { final String confFile =opt.getSet().isSet("c")?opt.getSet().getOption("c").getResultValue(0):""; // react on the first view being created, at that time the UI is available - eventBroker.subscribe(UIEvents.UILifeCycle.ACTIVATE, new EventHandler() { - @Override - public void handleEvent(Event event) { - MPart part = (MPart) event.getProperty("ChangedElement"); //$NON-NLS-1$ - if(part!=null){ - IEclipseContext ctx = part.getContext(); - OpenViewHandler openViewHandler= new OpenViewHandler(); - if(confFile.length()>0) openViewHandler.setConfigFile(confFile); - ContextInjectionFactory.inject(openViewHandler, ctx); - eventBroker.unsubscribe(this); - for(String name:opt.getSet().getData()){ - openViewHandler.openViewForFile(name); - } - } - } - }); +// eventBroker.subscribe(UIEvents.UILifeCycle.ACTIVATE, new EventHandler() { +// @Override +// public void handleEvent(Event event) { +// MPart part = (MPart) event.getProperty("ChangedElement"); //$NON-NLS-1$ +// if(part!=null){ +// } +// } +// }); eventBroker.subscribe(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE, new EventHandler() { @Override public void handleEvent(Event event) { @@ -101,9 +98,20 @@ public class E4LifeCycle { boolean isLocked = instanceLocation.isLocked(); if(isLocked) instanceLocation.release(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + } catch (IOException e) { } + if(opt.getSet().getData().size()>0) { + MApplication app= workbenchContext.get(MApplication.class); + EModelService modelService = workbenchContext.get(EModelService.class); + EPartService partService= workbenchContext.get(EPartService.class); + MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$ + part.setLabel(opt.getSet().getData().get(0)); + MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$ + partStack.getChildren().add(part); + partService.showPart(part, PartState.CREATE); + partService.showPart(part, PartState.ACTIVATE); + IEclipseContext ctx = part.getContext(); + ctx.modify("input", opt.getSet().getData()); + ctx.modify("config", confFile); //$NON-NLS-1$ } } }); @@ -135,70 +143,4 @@ public class E4LifeCycle { @ProcessRemovals void processRemovals(IEclipseContext workbenchContext) { } - - /** - * Join. - * - * @param tokens the tokens - * @return the string - */ - String join(String[] tokens){ - StringBuilder sb = new StringBuilder(); - boolean first=true; - for(String token:tokens){ - if(!first) sb.append(","); //$NON-NLS-1$ - sb.append(token); - first=false; - } - return sb.toString(); - } - - /** - * The Class OpenViewHandler. - */ - private class OpenViewHandler { - - /** The app. */ - @Inject MApplication app; - - /** The model service. */ - @Inject EModelService modelService; - - /** The part service. */ - @Inject EPartService partService; - - String confFile=""; - /** - * Open view for file. - * - * @param name the name - */ - public void openViewForFile(String name){ - File file = new File(getFirstFileName(name)); - if(!file.exists()) - return; - MPart part = partService.createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$ - part.setLabel(file.getName()); - MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$ - partStack.getChildren().add(part); - partService.showPart(part, PartState.ACTIVATE); - IEclipseContext ctx=part.getContext(); - ctx.modify("input", name); //$NON-NLS-1$ - //ctx.declareModifiable("input"); //$NON-NLS-1$ - ctx.modify("config", confFile); //$NON-NLS-1$ - //ctx.declareModifiable("config"); //$NON-NLS-1$ - } - - private String getFirstFileName(String name) { - if(name.contains(",")) { - String[] tokens = name.split(","); - return tokens[0]; - } else - return name; - } - - public void setConfigFile(String confFile) { - this.confFile=confFile; - } - } } From b642c396c7a1c2a179bf26d0d57a15424bbaeeaf Mon Sep 17 00:00:00 2001 From: eyck Date: Wed, 28 Oct 2020 13:32:17 +0100 Subject: [PATCH 2/3] add reload menu and toolbar item --- .../Application.e4xmi | 8 +++- .../icons/database_refresh.png | Bin 0 -> 770 bytes .../application/handlers/ReloadHandler.java | 42 ++++++++++++++++++ .../e4/application/parts/WaveformViewer.java | 24 +++++++--- 4 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 plugins/com.minres.scviewer.e4.application/icons/database_refresh.png create mode 100644 plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/ReloadHandler.java diff --git a/plugins/com.minres.scviewer.e4.application/Application.e4xmi b/plugins/com.minres.scviewer.e4.application/Application.e4xmi index 81fadd5..0822bbe 100644 --- a/plugins/com.minres.scviewer.e4.application/Application.e4xmi +++ b/plugins/com.minres.scviewer.e4.application/Application.e4xmi @@ -11,7 +11,8 @@ - + + @@ -58,7 +59,8 @@ - + + @@ -133,6 +135,7 @@ + type:user @@ -264,6 +267,7 @@ + diff --git a/plugins/com.minres.scviewer.e4.application/icons/database_refresh.png b/plugins/com.minres.scviewer.e4.application/icons/database_refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..ff803be124ac5f1bd747490d2243f876eebdf5f6 GIT binary patch literal 770 zcmV+d1O5DoP)L1E-$)@F1-w)3&R|k zpe8{Z8<~c8GL+Q$?>DkG77MrB>ib*oIq``rr5B#_9^P}_=lwfJ$Ye4I1OislR|zeK zVbqYWCeYUSM0$zz3qqi|xmm|wBKZCO<8;X*Nm5-|Ss83L8wv^vz=$_CHjqpv5e|nD zi^V>Y?WWu9Ue99i`F!tXS!UrfyNRl*nP4!OdF<_2YxlP1Fme+XT27Rfmg0ZnbUKmN zQchLT0^98(MdnP?)6=lq?HnZ~C0I!=;+^~kYsqD3nhs6X;Vdi{?VA1UEzfmtU&~-q z7JwZi{gIM{t3{_E4UR1%)L*WJg$bH{MmVw30fE`e?I2IEj?l`hAghYH3 zt$W+>w6P28pTBBza%f!nsWhE`b~-<+1YOrT3B$cZ4>?gZ8b$I)lH1swJjJS$^EqF~ zm_fejtPITPCdn3|s^RUIA%3SpXiSi^{?8N`Oh=PY(SA|m3=BsGkWx0eT~QP?b~cPr zKhDrN8M!R7Nbz_a^b+|5(&_XcW=k#xvLap&a?YNRF|tvD>5s;|fF{5;0S zC%l5k;M1&07*qoM6N<$f state) { + loadDatabase(state, 1000L); + } + + protected void loadDatabase(final Map state, long delay) { fileMonitor.removeFileChangeListener(this); Job job = new Job(Messages.WaveformViewer_15) { @Override @@ -619,8 +623,9 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis return result; } }; + job.setName("Load Database"); job.setSystem(true); - job.schedule(1000L); // let the UI initialize so that we have a progress monitor + job.schedule(delay); // let the UI initialize so that we have a progress monitor } /* (non-Javadoc) @@ -634,18 +639,23 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis public void run() { if (MessageDialog.openQuestion(display.getActiveShell(), Messages.WaveformViewer_17, Messages.WaveformViewer_18)) { - Map state = new HashMap<>(); - saveWaveformViewerState(state); - waveformPane.getStreamList().clear(); - database.clear(); - if (filesToLoad.size() > 0) - loadDatabase(state); + reloadDatabase(); } } + }); fileMonitor.removeFileChangeListener(this); } + public void reloadDatabase() { + Map state = new HashMap<>(); + saveWaveformViewerState(state); + waveformPane.getStreamList().clear(); + database.clear(); + if (filesToLoad.size() > 0) + loadDatabase(state, 0L); + } + /** * Sets the part input. * From 90249dadb997b6740245c5eb838c528078388974 Mon Sep 17 00:00:00 2001 From: eyck Date: Wed, 11 Nov 2020 17:55:10 +0100 Subject: [PATCH 3/3] replace TreeViewer with TableViewer in TransactionList --- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../e4/application/parts/TransactionList.java | 113 ++++++++++-------- .../txTableTree/AttributeLabelProvider.java | 23 +++- .../com.minres.scviewer.e4.product/pom.xml | 2 +- .../scviewer.product | 2 +- .../pom.xml | 2 +- .../scviewer.product | 2 +- 8 files changed, 88 insertions(+), 60 deletions(-) diff --git a/plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF b/plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF index 636ced4..003c3c4 100644 --- a/plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF +++ b/plugins/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.9.1.qualifier +Bundle-Version: 2.9.2.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/plugins/com.minres.scviewer.e4.application/pom.xml b/plugins/com.minres.scviewer.e4.application/pom.xml index 1f8e023..5e4e62e 100644 --- a/plugins/com.minres.scviewer.e4.application/pom.xml +++ b/plugins/com.minres.scviewer.e4.application/pom.xml @@ -1,7 +1,7 @@ 4.0.0 com.minres.scviewer.e4.application - 2.9.1-SNAPSHOT + 2.9.2-SNAPSHOT com.minres.scviewer com.minres.scviewer.parent diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionList.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionList.java index 6b09468..3d4f45e 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionList.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/TransactionList.java @@ -12,11 +12,12 @@ import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider; import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ITreeSelection; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.TreeViewerColumn; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; @@ -26,9 +27,10 @@ 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.Label; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; import com.minres.scviewer.database.DataType; import com.minres.scviewer.database.ITx; @@ -73,11 +75,11 @@ public class TransactionList extends Composite { private Text searchPropValue; - private TreeViewer treeViewer = null; + private TableViewer tableViewer = null; - private TreeColumn valueColumn = null; - - private AttributeLabelProvider nameLabelProvider = null; + private TableColumn valueColumn = null; + + private AttributeLabelProvider valueLabelProvider = null; private ITxStream stream; @@ -96,9 +98,14 @@ public class TransactionList extends Composite { */ public TransactionList(Composite parent, int style, WaveformViewer waveformViewer) { super(parent, style); - setLayout(new GridLayout(3, false)); + setLayout(new GridLayout(5, false)); txFilter = new TxFilter(); + Label lbl1 = new Label(this, SWT.NONE); + lbl1.setAlignment(SWT.RIGHT); + lbl1.setText("Property to match:"); + lbl1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + searchPropComboViewer = new ComboViewer(this, SWT.NONE); searchPropComboViewer.setLabelProvider(new LabelProvider() { public String getText(Object element) { @@ -116,27 +123,34 @@ public class TransactionList extends Composite { int idx = searchPropCombo.getSelectionIndex(); AttributeNameBean sel = attrNames.get(idx); txFilter.setSearchProp(sel.getName(), sel.getType()); - treeViewer.refresh(); + tableViewer.refresh(); } @Override public void widgetDefaultSelected(SelectionEvent e) { int idx = searchPropCombo.getSelectionIndex(); AttributeNameBean sel = attrNames.get(idx); txFilter.setSearchProp(sel.getName(), sel.getType()); - treeViewer.refresh(); + tableViewer.refresh(); } }); searchPropValue = new Text(this, SWT.BORDER); - searchPropValue.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); + GridData gd_searchPropValue = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); + gd_searchPropValue.minimumWidth = 50; + searchPropValue.setLayoutData(gd_searchPropValue); searchPropValue.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { txFilter.setSearchValue(((Text) e.widget).getText()); - treeViewer.refresh(); + tableViewer.refresh(); } }); + Label lbl2 = new Label(this, SWT.NONE); + lbl2.setAlignment(SWT.RIGHT); + lbl2.setText("Property to show:"); + lbl2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + viewPropComboViewer = new ComboViewer(this, SWT.NONE); viewPropComboViewer.setLabelProvider(new LabelProvider() { public String getText(Object element) { @@ -152,15 +166,15 @@ public class TransactionList extends Composite { @Override public void widgetSelected(SelectionEvent e) { int idx = viewPropCombo.getSelectionIndex(); - nameLabelProvider.setShowProp(attrNames.get(idx).getName()); - treeViewer.refresh(true); + valueLabelProvider.setShowProp(attrNames.get(idx).getName()); + tableViewer.refresh(true); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); - treeViewer = new TreeViewer(this); - treeViewer.setContentProvider(new AbstractTransactionTreeContentProvider(waveformViewer) { + tableViewer = new TableViewer(this); + tableViewer.setContentProvider(new AbstractTransactionTreeContentProvider(waveformViewer) { @SuppressWarnings("unchecked") @Override @@ -171,66 +185,65 @@ public class TransactionList extends Composite { return new Object[0]; } }); - treeViewer.addFilter(txFilter); - treeViewer.addDoubleClickListener(new IDoubleClickListener() { + tableViewer.addFilter(txFilter); + tableViewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { - ITreeSelection treeSelection = treeViewer.getStructuredSelection(); - Object selected = treeSelection.getFirstElement(); - if(selected instanceof ITx){ - waveformViewer.setSelection(new StructuredSelection(selected)); - } else if(selected instanceof TransactionTreeNode && ((TransactionTreeNode)selected).type == TransactionTreeNodeType.TX) { - waveformViewer.setSelection(new StructuredSelection(((TransactionTreeNode)selected).element)); + ISelection treeSelection = tableViewer.getSelection(); + if(treeSelection instanceof IStructuredSelection) { + Object selected = ((IStructuredSelection)treeSelection).getFirstElement(); + if(selected instanceof ITx){ + waveformViewer.setSelection(new StructuredSelection(selected)); + } else if(selected instanceof TransactionTreeNode && ((TransactionTreeNode)selected).type == TransactionTreeNodeType.TX) { + waveformViewer.setSelection(new StructuredSelection(((TransactionTreeNode)selected).element)); + } } } }); - Tree tree = treeViewer.getTree(); - tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); + Table table = tableViewer.getTable(); + table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1)); - TreeViewerColumn nameColumnViewer = new TreeViewerColumn(treeViewer, SWT.NONE); - TreeColumn nameColumn = nameColumnViewer.getColumn(); + TableViewerColumn nameColumnViewer = new TableViewerColumn(tableViewer, SWT.NONE); + TableColumn nameColumn = nameColumnViewer.getColumn(); nameColumn.setWidth(200); nameColumn.setText("Tx ID"); nameColumn.setResizable(true); nameColumnViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(waveformViewer, AttributeLabelProvider.NAME))); - TreeViewerColumn timeColumnViewer = new TreeViewerColumn(treeViewer, SWT.NONE); - TreeColumn timeColumn = timeColumnViewer.getColumn(); + TableViewerColumn timeColumnViewer = new TableViewerColumn(tableViewer, SWT.NONE); + TableColumn timeColumn = timeColumnViewer.getColumn(); timeColumn.setAlignment(SWT.RIGHT); timeColumn.setWidth(150); timeColumn.setText("Start time"); timeColumn.setResizable(true); timeColumnViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(waveformViewer, AttributeLabelProvider.TX_TIME))); - TreeViewerColumn typeColumnViewer = new TreeViewerColumn(treeViewer, SWT.NONE); - TreeColumn typeColumn = typeColumnViewer.getColumn(); - typeColumn.setAlignment(SWT.RIGHT); - typeColumn.setWidth(150); - typeColumn.setText("Type"); - typeColumn.setResizable(true); - typeColumnViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(waveformViewer, AttributeLabelProvider.TYPE))); - - TreeViewerColumn valueColumnViewer = new TreeViewerColumn(treeViewer, SWT.NONE); + TableViewerColumn valueColumnViewer = new TableViewerColumn(tableViewer, SWT.NONE); valueColumn = valueColumnViewer.getColumn(); valueColumn.setWidth(150); - valueColumn.setText("Value"); + valueColumn.setText("Property Value"); valueColumn.setResizable(true); - nameLabelProvider= new AttributeLabelProvider(waveformViewer, AttributeLabelProvider.VALUE); - valueColumnViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(nameLabelProvider)); + valueLabelProvider= new AttributeLabelProvider(waveformViewer, AttributeLabelProvider.VALUE); + valueColumnViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(valueLabelProvider)); // Turn on the header and the lines - tree.setHeaderVisible(true); - tree.setLinesVisible(true); + table.setHeaderVisible(true); + table.setLinesVisible(true); + new Label(this, SWT.NONE); + new Label(this, SWT.NONE); + new Label(this, SWT.NONE); + new Label(this, SWT.NONE); + new Label(this, SWT.NONE); } public void setInput(TrackEntry trackEntry) { if(trackEntry==null || !trackEntry.isStream()) { attrNames.clear(); - treeViewer.setInput(emptyList); + tableViewer.setInput(emptyList); } else { stream=trackEntry.getStream(); - treeViewer.setInput(emptyList); + tableViewer.setInput(emptyList); new Thread() { private ConcurrentHashMap propNames=new ConcurrentHashMap(); @@ -257,7 +270,7 @@ public class TransactionList extends Composite { getDisplay().asyncExec(new Runnable() { @Override public void run() { - treeViewer.setInput(eventList); + tableViewer.setInput(eventList); attrNames.clear(); attrNames.addAll(getEntries()); searchPropComboViewer.getCombo().select(0); @@ -266,7 +279,7 @@ public class TransactionList extends Composite { searchPropComboViewer.setInput(attrNames); searchPropComboViewer.setSelection(new StructuredSelection(searchPropComboViewer.getElementAt(0))); } - treeViewer.refresh(true); + tableViewer.refresh(true); } }); } diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/txTableTree/AttributeLabelProvider.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/txTableTree/AttributeLabelProvider.java index 27ad4c7..6b20914 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/txTableTree/AttributeLabelProvider.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/txTableTree/AttributeLabelProvider.java @@ -72,6 +72,13 @@ public class AttributeLabelProvider extends LabelProvider implements IStyledLabe return new StyledString(iTx.getId().toString()); case TX_TIME: return new StyledString(waveformViewerPart.getScaledTime(iTx.getBeginTime())); + case TYPE: + if(showProp!=null){ + List res = iTx.getAttributes().stream().filter(a -> showProp.equals(a.getName())).collect(Collectors.toList()); + if(res.size()==1) + return new StyledString(res.get(0).getDataType().toString()); + } + return new StyledString(""); case VALUE: if(showProp!=null){ List res = iTx.getAttributes().stream().filter(a -> showProp.equals(a.getName())).collect(Collectors.toList()); @@ -95,13 +102,21 @@ public class AttributeLabelProvider extends LabelProvider implements IStyledLabe } else return new StyledString(element.toString()); case TYPE: - if (element instanceof ITxAttribute) { + if(element instanceof TransactionTreeNode) { + if(showProp!=null){ + ITx iTx = ((TransactionTreeNode) element).element; + List res = iTx.getAttributes().stream().filter(a -> showProp.equals(a.getName())).collect(Collectors.toList()); + if(res.size()==1) + return new StyledString(res.get(0).getDataType().toString()); + } + return new StyledString(""); + } else if (element instanceof ITxAttribute) { ITxAttribute attribute = (ITxAttribute) element; return new StyledString(attribute.getDataType().toString()); - }else if(element instanceof Object[]){ + } else if(element instanceof Object[]){ Object[] elements = (Object[]) element; return new StyledString(elements[field].toString()); - }else + } else return new StyledString(""); //$NON-NLS-1$ case TX_TIME: if(element instanceof TransactionTreeNode) { @@ -120,7 +135,7 @@ public class AttributeLabelProvider extends LabelProvider implements IStyledLabe } else if (element instanceof ITxAttribute) { ITxAttribute attribute = (ITxAttribute) element; return getAttrValueAsStyledString(attribute); - }else if(element instanceof Object[]){ + } else if(element instanceof Object[]){ Object[] elements = (Object[]) element; Object o = elements[field]; if(o instanceof ITx) { diff --git a/products/com.minres.scviewer.e4.product/pom.xml b/products/com.minres.scviewer.e4.product/pom.xml index 325ae3e..6a7c1fb 100644 --- a/products/com.minres.scviewer.e4.product/pom.xml +++ b/products/com.minres.scviewer.e4.product/pom.xml @@ -10,7 +10,7 @@ ../.. com.minres.scviewer.e4.product - 2.9.1-SNAPSHOT + 2.9.2-SNAPSHOT eclipse-repository com.minres.scviewer diff --git a/products/com.minres.scviewer.e4.product/scviewer.product b/products/com.minres.scviewer.e4.product/scviewer.product index 976632a..b81b823 100644 --- a/products/com.minres.scviewer.e4.product/scviewer.product +++ b/products/com.minres.scviewer.e4.product/scviewer.product @@ -1,7 +1,7 @@ - + diff --git a/products/com.minres.scviewer.e4.product_slim/pom.xml b/products/com.minres.scviewer.e4.product_slim/pom.xml index 9f85fd4..65d57cc 100644 --- a/products/com.minres.scviewer.e4.product_slim/pom.xml +++ b/products/com.minres.scviewer.e4.product_slim/pom.xml @@ -10,7 +10,7 @@ ../.. com.minres.scviewer.e4.product_slim - 2.9.1-SNAPSHOT + 2.9.2-SNAPSHOT eclipse-repository com.minres.scviewer diff --git a/products/com.minres.scviewer.e4.product_slim/scviewer.product b/products/com.minres.scviewer.e4.product_slim/scviewer.product index 6afa745..d53d65b 100644 --- a/products/com.minres.scviewer.e4.product_slim/scviewer.product +++ b/products/com.minres.scviewer.e4.product_slim/scviewer.product @@ -1,7 +1,7 @@ - +