diff --git a/com.minres.scviewer.e4.product/scviewer.product b/com.minres.scviewer.e4.product/scviewer.product index 266b0c7..a367b8e 100644 --- a/com.minres.scviewer.e4.product/scviewer.product +++ b/com.minres.scviewer.e4.product/scviewer.product @@ -54,9 +54,12 @@ + + + diff --git a/p2repositories/com.minres.scviewer.updateSite/category.xml b/p2repositories/com.minres.scviewer.updateSite/category.xml index a4f42b6..4b66073 100644 --- a/p2repositories/com.minres.scviewer.updateSite/category.xml +++ b/p2repositories/com.minres.scviewer.updateSite/category.xml @@ -3,9 +3,13 @@ + + + Viewer for SystemC Verification (SCV) library's transaction recording + diff --git a/plugins/com.minres.scviewer.e4.application/Application.e4xmi b/plugins/com.minres.scviewer.e4.application/Application.e4xmi index 66eb04a..0f5ec93 100644 --- a/plugins/com.minres.scviewer.e4.application/Application.e4xmi +++ b/plugins/com.minres.scviewer.e4.application/Application.e4xmi @@ -1,6 +1,6 @@ - + @@ -144,10 +144,7 @@ stretch - - Draggable - - + Draggable diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/status/StatusBarControl.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/status/StatusBarControl.java index f7f4111..e51d975 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/status/StatusBarControl.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/status/StatusBarControl.java @@ -26,14 +26,10 @@ 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; import com.minres.scviewer.e4.application.AppModelId; -import com.minres.scviewer.e4.application.Messages; /** * The Class StatusBarControl. @@ -58,9 +54,6 @@ public class StatusBarControl { /** The monitor. */ private SyncedProgressMonitor monitor; - /** The progress bar. */ - private ProgressBar progressBar; - /** * Instantiates a new status bar control. * @@ -84,9 +77,7 @@ public class StatusBarControl { if (toolControl.getElementId().equals(AppModelId.TOOLCONTROL_ORG_ECLIPSE_UI_STATUSLINE)) { //$NON-NLS-1$ createStatusLine(parent, toolControl); } else if (toolControl.getElementId().equals(AppModelId.TOOLCONTROL_ORG_ECLIPSE_UI_HEAPSTATUS)) { //$NON-NLS-1$ - createHeapStatus(parent, toolControl); - } else if (toolControl.getElementId().equals(AppModelId.TOOLCONTROL_ORG_ECLIPSE_UI_PROGRESSBAR)) { //$NON-NLS-1$ - createProgressBar(parent, toolControl); + new HeapStatus(parent, osgiPreverences.getSystemPreferences()); } } @@ -101,36 +92,6 @@ public class StatusBarControl { } } - /** - * Creates the progress bar. - * - * @param parent the parent - * @param toolControl the tool control - */ - private void createProgressBar(Composite parent, MToolControl toolControl) { - 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) { - return monitor.addJob(job); - } - }); - } - - /** - * Creates the heap status. - * - * @param parent the parent - * @param toolControl the tool control - */ - private void createHeapStatus(Composite parent, MToolControl toolControl) { - new HeapStatus(parent, osgiPreverences.getSystemPreferences()); - } - /** * Creates the status line. * @@ -140,6 +101,14 @@ public class StatusBarControl { private void createStatusLine(Composite parent, MToolControl toolControl) { // IEclipseContext context = modelService.getContainingContext(toolControl); manager.createControl(parent); + monitor=new SyncedProgressMonitor(manager.getProgressMonitor()); + Job.getJobManager().setProgressProvider(new ProgressProvider() { + @Override + public IProgressMonitor createMonitor(Job job) { + return monitor.addJob(job); + } + }); + } /** @@ -160,25 +129,17 @@ public class StatusBarControl { */ private final class SyncedProgressMonitor extends NullProgressMonitor { - // thread-Safe via thread confinement of the UI-Thread - /** The running tasks. */ - // (means access only via UI-Thread) - private long runningTasks = 0L; - /** The progress bar. */ - private ProgressBar progressBar; + private IProgressMonitor progressBar; /** * Instantiates a new synced progress monitor. * - * @param progressBar the progress bar + * @param iProgressMonitor the progress bar */ - public SyncedProgressMonitor(ProgressBar progressBar) { + public SyncedProgressMonitor(IProgressMonitor iProgressMonitor) { super(); - this.progressBar = progressBar; - runningTasks=0; - progressBar.setSelection(0); - progressBar.setEnabled(false); + this.progressBar = iProgressMonitor; } /* (non-Javadoc) @@ -189,13 +150,41 @@ public class StatusBarControl { sync.asyncExec(new Runnable() { @Override public void run() { - 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.beginTask(name, totalWork); + } + }); + } + + /** + * This implementation does nothing. + * Subclasses may override this method to do something + * with the name of the task. + * + * @see IProgressMonitor#setTaskName(String) + */ + @Override + public void setTaskName(String name) { + sync.asyncExec(new Runnable() { + @Override + public void run() { + progressBar.setTaskName(name); + } + }); + } + + /** + * This implementation does nothing. + * Subclasses may override this method to do interesting + * processing when a subtask begins. + * + * @see IProgressMonitor#subTask(String) + */ + @Override + public void subTask(String name) { + sync.asyncExec(new Runnable() { + @Override + public void run() { + progressBar.subTask(name); } }); } @@ -208,7 +197,16 @@ public class StatusBarControl { sync.asyncExec(new Runnable() { @Override public void run() { - progressBar.setSelection(progressBar.getSelection() + work); + progressBar.worked(work); + } + }); + } + @Override + public void done() { + sync.asyncExec(new Runnable() { + @Override + public void run() { + progressBar.done(); } }); } @@ -228,14 +226,8 @@ public class StatusBarControl { @Override public void run() { if(event.getResult()==null) return; - if(runningTasks>0) runningTasks--; - if (runningTasks > 0){ // --- some tasks are still running --- - progressBar.setToolTipText(Messages.StatusBarControl_3 + runningTasks); - } else { // --- all tasks are done (a reset of selection could also be done) --- - progressBar.setToolTipText(Messages.StatusBarControl_4); - progressBar.setSelection(progressBar.getMaximum()); - progressBar.setEnabled(false); - } + if(!event.getResult().isOK()) + progressBar.done(); } }); // clean-up diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/status/StatusLineContributionItem.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/status/StatusLineContributionItem.java new file mode 100644 index 0000000..4b40081 --- /dev/null +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/status/StatusLineContributionItem.java @@ -0,0 +1,230 @@ +package com.minres.scviewer.e4.application.internal.status; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CLabel; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +import org.eclipse.jface.action.ContributionItem; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.LegacyActionTools; +import org.eclipse.jface.action.StatusLineLayoutData; +import org.eclipse.jface.resource.JFaceColors; + + +/** + * Contribution item for the status line. + * @since 2.0 + */ +public class StatusLineContributionItem extends ContributionItem { + + /** + * Internal mouse listener to track double clicking the status line item. + * @since 3.0 + */ + private class Listener extends MouseAdapter { + @Override + public void mouseDoubleClick(MouseEvent e) { + if (fActionHandler != null && fActionHandler.isEnabled()) + fActionHandler.run(); + } + } + + /** + * Left and right margin used in CLabel. + * @since 2.1 + */ + private static final int INDENT= 3; + /** + * Default number of characters that should fit into the item. + * @since 3.0 + */ + static final int DEFAULT_WIDTH_IN_CHARS = 19; + /** + * Pre-computed label width hint. + * @since 2.1 + */ + private int fFixedWidth= -1; + /** + * Pre-computed label height hint. + * @since 3.0 + */ + private int fFixedHeight= -1; + /** The text */ + private String fText; + /** The image */ + private Image fImage; + /** + * The error text. + * @since 3.0 + */ + private String fErrorText; + /** + * The error image. + * @since 3.0 + */ + private Image fErrorImage; + /** + * The tool tip text. + * @since 3.0 + */ + private String fToolTipText; + /** + * Number of characters that should fit into the item. + * @since 3.0 + */ + private int fWidthInChars; + /** The status line label widget */ + private CLabel fLabel; + /** + * The action handler. + * @since 3.0 + */ + private IAction fActionHandler; + /** + * The mouse listener + * @since 3.0 + */ + private MouseListener fMouseListener; + + + /** + * Creates a new item with the given attributes. + * + * @param id the item's id + * @param visible the visibility of this item + * @param widthInChars the width in characters + * @since 3.0 + */ + public StatusLineContributionItem(String id, boolean visible, int widthInChars) { + super(id); + setVisible(visible); + fWidthInChars= widthInChars; + } + + @Override + public void fill(Composite parent) { + + Label sep= new Label(parent, SWT.SEPARATOR); + CLabel label=new CLabel(parent, SWT.SHADOW_NONE); + label.setText(getId()); + fLabel= new CLabel(parent, SWT.SHADOW_IN); + fLabel.setAlignment(SWT.RIGHT); + + fLabel.addDisposeListener(e -> fMouseListener = null); + if (fActionHandler != null) { + fMouseListener= new Listener(); + fLabel.addMouseListener(fMouseListener); + } + + StatusLineLayoutData data= new StatusLineLayoutData(); + data.widthHint= getWidthHint(parent); + fLabel.setLayoutData(data); + + data= new StatusLineLayoutData(); + data.heightHint= getHeightHint(parent); + sep.setLayoutData(data); + + updateMessageLabel(); + } + + public void setActionHandler(IAction actionHandler) { + if (fActionHandler != null && actionHandler == null && fMouseListener != null) { + if (!fLabel.isDisposed()) + fLabel.removeMouseListener(fMouseListener); + fMouseListener= null; + } + + fActionHandler= actionHandler; + + if (fLabel != null && !fLabel.isDisposed() && fMouseListener == null && fActionHandler != null) { + fMouseListener= new Listener(); + fLabel.addMouseListener(fMouseListener); + } + } + + /** + * Returns the width hint for this label. + * + * @param control the root control of this label + * @return the width hint for this label + * @since 2.1 + */ + private int getWidthHint(Composite control) { + if (fFixedWidth < 0) { + GC gc= new GC(control); + gc.setFont(control.getFont()); + fFixedWidth = (int) gc.getFontMetrics().getAverageCharacterWidth() * fWidthInChars; + fFixedWidth += INDENT * 2; + gc.dispose(); + } + return fFixedWidth; + } + + /** + * Returns the height hint for this label. + * + * @param control the root control of this label + * @return the height hint for this label + * @since 3.0 + */ + private int getHeightHint(Composite control) { + if (fFixedHeight < 0) { + GC gc= new GC(control); + gc.setFont(control.getFont()); + fFixedHeight= gc.getFontMetrics().getHeight(); + gc.dispose(); + } + return fFixedHeight; + } + + /** + * Updates the message label widget. + * + * @since 3.0 + */ + private void updateMessageLabel() { + if (fLabel != null && !fLabel.isDisposed()) { + Display display= fLabel.getDisplay(); + if ((fErrorText != null && !fErrorText.isEmpty()) || fErrorImage != null) { + fLabel.setForeground(JFaceColors.getErrorText(display)); + fLabel.setText(fErrorText); + fLabel.setImage(fErrorImage); + if (fToolTipText != null) + fLabel.setToolTipText(fToolTipText); + else if (fErrorText.length() > fWidthInChars) + fLabel.setToolTipText(fErrorText); + else + fLabel.setToolTipText(null); + + } else { + fLabel.setForeground(fLabel.getParent().getForeground()); + fLabel.setText(fText); + fLabel.setImage(fImage); + if (fToolTipText != null) + fLabel.setToolTipText(fToolTipText); + else if (fText != null && fText.length() > fWidthInChars) + fLabel.setToolTipText(fText); + else + fLabel.setToolTipText(null); + } + } + } + + public void setText(String message){ + this.fText=message; + updateMessageLabel(); + } + + public void setErrorText(String message){ + this.fErrorText=message; + updateMessageLabel(); + } +} + diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/status/TextContributionItem.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/status/TextContributionItem.java new file mode 100644 index 0000000..ed9e9fc --- /dev/null +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/status/TextContributionItem.java @@ -0,0 +1,72 @@ +package com.minres.scviewer.e4.application.internal.status; + +import org.eclipse.jface.action.ContributionItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CLabel; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; + +/** + * The Class TextContributionItem. + */ +class TextContributionItem extends ContributionItem { + + /** The label string. */ + final String labelString; + + /** The text. */ + CLabel label, text; + + /** The content. */ + private String content; + + /** + * Instantiates a new text contribution item. + * + * @param labelString the label string + */ + public TextContributionItem(String labelString) { + super(); + this.labelString = labelString; + content=""; //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.jface.action.ContributionItem#fill(org.eclipse.swt.widgets.Composite) + */ + @Override + public void fill(Composite parent) { + Composite box=new Composite(parent, SWT.NONE); //NONE + box.setLayout(new GridLayout(2, false)); + label=new CLabel(box, SWT.SHADOW_NONE); + label.setText(labelString); + text=new CLabel(box, SWT.SHADOW_IN); + text.setAlignment(SWT.RIGHT); + text.setText(" "); + Point p = text.computeSize(SWT.DEFAULT, SWT.DEFAULT); + GridData layoutData=new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false); + layoutData.minimumWidth=12*p.x; + text.setLayoutData(layoutData); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.action.ContributionItem#isDynamic() + */ + @Override + public boolean isDynamic() { + return true; + } + + /** + * Sets the text. + * + * @param message the new text + */ + public void setText(String message){ + this.content=message; + if(text!=null && !text.isDisposed()) text.setText(content); + } + +} diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/status/WaveStatusBarControl.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/status/WaveStatusBarControl.java index a1c2006..767d22e 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/status/WaveStatusBarControl.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/internal/status/WaveStatusBarControl.java @@ -23,6 +23,10 @@ import org.eclipse.jface.action.StatusLineManager; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CLabel; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; @@ -50,76 +54,9 @@ public class WaveStatusBarControl extends StatusBarControl { @Inject EModelService modelService; - /** - * The Class TextContributionItem. - */ - class TextContributionItem extends ContributionItem { - - /** The label string. */ - final String labelString; - - /** The width. */ - //final int width; - - /** The text. */ - CLabel label, text; - - /** The content. */ - private String content; - - /** - * Instantiates a new text contribution item. - * - * @param labelString the label string - * @param width the width - */ - public TextContributionItem(String labelString /*, int width */) { - super(); - this.labelString = labelString; - //this.width=width; - content=""; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.jface.action.ContributionItem#fill(org.eclipse.swt.widgets.Composite) - */ - @Override - public void fill(Composite parent) { - Composite box=new Composite(parent, SWT.NONE); //NONE - box.setLayout(new GridLayout(2, false)); - label=new CLabel(box, SWT.SHADOW_NONE); - label.setText(labelString); - text=new CLabel(box, SWT.SHADOW_IN); - text.setAlignment(SWT.RIGHT); - //GridData layoutData=new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false); - GridData layoutData=new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false); - layoutData.minimumWidth=70; - //layoutData.minimumWidth=width; - text.setLayoutData(layoutData); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.action.ContributionItem#isDynamic() - */ - @Override - public boolean isDynamic() { - return true; - } - - /** - * Sets the text. - * - * @param message the new text - */ - public void setText(String message){ - this.content=message; - if(text!=null && !text.isDisposed()) text.setText(content); - } - - } /** The zoom contribution. */ - TextContributionItem cursorContribution, markerContribution, markerDiffContribution, zoomContribution; + StatusLineContributionItem cursorContribution, markerContribution, markerDiffContribution, zoomContribution; /** * Instantiates a new wave status bar control. @@ -130,10 +67,10 @@ public class WaveStatusBarControl extends StatusBarControl { public WaveStatusBarControl(UISynchronize sync) { super(sync); - cursorContribution = new TextContributionItem(Messages.WaveStatusBarControl_5 /*, 150 */); //150 - markerContribution = new TextContributionItem(Messages.WaveStatusBarControl_6 /*, 150 */); //150 - markerDiffContribution = new TextContributionItem(Messages.WaveStatusBarControl_7 /*, 150 */); //150 - zoomContribution = new TextContributionItem(Messages.WaveStatusBarControl_8 /*, 60 */); //60 + cursorContribution = new StatusLineContributionItem(Messages.WaveStatusBarControl_5, true, 20); + markerContribution = new StatusLineContributionItem(Messages.WaveStatusBarControl_6, true, 20); + markerDiffContribution = new StatusLineContributionItem(Messages.WaveStatusBarControl_7, true, 20); + zoomContribution = new StatusLineContributionItem(Messages.WaveStatusBarControl_8, true, 8); manager.appendToGroup(StatusLineManager.BEGIN_GROUP,cursorContribution); manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerContribution); manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerDiffContribution); diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java index aea6b89..81cb383 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java @@ -34,13 +34,9 @@ import javax.inject.Named; import org.eclipse.core.internal.preferences.InstancePreferences; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.SubMonitor; -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.JobGroup; import org.eclipse.core.runtime.preferences.ConfigurationScope; import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener; @@ -535,9 +531,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis @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; } @@ -549,15 +543,14 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis */ protected void loadDatabase(final Map state) { fileMonitor.removeFileChangeListener(this); - MultiStatus fStatus= new MultiStatus("blah", IStatus.OK, Messages.WaveformViewer_13, null); Job job = new Job(Messages.WaveformViewer_15) { @Override protected IStatus run(IProgressMonitor monitor) { - SubMonitor subMonitor = SubMonitor.convert(monitor, filesToLoad.size()); + IProgressMonitor progressGroup = getJobManager().createProgressGroup(); 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.setProgressGroup(progressGroup, 1); job.setJobGroup(jobGroup); job.schedule(); }); @@ -569,34 +562,28 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis if (monitor.isCanceled()) throw new OperationCanceledException(Messages.WaveformViewer_14); - fStatus.addAll(jobGroup.getResult()); - return fStatus; - } - }; - job.addJobChangeListener(new JobChangeAdapter() { - @Override - public void done(IJobChangeEvent event) { - IStatus result = event.getResult(); + + IStatus result = jobGroup.getResult(); if( (!result.isMultiStatus() && result.getCode() != Status.OK_STATUS.getCode() ) || - (result.isMultiStatus() && result.getChildren().length > 0 && result.getChildren()[0].getCode() != Status.OK_STATUS.getCode() ) ){ + (result.isMultiStatus() && result.getChildren().length > 0 && result.getChildren()[0].getCode() != Status.OK_STATUS.getCode() ) ){ // kill editor and pop up warning for user sync.asyncExec(() -> { final Display display = myParent.getDisplay(); MessageDialog.openWarning(display.getActiveShell(), "Error loading database", "Database cannot be loaded. Aborting..."); - ePartService.hidePart(myPart, true); + ePartService.hidePart(myPart, true); }); - return; - } - sync.asyncExec(()->{ - waveformPane.setMaxTime(database.getMaxTime()); - if (state != null) - restoreWaveformViewerState(state); - fileChecker = null; - if (checkForUpdates) - fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad, FILE_CHECK_INTERVAL); - }); + } else + sync.asyncExec(()->{ + waveformPane.setMaxTime(database.getMaxTime()); + if (state != null) + restoreWaveformViewerState(state); + fileChecker = null; + if (checkForUpdates) + fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad, FILE_CHECK_INTERVAL); + }); + return result; } - }); + }; job.setSystem(true); job.schedule(1000L); // let the UI initialize so that we have a progress monitor }