Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCurtis Windatt2008-03-10 21:53:54 -0400
committerCurtis Windatt2008-03-10 21:53:54 -0400
commit0cff7dfb8269efd827dbe89319deef162bfb0dae (patch)
tree0eeb828f7452f1fe715145422043b9ce208220b5 /org.eclipse.debug.examples.ui/src/org/eclipse/debug
parent0eef3bce739f6ed1fda09bd791ca46e880b6e601 (diff)
downloadeclipse.platform.debug-0cff7dfb8269efd827dbe89319deef162bfb0dae.tar.gz
eclipse.platform.debug-0cff7dfb8269efd827dbe89319deef162bfb0dae.tar.xz
eclipse.platform.debug-0cff7dfb8269efd827dbe89319deef162bfb0dae.zip
Added example step over handler
Diffstat (limited to 'org.eclipse.debug.examples.ui/src/org/eclipse/debug')
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiAdapterFactory.java8
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiStepOverHandler.java46
2 files changed, 53 insertions, 1 deletions
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiAdapterFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiAdapterFactory.java
index 2fe6cc27c..26696b1c6 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiAdapterFactory.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiAdapterFactory.java
@@ -14,6 +14,7 @@ import javax.sound.midi.MidiEvent;
import javax.sound.midi.Track;
import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.debug.core.commands.IStepOverHandler;
import org.eclipse.debug.examples.core.midi.launcher.MidiLaunch;
import org.eclipse.debug.examples.core.midi.launcher.SequencerControl;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory;
@@ -43,6 +44,8 @@ public class MidiAdapterFactory implements IAdapterFactory {
private static IModelProxyFactory fgSequencerModelProxyFactory = new SequencerModelProxyFactory();
private static IElementMementoProvider fgMementoProvider = new ControlsMementoProvider();
+
+ private static IStepOverHandler fgStepOverHandler = new MidiStepOverHandler();
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (IElementContentProvider.class.equals(adapterType)) {
@@ -86,10 +89,13 @@ public class MidiAdapterFactory implements IAdapterFactory {
if (IElementMementoProvider.class.equals(adapterType)) {
return fgMementoProvider;
}
+ if (IStepOverHandler.class.equals(adapterType)) {
+ return fgStepOverHandler;
+ }
return null;
}
public Class[] getAdapterList() {
- return new Class[]{IElementContentProvider.class, IElementLabelProvider.class};
+ return new Class[]{IElementContentProvider.class, IElementLabelProvider.class, IStepOverHandler.class};
}
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiStepOverHandler.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiStepOverHandler.java
new file mode 100644
index 000000000..fb2bdaafa
--- /dev/null
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiStepOverHandler.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.adapters;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.commands.IDebugCommandRequest;
+import org.eclipse.debug.core.commands.IEnabledStateRequest;
+import org.eclipse.debug.core.commands.IStepOverHandler;
+
+/**
+ * Provides an example command handler for the step over action.
+ * On execute, it simply returns a status that is opened in an
+ * error dialog.
+ */
+public class MidiStepOverHandler implements IStepOverHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.commands.IDebugCommandHandler#canExecute(org.eclipse.debug.core.commands.IEnabledStateRequest)
+ */
+ public void canExecute(IEnabledStateRequest request) {
+ // We could create a job here, schedule it, then return to be asynchronous
+ request.setEnabled(request.getElements().length > 0);
+ request.done();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.commands.IDebugCommandHandler#execute(org.eclipse.debug.core.commands.IDebugCommandRequest)
+ */
+ public boolean execute(IDebugCommandRequest request) {
+ // We could create a job to do this work, schedule it, then return to be asynchronous
+ // If running asynchronously, remember to return the enablement you want the action to have while this action is run
+ request.setStatus(new Status(IStatus.WARNING,"org.eclipse.debug.examples.ui","This is an example command handler overriding the default using an adapter on " + request.getElements()[0].getClass().getName()));
+ request.done();
+ return true;
+ }
+
+}

Back to the top