Updated UI to reflect database changes esp. in VCD
This commit is contained in:
parent
47a285bf6d
commit
f81e830e93
|
@ -1,7 +1,6 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>com.minres.scviewer.database.ui.swt</artifactId>
|
<artifactId>com.minres.scviewer.database.ui.swt</artifactId>
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
|
|
|
@ -182,7 +182,6 @@ public class SignalPainter extends TrackPainter {
|
||||||
tmpAwtFont = new java.awt.Font(fd.getName(), fd.getStyle(), height);
|
tmpAwtFont = new java.awt.Font(fd.getName(), fd.getStyle(), height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
||||||
Color colorBorder = waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
|
Color colorBorder = waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
|
||||||
BitVector last = (BitVector) left;
|
BitVector last = (BitVector) left;
|
||||||
|
@ -267,7 +266,6 @@ public class SignalPainter extends TrackPainter {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
||||||
long leftVal = ((BitVector) left).toUnsignedValue();
|
long leftVal = ((BitVector) left).toUnsignedValue();
|
||||||
long rightVal= ((BitVector) right).toUnsignedValue();
|
long rightVal= ((BitVector) right).toUnsignedValue();
|
||||||
|
@ -294,7 +292,6 @@ public class SignalPainter extends TrackPainter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SingleBitStencil implements SignalStencil {
|
private class SingleBitStencil implements SignalStencil {
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
||||||
if (multiple) {
|
if (multiple) {
|
||||||
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNALU.ordinal()]);
|
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNALU.ordinal()]);
|
||||||
|
@ -375,7 +372,6 @@ public class SignalPainter extends TrackPainter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
||||||
double leftVal = (Double) left;
|
double leftVal = (Double) left;
|
||||||
double rightVal= (Double) right;
|
double rightVal= (Double) right;
|
||||||
|
|
|
@ -39,7 +39,6 @@ import org.eclipse.wb.swt.SWTResourceManager;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
import com.minres.scviewer.database.swt.Constants;
|
import com.minres.scviewer.database.swt.Constants;
|
||||||
import com.minres.scviewer.database.ui.IWaveformViewer;
|
import com.minres.scviewer.database.ui.IWaveformViewer;
|
||||||
|
|
|
@ -14,7 +14,6 @@ import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.beans.PropertyChangeSupport;
|
import java.beans.PropertyChangeSupport;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -79,7 +78,6 @@ import com.minres.scviewer.database.ITxEvent;
|
||||||
import com.minres.scviewer.database.ITxRelation;
|
import com.minres.scviewer.database.ITxRelation;
|
||||||
import com.minres.scviewer.database.ITxStream;
|
import com.minres.scviewer.database.ITxStream;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
import com.minres.scviewer.database.swt.Constants;
|
import com.minres.scviewer.database.swt.Constants;
|
||||||
import com.minres.scviewer.database.ui.GotoDirection;
|
import com.minres.scviewer.database.ui.GotoDirection;
|
||||||
|
@ -423,8 +421,6 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
waveformCanvas.syncScrollBars();
|
waveformCanvas.syncScrollBars();
|
||||||
nameList.setSize(nameMaxWidth + 15, trackVerticalHeight);
|
nameList.setSize(nameMaxWidth + 15, trackVerticalHeight);
|
||||||
nameListScrolled.setMinSize(nameMaxWidth + 15, trackVerticalHeight);
|
nameListScrolled.setMinSize(nameMaxWidth + 15, trackVerticalHeight);
|
||||||
valueList.setSize(calculateValueWidth(), trackVerticalHeight);
|
|
||||||
valueListScrolled.setMinSize(calculateValueWidth(), trackVerticalHeight);
|
|
||||||
nameList.redraw();
|
nameList.redraw();
|
||||||
updateValueList();
|
updateValueList();
|
||||||
waveformCanvas.redraw();
|
waveformCanvas.redraw();
|
||||||
|
@ -501,7 +497,10 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
valueList.redraw();
|
int width = calculateValueWidth();
|
||||||
|
valueList.setSize(width, trackVerticalHeight);
|
||||||
|
valueListScrolled.setMinSize(width, trackVerticalHeight);
|
||||||
|
valueListScrolled.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isArrayFull(Object[] array){
|
private boolean isArrayFull(Object[] array){
|
||||||
|
|
|
@ -14,7 +14,6 @@ import com.minres.scviewer.database.ISignal;
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
import com.minres.scviewer.database.ITxStream;
|
import com.minres.scviewer.database.ITxStream;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
|
||||||
|
|
||||||
|
|
||||||
public class TrackEntry {
|
public class TrackEntry {
|
||||||
|
|
|
@ -40,6 +40,8 @@ public class Messages extends NLS {
|
||||||
public static String TransactionDetails_3;
|
public static String TransactionDetails_3;
|
||||||
public static String TransactionDetails_4;
|
public static String TransactionDetails_4;
|
||||||
public static String WaveformPreferencesPage_1;
|
public static String WaveformPreferencesPage_1;
|
||||||
|
public static String WaveformViewer_13;
|
||||||
|
public static String WaveformViewer_14;
|
||||||
public static String WaveformViewer_15;
|
public static String WaveformViewer_15;
|
||||||
public static String WaveformViewer_16;
|
public static String WaveformViewer_16;
|
||||||
public static String WaveformViewer_17;
|
public static String WaveformViewer_17;
|
||||||
|
|
|
@ -44,12 +44,13 @@ public class WaveformPopupMenuContribution {
|
||||||
Object selected = ((IStructuredSelection)sel).getFirstElement();
|
Object selected = ((IStructuredSelection)sel).getFirstElement();
|
||||||
if(selected instanceof ISignal<?>) {
|
if(selected instanceof ISignal<?>) {
|
||||||
Object x = ((ISignal<?>) selected).getEvents().firstEntry().getValue();
|
Object x = ((ISignal<?>) selected).getEvents().firstEntry().getValue();
|
||||||
if((x instanceof Double) || (x instanceof BitVector)) {
|
if((x instanceof BitVector) && ((BitVector)x).getWidth()==1) {
|
||||||
|
return false;
|
||||||
|
} else
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -186,17 +186,15 @@ public class StatusBarControl {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void beginTask(final String name, final int totalWork) {
|
public void beginTask(final String name, final int totalWork) {
|
||||||
sync.syncExec(new Runnable() {
|
sync.asyncExec(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
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++;
|
runningTasks++;
|
||||||
|
if(runningTasks == 1) { // --- no task is running at the moment ---
|
||||||
|
progressBar.setEnabled(true);
|
||||||
|
progressBar.setSelection(0);
|
||||||
|
}
|
||||||
|
progressBar.setMaximum(totalWork);
|
||||||
progressBar.setToolTipText(Messages.StatusBarControl_1 + runningTasks + Messages.StatusBarControl_2 + name);
|
progressBar.setToolTipText(Messages.StatusBarControl_1 + runningTasks + Messages.StatusBarControl_2 + name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -207,7 +205,7 @@ public class StatusBarControl {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void worked(final int work) {
|
public void worked(final int work) {
|
||||||
sync.syncExec(new Runnable() {
|
sync.asyncExec(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
progressBar.setSelection(progressBar.getSelection() + work);
|
progressBar.setSelection(progressBar.getSelection() + work);
|
||||||
|
@ -215,63 +213,28 @@ public class StatusBarControl {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.core.runtime.NullProgressMonitor#done()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void done() {
|
|
||||||
sync.syncExec(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
progressBar.setSelection(0);
|
|
||||||
progressBar.setMaximum(1);
|
|
||||||
progressBar.setEnabled(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the job.
|
* Adds the job.
|
||||||
*
|
*
|
||||||
* @param job the job
|
* @param job the job
|
||||||
* @return the i progress monitor
|
* @return the i progress monitor
|
||||||
*/
|
|
||||||
/*
|
|
||||||
@Override
|
|
||||||
public boolean isCanceled() {
|
|
||||||
sync.syncExec(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
cancelled=delegate.isCanceled();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return cancelled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCanceled(final boolean value) {
|
|
||||||
sync.syncExec(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
delegate.setCanceled(value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
public IProgressMonitor addJob(Job job){
|
public IProgressMonitor addJob(Job job){
|
||||||
if(job != null){
|
if(job != null){
|
||||||
job.addJobChangeListener(new JobChangeAdapter() {
|
job.addJobChangeListener(new JobChangeAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void done(IJobChangeEvent event) {
|
public void done(final IJobChangeEvent event) {
|
||||||
sync.syncExec(new Runnable() {
|
sync.asyncExec(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
runningTasks--;
|
if(event.getResult()==null) return;
|
||||||
|
if(runningTasks>0) runningTasks--;
|
||||||
if (runningTasks > 0){ // --- some tasks are still running ---
|
if (runningTasks > 0){ // --- some tasks are still running ---
|
||||||
progressBar.setToolTipText(Messages.StatusBarControl_3 + runningTasks);
|
progressBar.setToolTipText(Messages.StatusBarControl_3 + runningTasks);
|
||||||
} else { // --- all tasks are done (a reset of selection could also be done) ---
|
} else { // --- all tasks are done (a reset of selection could also be done) ---
|
||||||
progressBar.setToolTipText(Messages.StatusBarControl_4);
|
progressBar.setToolTipText(Messages.StatusBarControl_4);
|
||||||
|
progressBar.setSelection(progressBar.getMaximum());
|
||||||
|
progressBar.setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,6 +34,8 @@ TransactionDetails_21=End time
|
||||||
TransactionDetails_3=Value
|
TransactionDetails_3=Value
|
||||||
TransactionDetails_4=Relation
|
TransactionDetails_4=Relation
|
||||||
WaveformPreferencesPage_1=Color for
|
WaveformPreferencesPage_1=Color for
|
||||||
|
WaveformViewer_13=Database Load Status
|
||||||
|
WaveformViewer_14=Database Load Cancelled
|
||||||
WaveformViewer_15=Database Load Job
|
WaveformViewer_15=Database Load Job
|
||||||
WaveformViewer_16=Loading
|
WaveformViewer_16=Loading
|
||||||
WaveformViewer_17=Database re-load
|
WaveformViewer_17=Database re-load
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class LoadingWaveformDb implements IWaveformDb {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean load(File inp) throws Exception {
|
public boolean load(File inp) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,14 +31,19 @@ import javax.annotation.PostConstruct;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import org.eclipse.core.internal.jobs.JobManager;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.MultiStatus;
|
||||||
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.SubMonitor;
|
import org.eclipse.core.runtime.SubMonitor;
|
||||||
|
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
||||||
|
import org.eclipse.core.runtime.jobs.IJobManager;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
||||||
|
import org.eclipse.core.runtime.jobs.JobGroup;
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
|
||||||
|
@ -48,6 +53,7 @@ import org.eclipse.e4.core.services.events.IEventBroker;
|
||||||
import org.eclipse.e4.ui.di.Focus;
|
import org.eclipse.e4.ui.di.Focus;
|
||||||
import org.eclipse.e4.ui.di.PersistState;
|
import org.eclipse.e4.ui.di.PersistState;
|
||||||
import org.eclipse.e4.ui.di.UIEventTopic;
|
import org.eclipse.e4.ui.di.UIEventTopic;
|
||||||
|
import org.eclipse.e4.ui.di.UISynchronize;
|
||||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||||
import org.eclipse.e4.ui.services.EMenuService;
|
import org.eclipse.e4.ui.services.EMenuService;
|
||||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||||
|
@ -75,7 +81,6 @@ import com.minres.scviewer.database.ITxRelation;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.IWaveformDbFactory;
|
import com.minres.scviewer.database.IWaveformDbFactory;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
import com.minres.scviewer.database.swt.Constants;
|
import com.minres.scviewer.database.swt.Constants;
|
||||||
import com.minres.scviewer.database.swt.WaveformViewerFactory;
|
import com.minres.scviewer.database.swt.WaveformViewerFactory;
|
||||||
|
@ -143,6 +148,9 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
/** The waveform pane. */
|
/** The waveform pane. */
|
||||||
private IWaveformViewer waveformPane;
|
private IWaveformViewer waveformPane;
|
||||||
|
|
||||||
|
/** get UISynchronize injected as field */
|
||||||
|
@Inject UISynchronize sync;
|
||||||
|
|
||||||
/** The event broker. */
|
/** The event broker. */
|
||||||
@Inject
|
@Inject
|
||||||
private IEventBroker eventBroker;
|
private IEventBroker eventBroker;
|
||||||
|
@ -284,7 +292,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(Event e) {
|
public void handleEvent(Event e) {
|
||||||
if(e==null) { // dummy to take out logging
|
/*
|
||||||
String string = e.type == SWT.KeyDown ? "DOWN:" : "UP :";
|
String string = e.type == SWT.KeyDown ? "DOWN:" : "UP :";
|
||||||
string += " stateMask=0x" + Integer.toHexString (e.stateMask) + ","; // SWT.CTRL, SWT.ALT, SWT.SHIFT, SWT.COMMAND
|
string += " stateMask=0x" + Integer.toHexString (e.stateMask) + ","; // SWT.CTRL, SWT.ALT, SWT.SHIFT, SWT.COMMAND
|
||||||
string += " keyCode=0x" + Integer.toHexString (e.keyCode) + ",";
|
string += " keyCode=0x" + Integer.toHexString (e.keyCode) + ",";
|
||||||
|
@ -293,7 +301,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
string += " location="+e.keyLocation;
|
string += " location="+e.keyLocation;
|
||||||
}
|
}
|
||||||
System.out.println (string);
|
System.out.println (string);
|
||||||
}
|
*/
|
||||||
if((e.stateMask&SWT.MOD3)!=0) { // Alt key
|
if((e.stateMask&SWT.MOD3)!=0) { // Alt key
|
||||||
} else if((e.stateMask&SWT.MOD1)!=0) { //Ctrl/Cmd
|
} else if((e.stateMask&SWT.MOD1)!=0) { //Ctrl/Cmd
|
||||||
int zoomlevel = waveformPane.getZoomLevel();
|
int zoomlevel = waveformPane.getZoomLevel();
|
||||||
|
@ -412,6 +420,22 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
waveformPane.setColors(colorPref);
|
waveformPane.setColors(colorPref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DbLoadJob extends Job {
|
||||||
|
final File file;
|
||||||
|
public DbLoadJob(String name, final File file) {
|
||||||
|
super(name);
|
||||||
|
this.file=file;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
|
monitor.setTaskName(Messages.WaveformViewer_16+file.getName());
|
||||||
|
boolean res = database.load(file);
|
||||||
|
monitor.done();
|
||||||
|
database.addPropertyChangeListener(waveformPane);
|
||||||
|
return res?Status.OK_STATUS:Status.CANCEL_STATUS;
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Load database.
|
* Load database.
|
||||||
*
|
*
|
||||||
|
@ -419,50 +443,46 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
*/
|
*/
|
||||||
protected void loadDatabase(final Map<String, String> state) {
|
protected void loadDatabase(final Map<String, String> state) {
|
||||||
fileMonitor.removeFileChangeListener(this);
|
fileMonitor.removeFileChangeListener(this);
|
||||||
|
MultiStatus fStatus= new MultiStatus("blah", IStatus.OK, Messages.WaveformViewer_13, null);
|
||||||
Job job = new Job(Messages.WaveformViewer_15) {
|
Job job = new Job(Messages.WaveformViewer_15) {
|
||||||
@Override
|
@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 subMonitor = SubMonitor.convert(monitor, filesToLoad.size()+1);
|
JobGroup jobGroup = new JobGroup(Messages.WaveformViewer_15, filesToLoad.size(), filesToLoad.size());
|
||||||
|
filesToLoad.forEach((final File file) -> {
|
||||||
|
Job job = new DbLoadJob(Messages.WaveformViewer_16 + file.getName(), file);
|
||||||
|
job.setProgressGroup(subMonitor, 1);
|
||||||
|
job.setJobGroup(jobGroup);
|
||||||
|
job.schedule();
|
||||||
|
});
|
||||||
try {
|
try {
|
||||||
subMonitor.worked(1);
|
jobGroup.join(0, monitor);
|
||||||
for (File file : filesToLoad) {
|
} catch (OperationCanceledException | InterruptedException e) {
|
||||||
subMonitor.setTaskName(Messages.WaveformViewer_16+file.getName());
|
throw new OperationCanceledException(Messages.WaveformViewer_14);
|
||||||
database.load(file);
|
}
|
||||||
database.addPropertyChangeListener(waveformPane);
|
|
||||||
subMonitor.worked(1);
|
|
||||||
if (monitor.isCanceled())
|
if (monitor.isCanceled())
|
||||||
return Status.CANCEL_STATUS;
|
throw new OperationCanceledException(Messages.WaveformViewer_14);
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
fStatus.addAll(jobGroup.getResult());
|
||||||
database = null;
|
return fStatus;
|
||||||
e.printStackTrace();
|
|
||||||
return Status.CANCEL_STATUS;
|
|
||||||
}
|
|
||||||
subMonitor.done();
|
|
||||||
monitor.done();
|
|
||||||
return Status.OK_STATUS;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
job.addJobChangeListener(new JobChangeAdapter() {
|
job.addJobChangeListener(new JobChangeAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void done(IJobChangeEvent event) {
|
public void done(IJobChangeEvent event) {
|
||||||
if (event.getResult() == Status.OK_STATUS)
|
if (event.getResult().getCode() != Status.OK_STATUS.getCode()) return;
|
||||||
myParent.getDisplay().asyncExec(new Runnable() {
|
sync.asyncExec(()->{
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
waveformPane.setMaxTime(database.getMaxTime());
|
waveformPane.setMaxTime(database.getMaxTime());
|
||||||
if (state != null)
|
if (state != null)
|
||||||
restoreWaveformViewerState(state);
|
restoreWaveformViewerState(state);
|
||||||
fileChecker = null;
|
fileChecker = null;
|
||||||
if (checkForUpdates)
|
if (checkForUpdates)
|
||||||
fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad,
|
fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad, FILE_CHECK_INTERVAL);
|
||||||
FILE_CHECK_INTERVAL);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
job.schedule(0);
|
job.setSystem(true);
|
||||||
|
job.schedule(1000L); // let the UI initialize so that we have a progress monitor
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -48,7 +48,6 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.IWaveformDbFactory;
|
import com.minres.scviewer.database.IWaveformDbFactory;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
|
||||||
import com.minres.scviewer.database.swt.WaveformViewerFactory;
|
import com.minres.scviewer.database.swt.WaveformViewerFactory;
|
||||||
import com.minres.scviewer.database.ui.GotoDirection;
|
import com.minres.scviewer.database.ui.GotoDirection;
|
||||||
import com.minres.scviewer.database.ui.IWaveformViewer;
|
import com.minres.scviewer.database.ui.IWaveformViewer;
|
||||||
|
|
|
@ -19,12 +19,10 @@ import org.eclipse.ui.IEditorPart;
|
||||||
import org.eclipse.ui.handlers.HandlerUtil;
|
import org.eclipse.ui.handlers.HandlerUtil;
|
||||||
|
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
|
||||||
import com.minres.scviewer.ui.TxEditorPart;
|
import com.minres.scviewer.ui.TxEditorPart;
|
||||||
|
|
||||||
public class RemoveHandler extends AbstractHandler {
|
public class RemoveHandler extends AbstractHandler {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||||
IEditorPart editor = HandlerUtil.getActiveEditor(event);
|
IEditorPart editor = HandlerUtil.getActiveEditor(event);
|
||||||
|
|
|
@ -36,7 +36,6 @@ import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
|
||||||
|
|
||||||
import com.minres.scviewer.database.IHierNode;
|
import com.minres.scviewer.database.IHierNode;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
|
||||||
import com.minres.scviewer.ui.TxEditorPart;
|
import com.minres.scviewer.ui.TxEditorPart;
|
||||||
import com.minres.scviewer.ui.views.provider.TxDbTreeContentProvider;
|
import com.minres.scviewer.ui.views.provider.TxDbTreeContentProvider;
|
||||||
import com.minres.scviewer.ui.views.provider.TxDbTreeLabelProvider;
|
import com.minres.scviewer.ui.views.provider.TxDbTreeLabelProvider;
|
||||||
|
@ -177,7 +176,6 @@ public class TxOutlinePage extends ContentOutlinePage implements ISelectionList
|
||||||
|
|
||||||
private Action makeStreamAction(String text, String imgDescriptor, final IStructuredSelection selection, boolean enabled, final boolean remove) {
|
private Action makeStreamAction(String text, String imgDescriptor, final IStructuredSelection selection, boolean enabled, final boolean remove) {
|
||||||
Action action = new Action() {
|
Action action = new Action() {
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void run() {
|
public void run() {
|
||||||
if(selection!=null)
|
if(selection!=null)
|
||||||
for(Object obj :selection.toArray()){
|
for(Object obj :selection.toArray()){
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
|
|
Loading…
Reference in New Issue