diff --git a/com.minres.scviewer.database.swt/src/org/eclipse/wb/swt/SWTResourceManager.java b/com.minres.scviewer.database.swt/src/org/eclipse/wb/swt/SWTResourceManager.java
index 20a9264..8b6d4cc 100644
--- a/com.minres.scviewer.database.swt/src/org/eclipse/wb/swt/SWTResourceManager.java
+++ b/com.minres.scviewer.database.swt/src/org/eclipse/wb/swt/SWTResourceManager.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2015 MINRES Technologies GmbH and others.
+ * Copyright (c) 2011 Google, Inc.
* 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
+ * Google, Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.wb.swt;
diff --git a/com.minres.scviewer.database.test/DatabaseServicesTest.launch b/com.minres.scviewer.database.test/DatabaseServicesTest.launch
new file mode 100644
index 0000000..8a79ccd
--- /dev/null
+++ b/com.minres.scviewer.database.test/DatabaseServicesTest.launch
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/com.minres.scviewer.database.test/META-INF/MANIFEST.MF b/com.minres.scviewer.database.test/META-INF/MANIFEST.MF
index 2995fbb..30928c6 100644
--- a/com.minres.scviewer.database.test/META-INF/MANIFEST.MF
+++ b/com.minres.scviewer.database.test/META-INF/MANIFEST.MF
@@ -11,3 +11,4 @@ Require-Bundle: org.junit,
com.minres.scviewer.database.text;bundle-version="1.0.0",
com.minres.scviewer.database.vcd;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy
+Service-Component: OSGI-INF/component.xml
diff --git a/com.minres.scviewer.database.test/OSGI-INF/component.xml b/com.minres.scviewer.database.test/OSGI-INF/component.xml
new file mode 100644
index 0000000..7ebc679
--- /dev/null
+++ b/com.minres.scviewer.database.test/OSGI-INF/component.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/com.minres.scviewer.database.test/build.properties b/com.minres.scviewer.database.test/build.properties
index 9066d9d..e310bbc 100644
--- a/com.minres.scviewer.database.test/build.properties
+++ b/com.minres.scviewer.database.test/build.properties
@@ -1,13 +1,4 @@
-###############################################################################
-# Copyright (c) 2014, 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
-###############################################################################
bin.includes = META-INF/,\
- .
+ .,\
+ OSGI-INF/component.xml
source.. = src/
diff --git a/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java b/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java
index e15c231..30b2219 100644
--- a/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java
+++ b/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java
@@ -21,20 +21,36 @@ import org.junit.Before;
import org.junit.Test;
import com.minres.scviewer.database.IWaveformDb;
-import com.minres.scviewer.database.internal.WaveformDb;
+import com.minres.scviewer.database.IWaveformDbFactory;
public class DatabaseServicesTest {
+
+ private static IWaveformDbFactory waveformDbFactory;
+
+ private IWaveformDb waveformDb;
+
+ public synchronized void setFactory(IWaveformDbFactory service) {
+ waveformDbFactory = service;
+ }
+
+ public synchronized void unsetFactory(IWaveformDbFactory service) {
+ if (waveformDbFactory == service) {
+ waveformDbFactory = null;
+ }
+ }
+
@Before
public void setUp() throws Exception {
+ waveformDb=waveformDbFactory.getDatabase();
// Wait for OSGi dependencies
- for (int i = 0; i < 10; i++) {
- if (WaveformDb.getLoaders().size() == 3) // Dependencies fulfilled
- return;
- Thread.sleep(1000);
- }
- assertEquals("OSGi dependencies unfulfilled", 3, WaveformDb.getLoaders().size());
- }
+// for (int i = 0; i < 10; i++) {
+// if (waveformDb.size() == 3) // Dependencies fulfilled
+// return;
+// Thread.sleep(1000);
+// }
+// assertEquals("OSGi dependencies unfulfilled", 3, WaveformDb.getLoaders().size());
+ }
@After
public void tearDown() throws Exception {
@@ -44,33 +60,30 @@ public class DatabaseServicesTest {
public void testVCD() throws Exception {
File f = new File("inputs/my_db.vcd").getAbsoluteFile();
assertTrue(f.exists());
- IWaveformDb database=new WaveformDb();
- database.load(f);
- assertNotNull(database);
- assertEquals(14, database.getAllWaves().size());
- assertEquals(2, database.getChildNodes().size());
+ waveformDb.load(f);
+ assertNotNull(waveformDb);
+ assertEquals(14, waveformDb.getAllWaves().size());
+ assertEquals(2, waveformDb.getChildNodes().size());
}
@Test
public void testTxSQLite() throws Exception {
File f = new File("inputs/my_db.txdb").getAbsoluteFile();
assertTrue(f.exists());
- IWaveformDb database=new WaveformDb();
- database.load(f);
- assertNotNull(database);
- assertEquals(3, database.getAllWaves().size());
- assertEquals(1, database.getChildNodes().size());
+ waveformDb.load(f);
+ assertNotNull(waveformDb);
+ assertEquals(3, waveformDb.getAllWaves().size());
+ assertEquals(1, waveformDb.getChildNodes().size());
}
@Test
public void testTxText() throws Exception {
File f = new File("inputs/my_db.txlog").getAbsoluteFile();
assertTrue(f.exists());
- IWaveformDb database=new WaveformDb();
- database.load(f);
- assertNotNull(database);
- assertEquals(3, database.getAllWaves().size());
- assertEquals(1, database.getChildNodes().size());
+ waveformDb.load(f);
+ assertNotNull(waveformDb);
+ assertEquals(3, waveformDb.getAllWaves().size());
+ assertEquals(1, waveformDb.getChildNodes().size());
}
diff --git a/com.minres.scviewer.e4.application/Application.e4xmi b/com.minres.scviewer.e4.application/Application.e4xmi
index 3dd80be..b06a5d1 100644
--- a/com.minres.scviewer.e4.application/Application.e4xmi
+++ b/com.minres.scviewer.e4.application/Application.e4xmi
@@ -98,15 +98,13 @@
-
-
-
- glue
- move_after:PerspectiveSpacer
- SHOW_RESTORE_MENU
+
+ stretch
-
+
+ Draggable
+
diff --git a/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF b/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF
index fe3be3e..43bab36 100644
--- a/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF
+++ b/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF
@@ -23,7 +23,8 @@ Require-Bundle: javax.inject;bundle-version="1.0.0",
org.eclipse.osgi.services;bundle-version="3.5.0",
org.eclipse.core.jobs,
org.eclipse.osgi,
- com.google.guava
+ com.google.guava,
+ org.eclipse.equinox.preferences
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: com.minres.scviewer.database,
javax.inject;version="1.0.0"
diff --git a/com.minres.scviewer.e4.application/icons/append_all_waves.png b/com.minres.scviewer.e4.application/icons/append_all_waves.png
new file mode 100644
index 0000000..8a4698d
Binary files /dev/null and b/com.minres.scviewer.e4.application/icons/append_all_waves.png differ
diff --git a/com.minres.scviewer.e4.application/icons/append_wave.png b/com.minres.scviewer.e4.application/icons/append_wave.png
new file mode 100644
index 0000000..cea9636
Binary files /dev/null and b/com.minres.scviewer.e4.application/icons/append_wave.png differ
diff --git a/com.minres.scviewer.e4.application/icons/insert_all_waves.png b/com.minres.scviewer.e4.application/icons/insert_all_waves.png
new file mode 100644
index 0000000..70950db
Binary files /dev/null and b/com.minres.scviewer.e4.application/icons/insert_all_waves.png differ
diff --git a/com.minres.scviewer.e4.application/icons/insert_wave.png b/com.minres.scviewer.e4.application/icons/insert_wave.png
new file mode 100644
index 0000000..aa3efdc
Binary files /dev/null and b/com.minres.scviewer.e4.application/icons/insert_wave.png differ
diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/HeapStatus.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/HeapStatus.java
index d591d93..a1c6d72 100644
--- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/HeapStatus.java
+++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/HeapStatus.java
@@ -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.osgi.service.prefs.Preferences;
/**
* The Heap Status control, which shows the heap usage statistics in the window trim.
@@ -46,7 +47,7 @@ public class HeapStatus extends Composite {
private Image disabledGcImage;
private Color bgCol, usedMemCol, lowMemCol, freeMemCol, topLeftCol, bottomRightCol, sepCol, textCol, markCol, armCol;
private Canvas button;
- private IEclipsePreferences prefStore;
+ private Preferences preferences;
private int updateInterval;
private boolean showMax;
private long totalMem;
@@ -86,10 +87,10 @@ public class HeapStatus extends Composite {
@Override
public void preferenceChange(PreferenceChangeEvent event) {
if (IHeapStatusConstants.PREF_UPDATE_INTERVAL.equals(event.getKey())) {
- setUpdateIntervalInMS(prefStore.getInt(IHeapStatusConstants.PREF_UPDATE_INTERVAL, 100));
+ setUpdateIntervalInMS(preferences.getInt(IHeapStatusConstants.PREF_UPDATE_INTERVAL, 100));
}
else if (IHeapStatusConstants.PREF_SHOW_MAX.equals(event.getKey())) {
- showMax = prefStore.getBoolean(IHeapStatusConstants.PREF_SHOW_MAX, true);
+ showMax = preferences.getBoolean(IHeapStatusConstants.PREF_SHOW_MAX, true);
}
}
@@ -103,14 +104,15 @@ public class HeapStatus extends Composite {
* @param parent the parent composite
* @param preferences the preference store
*/
- public HeapStatus(Composite parent, IEclipsePreferences preferences) {
+ public HeapStatus(Composite parent, Preferences preferences) {
super(parent, SWT.NONE);
maxMem = getMaxMem();
maxMemKnown = maxMem != Long.MAX_VALUE;
- this.prefStore = preferences;
- preferences.addPreferenceChangeListener(prefListener);
+ this.preferences = preferences;
+ if(this.preferences instanceof IEclipsePreferences)
+ ((IEclipsePreferences)this.preferences).addPreferenceChangeListener(prefListener);
setUpdateIntervalInMS(preferences.getInt(IHeapStatusConstants.PREF_UPDATE_INTERVAL, 100));
showMax = preferences.getBoolean(IHeapStatusConstants.PREF_SHOW_MAX, true);
@@ -263,7 +265,8 @@ public class HeapStatus extends Composite {
}
private void doDispose() {
- prefStore.removePreferenceChangeListener(prefListener);
+ if(preferences instanceof IEclipsePreferences)
+ ((IEclipsePreferences)preferences).removePreferenceChangeListener(prefListener);
if (gcImage != null) {
gcImage.dispose();
}
@@ -591,7 +594,7 @@ public class HeapStatus extends Composite {
@Override
public void run() {
- prefStore.putBoolean(IHeapStatusConstants.PREF_SHOW_MAX, isChecked());
+ preferences.putBoolean(IHeapStatusConstants.PREF_SHOW_MAX, isChecked());
redraw();
}
}
diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/StatusBarControl.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/StatusBarControl.java
index 8c523e4..38fde61 100644
--- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/StatusBarControl.java
+++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/StatusBarControl.java
@@ -14,20 +14,23 @@ import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
-import org.eclipse.core.internal.preferences.BundleDefaultPreferences;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.core.runtime.jobs.ProgressProvider;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.di.UIEventTopic;
import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.e4.ui.model.application.ui.menu.MToolControl;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.jface.action.StatusLineManager;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.ProgressBar;
+import org.osgi.service.prefs.PreferencesService;
public class StatusBarControl {
@@ -36,12 +39,15 @@ public class StatusBarControl {
public static final String CURSOR_TIME="CursorPosUpdate";
@Inject EModelService modelService;
- @Inject @Optional IEclipsePreferences preferences;
+
+ @Inject @Optional PreferencesService osgiPreverences;
+
private final UISynchronize sync;
protected StatusLineManager manager;
private SyncedProgressMonitor monitor;
+ private ProgressBar progressBar;
@Inject
public StatusBarControl(UISynchronize sync) {
@@ -74,8 +80,11 @@ public class StatusBarControl {
* @param toolControl
*/
private void createProgressBar(Composite parent, MToolControl toolControl) {
- manager.createControl(parent);
- monitor=new SyncedProgressMonitor(manager.getProgressMonitor());
+ new Label(parent, SWT.NONE);
+ progressBar = new ProgressBar(parent, SWT.SMOOTH);
+ progressBar.setBounds(100, 10, 200, 20);
+ new Label(parent, SWT.NONE);
+ monitor=new SyncedProgressMonitor(progressBar);
Job.getJobManager().setProgressProvider(new ProgressProvider() {
@Override
public IProgressMonitor createMonitor(Job job) {
@@ -89,12 +98,7 @@ public class StatusBarControl {
* @param toolControl
*/
private void createHeapStatus(Composite parent, MToolControl toolControl) {
- if(preferences==null){
- preferences=new BundleDefaultPreferences();
- preferences.putInt(IHeapStatusConstants.PREF_UPDATE_INTERVAL, 100);
- preferences.putBoolean(IHeapStatusConstants.PREF_SHOW_MAX, true);
- }
- new HeapStatus(parent, preferences);
+ new HeapStatus(parent, osgiPreverences.getSystemPreferences());
}
/**
@@ -113,26 +117,19 @@ public class StatusBarControl {
}
}
- private final class SyncedProgressMonitor implements IProgressMonitor {
+ private final class SyncedProgressMonitor extends NullProgressMonitor {
- IProgressMonitor delegate;
- private boolean cancelled;
+ // thread-Safe via thread confinement of the UI-Thread
+ // (means access only via UI-Thread)
+ private long runningTasks = 0L;
+ private ProgressBar progressBar;
- SyncedProgressMonitor(IProgressMonitor delegate){
- this.delegate=delegate;
- }
-
- public IProgressMonitor addJob(Job job){
- if(job != null){
- job.addJobChangeListener(new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- // clean-up
- event.getJob().removeJobChangeListener(this);
- }
- });
- }
- return this;
+ public SyncedProgressMonitor(ProgressBar progressBar) {
+ super();
+ this.progressBar = progressBar;
+ runningTasks=0;
+ progressBar.setSelection(0);
+ progressBar.setEnabled(false);
}
@Override
@@ -140,7 +137,15 @@ public class StatusBarControl {
sync.syncExec(new Runnable() {
@Override
public void run() {
- delegate.beginTask(name, totalWork);
+ if(runningTasks <= 0) { // --- no task is running at the moment ---
+ progressBar.setEnabled(false);
+ progressBar.setSelection(0);
+ progressBar.setMaximum(totalWork);
+ } else { // --- other tasks are running ---
+ progressBar.setMaximum(progressBar.getMaximum() + totalWork);
+ }
+ runningTasks++;
+ progressBar.setToolTipText("Currently running: " + runningTasks + "\nLast task: " + name);
}
});
}
@@ -150,7 +155,7 @@ public class StatusBarControl {
sync.syncExec(new Runnable() {
@Override
public void run() {
- delegate.worked(work);
+ progressBar.setSelection(progressBar.getSelection() + work);
}
});
}
@@ -160,21 +165,13 @@ public class StatusBarControl {
sync.syncExec(new Runnable() {
@Override
public void run() {
- delegate.done();
+ progressBar.setSelection(0);
+ progressBar.setMaximum(1);
+ progressBar.setEnabled(false);
}
});
}
-
- @Override
- public void internalWorked(final double work) {
- sync.syncExec(new Runnable() {
- @Override
- public void run() {
- delegate.internalWorked(work);
- }
- });
- }
-
+/*
@Override
public boolean isCanceled() {
sync.syncExec(new Runnable() {
@@ -195,25 +192,30 @@ public class StatusBarControl {
}
});
}
+*/
+ public IProgressMonitor addJob(Job job){
+ if(job != null){
+ job.addJobChangeListener(new JobChangeAdapter() {
+ @Override
+ public void done(IJobChangeEvent event) {
+ sync.syncExec(new Runnable() {
- @Override
- public void setTaskName(final String name) {
- sync.syncExec(new Runnable() {
- @Override
- public void run() {
- delegate.setTaskName(name);
- }
- });
- }
-
- @Override
- public void subTask(final String name) {
- sync.syncExec(new Runnable() {
- @Override
- public void run() {
- delegate.subTask(name);
- }
- });
+ @Override
+ public void run() {
+ runningTasks--;
+ if (runningTasks > 0){ // --- some tasks are still running ---
+ progressBar.setToolTipText("Currently running: " + runningTasks);
+ } else { // --- all tasks are done (a reset of selection could also be done) ---
+ progressBar.setToolTipText("No background progress running.");
+ }
+ }
+ });
+ // clean-up
+ event.getJob().removeJobChangeListener(this);
+ }
+ });
+ }
+ return this;
}
}
}
\ No newline at end of file
diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/WaveStatusBarControl.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/WaveStatusBarControl.java
index 6611a5a..344b5df 100644
--- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/WaveStatusBarControl.java
+++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/WaveStatusBarControl.java
@@ -82,8 +82,8 @@ public class WaveStatusBarControl extends StatusBarControl {
super(sync);
zoomContribution = new TextContributionItem("Z:", 150);
cursorContribution = new TextContributionItem("C:", 120);
- manager.appendToGroup(StatusLineManager.BEGIN_GROUP,cursorContribution);
- manager.appendToGroup(StatusLineManager.MIDDLE_GROUP, zoomContribution);
+ manager.prependToGroup(StatusLineManager.BEGIN_GROUP,cursorContribution);
+ manager.appendToGroup(StatusLineManager.BEGIN_GROUP, zoomContribution);
}
@Inject
diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformListPart.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformListPart.java
index 172f312..429d713 100644
--- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformListPart.java
+++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformListPart.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package com.minres.scviewer.e4.application.parts;
+import java.util.Arrays;
+
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
@@ -18,10 +20,13 @@ 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.di.UIEventTopic;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
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.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableViewer;
@@ -53,9 +58,10 @@ public class WaveformListPart implements ISelectionChangedListener {
private Text nameFilter;
private TableViewer txTableViewer;
- ToolItem appendItem, insertItem;
+ ToolItem appendItem, insertItem, insertAllItem, appendAllItem;
WaveformAttributeFilter attributeFilter;
-
+ int thisSelectionCount=0, otherSelectionCount=0;
+
@PostConstruct
public void createComposite(Composite parent) {
parent.setLayout(new GridLayout(1, false));
@@ -66,11 +72,12 @@ public class WaveformListPart implements ISelectionChangedListener {
@Override
public void modifyText(ModifyEvent e) {
attributeFilter.setSearchText(((Text) e.widget).getText());
+ updateButtons();
txTableViewer.refresh();
}
});
nameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
+
attributeFilter = new WaveformAttributeFilter();
txTableViewer = new TableViewer(parent);
@@ -79,14 +86,27 @@ public class WaveformListPart implements ISelectionChangedListener {
txTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
txTableViewer.addSelectionChangedListener(this);
txTableViewer.addFilter(attributeFilter);
-
+
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("Append selected");
+ appendItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_wave.png"));
+ appendItem.setEnabled(false);
+ appendItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ eventBroker.post(WaveformViewerPart.ADD_WAVEFORM,
+ ((IStructuredSelection)txTableViewer.getSelection()).toList());
+
+ }
+ });
+
insertItem = new ToolItem(toolBar, SWT.NONE);
- insertItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/bullet_plus.png"));
- insertItem.setText("Insert");
+ insertItem.setToolTipText("Insert selected");
+ insertItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_wave.png"));
insertItem.setEnabled(false);
insertItem.addSelectionListener(new SelectionAdapter() {
@Override
@@ -96,15 +116,33 @@ public class WaveformListPart implements ISelectionChangedListener {
}
});
- appendItem = new ToolItem(toolBar, SWT.NONE);
- appendItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/bullet_plus.png"));
- appendItem.setText("Append");
- appendItem.setEnabled(false);
- appendItem.addSelectionListener(new SelectionAdapter() {
+ new ToolItem(toolBar, SWT.SEPARATOR);
+
+ appendAllItem = new ToolItem(toolBar, SWT.NONE);
+ appendAllItem.setToolTipText("Append all");
+ appendAllItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_all_waves.png"));
+ appendAllItem.setEnabled(false);
+
+ new ToolItem(toolBar, SWT.SEPARATOR);
+ appendAllItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- eventBroker.post(WaveformViewerPart.ADD_WAVEFORM,
- ((IStructuredSelection)txTableViewer.getSelection()).toList());
+ Object[] all = getFilteredChildren(txTableViewer);
+ if(all.length>0)
+ eventBroker.post(WaveformViewerPart.ADD_WAVEFORM, Arrays.asList(all));
+
+ }
+ });
+ insertAllItem = new ToolItem(toolBar, SWT.NONE);
+ insertAllItem.setToolTipText("Insert all");
+ insertAllItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_all_waves.png"));
+ insertAllItem.setEnabled(false);
+ insertAllItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Object[] all = getFilteredChildren(txTableViewer);
+ if(all.length>0)
+ eventBroker.post(WaveformViewerPart.ADD_WAVEFORM, Arrays.asList(all));
}
});
@@ -119,6 +157,7 @@ public class WaveformListPart implements ISelectionChangedListener {
@Inject @Optional
public void getStatusEvent(@UIEventTopic(WaveformViewerPart.ACTIVE_NODE) Object o) {
txTableViewer.setInput(o);
+ updateButtons();
}
@Override
@@ -131,50 +170,79 @@ public class WaveformListPart implements ISelectionChangedListener {
switch(selection.size()){
case 0:
appendItem.setEnabled(false);
- insertItem.setEnabled(false);
break;
case 1:
selectionService.setSelection(selection.getFirstElement());
- appendItem.setEnabled(true);
break;
default:
selectionService.setSelection(selection.toList());
- appendItem.setEnabled(true);
break;
}
+ thisSelectionCount=selection.toList().size();
+ updateButtons();
}
@Inject
- public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional Object object){
- if(txTableViewer!=null && !insertItem.isDisposed() && !appendItem.isDisposed())
- if(object instanceof ITx && appendItem.isEnabled()){
- insertItem.setEnabled(true);
- } else if(object instanceof IWaveform> && appendItem.isEnabled()){
- insertItem.setEnabled(true);
- } else {
- insertItem.setEnabled(false);
- }
+ public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional Object object, EPartService partService){
+ MPart part = partService.getActivePart();
+ if(part!=null && part.getObject() != this)
+ otherSelectionCount = (object instanceof IWaveform> || object instanceof ITx)?1:0;
+ updateButtons();
}
-
+
+ private void updateButtons() {
+ if(txTableViewer!=null && !insertItem.isDisposed() && !appendItem.isDisposed() &&
+ !appendAllItem.isDisposed() && !insertAllItem.isDisposed()){
+ Object[] all = getFilteredChildren(txTableViewer);
+ appendItem.setEnabled(thisSelectionCount>0);
+ appendAllItem.setEnabled(all.length>0);
+ insertItem.setEnabled(thisSelectionCount>0 && otherSelectionCount>0);
+ insertAllItem.setEnabled(all.length>0 && otherSelectionCount>0);
+ }
+ }
+
public class WaveformAttributeFilter extends ViewerFilter {
- private String searchString;
+ private String searchString;
- public void setSearchText(String s) {
- this.searchString = ".*" + s + ".*";
- }
-
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (searchString == null || searchString.length() == 0) {
- return true;
- }
- IWaveform> p = (IWaveform>) element;
- if (p.getName().matches(searchString)) {
- return true;
- }
- return false;
- }
+ public void setSearchText(String s) {
+ this.searchString = ".*" + s + ".*";
}
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (searchString == null || searchString.length() == 0) {
+ return true;
+ }
+ IWaveform> p = (IWaveform>) element;
+ if (p.getName().matches(searchString)) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ 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;
+ }
}
\ No newline at end of file
diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewerPart.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewerPart.java
index 2261cb0..9059647 100644
--- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewerPart.java
+++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewerPart.java
@@ -18,6 +18,7 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -155,9 +156,10 @@ public class WaveformViewerPart {
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(20);
+ TimeUnit.SECONDS.sleep(2);
database.load(file);
database.addPropertyChangeListener(txDisplay);
subMonitor.worked(1);
@@ -169,6 +171,8 @@ public class WaveformViewerPart {
e.printStackTrace();
return Status.CANCEL_STATUS;
}
+ subMonitor.done();
+ monitor.done();
return Status.OK_STATUS;
}
};
@@ -271,7 +275,7 @@ public class WaveformViewerPart {
@Inject @Optional
public void getAddWaveformEvent(@UIEventTopic(WaveformViewerPart.ADD_WAVEFORM) Object o) {
- Object sel = selectionService.getSelection();
+ Object sel = o==null?selectionService.getSelection():o;
if(sel instanceof List>)
for(Object el:((List>)sel)){
if(el instanceof IWaveform>)
diff --git a/com.minres.scviewer.e4.application/src/org/eclipse/wb/swt/ResourceManager.java b/com.minres.scviewer.e4.application/src/org/eclipse/wb/swt/ResourceManager.java
index f42c09f..4bfbc6b 100644
--- a/com.minres.scviewer.e4.application/src/org/eclipse/wb/swt/ResourceManager.java
+++ b/com.minres.scviewer.e4.application/src/org/eclipse/wb/swt/ResourceManager.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2015 MINRES Technologies GmbH and others.
+ * Copyright (c) 2011 Google, Inc.
* 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
+ * Google, Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.wb.swt;
diff --git a/com.minres.scviewer.e4.product/SCViewer (restart).launch b/com.minres.scviewer.e4.product/SCViewer (restart).launch
new file mode 100644
index 0000000..5faee8e
--- /dev/null
+++ b/com.minres.scviewer.e4.product/SCViewer (restart).launch
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/com.minres.scviewer.e4.product/SCViewer.launch b/com.minres.scviewer.e4.product/SCViewer.launch
new file mode 100644
index 0000000..7320b34
--- /dev/null
+++ b/com.minres.scviewer.e4.product/SCViewer.launch
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/com.minres.scviewer.target/mars.target b/com.minres.scviewer.target/mars.target
index 68a3830..51b6ba5 100644
--- a/com.minres.scviewer.target/mars.target
+++ b/com.minres.scviewer.target/mars.target
@@ -1,17 +1,17 @@
-
+
-
-
-
-
+
+
+
+
x86_64