Fixed Styling and window system resource handling
This commit is contained in:
parent
5680af1b45
commit
41de99dd4b
|
@ -14,6 +14,8 @@ import org.eclipse.swt.SWT;
|
|||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.wb.swt.SWTResourceManager;
|
||||
|
||||
public class RulerPainter implements IPainter {
|
||||
protected WaveformCanvas waveCanvas;
|
||||
|
@ -21,17 +23,18 @@ public class RulerPainter implements IPainter {
|
|||
static final int rulerTickMinorC = 10;
|
||||
static final int rulerTickMajorC = 100;
|
||||
|
||||
private Color headerBgColor;
|
||||
private Color headerFgColor;
|
||||
|
||||
public RulerPainter(WaveformCanvas waveCanvas, Color headerFgColor, Color headerBgColor) {
|
||||
public RulerPainter(WaveformCanvas waveCanvas) {
|
||||
this.waveCanvas=waveCanvas;
|
||||
this.headerBgColor=headerBgColor;
|
||||
this.headerFgColor=headerFgColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintArea(GC gc, Rectangle area) {
|
||||
Color headerFgColor=waveCanvas.getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND);
|
||||
if(headerFgColor.isDisposed())
|
||||
headerFgColor=SWTResourceManager.getColor(0,0,0);
|
||||
Color headerBgColor = waveCanvas.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
|
||||
if(headerBgColor.isDisposed())
|
||||
headerBgColor=SWTResourceManager.getColor(255,255,255);
|
||||
String unit=waveCanvas.getUnitStr();
|
||||
int unitMultiplier=waveCanvas.getUnitMultiplier();
|
||||
long scaleFactor=waveCanvas.getScaleFactor();
|
||||
|
|
|
@ -111,7 +111,7 @@ public class WaveformCanvas extends Canvas {
|
|||
// order is important: it is bottom to top
|
||||
trackAreaPainter=new TrackAreaPainter(this);
|
||||
painterList.add(trackAreaPainter);
|
||||
rulerPainter=new RulerPainter(this, getDisplay().getSystemColor(SWT.COLOR_BLACK), getDisplay().getSystemColor(SWT.COLOR_WHITE));
|
||||
rulerPainter=new RulerPainter(this);
|
||||
painterList.add(rulerPainter);
|
||||
CursorPainter cp = new CursorPainter(this, scaleFactor * 10, cursorPainters.size()-1);
|
||||
painterList.add(cp);
|
||||
|
|
|
@ -96,6 +96,8 @@ public class WaveformViewer implements IWaveformViewer {
|
|||
|
||||
private ScrolledComposite valueListScrolled;
|
||||
|
||||
private Control namePaneHeader;
|
||||
|
||||
private Canvas nameList;
|
||||
|
||||
private Canvas valueList;
|
||||
|
@ -239,10 +241,11 @@ public class WaveformViewer implements IWaveformViewer {
|
|||
waveformCanvas = new WaveformCanvas(topSash, SWT.NONE);
|
||||
|
||||
SashForm leftSash = new SashForm(composite, SWT.SMOOTH);
|
||||
leftSash.setBackground(leftSash.getDisplay().getSystemColor(SWT.COLOR_GRAY));
|
||||
leftSash.setBackground(SWTResourceManager.getColor(SWT.COLOR_GRAY));
|
||||
|
||||
Composite namePane = createTextPane(leftSash, "Name");
|
||||
namePane.setBackground(namePane.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
|
||||
namePaneHeader= namePane.getChildren()[0];
|
||||
namePane.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
|
||||
|
||||
nameListScrolled = new ScrolledComposite(namePane, SWT.H_SCROLL | SWT.V_SCROLL);
|
||||
nameListScrolled.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
|
||||
|
@ -275,7 +278,7 @@ public class WaveformViewer implements IWaveformViewer {
|
|||
nameListScrolled.setContent(nameList);
|
||||
|
||||
Composite valuePane = createTextPane(leftSash, "Value");
|
||||
valuePane.setBackground(valuePane.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
|
||||
valuePane.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
|
||||
valueListScrolled = new ScrolledComposite(valuePane, SWT.H_SCROLL | SWT.V_SCROLL);
|
||||
valueListScrolled.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
|
||||
valueListScrolled.setExpandHorizontal(true);
|
||||
|
@ -805,8 +808,8 @@ public class WaveformViewer implements IWaveformViewer {
|
|||
gc.fillRectangle(subArea.x, subArea.y + yOffset, subArea.width, subArea.height);
|
||||
gc.setFont(nameFontB);
|
||||
} else {
|
||||
gc.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_BACKGROUND));
|
||||
gc.setForeground(SWTResourceManager.getColor(SWT.COLOR_LIST_FOREGROUND));
|
||||
gc.setBackground(namePaneHeader.getBackground());
|
||||
gc.setForeground(namePaneHeader.getForeground());
|
||||
gc.setFont(nameFont);
|
||||
}
|
||||
gc.drawText(value, subArea.x + 5, subArea.y + yOffset + (waveformCanvas.getTrackHeight() - size.y) / 2, true);
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
<handlers xmi:id="_95Pfx3NmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.aboutCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.AboutHandler" command="_95PfxnNmEeWBq8z1Dv39LA"/>
|
||||
<handlers xmi:id="_3ZZhsHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.selectallCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SelectAllHandler" command="_bV-TMHXHEeWwZ-9vrAR2UQ"/>
|
||||
<handlers xmi:id="_CTcpEIl_EeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.handler.preferences" contributionURI="bundleclass://com.opcoach.e4.preferences/com.opcoach.e4.preferences.handlers.E4PreferencesHandler" command="_AxH6sIl_EeWxJ_wPkM6yGQ"/>
|
||||
<handlers xmi:id="_UUnX8IoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.handler.set_them" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.ThemeSetHandler" command="_KlGlsIoNEeWxJ_wPkM6yGQ"/>
|
||||
<bindingTables xmi:id="_95PfvnNmEeWBq8z1Dv39LA" bindingContext="_95PfuXNmEeWBq8z1Dv39LA">
|
||||
<bindings xmi:id="_95Pfv3NmEeWBq8z1Dv39LA" keySequence="M1+Q" command="_95PfvHNmEeWBq8z1Dv39LA"/>
|
||||
<bindings xmi:id="_95PfwnNmEeWBq8z1Dv39LA" keySequence="M1+O" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
||||
|
@ -212,6 +213,9 @@
|
|||
<parameters xmi:id="_7T1TcHwIEeWv0Y5uF2QN5w" elementId="com.minres.scviewer.e4.application.command.addwaveform.all" name="all" typeId="" optional="false"/>
|
||||
</commands>
|
||||
<commands xmi:id="_AxH6sIl_EeWxJ_wPkM6yGQ" elementId="org.eclipse.ui.window.preferences" commandName="Preferences"/>
|
||||
<commands xmi:id="_KlGlsIoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.command.set_them" commandName="Set Theme">
|
||||
<parameters xmi:id="_O8Z9IIoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.command.theme.parameter.id" name="themeId"/>
|
||||
</commands>
|
||||
<addons xmi:id="_95PfsnNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.core.commands.service" contributionURI="bundleclass://org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"/>
|
||||
<addons xmi:id="_95Pfs3NmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.contexts.service" contributionURI="bundleclass://org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"/>
|
||||
<addons xmi:id="_95PftHNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.bindings.service" contributionURI="bundleclass://org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"/>
|
||||
|
|
|
@ -30,7 +30,8 @@ Require-Bundle: javax.inject;bundle-version="1.0.0",
|
|||
org.eclipse.e4.core.commands;bundle-version="0.11.0",
|
||||
org.eclipse.e4.ui.workbench.addons.swt,
|
||||
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"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||
Import-Package: com.minres.scviewer.database,
|
||||
javax.inject;version="1.0.0"
|
||||
|
|
|
@ -5,7 +5,6 @@ bin.includes = META-INF/,\
|
|||
plugin.xml,\
|
||||
Application.e4xmi,\
|
||||
icons/,\
|
||||
css/default.css,\
|
||||
OSGI-INF/l10n/bundle.properties,\
|
||||
css/,\
|
||||
OSGI-INF/
|
||||
source.. = src/
|
||||
|
|
|
@ -1,205 +1,78 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010, 2014 IBM Corporation 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:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Lars Vogel <Lars.Vogel@gmail.com> - Bug 420836
|
||||
*******************************************************************************/
|
||||
|
||||
/* New ColorDefinitions for the E4 default theme */
|
||||
ThemesExtension { color-definition:
|
||||
'#org-eclipse-ui-workbench-INACTIVE_UNSELECTED_TABS_COLOR_START',
|
||||
'#org-eclipse-ui-workbench-INACTIVE_UNSELECTED_TABS_COLOR_END',
|
||||
'#org-eclipse-ui-workbench-INACTIVE_TAB_OUTER_KEYLINE_COLOR',
|
||||
'#org-eclipse-ui-workbench-INACTIVE_TAB_INNER_KEYLINE_COLOR',
|
||||
'#org-eclipse-ui-workbench-INACTIVE_TAB_OUTLINE_COLOR',
|
||||
'#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_START',
|
||||
'#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_END',
|
||||
'#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR',
|
||||
'#org-eclipse-ui-workbench-ACTIVE_TAB_INNER_KEYLINE_COLOR',
|
||||
'#org-eclipse-ui-workbench-ACTIVE_TAB_OUTLINE_COLOR';
|
||||
Label, Button[style~='SWT.CHECK'] {
|
||||
color: black;
|
||||
}
|
||||
|
||||
ColorDefinition#org-eclipse-ui-workbench-INACTIVE_UNSELECTED_TABS_COLOR_START {
|
||||
color: #FFFFFF;
|
||||
category: '#org-eclipse-ui-presentation-default';
|
||||
label: url('platform:/plugin/org.eclipse.ui.themes?message=INACTIVE_UNSELECTED_TABS_COLOR_START')
|
||||
Composite Label {
|
||||
color: black;
|
||||
}
|
||||
|
||||
ColorDefinition#org-eclipse-ui-workbench-INACTIVE_UNSELECTED_TABS_COLOR_END {
|
||||
color: #FFFFFF;
|
||||
category: '#org-eclipse-ui-presentation-default';
|
||||
label: url('platform:/plugin/org.eclipse.ui.themes?message=INACTIVE_UNSELECTED_TABS_COLOR_END');
|
||||
#SeparatorLabel {
|
||||
color: #1d659f;
|
||||
}
|
||||
|
||||
ColorDefinition#org-eclipse-ui-workbench-INACTIVE_TAB_OUTER_KEYLINE_COLOR {
|
||||
color: #FFFFFF;
|
||||
category: '#org-eclipse-ui-presentation-default';
|
||||
label: url('platform:/plugin/org.eclipse.ui.themes?message=INACTIVE_TAB_OUTER_KEYLINE_COLOR');
|
||||
/*
|
||||
Text {
|
||||
font: Verdana 8px;
|
||||
}
|
||||
*/
|
||||
|
||||
Composite Text {
|
||||
background-color: white;
|
||||
color: black;
|
||||
}
|
||||
|
||||
ColorDefinition#org-eclipse-ui-workbench-INACTIVE_TAB_INNER_KEYLINE_COLOR {
|
||||
color: #FFFFFF;
|
||||
category: '#org-eclipse-ui-presentation-default';
|
||||
label: url('platform:/plugin/org.eclipse.ui.themes?message=INACTIVE_TAB_INNER_KEYLINE_COLOR');
|
||||
SashForm {
|
||||
background-color: #dddddd;
|
||||
}
|
||||
|
||||
ColorDefinition#org-eclipse-ui-workbench-INACTIVE_TAB_OUTLINE_COLOR {
|
||||
color: #B6BCCC;
|
||||
category: '#org-eclipse-ui-presentation-default';
|
||||
label: url('platform:/plugin/org.eclipse.ui.themes?message=INACTIVE_TAB_OUTLINE_COLOR');
|
||||
#DetailsView {
|
||||
background-color: #e8e8e8 #cccccc 60%;
|
||||
}
|
||||
|
||||
ColorDefinition#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_START {
|
||||
color: #FFFFFF;
|
||||
category: '#org-eclipse-ui-presentation-default';
|
||||
label: url('platform:/plugin/org.eclipse.ui.themes?message=ACTIVE_UNSELECTED_TABS_COLOR_START');
|
||||
Table {
|
||||
/*background-color: #e8e8e8 #cccccc 60%;*/
|
||||
background-color: #f7f7f7 60%;
|
||||
color: black;
|
||||
}
|
||||
|
||||
ColorDefinition#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_END {
|
||||
color: #FFFFFF;
|
||||
category: '#org-eclipse-ui-presentation-default';
|
||||
label: url('platform:/plugin/org.eclipse.ui.themes?message=ACTIVE_UNSELECTED_TABS_COLOR_END');
|
||||
Tree {
|
||||
/*background-color: #e8e8e8 #cccccc 60%;*/
|
||||
background-color: #f7f7f7 60%;
|
||||
color: black;
|
||||
}
|
||||
|
||||
ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR {
|
||||
color: #CCCCCC;
|
||||
category: '#org-eclipse-ui-presentation-default';
|
||||
label: url('platform:/plugin/org.eclipse.ui.themes?message=ACTIVE_TAB_OUTER_KEYLINE_COLOR');
|
||||
.MTrimBar {
|
||||
background-color: white #dddddd #eeeeee 35% 25% 25%;
|
||||
color: white;
|
||||
}
|
||||
|
||||
ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_INNER_KEYLINE_COLOR {
|
||||
color: #FFFFFF;
|
||||
category: '#org-eclipse-ui-presentation-default';
|
||||
label: url('platform:/plugin/org.eclipse.ui.themes?message=ACTIVE_TAB_INNER_KEYLINE_COLOR');
|
||||
CTabFolder {
|
||||
/* The tab rendering background for the min/max toolbar pulls
|
||||
* background from the tabfolder's background (or it's parent?)
|
||||
* and so the gradient doesn't come through. So just set the
|
||||
* tabfolder's background to a color */
|
||||
/*background-color: white #dddddd #eeeeee 35% 25% 25%;*/
|
||||
background-color: #eeeeee;
|
||||
color: white;
|
||||
swt-simple: true;
|
||||
}
|
||||
|
||||
ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_OUTLINE_COLOR {
|
||||
color: #B6BCCC;
|
||||
category: '#org-eclipse-ui-presentation-default';
|
||||
label: url('platform:/plugin/org.eclipse.ui.themes?message=ACTIVE_TAB_OUTLINE_COLOR');
|
||||
}
|
||||
|
||||
/* Already existing ColorDefinitions overridden for the E4 default theme */
|
||||
ColorDefinition#org-eclipse-ui-workbench-INACTIVE_TAB_BG_START {
|
||||
color: #dddfe5;
|
||||
}
|
||||
|
||||
ColorDefinition#org-eclipse-ui-workbench-INACTIVE_TAB_BG_END {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_BG_START{
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_BG_END {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
ColorDefinition#org-eclipse-ui-workbench-ACTIVE_NOFOCUS_TAB_BG_START {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
ColorDefinition#org-eclipse-ui-workbench-ACTIVE_NOFOCUS_TAB_BG_END {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
ColorDefinition#org-eclipse-ui-workbench-ACTIVE_NOFOCUS_TAB_TEXT_COLOR {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.MTrimmedWindow.topLevel {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
margin-left: 3px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
.MPart.busy {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.MPart.highlighted {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.MPartStack, .MPart {
|
||||
font-family: '#org-eclipse-ui-workbench-TAB_TEXT_FONT';
|
||||
CTabItem {
|
||||
color: black;
|
||||
}
|
||||
|
||||
CTabItem:selected {
|
||||
color: '#org-eclipse-ui-workbench-ACTIVE_TAB_TEXT_COLOR';
|
||||
background-color: #cccccc #e8e8e8 60%;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.MPartStack {
|
||||
swt-tab-renderer: url('bundleclass://org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.ui.workbench.renderers.swt.CTabRendering');
|
||||
swt-selected-tab-fill: '#org-eclipse-ui-workbench-INACTIVE_TAB_BG_START' '#org-eclipse-ui-workbench-INACTIVE_TAB_BG_END' 100% 100%;
|
||||
swt-unselected-tabs-color: '#org-eclipse-ui-workbench-INACTIVE_UNSELECTED_TABS_COLOR_START' '#org-eclipse-ui-workbench-INACTIVE_UNSELECTED_TABS_COLOR_END' 100% 100%;
|
||||
swt-outer-keyline-color: '#org-eclipse-ui-workbench-INACTIVE_TAB_OUTER_KEYLINE_COLOR';
|
||||
swt-inner-keyline-color: '#org-eclipse-ui-workbench-INACTIVE_TAB_INNER_KEYLINE_COLOR';
|
||||
swt-tab-outline: '#org-eclipse-ui-workbench-INACTIVE_TAB_OUTLINE_COLOR';
|
||||
padding: 0px 2px 2px;
|
||||
swt-shadow-visible: false;
|
||||
swt-mru-visible: false;
|
||||
color: '#org-eclipse-ui-workbench-INACTIVE_TAB_TEXT_COLOR';
|
||||
CTabItem.active:selected {
|
||||
background-color: #ffffff #cccccc #dddddd 50% 50%;
|
||||
color: #1d659f;
|
||||
font: bold;
|
||||
}
|
||||
|
||||
.MPartStack.active {
|
||||
swt-selected-tab-fill: '#org-eclipse-ui-workbench-ACTIVE_TAB_BG_START' '#org-eclipse-ui-workbench-ACTIVE_TAB_BG_END' 100% 100%;
|
||||
swt-unselected-tabs-color: '#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_START' '#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_END' 100% 100%;
|
||||
swt-outer-keyline-color: '#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR';
|
||||
swt-inner-keyline-color: '#org-eclipse-ui-workbench-ACTIVE_TAB_INNER_KEYLINE_COLOR';
|
||||
swt-tab-outline: '#org-eclipse-ui-workbench-ACTIVE_TAB_OUTLINE_COLOR';
|
||||
swt-shadow-visible: false;
|
||||
}
|
||||
|
||||
.MPartStack.active.noFocus {
|
||||
swt-selected-tab-fill: '#org-eclipse-ui-workbench-ACTIVE_NOFOCUS_TAB_BG_START' '#org-eclipse-ui-workbench-ACTIVE_NOFOCUS_TAB_BG_END' 100% 100%;
|
||||
}
|
||||
|
||||
.MPartStack.active.noFocus > CTabItem:selected {
|
||||
color: '#org-eclipse-ui-workbench-ACTIVE_NOFOCUS_TAB_TEXT_COLOR';
|
||||
}
|
||||
|
||||
#PerspectiveSwitcher {
|
||||
eclipse-perspective-keyline-color: #AAB0BF #AAB0BF;
|
||||
}
|
||||
|
||||
.MToolControl.TrimStack {
|
||||
frame-image: url(./winXPTSFrame.png);
|
||||
handle-image: url(./winXPHandle.png);
|
||||
frame-cuts: 5px 1px 5px 16px;
|
||||
}
|
||||
|
||||
.MToolBar.Draggable {
|
||||
handle-image: url(./dragHandle.png);
|
||||
}
|
||||
|
||||
.MToolControl.Draggable {
|
||||
handle-image: url(./dragHandle.png);
|
||||
}
|
||||
|
||||
.DragFeedback {
|
||||
background-color: COLOR-WIDGET-NORMAL-SHADOW;
|
||||
}
|
||||
|
||||
.ModifiedDragFeedback {
|
||||
background-color: #A0A000;
|
||||
}
|
||||
|
||||
.MPartStack > Composite {
|
||||
background-color: '#org-eclipse-ui-workbench-INACTIVE_TAB_BG_END';
|
||||
}
|
||||
|
||||
.MPartStack.active > Composite {
|
||||
background-color: '#org-eclipse-ui-workbench-ACTIVE_TAB_BG_END';
|
||||
}
|
||||
|
||||
.MPartStack.active.noFocus > Composite {
|
||||
background-color: '#org-eclipse-ui-workbench-ACTIVE_NOFOCUS_TAB_BG_END';
|
||||
Shell {
|
||||
background-color: #e8e8e8 #cccccc 60%;
|
||||
swt-background-mode: default;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
name="windowImages"
|
||||
value="icons/SCViewer_16x32.png,icons/SCViewer_32x32.png,icons/SCViewer_48x32.png,icons/SCViewer_64x32.png,icons/SCViewer_128x32.png,icons/SCViewer_256x32.png">
|
||||
</property>
|
||||
<property
|
||||
name="applicationCSS"
|
||||
value="platform:/plugin/com.minres.scviewer.e4.application/css/default.css">
|
||||
</property>
|
||||
</product>
|
||||
</extension>
|
||||
<extension
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/*******************************************************************************
|
||||
* 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.handlers;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.ui.css.swt.theme.IThemeEngine;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
|
||||
/*
|
||||
* see http://www.vogella.com/tutorials/Eclipse4CSS/article.html#tutorial_cssstyling
|
||||
*/
|
||||
@SuppressWarnings("restriction")
|
||||
public class ThemeSetHandler {
|
||||
final static String PARAMTER_ID = "com.minres.scviewer.e4.application.command.theme.parameter.id";
|
||||
|
||||
@CanExecute
|
||||
public boolean canExecute(EPartService partService) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void setTheme(@Named(PARAMTER_ID) String param, IThemeEngine engine) {
|
||||
if (!engine.getActiveTheme().getId().equals(param)) {
|
||||
// second argument defines that change is
|
||||
// persisted and restored on restart
|
||||
engine.setTheme(param, true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -33,6 +33,7 @@ import org.eclipse.swt.widgets.Event;
|
|||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.wb.swt.ResourceManager;
|
||||
import org.eclipse.wb.swt.SWTResourceManager;
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
|
||||
/**
|
||||
|
@ -128,12 +129,12 @@ public class HeapStatus extends Composite {
|
|||
disabledGcImage = new Image(display, gcImage, SWT.IMAGE_DISABLE);
|
||||
}
|
||||
usedMemCol = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
|
||||
lowMemCol = new Color(display, 255, 70, 70); // medium red
|
||||
freeMemCol = new Color(display, 255, 190, 125); // light orange
|
||||
bgCol = display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
|
||||
sepCol = topLeftCol = armCol = display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
|
||||
bottomRightCol = display.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
|
||||
markCol = textCol = display.getSystemColor(SWT.COLOR_INFO_FOREGROUND);
|
||||
lowMemCol = SWTResourceManager.getColor(255, 70, 70); // medium red
|
||||
freeMemCol = SWTResourceManager.getColor(255, 190, 125); // light orange
|
||||
bgCol = SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND);
|
||||
sepCol = topLeftCol = armCol = SWTResourceManager.getColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
|
||||
bottomRightCol = SWTResourceManager.getColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
|
||||
markCol = textCol = SWTResourceManager.getColor(SWT.COLOR_INFO_FOREGROUND);
|
||||
|
||||
createContextMenu();
|
||||
|
||||
|
@ -273,13 +274,6 @@ public class HeapStatus extends Composite {
|
|||
if (disabledGcImage != null) {
|
||||
disabledGcImage.dispose();
|
||||
}
|
||||
|
||||
if (lowMemCol != null) {
|
||||
lowMemCol.dispose();
|
||||
}
|
||||
if (freeMemCol != null) {
|
||||
freeMemCol.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -469,7 +463,9 @@ public class HeapStatus extends Composite {
|
|||
int tw = (int) (sw * totalMem / maxMem); // current total mem width
|
||||
int tx = x + 1 + tw; // current total mem right edge
|
||||
|
||||
if (bgCol != null) {
|
||||
gc.setBackground(bgCol);
|
||||
}
|
||||
gc.fillRectangle(rect);
|
||||
gc.setForeground(sepCol);
|
||||
gc.drawLine(dx, y, dx, y + h);
|
||||
|
|
|
@ -77,16 +77,16 @@ import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
|||
@SuppressWarnings("restriction")
|
||||
public class WaveformViewerPart implements IFileChangeListener, IPreferenceChangeListener {
|
||||
|
||||
public static final String ACTIVE_WAVEFORMVIEW="Active_Waveform_View";
|
||||
public static final String ACTIVE_WAVEFORMVIEW = "Active_Waveform_View";
|
||||
|
||||
public static final String ADD_WAVEFORM="AddWaveform";
|
||||
public static final String ADD_WAVEFORM = "AddWaveform";
|
||||
|
||||
protected static final String DATABASE_FILE = "DATABASE_FILE";
|
||||
protected static final String SHOWN_WAVEFORM = "SHOWN_WAVEFORM";
|
||||
protected static final String SHOWN_CURSOR = "SHOWN_CURSOR";
|
||||
protected static final String ZOOM_LEVEL = "ZOOM_LEVEL";
|
||||
|
||||
protected static final long FILE_CHECK_INTERVAL=60000;
|
||||
protected static final long FILE_CHECK_INTERVAL = 60000;
|
||||
|
||||
private String[] zoomLevel;
|
||||
|
||||
|
@ -98,15 +98,21 @@ public class WaveformViewerPart implements IFileChangeListener, IPreferenceChang
|
|||
|
||||
private IWaveformViewer waveformPane;
|
||||
|
||||
@Inject private IEventBroker eventBroker;
|
||||
@Inject
|
||||
private IEventBroker eventBroker;
|
||||
|
||||
@Inject EMenuService menuService;
|
||||
@Inject
|
||||
EMenuService menuService;
|
||||
|
||||
@Inject ESelectionService selectionService;
|
||||
@Inject
|
||||
ESelectionService selectionService;
|
||||
|
||||
@Inject EPartService ePartService;
|
||||
@Inject
|
||||
EPartService ePartService;
|
||||
|
||||
@Inject @Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE) IEclipsePreferences prefs;
|
||||
@Inject
|
||||
@Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE)
|
||||
IEclipsePreferences prefs;
|
||||
|
||||
private IWaveformDb database;
|
||||
|
||||
|
@ -126,13 +132,13 @@ public class WaveformViewerPart implements IFileChangeListener, IPreferenceChang
|
|||
|
||||
@PostConstruct
|
||||
public void createComposite(MPart part, Composite parent, IWaveformDbFactory dbFactory) {
|
||||
myPart=part;
|
||||
myParent=parent;
|
||||
database=dbFactory.getDatabase();
|
||||
myPart = part;
|
||||
myParent = parent;
|
||||
database = dbFactory.getDatabase();
|
||||
database.addPropertyChangeListener(new PropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
if("WAVEFORMS".equals(evt.getPropertyName())) {
|
||||
if ("WAVEFORMS".equals(evt.getPropertyName())) {
|
||||
myParent.getDisplay().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -149,8 +155,8 @@ public class WaveformViewerPart implements IFileChangeListener, IPreferenceChang
|
|||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
Long time = (Long) evt.getNewValue();
|
||||
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, waveformPane.getScaledTime(time));
|
||||
long marker=waveformPane.getSelectedMarkerTime();
|
||||
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(time-marker));
|
||||
long marker = waveformPane.getSelectedMarkerTime();
|
||||
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(time - marker));
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -159,37 +165,42 @@ public class WaveformViewerPart implements IFileChangeListener, IPreferenceChang
|
|||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
Long time = (Long) evt.getNewValue();
|
||||
eventBroker.post(WaveStatusBarControl.MARKER_TIME, waveformPane.getScaledTime(time));
|
||||
long cursor=waveformPane.getCursorTime();
|
||||
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(cursor-time));
|
||||
long cursor = waveformPane.getCursorTime();
|
||||
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(cursor - time));
|
||||
}
|
||||
});
|
||||
waveformPane.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
if(event.getSelection() instanceof IStructuredSelection)
|
||||
if (event.getSelection() instanceof IStructuredSelection)
|
||||
selectionService.setSelection(event.getSelection());
|
||||
}
|
||||
});
|
||||
zoomLevel=waveformPane.getZoomLevels();
|
||||
zoomLevel = waveformPane.getZoomLevels();
|
||||
setupColors();
|
||||
checkForUpdates=prefs.getBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
||||
filesToLoad=new ArrayList<File>();
|
||||
checkForUpdates = prefs.getBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
||||
filesToLoad = new ArrayList<File>();
|
||||
persistedState = part.getPersistedState();
|
||||
Integer files = persistedState.containsKey(DATABASE_FILE+"S")?Integer.parseInt(persistedState.get(DATABASE_FILE+"S")):0;
|
||||
for(int i=0; i<files;i++){
|
||||
filesToLoad.add(new File(persistedState.get(DATABASE_FILE+i)));
|
||||
Integer files = persistedState.containsKey(DATABASE_FILE + "S")
|
||||
? Integer.parseInt(persistedState.get(DATABASE_FILE + "S")) : 0;
|
||||
for (int i = 0; i < files; i++) {
|
||||
filesToLoad.add(new File(persistedState.get(DATABASE_FILE + i)));
|
||||
}
|
||||
if(filesToLoad.size()>0)
|
||||
if (filesToLoad.size() > 0)
|
||||
loadDatabase(persistedState);
|
||||
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[waveformPane.getZoomLevel()]);
|
||||
menuService.registerContextMenu(waveformPane.getNameControl(), "com.minres.scviewer.e4.application.popupmenu.namecontext");
|
||||
menuService.registerContextMenu(waveformPane.getValueControl(), "com.minres.scviewer.e4.application.popupmenu.namecontext");
|
||||
menuService.registerContextMenu(waveformPane.getWaveformControl(), "com.minres.scviewer.e4.application.popupmenu.wavecontext");
|
||||
ePartService.addPartListener(new PartListener(){
|
||||
menuService.registerContextMenu(waveformPane.getNameControl(),
|
||||
"com.minres.scviewer.e4.application.popupmenu.namecontext");
|
||||
menuService.registerContextMenu(waveformPane.getValueControl(),
|
||||
"com.minres.scviewer.e4.application.popupmenu.namecontext");
|
||||
menuService.registerContextMenu(waveformPane.getWaveformControl(),
|
||||
"com.minres.scviewer.e4.application.popupmenu.wavecontext");
|
||||
ePartService.addPartListener(new PartListener() {
|
||||
@Override
|
||||
public void partActivated(MPart part) {
|
||||
if (part == myPart) {
|
||||
if(fileChecker!=null) fileChecker.check();
|
||||
if (fileChecker != null)
|
||||
fileChecker.check();
|
||||
updateAll();
|
||||
}
|
||||
}
|
||||
|
@ -199,11 +210,12 @@ public class WaveformViewerPart implements IFileChangeListener, IPreferenceChang
|
|||
|
||||
@Override
|
||||
public void preferenceChange(PreferenceChangeEvent event) {
|
||||
if(PreferenceConstants.DATABASE_RELOAD.equals(event.getKey())){
|
||||
if (PreferenceConstants.DATABASE_RELOAD.equals(event.getKey())) {
|
||||
checkForUpdates = (Boolean) event.getNewValue();
|
||||
fileChecker=null;
|
||||
if(checkForUpdates)
|
||||
fileChecker=fileMonitor.addFileChangeListener(WaveformViewerPart.this,filesToLoad, FILE_CHECK_INTERVAL);
|
||||
fileChecker = null;
|
||||
if (checkForUpdates)
|
||||
fileChecker = fileMonitor.addFileChangeListener(WaveformViewerPart.this, filesToLoad,
|
||||
FILE_CHECK_INTERVAL);
|
||||
else
|
||||
fileMonitor.removeFileChangeListener(this);
|
||||
} else {
|
||||
|
@ -213,9 +225,9 @@ public class WaveformViewerPart implements IFileChangeListener, IPreferenceChang
|
|||
|
||||
protected void setupColors() {
|
||||
DefaultValuesInitializer initializer = new DefaultValuesInitializer();
|
||||
HashMap<WaveformColors, RGB> colorPref=new HashMap<>();
|
||||
HashMap<WaveformColors, RGB> colorPref = new HashMap<>();
|
||||
for (WaveformColors c : WaveformColors.values()) {
|
||||
String prefValue=prefs.get(c.name() + "_COLOR",
|
||||
String prefValue = prefs.get(c.name() + "_COLOR",
|
||||
StringConverter.asString(initializer.colors[c.ordinal()].getRGB()));
|
||||
RGB rgb = StringConverter.asRGB(prefValue);
|
||||
colorPref.put(c, rgb);
|
||||
|
@ -227,21 +239,22 @@ public class WaveformViewerPart implements IFileChangeListener, IPreferenceChang
|
|||
fileMonitor.removeFileChangeListener(this);
|
||||
Job job = new Job(" My Job") {
|
||||
@Override
|
||||
protected IStatus run( IProgressMonitor monitor) {
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
// convert to SubMonitor and set total number of work units
|
||||
SubMonitor subMonitor = SubMonitor.convert(monitor, filesToLoad.size());
|
||||
subMonitor.setTaskName("Loading database");
|
||||
try {
|
||||
for(File file: filesToLoad){
|
||||
//TimeUnit.SECONDS.sleep(2);
|
||||
for (File file : filesToLoad) {
|
||||
// TimeUnit.SECONDS.sleep(2);
|
||||
database.load(file);
|
||||
database.addPropertyChangeListener(waveformPane);
|
||||
subMonitor.worked(1);
|
||||
if(monitor.isCanceled()) return Status.CANCEL_STATUS;
|
||||
if (monitor.isCanceled())
|
||||
return Status.CANCEL_STATUS;
|
||||
}
|
||||
// sleep a second
|
||||
} catch (Exception e) {
|
||||
database=null;
|
||||
database = null;
|
||||
e.printStackTrace();
|
||||
return Status.CANCEL_STATUS;
|
||||
}
|
||||
|
@ -250,18 +263,20 @@ public class WaveformViewerPart implements IFileChangeListener, IPreferenceChang
|
|||
return Status.OK_STATUS;
|
||||
}
|
||||
};
|
||||
job.addJobChangeListener(new JobChangeAdapter(){
|
||||
job.addJobChangeListener(new JobChangeAdapter() {
|
||||
@Override
|
||||
public void done(IJobChangeEvent event) {
|
||||
if(event.getResult()==Status.OK_STATUS)
|
||||
if (event.getResult() == Status.OK_STATUS)
|
||||
myParent.getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
waveformPane.setMaxTime(database.getMaxTime());
|
||||
if(state!=null) restoreWaveformViewerState(state);
|
||||
fileChecker=null;
|
||||
if(checkForUpdates) fileChecker=fileMonitor.addFileChangeListener(
|
||||
WaveformViewerPart.this,filesToLoad, FILE_CHECK_INTERVAL);
|
||||
if (state != null)
|
||||
restoreWaveformViewerState(state);
|
||||
fileChecker = null;
|
||||
if (checkForUpdates)
|
||||
fileChecker = fileMonitor.addFileChangeListener(WaveformViewerPart.this, filesToLoad,
|
||||
FILE_CHECK_INTERVAL);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -275,12 +290,14 @@ public class WaveformViewerPart implements IFileChangeListener, IPreferenceChang
|
|||
display.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(MessageDialog.openQuestion(display.getActiveShell(), "Database re-load", "Would you like to reload the database?")){
|
||||
if (MessageDialog.openQuestion(display.getActiveShell(), "Database re-load",
|
||||
"Would you like to reload the database?")) {
|
||||
Map<String, String> state = new HashMap<>();
|
||||
saveWaveformViewerState(state);
|
||||
waveformPane.getStreamList().clear();
|
||||
database.clear();
|
||||
if(filesToLoad.size()>0) loadDatabase(state);
|
||||
if (filesToLoad.size() > 0)
|
||||
loadDatabase(state);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -288,29 +305,29 @@ public class WaveformViewerPart implements IFileChangeListener, IPreferenceChang
|
|||
|
||||
@Inject
|
||||
@Optional
|
||||
public void setPartInput( @Named( "input" ) Object partInput ) {
|
||||
if(partInput instanceof File){
|
||||
filesToLoad=new ArrayList<File>();
|
||||
public void setPartInput(@Named("input") Object partInput) {
|
||||
if (partInput instanceof File) {
|
||||
filesToLoad = new ArrayList<File>();
|
||||
File file = (File) partInput;
|
||||
if(file.exists()){
|
||||
if (file.exists()) {
|
||||
filesToLoad.add(file);
|
||||
try {
|
||||
String ext = getFileExtension(file.getName());
|
||||
if("vcd".equals(ext.toLowerCase())){
|
||||
if(askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "txdb")))){
|
||||
if ("vcd".equals(ext.toLowerCase())) {
|
||||
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "txdb")))) {
|
||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), "txdb")));
|
||||
}else if(askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "txlog")))){
|
||||
} else if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "txlog")))) {
|
||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), "txlog")));
|
||||
}
|
||||
} else if("txdb".equals(ext.toLowerCase()) || "txlog".equals(ext.toLowerCase())){
|
||||
if(askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "vcd")))){
|
||||
} else if ("txdb".equals(ext.toLowerCase()) || "txlog".equals(ext.toLowerCase())) {
|
||||
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "vcd")))) {
|
||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), "vcd")));
|
||||
}
|
||||
}
|
||||
} catch (IOException e) { // silently ignore any error
|
||||
}
|
||||
}
|
||||
if(filesToLoad.size()>0)
|
||||
if (filesToLoad.size() > 0)
|
||||
loadDatabase(persistedState);
|
||||
}
|
||||
}
|
||||
|
@ -320,15 +337,14 @@ public class WaveformViewerPart implements IFileChangeListener, IPreferenceChang
|
|||
myParent.setFocus();
|
||||
}
|
||||
|
||||
|
||||
@PersistState
|
||||
public void saveState(MPart part) {
|
||||
// save changes
|
||||
Map<String, String> persistedState = part.getPersistedState();
|
||||
persistedState.put(DATABASE_FILE+"S", Integer.toString(filesToLoad.size()));
|
||||
Integer index=0;
|
||||
for(File file:filesToLoad){
|
||||
persistedState.put(DATABASE_FILE+index, file.getAbsolutePath());
|
||||
persistedState.put(DATABASE_FILE + "S", Integer.toString(filesToLoad.size()));
|
||||
Integer index = 0;
|
||||
for (File file : filesToLoad) {
|
||||
persistedState.put(DATABASE_FILE + index, file.getAbsolutePath());
|
||||
index++;
|
||||
}
|
||||
saveWaveformViewerState(persistedState);
|
||||
|
@ -336,17 +352,17 @@ public class WaveformViewerPart implements IFileChangeListener, IPreferenceChang
|
|||
|
||||
protected void saveWaveformViewerState(Map<String, String> persistedState) {
|
||||
Integer index;
|
||||
persistedState.put(SHOWN_WAVEFORM+"S", Integer.toString(waveformPane.getStreamList().size()));
|
||||
index=0;
|
||||
for(TrackEntry trackEntry:waveformPane.getStreamList()){
|
||||
persistedState.put(SHOWN_WAVEFORM+index, trackEntry.waveform.getFullName());
|
||||
persistedState.put(SHOWN_WAVEFORM + "S", Integer.toString(waveformPane.getStreamList().size()));
|
||||
index = 0;
|
||||
for (TrackEntry trackEntry : waveformPane.getStreamList()) {
|
||||
persistedState.put(SHOWN_WAVEFORM + index, trackEntry.waveform.getFullName());
|
||||
index++;
|
||||
}
|
||||
List<ICursor> cursors = waveformPane.getCursorList();
|
||||
persistedState.put(SHOWN_CURSOR+"S", Integer.toString(cursors.size()));
|
||||
index=0;
|
||||
for(ICursor cursor:cursors){
|
||||
persistedState.put(SHOWN_CURSOR+index, Long.toString(cursor.getTime()));
|
||||
persistedState.put(SHOWN_CURSOR + "S", Integer.toString(cursors.size()));
|
||||
index = 0;
|
||||
for (ICursor cursor : cursors) {
|
||||
persistedState.put(SHOWN_CURSOR + index, Long.toString(cursor.getTime()));
|
||||
index++;
|
||||
}
|
||||
persistedState.put(ZOOM_LEVEL, Integer.toString(waveformPane.getZoomLevel()));
|
||||
|
@ -354,54 +370,57 @@ public class WaveformViewerPart implements IFileChangeListener, IPreferenceChang
|
|||
|
||||
protected void restoreWaveformViewerState(Map<String, String> state) {
|
||||
updateAll();
|
||||
Integer waves = state.containsKey(SHOWN_WAVEFORM+"S")?Integer.parseInt(state.get(SHOWN_WAVEFORM+"S")):0;
|
||||
Integer waves = state.containsKey(SHOWN_WAVEFORM + "S") ? Integer.parseInt(state.get(SHOWN_WAVEFORM + "S")) : 0;
|
||||
List<TrackEntry> res = new LinkedList<>();
|
||||
for(int i=0; i<waves;i++){
|
||||
IWaveform<? extends IWaveformEvent> waveform = database.getStreamByName(state.get(SHOWN_WAVEFORM+i));
|
||||
if(waveform!=null) res.add(new TrackEntry(waveform));
|
||||
for (int i = 0; i < waves; i++) {
|
||||
IWaveform<? extends IWaveformEvent> waveform = database.getStreamByName(state.get(SHOWN_WAVEFORM + i));
|
||||
if (waveform != null)
|
||||
res.add(new TrackEntry(waveform));
|
||||
}
|
||||
if(res.size()>0) waveformPane.getStreamList().addAll(res);
|
||||
Integer cursorLength = state.containsKey(SHOWN_CURSOR+"S")?Integer.parseInt(state.get(SHOWN_CURSOR+"S")):0;
|
||||
if (res.size() > 0)
|
||||
waveformPane.getStreamList().addAll(res);
|
||||
Integer cursorLength = state.containsKey(SHOWN_CURSOR + "S") ? Integer.parseInt(state.get(SHOWN_CURSOR + "S"))
|
||||
: 0;
|
||||
List<ICursor> cursors = waveformPane.getCursorList();
|
||||
if(cursorLength==cursors.size()){
|
||||
for(int i=0; i<cursorLength;i++){
|
||||
Long time = Long.parseLong(state.get(SHOWN_CURSOR+i));
|
||||
if (cursorLength == cursors.size()) {
|
||||
for (int i = 0; i < cursorLength; i++) {
|
||||
Long time = Long.parseLong(state.get(SHOWN_CURSOR + i));
|
||||
cursors.get(i).setTime(time);
|
||||
}
|
||||
}
|
||||
if(state.containsKey(ZOOM_LEVEL)){
|
||||
if (state.containsKey(ZOOM_LEVEL)) {
|
||||
try {
|
||||
Integer scale = Integer.parseInt(state.get(ZOOM_LEVEL));
|
||||
waveformPane.setZoomLevel(scale);
|
||||
} catch(NumberFormatException e){}
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateAll() {
|
||||
eventBroker.post(ACTIVE_WAVEFORMVIEW, this);
|
||||
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[waveformPane.getZoomLevel()]);
|
||||
long cursor=waveformPane.getCursorTime();
|
||||
long marker=waveformPane.getSelectedMarkerTime();
|
||||
long cursor = waveformPane.getCursorTime();
|
||||
long marker = waveformPane.getSelectedMarkerTime();
|
||||
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, waveformPane.getScaledTime(cursor));
|
||||
eventBroker.post(WaveStatusBarControl.MARKER_TIME, waveformPane.getScaledTime(marker));
|
||||
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(cursor-marker));
|
||||
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(cursor - marker));
|
||||
}
|
||||
|
||||
@Inject @Optional
|
||||
@Inject
|
||||
@Optional
|
||||
public void getAddWaveformEvent(@UIEventTopic(WaveformViewerPart.ADD_WAVEFORM) Object o) {
|
||||
Object sel = o==null?selectionService.getSelection():o;
|
||||
if(sel instanceof IStructuredSelection)
|
||||
for(Object el:((IStructuredSelection)sel).toArray()){
|
||||
if(el instanceof IWaveform<?>)
|
||||
Object sel = o == null ? selectionService.getSelection() : o;
|
||||
if (sel instanceof IStructuredSelection)
|
||||
for (Object el : ((IStructuredSelection) sel).toArray()) {
|
||||
if (el instanceof IWaveform<?>)
|
||||
addStreamToList((IWaveform<?>) el, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected boolean askIfToLoad(File txFile) {
|
||||
if(txFile.exists() &&
|
||||
MessageDialog.openQuestion(myParent.getDisplay().getActiveShell(), "Database open",
|
||||
"Would you like to open the adjacent database "+txFile.getName()+" as well?")){
|
||||
if (txFile.exists() && MessageDialog.openQuestion(myParent.getDisplay().getActiveShell(), "Database open",
|
||||
"Would you like to open the adjacent database " + txFile.getName() + " as well?")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -410,10 +429,10 @@ public class WaveformViewerPart implements IFileChangeListener, IPreferenceChang
|
|||
protected static String renameFileExtension(String source, String newExt) {
|
||||
String target;
|
||||
String currentExt = getFileExtension(source);
|
||||
if (currentExt.equals("")){
|
||||
target=source+"."+newExt;
|
||||
if (currentExt.equals("")) {
|
||||
target = source + "." + newExt;
|
||||
} else {
|
||||
target=source.replaceFirst(Pattern.quote("."+currentExt)+"$", Matcher.quoteReplacement("."+newExt));
|
||||
target = source.replaceFirst(Pattern.quote("." + currentExt) + "$", Matcher.quoteReplacement("." + newExt));
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
@ -435,34 +454,35 @@ public class WaveformViewerPart implements IFileChangeListener, IPreferenceChang
|
|||
return database;
|
||||
}
|
||||
|
||||
public void addStreamToList(IWaveform<? extends IWaveformEvent> obj, boolean insert){
|
||||
addStreamsToList(new IWaveform<?>[]{obj}, insert);
|
||||
public void addStreamToList(IWaveform<? extends IWaveformEvent> obj, boolean insert) {
|
||||
addStreamsToList(new IWaveform<?>[] { obj }, insert);
|
||||
}
|
||||
|
||||
public void addStreamsToList(IWaveform<? extends IWaveformEvent>[] iWaveforms, boolean insert){
|
||||
List<TrackEntry> streams= new LinkedList<>();
|
||||
for(IWaveform<? extends IWaveformEvent> stream:iWaveforms)
|
||||
public void addStreamsToList(IWaveform<? extends IWaveformEvent>[] iWaveforms, boolean insert) {
|
||||
List<TrackEntry> streams = new LinkedList<>();
|
||||
for (IWaveform<? extends IWaveformEvent> stream : iWaveforms)
|
||||
streams.add(new TrackEntry(stream));
|
||||
IStructuredSelection selection = (IStructuredSelection) waveformPane.getSelection();
|
||||
if(selection.size()==0){
|
||||
if (selection.size() == 0) {
|
||||
waveformPane.getStreamList().addAll(streams);
|
||||
}else {
|
||||
Object first=selection.getFirstElement();
|
||||
IWaveform<?> stream = (first instanceof ITx)?((ITx)first).getStream():(IWaveform<?>)first;
|
||||
TrackEntry trackEntry=waveformPane.getEntryForStream(stream);
|
||||
} else {
|
||||
Object first = selection.getFirstElement();
|
||||
IWaveform<?> stream = (first instanceof ITx) ? ((ITx) first).getStream() : (IWaveform<?>) first;
|
||||
TrackEntry trackEntry = waveformPane.getEntryForStream(stream);
|
||||
int index = waveformPane.getStreamList().indexOf(trackEntry);
|
||||
if(!insert) index++;
|
||||
if (!insert)
|
||||
index++;
|
||||
waveformPane.getStreamList().addAll(index, streams);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeStreamFromList(IWaveform<? extends IWaveformEvent> stream){
|
||||
TrackEntry trackEntry=waveformPane.getEntryForStream(stream);
|
||||
public void removeStreamFromList(IWaveform<? extends IWaveformEvent> stream) {
|
||||
TrackEntry trackEntry = waveformPane.getEntryForStream(stream);
|
||||
waveformPane.getStreamList().remove(trackEntry);
|
||||
}
|
||||
|
||||
public void removeStreamsFromList(IWaveform<? extends IWaveformEvent>[] iWaveforms){
|
||||
for(IWaveform<? extends IWaveformEvent> stream:iWaveforms)
|
||||
public void removeStreamsFromList(IWaveform<? extends IWaveformEvent>[] iWaveforms) {
|
||||
for (IWaveform<? extends IWaveformEvent> stream : iWaveforms)
|
||||
removeStreamFromList(stream);
|
||||
}
|
||||
|
||||
|
@ -475,17 +495,22 @@ public class WaveformViewerPart implements IFileChangeListener, IPreferenceChang
|
|||
}
|
||||
|
||||
public void moveCursor(GotoDirection direction) {
|
||||
waveformPane.moveCursor(direction); }
|
||||
waveformPane.moveCursor(direction);
|
||||
}
|
||||
|
||||
public void setZoomLevel(Integer level) {
|
||||
if(level<0) level=0;
|
||||
if(level>zoomLevel.length-1) level=zoomLevel.length-1;
|
||||
if (level < 0)
|
||||
level = 0;
|
||||
if (level > zoomLevel.length - 1)
|
||||
level = zoomLevel.length - 1;
|
||||
waveformPane.setZoomLevel(level);
|
||||
updateAll(); }
|
||||
updateAll();
|
||||
}
|
||||
|
||||
public void setZoomFit() {
|
||||
waveformPane.setZoomLevel(6);
|
||||
updateAll(); }
|
||||
updateAll();
|
||||
}
|
||||
|
||||
public int getZoomLevel() {
|
||||
return waveformPane.getZoomLevel();
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench">
|
||||
<booleanAttribute key="append.args" value="true"/>
|
||||
<stringAttribute key="application" value="org.eclipse.e4.ui.workbench.swt.E4Application"/>
|
||||
<booleanAttribute key="askclear" value="true"/>
|
||||
<booleanAttribute key="askclear" value="false"/>
|
||||
<booleanAttribute key="automaticAdd" value="false"/>
|
||||
<booleanAttribute key="automaticValidate" value="false"/>
|
||||
<stringAttribute key="bootstrap" value=""/>
|
||||
<stringAttribute key="checked" value="[NONE]"/>
|
||||
<booleanAttribute key="clearConfig" value="false"/>
|
||||
<booleanAttribute key="clearws" value="false"/>
|
||||
<booleanAttribute key="clearws" value="true"/>
|
||||
<booleanAttribute key="clearwslog" value="false"/>
|
||||
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/SCViewer"/>
|
||||
<booleanAttribute key="default" value="false"/>
|
||||
|
@ -22,7 +22,7 @@
|
|||
<stringAttribute key="pde.version" value="3.3"/>
|
||||
<stringAttribute key="product" value="com.minres.scviewer.e4.application.product"/>
|
||||
<stringAttribute key="productFile" value="/com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.product"/>
|
||||
<stringAttribute key="selected_target_plugins" value="com.google.guava@default:default,com.ibm.icu@default:default,javax.annotation@default:default,javax.inject@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.batik.css@default:default,org.apache.batik.util.gui@default:default,org.apache.batik.util@default:default,org.apache.commons.jxpath@default:default,org.apache.commons.logging@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.codehaus.groovy@default:default,org.eclipse.ant.core@default:default,org.eclipse.compare.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.java7@default:false,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.e4.core.commands@default:default,org.eclipse.e4.core.contexts@default:default,org.eclipse.e4.core.di.annotations@default:default,org.eclipse.e4.core.di.extensions@default:default,org.eclipse.e4.core.di@default:default,org.eclipse.e4.core.services@default:default,org.eclipse.e4.emf.xpath@default:default,org.eclipse.e4.ui.bindings@default:default,org.eclipse.e4.ui.css.core@default:default,org.eclipse.e4.ui.css.swt.theme@default:default,org.eclipse.e4.ui.css.swt@default:default,org.eclipse.e4.ui.di@default:default,org.eclipse.e4.ui.model.workbench@default:default,org.eclipse.e4.ui.services@default:default,org.eclipse.e4.ui.widgets@default:default,org.eclipse.e4.ui.workbench.addons.swt@default:default,org.eclipse.e4.ui.workbench.renderers.swt.cocoa@default:false,org.eclipse.e4.ui.workbench.renderers.swt@default:default,org.eclipse.e4.ui.workbench.swt@default:default,org.eclipse.e4.ui.workbench3@default:default,org.eclipse.e4.ui.workbench@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.bidi@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.concurrent@default:default,org.eclipse.equinox.console@default:default,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.help@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface.text@default:default,org.eclipse.jface@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.eclipse.swt@default:default,org.eclipse.team.core@default:default,org.eclipse.text@default:default,org.eclipse.ui.cocoa@default:false,org.eclipse.ui.console@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui@default:default,org.hamcrest.core@default:default,org.junit@default:default,org.w3c.css.sac@default:default,org.w3c.dom.events@default:default,org.w3c.dom.smil@default:default,org.w3c.dom.svg@default:default"/>
|
||||
<stringAttribute key="selected_target_plugins" value="com.google.guava@default:default,com.ibm.icu@default:default,javax.annotation@default:default,javax.inject@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.batik.css@default:default,org.apache.batik.util.gui@default:default,org.apache.batik.util@default:default,org.apache.commons.jxpath@default:default,org.apache.commons.logging@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.codehaus.groovy@default:default,org.eclipse.ant.core@default:default,org.eclipse.compare.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.java7@default:false,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.e4.core.commands@default:default,org.eclipse.e4.core.contexts@default:default,org.eclipse.e4.core.di.annotations@default:default,org.eclipse.e4.core.di.extensions@default:default,org.eclipse.e4.core.di@default:default,org.eclipse.e4.core.services@default:default,org.eclipse.e4.emf.xpath@default:default,org.eclipse.e4.ui.bindings@default:default,org.eclipse.e4.ui.css.core@default:default,org.eclipse.e4.ui.css.swt.theme@default:default,org.eclipse.e4.ui.css.swt@default:default,org.eclipse.e4.ui.di@default:default,org.eclipse.e4.ui.model.workbench@default:default,org.eclipse.e4.ui.services@default:default,org.eclipse.e4.ui.widgets@default:default,org.eclipse.e4.ui.workbench.addons.swt@default:default,org.eclipse.e4.ui.workbench.renderers.swt.cocoa@default:false,org.eclipse.e4.ui.workbench.renderers.swt@default:default,org.eclipse.e4.ui.workbench.swt@default:default,org.eclipse.e4.ui.workbench3@default:default,org.eclipse.e4.ui.workbench@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.bidi@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.concurrent@default:default,org.eclipse.equinox.console@default:default,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.help@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface.text@default:default,org.eclipse.jface@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.eclipse.swt@default:default,org.eclipse.team.core@default:default,org.eclipse.text@default:default,org.hamcrest.core@default:default,org.junit@default:default,org.w3c.css.sac@default:default,org.w3c.dom.events@default:default,org.w3c.dom.smil@default:default,org.w3c.dom.svg@default:default"/>
|
||||
<stringAttribute key="selected_workspace_plugins" value="com.minres.scviewer.database.sqlite@default:default,com.minres.scviewer.database.text@default:default,com.minres.scviewer.database.ui.swt@default:default,com.minres.scviewer.database.ui@default:default,com.minres.scviewer.database.vcd@default:default,com.minres.scviewer.database@default:default,com.minres.scviewer.e4.application@default:default,com.opcoach.e4.preferences@default:default"/>
|
||||
<booleanAttribute key="show_selected_only" value="false"/>
|
||||
<booleanAttribute key="tracing" value="false"/>
|
||||
|
|
Loading…
Reference in New Issue