diff options
Diffstat (limited to 'systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal')
5 files changed, 53 insertions, 21 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDECloseMonitor.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDECloseMonitor.java index 92c7520dee..0fe90bec3f 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDECloseMonitor.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDECloseMonitor.java @@ -11,8 +11,6 @@ package org.eclipse.linuxtools.internal.systemtap.ui.ide; -import java.text.MessageFormat; - import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.linuxtools.systemtap.ui.consolelog.structures.ScriptConsole; import org.eclipse.ui.IWorkbench; @@ -30,12 +28,13 @@ public class IDECloseMonitor implements IWorkbenchListener { @Override public boolean preShutdown(IWorkbench workbench, boolean forced) { boolean close = true; - if(!forced) { + if (!forced) { IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); - if(ScriptConsole.anyRunning()) { - String msg = MessageFormat.format(Localization.getString("IDECloseMonitor.StillRunning"),(Object[]) null); //$NON-NLS-1$ - close = MessageDialog.openQuestion(window.getShell(), "Closing...", msg); //$NON-NLS-1$ + if (ScriptConsole.anyRunning()) { + close = MessageDialog.openQuestion(window.getShell(), + Localization.getString("IDECloseMonitor.StillRunningTitle"), //$NON-NLS-1$ + Localization.getString("IDECloseMonitor.StillRunning")); //$NON-NLS-1$ } } return close; diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/localization.properties b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/localization.properties index 76784fb0ae..25bc454047 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/localization.properties +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/localization.properties @@ -33,6 +33,7 @@ DefinitionHandler.FileIOErrorMessage=Unable to open definition file. CEditor.ProbeInsertFailed=Probe Insertion Failure CEditor.CanNotProbeLine=Stap cannot insert a probe on this line of code. +IDECloseMonitor.StillRunningTitle=Closing... IDECloseMonitor.StillRunning=There are scripts still running, are you sure you want to close? TapsetsPreferencePage.AdditionalTapsetsCategory=Additional tapsets to be used with every script diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/ProbeParser.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/ProbeParser.java index d2ab9fc06f..3bf8c17681 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/ProbeParser.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/ProbeParser.java @@ -141,7 +141,7 @@ public final class ProbeParser extends TreeTapsetParser { TreeNode groupNode = null; while (st.hasNextLine()) { if (monitor.isCanceled()) { - canceled = false; + canceled = true; break; } String tokenString = st.nextLine(); diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/TapsetParser.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/TapsetParser.java index efdfb9a31b..29574fab3c 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/TapsetParser.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/TapsetParser.java @@ -63,7 +63,10 @@ public abstract class TapsetParser extends Job { @Override protected void canceling() { - getThread().interrupt(); + Thread thread = getThread(); + if (thread != null) { + thread.interrupt(); + } } /** @@ -202,6 +205,8 @@ public abstract class TapsetParser extends Job { port, EnvironmentVariablesPreferencePage.getEnvironmentVariables()); if (channel == null) { displayError(Messages.TapsetParser_CannotRunStapTitle, Messages.TapsetParser_CannotRunStapMessage); + } else { + channel.getSession().disconnect(); } return (!getErrors ? str : strErr).toString(); 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() { |