refactor to integrate design browser
This commit is contained in:
parent
563b6e2b01
commit
cc9be70708
|
@ -4,4 +4,5 @@ org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -98,4 +98,5 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||||
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -4,4 +4,5 @@ org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -5,4 +5,5 @@ org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -9,4 +9,5 @@ org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
pluginProject.extensions=false
|
pluginProject.extensions=false
|
||||||
resolve.requirebundle=false
|
|
||||||
|
|
|
@ -3,28 +3,6 @@
|
||||||
<children xsi:type="basic:TrimmedWindow" xmi:id="_95PfsXNmEeWBq8z1Dv39LA" label="SC Viewer" bindingContexts="_95PfunNmEeWBq8z1Dv39LA" width="1280" height="700">
|
<children xsi:type="basic:TrimmedWindow" xmi:id="_95PfsXNmEeWBq8z1Dv39LA" label="SC Viewer" bindingContexts="_95PfunNmEeWBq8z1Dv39LA" width="1280" height="700">
|
||||||
<children xsi:type="advanced:PerspectiveStack" xmi:id="_95QGxnNmEeWBq8z1Dv39LA">
|
<children xsi:type="advanced:PerspectiveStack" xmi:id="_95QGxnNmEeWBq8z1Dv39LA">
|
||||||
<children xsi:type="advanced:Perspective" xmi:id="_95QGx3NmEeWBq8z1Dv39LA">
|
<children xsi:type="advanced:Perspective" xmi:id="_95QGx3NmEeWBq8z1Dv39LA">
|
||||||
<children xsi:type="basic:PartSashContainer" xmi:id="_95QGyHNmEeWBq8z1Dv39LA" horizontal="true">
|
|
||||||
<children xsi:type="basic:Part" xmi:id="_95QGynNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.parts.DesignBrowser" containerData="2000" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.DesignBrowser" label="Design Browser" bindingContexts="_iQ3kQGVmEeqSQM-A6dw9ig">
|
|
||||||
<handlers xmi:id="_JIWOYIq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handler.addWaveformCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.AddWaveformHandler" command="_2PehEHr9EeWVM_sKoXvptg"/>
|
|
||||||
<menus xsi:type="menu:PopupMenu" xmi:id="_HvUl8Iq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parts.DesignBrowser.popupmenu">
|
|
||||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_HvUl8Yq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handledmenuitem.append" label="Append after" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/append_wave.png" command="_2PehEHr9EeWVM_sKoXvptg">
|
|
||||||
<parameters xmi:id="_HvUl8oq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.21" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="after"/>
|
|
||||||
<parameters xmi:id="_HvUl84q-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.25" name="com.minres.scviewer.e4.application.command.addwaveform.all" value="false"/>
|
|
||||||
</children>
|
|
||||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_HvUl9Iq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handledmenuitem.insertbefore" label="Insert before" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/insert_wave.png" command="_2PehEHr9EeWVM_sKoXvptg">
|
|
||||||
<parameters xmi:id="_HvUl9Yq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.22" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="before"/>
|
|
||||||
<parameters xmi:id="_HvUl9oq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.26" name="com.minres.scviewer.e4.application.command.addwaveform.all" value="false"/>
|
|
||||||
</children>
|
|
||||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_HvUl94q-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handledmenuitem.appendall" label="Append all" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/append_all_waves.png" command="_2PehEHr9EeWVM_sKoXvptg">
|
|
||||||
<parameters xmi:id="_HvUl-Iq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.23" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="after"/>
|
|
||||||
<parameters xmi:id="_HvUl-Yq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.27" name="com.minres.scviewer.e4.application.command.addwaveform.all" value="true"/>
|
|
||||||
</children>
|
|
||||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_HvUl-oq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handledmenuitem.insertall" label="Insert All" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/insert_all_waves.png" command="_2PehEHr9EeWVM_sKoXvptg">
|
|
||||||
<parameters xmi:id="_HvUl-4q-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.24" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="before"/>
|
|
||||||
<parameters xmi:id="_HvUl_Iq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.28" name="com.minres.scviewer.e4.application.command.addwaveform.all" value="true"/>
|
|
||||||
</children>
|
|
||||||
</menus>
|
|
||||||
</children>
|
|
||||||
<children xsi:type="basic:PartSashContainer" xmi:id="_uT9BIHgtEeWwZ-9vrAR2UQ" elementId="" containerData="8000">
|
<children xsi:type="basic:PartSashContainer" xmi:id="_uT9BIHgtEeWwZ-9vrAR2UQ" elementId="" containerData="8000">
|
||||||
<children xsi:type="basic:PartStack" xmi:id="_95QGyXNmEeWBq8z1Dv39LA" elementId="org.eclipse.editorss" containerData="7500">
|
<children xsi:type="basic:PartStack" xmi:id="_95QGyXNmEeWBq8z1Dv39LA" elementId="org.eclipse.editorss" containerData="7500">
|
||||||
<tags>NoAutoCollapse</tags>
|
<tags>NoAutoCollapse</tags>
|
||||||
|
@ -33,7 +11,6 @@
|
||||||
</children>
|
</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" bindingContexts="_95Pfu3NmEeWBq8z1Dv39LA"/>
|
<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" bindingContexts="_95Pfu3NmEeWBq8z1Dv39LA"/>
|
||||||
<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">
|
||||||
|
|
|
@ -28,7 +28,8 @@ Require-Bundle: javax.inject;bundle-version="1.0.0",
|
||||||
com.opcoach.e4.preferences,
|
com.opcoach.e4.preferences,
|
||||||
org.eclipse.e4.core.di.extensions,
|
org.eclipse.e4.core.di.extensions,
|
||||||
org.eclipse.e4.ui.css.swt.theme;bundle-version="0.10.0",
|
org.eclipse.e4.ui.css.swt.theme;bundle-version="0.10.0",
|
||||||
org.eclipse.core.resources;bundle-version="3.13.0"
|
org.eclipse.core.resources;bundle-version="3.13.0",
|
||||||
|
javax.annotation;bundle-version="1.2.0"
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Import-Package: com.minres.scviewer.database,
|
Import-Package: com.minres.scviewer.database,
|
||||||
javax.inject;version="1.0.0"
|
javax.inject;version="1.0.0"
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class RelationTypeToolControl extends PartListener implements ISelectionC
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
comboViewer.getCombo().setEnabled(false);
|
if(comboViewer!=null) comboViewer.getCombo().setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
package com.minres.scviewer.e4.application.handlers;
|
package com.minres.scviewer.e4.application.handlers;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||||
|
@ -39,12 +40,12 @@ public class OpenHandler {
|
||||||
part.setLabel(files.get(0).getName());
|
part.setLabel(files.get(0).getName());
|
||||||
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
||||||
partStack.getChildren().add(part);
|
partStack.getChildren().add(part);
|
||||||
partService.showPart(part, PartState.ACTIVATE);
|
partService.showPart(part, PartState.CREATE);
|
||||||
final IEclipseContext ctx=part.getContext();
|
final IEclipseContext ctx=part.getContext();
|
||||||
files.stream()
|
List<String> inputs=new ArrayList<>();
|
||||||
.map(x -> x.getAbsolutePath())
|
for(File f: files)
|
||||||
.reduce((s1, s2) -> s1 + "," + s2)
|
inputs.add(f.getAbsolutePath());
|
||||||
.ifPresent(s -> ctx.modify("input", s)); //$NON-NLS-1$
|
ctx.modify("input", inputs);
|
||||||
ctx.modify("config", ""); //$NON-NLS-1$
|
ctx.modify("config", ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,575 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. 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
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package com.minres.scviewer.e4.application.internal.ui;
|
||||||
|
|
||||||
|
import java.beans.PropertyChangeEvent;
|
||||||
|
import java.beans.PropertyChangeListener;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.regex.PatternSyntaxException;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||||
|
import org.eclipse.e4.core.di.annotations.Optional;
|
||||||
|
import org.eclipse.e4.core.services.events.IEventBroker;
|
||||||
|
import org.eclipse.e4.ui.di.Focus;
|
||||||
|
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||||
|
import org.eclipse.e4.ui.services.EMenuService;
|
||||||
|
import org.eclipse.e4.ui.services.IServiceConstants;
|
||||||
|
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||||
|
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
||||||
|
import org.eclipse.jface.viewers.IContentProvider;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||||
|
import org.eclipse.jface.viewers.ITreePathContentProvider;
|
||||||
|
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||||
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
|
import org.eclipse.jface.viewers.TableViewer;
|
||||||
|
import org.eclipse.jface.viewers.TreePath;
|
||||||
|
import org.eclipse.jface.viewers.TreeViewer;
|
||||||
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
|
import org.eclipse.jface.viewers.ViewerFilter;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.custom.SashForm;
|
||||||
|
import org.eclipse.swt.events.ControlAdapter;
|
||||||
|
import org.eclipse.swt.events.ControlEvent;
|
||||||
|
import org.eclipse.swt.events.ModifyEvent;
|
||||||
|
import org.eclipse.swt.events.ModifyListener;
|
||||||
|
import org.eclipse.swt.events.PaintEvent;
|
||||||
|
import org.eclipse.swt.events.PaintListener;
|
||||||
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
import org.eclipse.swt.widgets.ToolBar;
|
||||||
|
import org.eclipse.swt.widgets.ToolItem;
|
||||||
|
import org.eclipse.wb.swt.ResourceManager;
|
||||||
|
import org.eclipse.wb.swt.SWTResourceManager;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.HierNode;
|
||||||
|
import com.minres.scviewer.database.IHierNode;
|
||||||
|
import com.minres.scviewer.database.ITx;
|
||||||
|
import com.minres.scviewer.database.IWaveform;
|
||||||
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
|
import com.minres.scviewer.e4.application.parts.LoadingWaveformDb;
|
||||||
|
import com.minres.scviewer.e4.application.provider.TxDbContentProvider;
|
||||||
|
import com.minres.scviewer.e4.application.provider.TxDbLabelProvider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class DesignBrowser. It contains the design tree, a list of Streams & signals and a few buttons to
|
||||||
|
* add them them to the waveform view
|
||||||
|
*/
|
||||||
|
public abstract class AbstractDesignBrowser {
|
||||||
|
|
||||||
|
public TreeViewer getDbTreeViewer() {
|
||||||
|
return dbTreeViewer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TableViewer getStreamTableViewer() {
|
||||||
|
return streamTableViewer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The Constant POPUP_ID. */
|
||||||
|
private static final String POPUP_ID="com.minres.scviewer.e4.application.parts.DesignBrowser.popupmenu"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/** The event broker. */
|
||||||
|
@Inject IEventBroker eventBroker;
|
||||||
|
|
||||||
|
/** The selection service. */
|
||||||
|
@Inject ESelectionService selectionService;
|
||||||
|
|
||||||
|
/** The menu service. */
|
||||||
|
@Inject EMenuService menuService;
|
||||||
|
|
||||||
|
/** The eclipse ctx. */
|
||||||
|
@Inject IEclipseContext eclipseCtx;
|
||||||
|
|
||||||
|
/** The sash form. */
|
||||||
|
private SashForm sashForm;
|
||||||
|
|
||||||
|
/** The top. */
|
||||||
|
Composite top;
|
||||||
|
|
||||||
|
/** The bottom. */
|
||||||
|
private Composite bottom;
|
||||||
|
|
||||||
|
/** The tree viewer. */
|
||||||
|
private TreeViewer dbTreeViewer;
|
||||||
|
|
||||||
|
/** The name filter of the design browser tree. */
|
||||||
|
private Text treeNameFilter;
|
||||||
|
|
||||||
|
/** The attribute filter. */
|
||||||
|
StreamTTreeFilter treeAttributeFilter;
|
||||||
|
|
||||||
|
/** The name filter. */
|
||||||
|
private Text tableNameFilter;
|
||||||
|
|
||||||
|
/** The attribute filter. */
|
||||||
|
StreamTableFilter tableAttributeFilter;
|
||||||
|
|
||||||
|
/** The tx table viewer. */
|
||||||
|
protected TableViewer streamTableViewer;
|
||||||
|
|
||||||
|
/** The append all item. */
|
||||||
|
protected ToolItem appendItem, insertItem;
|
||||||
|
|
||||||
|
/** The other selection count. */
|
||||||
|
int thisSelectionCount=0, otherSelectionCount=0;
|
||||||
|
|
||||||
|
IWaveformDb waveformDb=null;
|
||||||
|
|
||||||
|
/** The tree viewer pcl. */
|
||||||
|
private PropertyChangeListener treeViewerPCL = new PropertyChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
|
if("CHILDS".equals(evt.getPropertyName())){ //$NON-NLS-1$
|
||||||
|
dbTreeViewer.getTree().getDisplay().asyncExec(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
dbTreeViewer.refresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** The sash paint listener. */
|
||||||
|
protected PaintListener sashPaintListener=new PaintListener() {
|
||||||
|
@Override
|
||||||
|
public void paintControl(PaintEvent e) {
|
||||||
|
int size=Math.min(e.width, e.height)-1;
|
||||||
|
e.gc.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY));
|
||||||
|
e.gc.setFillRule(SWT.FILL_EVEN_ODD);
|
||||||
|
if(e.width>e.height)
|
||||||
|
e.gc.drawArc(e.x+(e.width-size)/2, e.y, size, size, 0, 360);
|
||||||
|
else
|
||||||
|
e.gc.drawArc(e.x, e.y+(e.height-size)/2, size, size, 0, 360);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the composite.
|
||||||
|
*
|
||||||
|
* @param parent the parent
|
||||||
|
*/
|
||||||
|
@PostConstruct
|
||||||
|
public void createComposite(Composite parent) {
|
||||||
|
sashForm = new SashForm(parent, SWT.BORDER | SWT.SMOOTH | SWT.VERTICAL);
|
||||||
|
|
||||||
|
top = new Composite(sashForm, SWT.NONE);
|
||||||
|
createTreeViewerComposite(top);
|
||||||
|
bottom = new Composite(sashForm, SWT.NONE);
|
||||||
|
createTableComposite(bottom);
|
||||||
|
|
||||||
|
sashForm.setWeights(new int[] {100, 100});
|
||||||
|
sashForm.SASH_WIDTH=5;
|
||||||
|
top.addControlListener(new ControlAdapter() {
|
||||||
|
public void controlResized(ControlEvent e) {
|
||||||
|
sashForm.getChildren()[2].addPaintListener(sashPaintListener);
|
||||||
|
top.removeControlListener(this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the tree viewer composite.
|
||||||
|
*
|
||||||
|
* @param parent the parent
|
||||||
|
*/
|
||||||
|
public void createTreeViewerComposite(Composite parent) {
|
||||||
|
parent.setLayout(new GridLayout(1, false));
|
||||||
|
|
||||||
|
treeNameFilter = new Text(parent, SWT.BORDER);
|
||||||
|
treeNameFilter.setMessage(Messages.DesignBrowser_3);
|
||||||
|
treeNameFilter.addModifyListener(new ModifyListener() {
|
||||||
|
@Override
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
|
treeAttributeFilter.setSearchText(((Text) e.widget).getText());
|
||||||
|
dbTreeViewer.refresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
treeNameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
|
||||||
|
treeAttributeFilter = new StreamTTreeFilter();
|
||||||
|
|
||||||
|
dbTreeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
|
||||||
|
dbTreeViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
|
dbTreeViewer.setContentProvider(new TxDbContentProvider());
|
||||||
|
dbTreeViewer.setLabelProvider(new TxDbLabelProvider());
|
||||||
|
dbTreeViewer.addFilter(treeAttributeFilter);
|
||||||
|
dbTreeViewer.setUseHashlookup(true);
|
||||||
|
dbTreeViewer.setAutoExpandLevel(2);
|
||||||
|
dbTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void selectionChanged(SelectionChangedEvent event) {
|
||||||
|
ISelection selection=event.getSelection();
|
||||||
|
if( selection instanceof IStructuredSelection) {
|
||||||
|
Object object= ((IStructuredSelection)selection).getFirstElement();
|
||||||
|
if(object instanceof IHierNode && ((IHierNode)object).getChildNodes().size()!=0){
|
||||||
|
streamTableViewer.setInput(object);
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
else { //if selection is changed but empty
|
||||||
|
streamTableViewer.setInput(null);
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the table composite.
|
||||||
|
*
|
||||||
|
* @param parent the parent
|
||||||
|
*/
|
||||||
|
public void createTableComposite(Composite parent) {
|
||||||
|
parent.setLayout(new GridLayout(1, false));
|
||||||
|
|
||||||
|
tableNameFilter = new Text(parent, SWT.BORDER);
|
||||||
|
tableNameFilter.setMessage(Messages.DesignBrowser_2);
|
||||||
|
tableNameFilter.addModifyListener(new ModifyListener() {
|
||||||
|
@Override
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
|
tableAttributeFilter.setSearchText(((Text) e.widget).getText());
|
||||||
|
updateButtons();
|
||||||
|
streamTableViewer.refresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tableNameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
|
||||||
|
tableAttributeFilter = new StreamTableFilter();
|
||||||
|
|
||||||
|
streamTableViewer = new TableViewer(parent);
|
||||||
|
streamTableViewer.setContentProvider(new TxDbContentProvider(true));
|
||||||
|
streamTableViewer.setLabelProvider(new TxDbLabelProvider());
|
||||||
|
streamTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
|
streamTableViewer.addFilter(tableAttributeFilter);
|
||||||
|
streamTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void selectionChanged(SelectionChangedEvent event) {
|
||||||
|
selectionService.setSelection(event.getSelection());
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
menuService.registerContextMenu(streamTableViewer.getControl(), POPUP_ID);
|
||||||
|
|
||||||
|
ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.RIGHT);
|
||||||
|
toolBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
|
||||||
|
toolBar.setBounds(0, 0, 87, 20);
|
||||||
|
|
||||||
|
appendItem = new ToolItem(toolBar, SWT.NONE);
|
||||||
|
appendItem.setToolTipText(Messages.DesignBrowser_4);
|
||||||
|
appendItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_wave.png")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
appendItem.setEnabled(false);
|
||||||
|
|
||||||
|
insertItem = new ToolItem(toolBar, SWT.NONE);
|
||||||
|
insertItem.setToolTipText(Messages.DesignBrowser_8);
|
||||||
|
insertItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_wave.png")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
insertItem.setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IWaveformDb getWaveformDb() {
|
||||||
|
return waveformDb;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void setWaveformDb(IWaveformDb waveformDb) {
|
||||||
|
this.waveformDb = waveformDb;
|
||||||
|
Object input = dbTreeViewer.getInput();
|
||||||
|
if(input!=null && input instanceof List<?>){
|
||||||
|
IWaveformDb db = ((List<IWaveformDb>)input).get(0);
|
||||||
|
if(db==waveformDb) return; // do nothing if old and new database is the same
|
||||||
|
((List<IWaveformDb>)input).get(0).removePropertyChangeListener(treeViewerPCL);
|
||||||
|
}
|
||||||
|
dbTreeViewer.setInput(Arrays.asList(waveformDb.isLoaded()?new IWaveformDb[]{waveformDb}:new IWaveformDb[]{new LoadingWaveformDb()}));
|
||||||
|
// Set up the tree viewer
|
||||||
|
waveformDb.addPropertyChangeListener(treeViewerPCL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the focus.
|
||||||
|
*/
|
||||||
|
@Focus
|
||||||
|
public void setFocus() {
|
||||||
|
if(streamTableViewer!=null) {
|
||||||
|
streamTableViewer.getTable().setFocus();
|
||||||
|
IStructuredSelection selection = (IStructuredSelection)streamTableViewer.getSelection();
|
||||||
|
if(selection.size()==0){
|
||||||
|
appendItem.setEnabled(false);
|
||||||
|
}
|
||||||
|
selectionService.setSelection(selection);
|
||||||
|
thisSelectionCount=selection.toList().size();
|
||||||
|
}
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reset tree viewer and tableviewer after every closed tab
|
||||||
|
*/
|
||||||
|
protected void resetTreeViewer() {
|
||||||
|
//reset tree- and tableviewer
|
||||||
|
dbTreeViewer.setInput(null);
|
||||||
|
streamTableViewer.setInput(null);
|
||||||
|
streamTableViewer.setSelection(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void selectAllWaveforms() {
|
||||||
|
int itemCount = streamTableViewer.getTable().getItemCount();
|
||||||
|
ArrayList<Object> list = new ArrayList<>();
|
||||||
|
for(int i=0; i<itemCount; i++) {
|
||||||
|
list.add(streamTableViewer.getElementAt(i));
|
||||||
|
}
|
||||||
|
StructuredSelection sel = new StructuredSelection(list);
|
||||||
|
streamTableViewer.setSelection(sel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the selection.
|
||||||
|
*
|
||||||
|
* @param selection the selection
|
||||||
|
* @param partService the part service
|
||||||
|
*/
|
||||||
|
@Inject
|
||||||
|
public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection, EPartService partService){
|
||||||
|
MPart part = partService.getActivePart();
|
||||||
|
if(part!=null && part.getObject() != this && selection!=null){
|
||||||
|
if( selection instanceof IStructuredSelection) {
|
||||||
|
Object object= ((IStructuredSelection)selection).getFirstElement();
|
||||||
|
if(object instanceof IHierNode&& ((IHierNode)object).getChildNodes().size()!=0)
|
||||||
|
streamTableViewer.setInput(object);
|
||||||
|
otherSelectionCount = (object instanceof IWaveform || object instanceof ITx)?1:0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the listeners for the buttons.
|
||||||
|
*/
|
||||||
|
protected abstract void initializeButtonListeners();
|
||||||
|
/**
|
||||||
|
* Update buttons.
|
||||||
|
*/
|
||||||
|
protected abstract void updateButtons();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class StreamTableFilter.
|
||||||
|
*/
|
||||||
|
public class StreamTableFilter extends ViewerFilter {
|
||||||
|
|
||||||
|
/** The search string. */
|
||||||
|
private String searchString;
|
||||||
|
private Pattern pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the search text.
|
||||||
|
*
|
||||||
|
* @param s the new search text
|
||||||
|
*/
|
||||||
|
public void setSearchText(String s) {
|
||||||
|
try {
|
||||||
|
pattern = Pattern.compile(".*" + s + ".*"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
} catch (PatternSyntaxException e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||||
|
if (searchString == null || searchString.length() == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(element instanceof IWaveform) {
|
||||||
|
if (pattern.matcher(((IWaveform) element).getName()).matches())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class StreamTTreeFilter extends ViewerFilter {
|
||||||
|
|
||||||
|
/** The search string. */
|
||||||
|
private String searchString;
|
||||||
|
private Pattern pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the search text.
|
||||||
|
*
|
||||||
|
* @param s the new search text
|
||||||
|
*/
|
||||||
|
public void setSearchText(String s) {
|
||||||
|
try {
|
||||||
|
pattern = Pattern.compile(".*" + s + ".*");
|
||||||
|
this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
} catch (PatternSyntaxException e) {}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||||
|
return selectTreePath(viewer, new TreePath(new Object[] { parentElement }), element);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean selectTreePath(Viewer viewer, TreePath parentPath, Object element) {
|
||||||
|
// Cut off children of elements that are shown repeatedly.
|
||||||
|
for (int i = 0; i < parentPath.getSegmentCount() - 1; i++) {
|
||||||
|
if (element.equals(parentPath.getSegment(i))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(viewer instanceof TreeViewer)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (searchString == null || searchString.length() == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
TreeViewer treeViewer = (TreeViewer) viewer;
|
||||||
|
Boolean matchingResult = isMatchingOrNull(element);
|
||||||
|
if (matchingResult != null) {
|
||||||
|
return matchingResult;
|
||||||
|
}
|
||||||
|
return hasUnfilteredChild(treeViewer, parentPath, element);
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean isMatchingOrNull(Object element) {
|
||||||
|
if(element instanceof IWaveform) {
|
||||||
|
if (pattern.matcher(((IWaveform) element).getName()).matches())
|
||||||
|
return Boolean.TRUE;
|
||||||
|
} else if(element instanceof IWaveformDb) {
|
||||||
|
return Boolean.TRUE;
|
||||||
|
} else if(element instanceof HierNode) {
|
||||||
|
HierNode n = (HierNode) element;
|
||||||
|
try {
|
||||||
|
if (pattern.matcher(n.getFullName()).matches())
|
||||||
|
return Boolean.TRUE;
|
||||||
|
} catch (PatternSyntaxException e) {
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return Boolean.FALSE;
|
||||||
|
}
|
||||||
|
/* maybe children are matching */
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasUnfilteredChild(TreeViewer viewer, TreePath parentPath, Object element) {
|
||||||
|
TreePath elementPath = parentPath.createChildPath(element);
|
||||||
|
IContentProvider contentProvider = viewer.getContentProvider();
|
||||||
|
Object[] children = contentProvider instanceof ITreePathContentProvider
|
||||||
|
? ((ITreePathContentProvider) contentProvider).getChildren(elementPath)
|
||||||
|
: ((ITreeContentProvider) contentProvider).getChildren(element);
|
||||||
|
|
||||||
|
/* avoid NPE + guard close */
|
||||||
|
if (children == null || children.length == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < children.length; i++) {
|
||||||
|
if (selectTreePath(viewer, elementPath, children[i])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Gets the filtered children.
|
||||||
|
*
|
||||||
|
* @param viewer the viewer
|
||||||
|
* @return the filtered children
|
||||||
|
*/
|
||||||
|
protected Object[] getFilteredChildren(TableViewer viewer){
|
||||||
|
Object parent = viewer.getInput();
|
||||||
|
if(parent==null) return new Object[0];
|
||||||
|
Object[] result = null;
|
||||||
|
if (parent != null) {
|
||||||
|
IStructuredContentProvider cp = (IStructuredContentProvider) viewer.getContentProvider();
|
||||||
|
if (cp != null) {
|
||||||
|
result = cp.getElements(parent);
|
||||||
|
if(result==null) return new Object[0];
|
||||||
|
for (int i = 0, n = result.length; i < n; ++i) {
|
||||||
|
if(result[i]==null) return new Object[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ViewerFilter[] filters = viewer.getFilters();
|
||||||
|
if (filters != null) {
|
||||||
|
for (ViewerFilter f:filters) {
|
||||||
|
Object[] filteredResult = f.filter(viewer, parent, result);
|
||||||
|
result = filteredResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the filtered children.
|
||||||
|
*
|
||||||
|
* @return the filtered children
|
||||||
|
*/
|
||||||
|
public Object[] getFilteredChildren() {
|
||||||
|
return getFilteredChildren(streamTableViewer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class DBState.
|
||||||
|
*/
|
||||||
|
class DBState {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new DB state.
|
||||||
|
*/
|
||||||
|
public DBState() {
|
||||||
|
this.expandedElements=dbTreeViewer.getExpandedElements();
|
||||||
|
this.treeSelection=dbTreeViewer.getSelection();
|
||||||
|
this.tableSelection=streamTableViewer.getSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply.
|
||||||
|
*/
|
||||||
|
public void apply() {
|
||||||
|
dbTreeViewer.setExpandedElements(expandedElements);
|
||||||
|
dbTreeViewer.setSelection(treeSelection, true);
|
||||||
|
streamTableViewer.setSelection(tableSelection, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The expanded elements. */
|
||||||
|
private Object[] expandedElements;
|
||||||
|
|
||||||
|
/** The tree selection. */
|
||||||
|
private ISelection treeSelection;
|
||||||
|
|
||||||
|
/** The table selection. */
|
||||||
|
private ISelection tableSelection;
|
||||||
|
}
|
||||||
|
};
|
|
@ -262,6 +262,7 @@ public class TransactionDetails {
|
||||||
*/
|
*/
|
||||||
@Focus
|
@Focus
|
||||||
public void setFocus() {
|
public void setFocus() {
|
||||||
|
if(treeViewer!=null)
|
||||||
treeViewer.getTree().setFocus();
|
treeViewer.getTree().setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,10 +103,13 @@ import com.minres.scviewer.database.ui.swt.WaveformViewFactory;
|
||||||
import com.minres.scviewer.database.ui.WaveformColors;
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
import com.minres.scviewer.e4.application.Messages;
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
import com.minres.scviewer.e4.application.internal.status.WaveStatusBarControl;
|
import com.minres.scviewer.e4.application.internal.status.WaveStatusBarControl;
|
||||||
|
import com.minres.scviewer.e4.application.internal.ui.AbstractDesignBrowser;
|
||||||
import com.minres.scviewer.e4.application.internal.util.FileMonitor;
|
import com.minres.scviewer.e4.application.internal.util.FileMonitor;
|
||||||
import com.minres.scviewer.e4.application.internal.util.IFileChangeListener;
|
import com.minres.scviewer.e4.application.internal.util.IFileChangeListener;
|
||||||
import com.minres.scviewer.e4.application.internal.util.IModificationChecker;
|
import com.minres.scviewer.e4.application.internal.util.IModificationChecker;
|
||||||
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
||||||
|
import org.eclipse.swt.custom.SashForm;
|
||||||
|
import org.eclipse.swt.layout.FillLayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class WaveformViewerPart.
|
* The Class WaveformViewerPart.
|
||||||
|
@ -166,6 +169,20 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
/** The factory. */
|
/** The factory. */
|
||||||
WaveformViewFactory factory = new WaveformViewFactory();
|
WaveformViewFactory factory = new WaveformViewFactory();
|
||||||
|
|
||||||
|
AbstractDesignBrowser browser = new AbstractDesignBrowser() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void updateButtons() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initializeButtonListeners() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
/** The waveform pane. */
|
/** The waveform pane. */
|
||||||
private IWaveformView waveformPane;
|
private IWaveformView waveformPane;
|
||||||
|
|
||||||
|
@ -199,7 +216,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
private boolean checkForUpdates;
|
private boolean checkForUpdates;
|
||||||
|
|
||||||
/** The my part. */
|
/** The my part. */
|
||||||
private MPart myPart;
|
@Inject private MPart myPart;
|
||||||
|
|
||||||
/** The my parent. */
|
/** The my parent. */
|
||||||
private Composite myParent;
|
private Composite myParent;
|
||||||
|
@ -207,6 +224,8 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
/** The files to load. */
|
/** The files to load. */
|
||||||
ArrayList<File> filesToLoad = new ArrayList<>();
|
ArrayList<File> filesToLoad = new ArrayList<>();
|
||||||
|
|
||||||
|
String partConfig = "";
|
||||||
|
|
||||||
/** The persisted state. */
|
/** The persisted state. */
|
||||||
Map<String, String> persistedState;
|
Map<String, String> persistedState;
|
||||||
|
|
||||||
|
@ -225,6 +244,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
/** The file checker. */
|
/** The file checker. */
|
||||||
IModificationChecker fileChecker;
|
IModificationChecker fileChecker;
|
||||||
|
|
||||||
|
@Inject IWaveformDbFactory dbFactory;
|
||||||
|
|
||||||
|
@Inject Composite parent;
|
||||||
|
|
||||||
private Boolean showHover;
|
private Boolean showHover;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -235,7 +258,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
* @param dbFactory the db factory
|
* @param dbFactory the db factory
|
||||||
*/
|
*/
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void createComposite(MPart part, Composite parent, IWaveformDbFactory dbFactory, @Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE) IEclipsePreferences prefs, @Preference(value = PreferenceConstants.SHOW_HOVER) Boolean hover) {
|
public void createComposite(MPart part, EMenuService menuService, @Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE) IEclipsePreferences prefs, @Preference(value = PreferenceConstants.SHOW_HOVER) Boolean hover) {
|
||||||
disposeListenerNumber += 1;
|
disposeListenerNumber += 1;
|
||||||
|
|
||||||
myPart = part;
|
myPart = part;
|
||||||
|
@ -256,7 +279,20 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
waveformPane = factory.createPanel(parent);
|
parent.setLayout(new FillLayout(SWT.HORIZONTAL));
|
||||||
|
SashForm sashFormTop = new SashForm(parent, SWT.NONE);
|
||||||
|
|
||||||
|
Composite left = new Composite(sashFormTop, SWT.NONE);
|
||||||
|
left.setLayout(new FillLayout(SWT.HORIZONTAL));
|
||||||
|
|
||||||
|
browser.createComposite(left);
|
||||||
|
browser.setWaveformDb(database);
|
||||||
|
|
||||||
|
Composite right = new Composite(sashFormTop, SWT.NONE);
|
||||||
|
|
||||||
|
waveformPane = factory.createPanel(right);
|
||||||
|
sashFormTop.setWeights(new int[] {25, 75});
|
||||||
|
|
||||||
waveformPane.setMaxTime(0);
|
waveformPane.setMaxTime(0);
|
||||||
setupColors();
|
setupColors();
|
||||||
//set selection to empty selection when opening a new waveformPane
|
//set selection to empty selection when opening a new waveformPane
|
||||||
|
@ -614,48 +650,21 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
@Optional
|
@Optional
|
||||||
public void setPartInput(@Named("input") Object partInput, @Named("config") Object partConfig) {
|
public void setPartInput(@Named("input") List<String> partInput, @Named("config") String partConfig) {
|
||||||
if (partInput instanceof String) {
|
for(String s:partInput) {
|
||||||
String name = (String)partInput;
|
File file = new File(s);
|
||||||
filesToLoad = new ArrayList<File>();
|
if(file.isFile() && "CURRENT".equals(file.getName()))
|
||||||
boolean explicit = name.contains(",");
|
|
||||||
for(String tok: name.split(",")) {
|
|
||||||
File file = new File(tok);
|
|
||||||
if(file.isFile() && "CURRENT".equals(file.getName())){
|
|
||||||
file=file.getParentFile();
|
file=file.getParentFile();
|
||||||
}
|
if (file.exists())
|
||||||
if (file.exists()) {
|
|
||||||
filesToLoad.add(file);
|
filesToLoad.add(file);
|
||||||
}
|
}
|
||||||
if(!explicit)
|
if(partConfig!=null) {
|
||||||
try {
|
this.partConfig=partConfig;
|
||||||
String ext = getFileExtension(file.getName());
|
|
||||||
if (Messages.WaveformViewer_19.equals(ext.toLowerCase())) {
|
|
||||||
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_20)))) {
|
|
||||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_20)));
|
|
||||||
} else if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_21)))) {
|
|
||||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_21)));
|
|
||||||
} else if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_22)))) {
|
|
||||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_22)));
|
|
||||||
}
|
|
||||||
} else if (Messages.WaveformViewer_20.equals(ext.toLowerCase()) ||
|
|
||||||
Messages.WaveformViewer_21.equals(ext.toLowerCase()) ||
|
|
||||||
Messages.WaveformViewer_22.equals(ext.toLowerCase())
|
|
||||||
) {
|
|
||||||
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_19)))) {
|
|
||||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_19)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException e) { // silently ignore any error
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (filesToLoad.size() > 0)
|
if (filesToLoad.size() > 0)
|
||||||
loadDatabase(persistedState);
|
loadDatabase(persistedState);
|
||||||
if(partConfig instanceof String && ((String)partConfig).length()>0) {
|
if(partConfig.length()>0)
|
||||||
loadState((String) partConfig);
|
loadState(partConfig);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -663,7 +672,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
*/
|
*/
|
||||||
@Focus
|
@Focus
|
||||||
public void setFocus() {
|
public void setFocus() {
|
||||||
waveformPane.getWaveformControl().setFocus();
|
if(waveformPane!=null) waveformPane.getWaveformControl().setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1108,7 +1117,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
* @return the selection
|
* @return the selection
|
||||||
*/
|
*/
|
||||||
public ISelection getSelection() {
|
public ISelection getSelection() {
|
||||||
|
if(waveformPane!=null)
|
||||||
return waveformPane.getSelection();
|
return waveformPane.getSelection();
|
||||||
|
else
|
||||||
|
return new StructuredSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1259,5 +1271,4 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, null);
|
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -9,4 +9,5 @@ org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -5,4 +5,5 @@ org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
Loading…
Reference in New Issue