Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2010-10-21 19:22:34 +0000
committerDarin Wright2010-10-21 19:22:34 +0000
commitab73cd0ab97104e7a32d5ef1706ce7d143380f31 (patch)
treed9bce916bbd3955bbb79443fe47b7516fd5322d0 /org.eclipse.debug.examples.ui
parentb35e26213d302155b4a5809b32401af95ce9d257 (diff)
downloadeclipse.platform.debug-ab73cd0ab97104e7a32d5ef1706ce7d143380f31.tar.gz
eclipse.platform.debug-ab73cd0ab97104e7a32d5ef1706ce7d143380f31.tar.xz
eclipse.platform.debug-ab73cd0ab97104e7a32d5ef1706ce7d143380f31.zip
Bug 328295 - Launch button disabled after failed launch
Diffstat (limited to 'org.eclipse.debug.examples.ui')
-rw-r--r--org.eclipse.debug.examples.ui/plugin.xml11
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/ExampleLaunchStatusHandler.java32
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/MidiMainTab.java62
3 files changed, 103 insertions, 2 deletions
diff --git a/org.eclipse.debug.examples.ui/plugin.xml b/org.eclipse.debug.examples.ui/plugin.xml
index 0507e30ba..96f52f139 100644
--- a/org.eclipse.debug.examples.ui/plugin.xml
+++ b/org.eclipse.debug.examples.ui/plugin.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?> <!--
- Copyright (c) 2005, 2009 IBM Corporation and others.
+ Copyright (c) 2005, 2010 IBM Corporation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
@@ -477,4 +477,13 @@
</enablement>
</renderingBindings>
</extension>
+ <extension
+ point="org.eclipse.debug.core.statusHandlers">
+ <statusHandler
+ class="org.eclipse.debug.examples.ui.midi.launcher.ExampleLaunchStatusHandler"
+ code="303"
+ id="org.eclipse.debug.examples.ui.status.handler.launch"
+ plugin="org.eclipse.debug.examples.core">
+ </statusHandler>
+ </extension>
</plugin>
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/ExampleLaunchStatusHandler.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/ExampleLaunchStatusHandler.java
new file mode 100644
index 000000000..16562cdd8
--- /dev/null
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/ExampleLaunchStatusHandler.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.examples.ui.midi.launcher;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.IStatusHandler;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+
+/**
+ * Example status handler used to open the launch dialog on a launch failure. This handler
+ * handles the '303' status code from 'org.eclipse.debug.examples.core' plug-in.
+ */
+public class ExampleLaunchStatusHandler implements IStatusHandler {
+
+ public Object handleStatus(IStatus status, Object source) throws CoreException {
+ if (source instanceof ILaunchConfigurationDialog) {
+ return null;
+ }
+ throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.debug.examples.ui", "'source' should be an instanceof ILaunchConfigrationDialog"));
+ }
+
+}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/MidiMainTab.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/MidiMainTab.java
index fca24e5b4..d063008b4 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/MidiMainTab.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/MidiMainTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -34,6 +34,7 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.ResourceListSelectionDialog;
@@ -49,6 +50,10 @@ public class MidiMainTab extends AbstractLaunchConfigurationTab {
private Text fFileText;
private Button fFileButton;
+ private Button fExceptions;
+ private Button fHandled;
+ private Button fUnhandled;
+
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
*/
@@ -87,6 +92,40 @@ public class MidiMainTab extends AbstractLaunchConfigurationTab {
browseMidiFiles();
}
});
+
+ new Label(comp, SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 3;
+
+ Group test = new Group(comp, SWT.NONE);
+ test.setText("Exceptions");
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 3;
+ test.setLayoutData(gd);
+ test.setLayout(new GridLayout());
+ fExceptions = new Button(test, SWT.CHECK);
+ fExceptions.setText("&Throw an exception during launch for testing purposes");
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 3;
+ fExceptions.setLayoutData(gd);
+ fExceptions.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ fHandled.setEnabled(fExceptions.getSelection());
+ fUnhandled.setEnabled(fExceptions.getSelection());
+ updateLaunchConfigurationDialog();
+ }
+ });
+ fHandled = new Button(test, SWT.RADIO);
+ fHandled.setText("Throw a handled e&xception during launch to re-open launch dialog");
+ SelectionAdapter sa = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ updateLaunchConfigurationDialog();
+ }
+ };
+ fHandled.addSelectionListener(sa);
+ fUnhandled = new Button(test, SWT.RADIO);
+ fUnhandled.setText("Throw an &unhandled exception during launch to open error dialog");
+ fUnhandled.addSelectionListener(sa);
}
/**
@@ -118,6 +157,16 @@ public class MidiMainTab extends AbstractLaunchConfigurationTab {
if (file != null) {
fFileText.setText(file);
}
+ String excep = configuration.getAttribute(MidiLaunchDelegate.ATTR_THROW_EXCEPTION, (String)null);
+ fExceptions.setSelection(excep != null);
+ fHandled.setEnabled(excep != null);
+ fUnhandled.setEnabled(excep != null);
+ if (excep != null) {
+ fHandled.setSelection(excep.equals(MidiLaunchDelegate.HANDLED));
+ fUnhandled.setSelection(excep.equals(MidiLaunchDelegate.UNHANDLED));
+ } else {
+ fHandled.setSelection(true);
+ }
} catch (CoreException e) {
setErrorMessage(e.getMessage());
}
@@ -140,6 +189,17 @@ public class MidiMainTab extends AbstractLaunchConfigurationTab {
}
configuration.setAttribute(MidiLaunchDelegate.ATTR_MIDI_FILE, file);
configuration.setMappedResources(resources);
+
+ // exception handling
+ if (fExceptions.getSelection()) {
+ if (fHandled.getSelection()) {
+ configuration.setAttribute(MidiLaunchDelegate.ATTR_THROW_EXCEPTION, MidiLaunchDelegate.HANDLED);
+ } else {
+ configuration.setAttribute(MidiLaunchDelegate.ATTR_THROW_EXCEPTION, MidiLaunchDelegate.UNHANDLED);
+ }
+ } else {
+ configuration.removeAttribute(MidiLaunchDelegate.ATTR_THROW_EXCEPTION);
+ }
}
/* (non-Javadoc)

Back to the top