fixes locking issue preventing reload
This commit is contained in:
parent
db640808f2
commit
523c266e8d
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: CBOR transaction database
|
Bundle-Name: CBOR transaction database
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.ftr
|
Bundle-SymbolicName: com.minres.scviewer.database.ftr
|
||||||
Bundle-Version: 1.0.0.qualifier
|
Bundle-Version: 1.0.1.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||||
Import-Package: org.osgi.framework;version="1.3.0",
|
Import-Package: org.osgi.framework;version="1.3.0",
|
||||||
|
|
|
@ -178,7 +178,6 @@ public class FtrDbLoader implements IWaveformDbLoader {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void load(File file) throws InputFormatException {
|
public void load(File file) throws InputFormatException {
|
||||||
dispose();
|
|
||||||
this.file=file;
|
this.file=file;
|
||||||
try {
|
try {
|
||||||
fis = new FileInputStream(file);
|
fis = new FileInputStream(file);
|
||||||
|
|
|
@ -366,10 +366,14 @@ public class DesignBrowser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void setWaveformViewer(WaveformViewer waveformViewerPart) {
|
public void setWaveformViewer(WaveformViewer waveformViewerPart) {
|
||||||
this.waveformViewerPart=waveformViewerPart;
|
this.waveformViewerPart=waveformViewerPart;
|
||||||
IWaveformDb database = waveformViewerPart.getDatabase();
|
IWaveformDb database = waveformViewerPart.getDatabase();
|
||||||
|
setWaveformDb(database);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void setWaveformDb(IWaveformDb database) {
|
||||||
Object input = treeViewer.getInput();
|
Object input = treeViewer.getInput();
|
||||||
if(input instanceof List<?>){
|
if(input instanceof List<?>){
|
||||||
IWaveformDb db = ((List<IWaveformDb>)input).get(0);
|
IWaveformDb db = ((List<IWaveformDb>)input).get(0);
|
||||||
|
|
|
@ -176,7 +176,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
/** The factory. */
|
/** The factory. */
|
||||||
WaveformViewFactory factory = new WaveformViewFactory();
|
WaveformViewFactory factory = new WaveformViewFactory();
|
||||||
|
|
||||||
DesignBrowser browser = null;
|
DesignBrowser designBrowser = null;
|
||||||
|
|
||||||
TransactionDetails detailsView = null;
|
TransactionDetails detailsView = null;
|
||||||
|
|
||||||
|
@ -206,8 +206,6 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
|
|
||||||
IEclipsePreferences store = null;
|
IEclipsePreferences store = null;
|
||||||
|
|
||||||
@Inject @Optional DesignBrowser designBrowser;
|
|
||||||
|
|
||||||
/** The database. */
|
/** The database. */
|
||||||
private IWaveformDb database;
|
private IWaveformDb database;
|
||||||
|
|
||||||
|
@ -295,7 +293,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
middleSash.setWeights(new int[] {75, 25});
|
middleSash.setWeights(new int[] {75, 25});
|
||||||
|
|
||||||
ctx.set(Composite.class, left);
|
ctx.set(Composite.class, left);
|
||||||
browser = ContextInjectionFactory.make(DesignBrowser.class, ctx);
|
designBrowser = ContextInjectionFactory.make(DesignBrowser.class, ctx);
|
||||||
|
|
||||||
ctx.set(Composite.class, right);
|
ctx.set(Composite.class, right);
|
||||||
detailsView = ContextInjectionFactory.make(TransactionDetails.class, ctx);
|
detailsView = ContextInjectionFactory.make(TransactionDetails.class, ctx);
|
||||||
|
@ -623,6 +621,8 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
loadState(partConfig);
|
loadState(partConfig);
|
||||||
if (state != null && !state.isEmpty())
|
if (state != null && !state.isEmpty())
|
||||||
restoreWaveformViewerState(state);
|
restoreWaveformViewerState(state);
|
||||||
|
if(designBrowser!=null)
|
||||||
|
designBrowser.setWaveformDb(database);
|
||||||
fileChecker = null;
|
fileChecker = null;
|
||||||
if (checkForUpdates)
|
if (checkForUpdates)
|
||||||
fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad, FILE_CHECK_INTERVAL);
|
fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad, FILE_CHECK_INTERVAL);
|
||||||
|
@ -654,9 +654,11 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
Map<String, String> state = new HashMap<>();
|
Map<String, String> state = new HashMap<>();
|
||||||
saveWaveformViewerState(state);
|
saveWaveformViewerState(state);
|
||||||
waveformPane.getStreamList().clear();
|
waveformPane.getStreamList().clear();
|
||||||
|
if(database.isLoaded())
|
||||||
|
database.close();
|
||||||
database = dbFactory.getDatabase();
|
database = dbFactory.getDatabase();
|
||||||
database.addPropertyChangeListener(evt -> {
|
database.addPropertyChangeListener(evt -> {
|
||||||
if (IHierNode.WAVEFORMS.equals(evt.getPropertyName())) { //$NON-NLS-1$
|
if (IHierNode.WAVEFORMS.equals(evt.getPropertyName()) || IHierNode.LOADING_FINISHED.equals(evt.getPropertyName())) { //$NON-NLS-1$
|
||||||
myParent.getDisplay().syncExec(() -> waveformPane.setMaxTime(database.getMaxTime()));
|
myParent.getDisplay().syncExec(() -> waveformPane.setMaxTime(database.getMaxTime()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue