Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/views/TapsetBrowserView.java')
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/views/TapsetBrowserView.java53
1 files changed, 40 insertions, 13 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/views/TapsetBrowserView.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/views/TapsetBrowserView.java
index 53003ddafe..6fed41f592 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/views/TapsetBrowserView.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/views/TapsetBrowserView.java
@@ -34,23 +34,26 @@ public abstract class TapsetBrowserView extends BrowserView {
@Override
public void aboutToRun(IJobChangeEvent event) {
- displayLoadingMessage();
+ synchronized (TapsetBrowserView.this) {
+ displayLoadingMessage();
+ }
}
@Override
public void done(IJobChangeEvent event) {
- if (event.getResult().isOK()) {
- displayContents();
- } else {
- setViewerInput(null);
- setRefreshable(true);
+ synchronized (TapsetBrowserView.this) {
+ if (event.getResult().isOK()) {
+ displayContents();
+ } else {
+ displayCancelContents();
+ }
}
}
};
/**
- * Create a new {@link BrowserView} for displaying tapset contents, which will
+ * Creates a new {@link BrowserView} for displaying tapset contents, which will
* be provided by an externally-run {@link TapsetParser}.
* @param job The parser used to obtain the tapset contents this view will display.
*/
@@ -62,18 +65,32 @@ public abstract class TapsetBrowserView extends BrowserView {
@Override
public void createPartControl(Composite parent) {
super.createPartControl(parent);
+ parser.addJobChangeListener(viewUpdater);
+ updateContents();
+ makeActions();
+ }
+ /**
+ * Updates the contents of this view without using the job listener.
+ * Use this when the result of the parser may be missed by the listener.
+ */
+ private synchronized void updateContents() {
IStatus result = parser.getResult();
- if (result != null && result.isOK()) {
- displayContents();
+ if (result != null) {
+ if (result.isOK()) {
+ displayContents();
+ } else {
+ displayCancelContents();
+ }
} else {
displayLoadingMessage();
}
-
- parser.addJobChangeListener(viewUpdater);
- makeActions();
}
+ /**
+ * Displays a loading message in the view and sets the view as refreshable.
+ * Automatically called whenever a parse job restarts; should not be called by clients.
+ */
@Override
protected void displayLoadingMessage() {
super.displayLoadingMessage();
@@ -82,11 +99,21 @@ public abstract class TapsetBrowserView extends BrowserView {
/**
* Populates the view with its contents obtained by the most recent run of {@link #parser}.
+ * Automatically called whenever a parse job succeeds; should not be called by clients.
*/
abstract protected void displayContents();
/**
- * Rerun the tapset parser to refresh the list of both probes and functions.
+ * Clears the view and sets it as refreshable when the {@link parser} job fails or is canceled.
+ * Automatically called whenever a parse job fails; should not be called by clients.
+ */
+ protected void displayCancelContents() {
+ setViewerInput(null);
+ setRefreshable(true);
+ }
+
+ /**
+ * Reruns the tapset parser to refresh the list of both probes and functions.
*/
@Override
protected void refresh() {

Back to the top