diff options
Diffstat (limited to 'org.eclipse.debug.examples.ui')
74 files changed, 0 insertions, 5457 deletions
diff --git a/org.eclipse.debug.examples.ui/.classpath b/org.eclipse.debug.examples.ui/.classpath deleted file mode 100644 index b7464f3ca..000000000 --- a/org.eclipse.debug.examples.ui/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/org.eclipse.debug.examples.ui/.cvsignore b/org.eclipse.debug.examples.ui/.cvsignore deleted file mode 100644 index ba077a403..000000000 --- a/org.eclipse.debug.examples.ui/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/org.eclipse.debug.examples.ui/.project b/org.eclipse.debug.examples.ui/.project deleted file mode 100644 index 4b906e693..000000000 --- a/org.eclipse.debug.examples.ui/.project +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.debug.examples.ui</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature> - </natures> -</projectDescription> diff --git a/org.eclipse.debug.examples.ui/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.examples.ui/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 438fd6eba..000000000 --- a/org.eclipse.debug.examples.ui/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,47 +0,0 @@ -#Tue May 19 11:43:28 CDT 2009 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.3 diff --git a/org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF b/org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF deleted file mode 100644 index 25f04b1e7..000000000 --- a/org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,30 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Example Debug UI Plug-in -Bundle-SymbolicName: org.eclipse.debug.examples.ui;singleton:=true -Bundle-Version: 1.2.0 -Bundle-Activator: org.eclipse.debug.examples.ui.pda.DebugUIPlugin -Require-Bundle: org.eclipse.core.runtime, - org.eclipse.core.resources, - org.eclipse.debug.core, - org.eclipse.ui, - org.eclipse.debug.ui, - org.eclipse.jface.text, - org.eclipse.ui.editors, - org.eclipse.ui.workbench.texteditor, - org.eclipse.ui.ide, - org.eclipse.debug.examples.core, - org.eclipse.core.expressions -Eclipse-LazyStart: true -Export-Package: org.eclipse.debug.examples.ui.midi.adapters, - org.eclipse.debug.examples.ui.midi.detailpanes, - org.eclipse.debug.examples.ui.midi.launcher, - org.eclipse.debug.examples.ui.pda, - org.eclipse.debug.examples.ui.pda.adapters, - org.eclipse.debug.examples.ui.pda.breakpoints, - org.eclipse.debug.examples.ui.pda.editor, - org.eclipse.debug.examples.ui.pda.launcher, - org.eclipse.debug.examples.ui.pda.presentation, - org.eclipse.debug.examples.ui.pda.views -Bundle-RequiredExecutionEnvironment: J2SE-1.4 -Bundle-ActivationPolicy: lazy diff --git a/org.eclipse.debug.examples.ui/about.html b/org.eclipse.debug.examples.ui/about.html deleted file mode 100644 index 460233046..000000000 --- a/org.eclipse.debug.examples.ui/about.html +++ /dev/null @@ -1,28 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> -<title>About</title> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>June 2, 2006</p> -<h3>License</h3> - -<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. -For purposes of the EPL, "Program" will mean the Content.</p> - -<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> - -</body> -</html>
\ No newline at end of file diff --git a/org.eclipse.debug.examples.ui/build.properties b/org.eclipse.debug.examples.ui/build.properties deleted file mode 100644 index bac56954d..000000000 --- a/org.eclipse.debug.examples.ui/build.properties +++ /dev/null @@ -1,22 +0,0 @@ -############################################################################### -# Copyright (c) 2005, 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 -############################################################################### -source.. = src/ -output.. = bin/ -bin.includes = plugin.xml,\ - bin/,\ - about.html,\ - META-INF/,\ - .,\ - icons/ -src.includes = src/,\ - about.html,\ - icons/,\ - plugin.xml diff --git a/org.eclipse.debug.examples.ui/icons/full/dlcl16/pop.gif b/org.eclipse.debug.examples.ui/icons/full/dlcl16/pop.gif Binary files differdeleted file mode 100644 index 559e46298..000000000 --- a/org.eclipse.debug.examples.ui/icons/full/dlcl16/pop.gif +++ /dev/null diff --git a/org.eclipse.debug.examples.ui/icons/full/dlcl16/push.gif b/org.eclipse.debug.examples.ui/icons/full/dlcl16/push.gif Binary files differdeleted file mode 100644 index f7e6cc089..000000000 --- a/org.eclipse.debug.examples.ui/icons/full/dlcl16/push.gif +++ /dev/null diff --git a/org.eclipse.debug.examples.ui/icons/full/elcl16/pop.gif b/org.eclipse.debug.examples.ui/icons/full/elcl16/pop.gif Binary files differdeleted file mode 100644 index 2cd9c5444..000000000 --- a/org.eclipse.debug.examples.ui/icons/full/elcl16/pop.gif +++ /dev/null diff --git a/org.eclipse.debug.examples.ui/icons/full/elcl16/push.gif b/org.eclipse.debug.examples.ui/icons/full/elcl16/push.gif Binary files differdeleted file mode 100644 index a5ac28d4c..000000000 --- a/org.eclipse.debug.examples.ui/icons/full/elcl16/push.gif +++ /dev/null diff --git a/org.eclipse.debug.examples.ui/icons/full/obj16/clef.png b/org.eclipse.debug.examples.ui/icons/full/obj16/clef.png Binary files differdeleted file mode 100644 index 5036eb5f0..000000000 --- a/org.eclipse.debug.examples.ui/icons/full/obj16/clef.png +++ /dev/null diff --git a/org.eclipse.debug.examples.ui/icons/full/obj16/note.gif b/org.eclipse.debug.examples.ui/icons/full/obj16/note.gif Binary files differdeleted file mode 100644 index 7bc1e0813..000000000 --- a/org.eclipse.debug.examples.ui/icons/full/obj16/note.gif +++ /dev/null diff --git a/org.eclipse.debug.examples.ui/icons/full/obj16/pda.gif b/org.eclipse.debug.examples.ui/icons/full/obj16/pda.gif Binary files differdeleted file mode 100644 index 04c5052b2..000000000 --- a/org.eclipse.debug.examples.ui/icons/full/obj16/pda.gif +++ /dev/null diff --git a/org.eclipse.debug.examples.ui/plugin.xml b/org.eclipse.debug.examples.ui/plugin.xml deleted file mode 100644 index 8129e2156..000000000 --- a/org.eclipse.debug.examples.ui/plugin.xml +++ /dev/null @@ -1,458 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.0"?>
<!-- - Copyright (c) 2005, 2009 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 - Patrick Chuong (Texas Instruments) - Checkbox support for Flexible Hierachy view (Bug 286310) - --> - -<plugin> -<!--#ifdef ex1 --> -<!--#else --> - <extension - point="org.eclipse.debug.ui.launchConfigurationTabGroups"> - <launchConfigurationTabGroup - class="org.eclipse.debug.examples.ui.pda.launcher.PDATabGroup" - description="Specify and launch a PDA program" - id="pda.tabGroup" - type="pda.launchType"/> - <launchConfigurationTabGroup - class="org.eclipse.debug.examples.ui.midi.launcher.MidiTabGroup" - description="Play a MIDI file" - id="midi.tabGroup" - type="midi.launchType"/> - </extension> - <extension - point="org.eclipse.debug.ui.launchConfigurationTypeImages"> - <launchConfigurationTypeImage - icon="icons/full/obj16/pda.gif" - configTypeID="pda.launchType" - id="pda.typeImage"/> - <launchConfigurationTypeImage - icon="icons/full/obj16/note.gif" - configTypeID="midi.launchType" - id="midi.typeImage"/> - </extension> - <extension - point="org.eclipse.debug.ui.launchShortcuts"> - <shortcut - label="PDA Application" - icon="icons/full/obj16/pda.gif" - class="org.eclipse.debug.examples.ui.pda.launcher.PDALaunchShortcut" - modes="run, debug" - id="pda.launchShortcut"> - <contextualLaunch> - <enablement> - <with variable="selection"> - <count value="1"/> - <iterate> - <instanceof value="org.eclipse.core.resources.IFile"/> - <test - value="*.pda" - property="org.eclipse.debug.ui.matchesPattern"/> - </iterate> - </with> - </enablement> - </contextualLaunch> - <configurationType - id="pda.launchType"> - </configurationType> - </shortcut> - <shortcut - class="org.eclipse.debug.examples.ui.midi.launcher.MidiLaunchShortcut" - description="Plays a standard MIDI file" - icon="icons/full/obj16/note.gif" - id="midi.launchShortcut" - label="MIDI File" - modes="run, debug"> - <contextualLaunch> - <enablement> - <with variable="selection"> - <count value="1"/> - <iterate> - <instanceof value="org.eclipse.core.resources.IFile"/> - <test - value="*.mid" - property="org.eclipse.debug.ui.matchesPattern"/> - </iterate> - </with> - </enablement> - </contextualLaunch> - <configurationType - id="midi.launchType"> - </configurationType> - </shortcut> - </extension> -<!--#endif --> - <extension - point="org.eclipse.debug.ui.debugModelPresentations"> - <debugModelPresentation - class="org.eclipse.debug.examples.ui.pda.presentation.PDAModelPresentation" - id="pda.debugModel"/> - </extension> - <extension - point="org.eclipse.ui.editors"> - <editor - filenames="*.pda" - class="org.eclipse.debug.examples.ui.pda.editor.PDAEditor" - icon="icons/full/obj16/pda.gif" - default="true" - name="PDA Editor" - id="pda.editor" - extensions="pda"/> - </extension> - <extension - point="org.eclipse.ui.editorActions"> - <editorContribution - targetID="pda.editor" - id="pda.rulerActions"> - <action - label="Not Used" - class="org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate" - style="push" - actionID="RulerDoubleClick" - id="pda.doubleClickBreakpointAction"/> - </editorContribution> - </extension> - <extension - point="org.eclipse.ui.views"> - <view - icon="icons/full/obj16/pda.gif" - class="org.eclipse.debug.examples.ui.pda.views.DataStackView" - name="PDA Data Stack" - id="pda.dataStackView"/> - <view - class="org.eclipse.debug.examples.ui.pda.views.CheckboxView" - id="org.eclipse.debug.examples.ui.checkboxView" - name="Checkbox View" - restorable="true"> - </view> - </extension> - - <extension - point="org.eclipse.ui.perspectiveExtensions"> - <perspectiveExtension targetID="org.eclipse.debug.ui.DebugPerspective"> - <view - visible="false" - relative="org.eclipse.debug.ui.VariableView" - relationship="stack" - id="pda.dataStackView"/> - </perspectiveExtension> - </extension> - <extension - point="org.eclipse.ui.contexts"> - <context - parentId="org.eclipse.debug.ui.debugging" - description="Debugging PDA Programs" - name="Debugging PDA Programs" - id="pda.debugging"/> - </extension> - <extension - point="org.eclipse.debug.ui.debugModelContextBindings"> - <modelContextBinding - contextId="pda.debugging" - debugModelId="pda.debugModel"/> - </extension> - <extension - point="org.eclipse.debug.ui.contextViewBindings"> - <contextViewBinding - contextId="pda.debugging" - viewId="pda.dataStackView"/> - </extension> - - <extension - point="org.eclipse.ui.popupMenus"> - <viewerContribution - targetID="pda.editor.rulerMenu" - id="pda.editor.rulerActions"> - <action - label="Toggle Breakpoint" - class="org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate" - menubarPath="debug" - id="pda.editor.ruler.toggleBreakpointAction"/> - </viewerContribution> - <viewerContribution - targetID="pda.editor.contextMenu" - id="pda.editor.menuActions"> - <action - label="Run to Line" - definitionId="org.eclipse.debug.ui.commands.RunToLine" - class="org.eclipse.debug.ui.actions.RunToLineActionDelegate" - menubarPath="additions" - id="pda.editor.context.runToLineAction"/> - </viewerContribution> -<!--#ifdef ex5 --> -<!--#else --> - <objectContribution - adaptable="false" - id="pda.dropToFrame" - objectClass="org.eclipse.debug.examples.core.pda.model.PDAStackFrame"> - <action - class="org.eclipse.debug.examples.ui.pda.editor.PopFrameActionDelegate" - id="pda.dropToFrame" - label="Pop Frame"/> - </objectContribution> -<!--#endif --> - </extension> - - <extension - point="org.eclipse.core.runtime.adapters"> - <factory - class="org.eclipse.debug.examples.ui.pda.breakpoints.PDAEditorAdapterFactory" - adaptableType="org.eclipse.debug.examples.ui.pda.editor.PDAEditor"> - <adapter type="org.eclipse.debug.ui.actions.IToggleBreakpointsTarget"/> -<!--#ifdef ex7 --> -<!--#else --> - <adapter type="org.eclipse.debug.ui.actions.IRunToLineTarget"/> -<!--#endif --> - </factory> - <factory - adaptableType="org.eclipse.debug.examples.core.pda.model.PDADebugElement" - class="org.eclipse.debug.examples.ui.pda.adapters.CommandAdapterFactory"> - <adapter - type="org.eclipse.debug.core.commands.IRestartHandler"> - </adapter> - </factory> ---> -<!-- FLEXIBLE HIERARCHY EXAMPLE - <factory - adaptableType="org.eclipse.debug.examples.core.pda.model.PDADebugTarget" - class="org.eclipse.debug.examples.ui.pda.adapters.AdapterFactory"> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider"> - </adapter> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory"> - </adapter> - </factory> ---> - </extension> - - <extension - point="org.eclipse.core.runtime.adapters"> - <factory - class="org.eclipse.debug.examples.ui.midi.adapters.MidiAdapterFactory" - adaptableType="org.eclipse.debug.examples.core.midi.launcher.MidiLaunch"> - <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider"/> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory"> - </adapter> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory"> - </adapter> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider"> - </adapter> - <adapter - type="org.eclipse.debug.core.commands.IStepOverHandler"> - </adapter> - </factory> - <factory - class="org.eclipse.debug.examples.ui.midi.adapters.MidiAdapterFactory" - adaptableType="javax.sound.midi.Track"> - <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider"/> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider"> - </adapter> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory"> - </adapter> - <adapter - type="org.eclipse.debug.core.commands.IStepOverHandler"> - </adapter> - </factory> - <factory - adaptableType="org.eclipse.debug.examples.core.midi.launcher.SequencerControl" - class="org.eclipse.debug.examples.ui.midi.adapters.MidiAdapterFactory"> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider"> - </adapter> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementEditor"> - </adapter> - </factory> - <factory - adaptableType="javax.sound.midi.MidiEvent" - class="org.eclipse.debug.examples.ui.midi.adapters.MidiAdapterFactory"> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider"> - </adapter> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory"> - </adapter> - </factory> - <factory - adaptableType="javax.sound.midi.Track" - class="org.eclipse.debug.examples.ui.midi.adapters.MidiAdapterFactory"> - <adapter - type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory"> - </adapter> - </factory> - - - </extension> - <extension - point="org.eclipse.debug.ui.detailPaneFactories"> - <detailFactories - class="org.eclipse.debug.examples.ui.midi.detailpanes.ControlDetailPaneFactory" - id="org.eclipse.debug.examples.ui.controlFactory"> - <enablement> - <with - variable="selection"> - <count - value="1"> - </count> - <iterate> - <or> - <instanceof - value="org.eclipse.debug.examples.core.midi.launcher.TempoControl"> - </instanceof> - <instanceof - value="org.eclipse.debug.examples.core.midi.launcher.ClockControl"> - </instanceof> - </or> - </iterate> - </with> - </enablement> - </detailFactories> - </extension> - <extension point="org.eclipse.debug.ui.toggleBreakpointsTargetFactories"> - <toggleTargetFactory - id="org.eclipse.debug.examples.ui.pda.ToggleWatchpointsTargetFactory" - class="org.eclipse.debug.examples.ui.pda.breakpoints.PDAToggleWatchpointsTargetFactory"> - <enablement> - <!-- Test the active debug context. Enable only if the context is a PDA - element , or if there is no debug context (with a debug model) selected. --> - <with variable="debugContext"> - <iterate> - <or> - <test property="org.eclipse.debug.ui.getModelIdentifier" value="pda.debugModel"/> - <test property="org.eclipse.debug.ui.getModelIdentifier" value=""/> - </or> - </iterate> - </with> - <!-- If the debug context matches or if there is no active debug - context. Enable the breakpoint toggle for PDA's editor --> - <or> - <instanceof value="org.eclipse.debug.examples.ui.pda.editor.PDAEditor"/> - <with variable="selection"> - <count value="1"/> - <iterate> - <or> - <instanceof value="org.eclipse.debug.examples.core.pda.model.PDAVariable"/> - </or> - </iterate> - </with> - </or> - </enablement> - </toggleTargetFactory> - </extension> - <extension - point="org.eclipse.ui.commands"> - <command - id="org.eclipse.debug.examples.ui.pushCommand" - name="Push"> - </command> - <command - id="org.eclipse.debug.examples.ui.popCommand" - name="Pop"> - </command> - </extension> - <extension - point="org.eclipse.ui.handlers"> - <handler - class="org.eclipse.debug.examples.ui.pda.views.PushHandler" - commandId="org.eclipse.debug.examples.ui.pushCommand"> - <enabledWhen> - <and> - <with variable="activePart"> - <instanceof value="org.eclipse.debug.examples.ui.pda.views.DataStackView"/> - </with> - <with variable="debugContext"> - <count value="1"/> - <iterate operator="and"> - <test property="org.eclipse.debug.ui.getModelIdentifier" - value="pda.debugModel"> - </test> - <test property="org.eclipse.debug.examples.ui.canPush"/> - </iterate> - </with> - </and> - </enabledWhen> - </handler> - <handler - class="org.eclipse.debug.examples.ui.pda.views.PopHandler" - commandId="org.eclipse.debug.examples.ui.popCommand"> - <enabledWhen> - <and> - <with variable="activePart"> - <instanceof value="org.eclipse.debug.examples.ui.pda.views.DataStackView"/> - </with> - <with variable="debugContext"> - <count value="1"/> - <iterate> - <test property="org.eclipse.debug.ui.getModelIdentifier" - value="pda.debugModel"> - </test> - </iterate> - </with> - <with variable="selection"> - <count value="1"/> - </with> - </and> - </enabledWhen> - </handler> - </extension> - <extension - point="org.eclipse.core.expressions.propertyTesters"> - <propertyTester - class="org.eclipse.debug.examples.ui.pda.views.CanPushTester" - id="org.eclipse.debug.examples.ui.canPushTester" - namespace="org.eclipse.debug.examples.ui" - properties="canPush" - type="org.eclipse.core.runtime.IAdaptable"> - </propertyTester> - </extension> - <extension - point="org.eclipse.ui.menus"> - <menuContribution - locationURI="popup:pda.dataStackView?after=additions"> - <command - commandId="org.eclipse.debug.examples.ui.pushCommand" - disabledIcon="icons/full/dlcl16/push.gif" - icon="icons/full/elcl16/push.gif" - label="Push" - style="push"> - </command> - <command - commandId="org.eclipse.debug.examples.ui.popCommand" - disabledIcon="icons/full/dlcl16/pop.gif" - icon="icons/full/elcl16/pop.gif" - label="Pop" - style="push"> - </command> - </menuContribution> - <menuContribution - locationURI="toolbar:pda.dataStackView?after=additions"> - <command - commandId="org.eclipse.debug.examples.ui.pushCommand" - disabledIcon="icons/full/dlcl16/push.gif" - icon="icons/full/elcl16/push.gif" - label="Push" - style="push"> - </command> - <command - commandId="org.eclipse.debug.examples.ui.popCommand" - disabledIcon="icons/full/dlcl16/pop.gif" - icon="icons/full/elcl16/pop.gif" - label="Pop" - style="push"> - </command> - </menuContribution> - </extension> -</plugin> diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/CheckboxModelProxyFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/CheckboxModelProxyFactory.java deleted file mode 100644 index 31d375ab8..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/CheckboxModelProxyFactory.java +++ /dev/null @@ -1,39 +0,0 @@ -/***************************************************************** - * Copyright (c) 2009 Texas Instruments 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: - * Patrick Chuong (Texas Instruments) - Initial API and implementation (Bug 286310) - *****************************************************************/ -package org.eclipse.debug.examples.ui.midi.adapters; - -import javax.sound.midi.MidiEvent; -import javax.sound.midi.Track; - -import org.eclipse.debug.examples.ui.pda.views.CheckboxView; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; - -public class CheckboxModelProxyFactory implements IModelProxyFactory { - private MidiEventModelProxy fMidiEventProxy = new MidiEventModelProxy(); - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory#createModelProxy(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext) - */ - public IModelProxy createModelProxy(Object element, IPresentationContext context) { - if (CheckboxView.ID.equals(context.getId())) { - if (element instanceof Track) { - return new TrackModelProxy((Track) element); - } else if (element instanceof MidiEvent) { - return fMidiEventProxy; - } - } - - return null; - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlCellModifier.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlCellModifier.java deleted file mode 100644 index 100f20e5a..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlCellModifier.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * 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.debug.examples.core.midi.launcher.SequencerControl; -import org.eclipse.jface.viewers.ICellModifier; - -/** - * A cell modifier for a sequencer control. Provides current - * values of controls and updates control values in the sequencer - * as they are changed in the UI. - * - * @since 1.0 - */ -public class ControlCellModifier implements ICellModifier { - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String) - */ - public boolean canModify(Object element, String property) { - if (SequencerColumnPresentation.COL_VALUE.equals(property)) { - if (element instanceof SequencerControl) { - return ((SequencerControl) element).isEditable(); - } - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object, java.lang.String) - */ - public Object getValue(Object element, String property) { - if (SequencerColumnPresentation.COL_VALUE.equals(property)) { - if (element instanceof SequencerControl) { - SequencerControl control = (SequencerControl) element; - return control.getValue(); - } - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object, java.lang.String, java.lang.Object) - */ - public void modify(Object element, String property, Object value) { - Object oldValue = getValue(element, property); - if (!value.equals(oldValue)) { - if (SequencerColumnPresentation.COL_VALUE.equals(property)) { - if (element instanceof SequencerControl) { - if (value instanceof String) { - SequencerControl control = (SequencerControl) element; - control.setValue((String) value); - } - } - } - } - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlEditor.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlEditor.java deleted file mode 100644 index ecb05ae8b..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlEditor.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * 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.debug.internal.ui.viewers.model.provisional.IElementEditor; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.ICellModifier; -import org.eclipse.jface.viewers.TextCellEditor; -import org.eclipse.swt.widgets.Composite; - -/** - * Provides cell editors and modifiers for sequencer controls. - * - * @since 1.0 - */ -public class ControlEditor implements IElementEditor { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IElementEditor#getCellEditor(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.String, java.lang.Object, org.eclipse.swt.widgets.Composite) - */ - public CellEditor getCellEditor(IPresentationContext context, String columnId, Object element, Composite parent) { - return new TextCellEditor(parent); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IElementEditor#getCellModifier(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.Object) - */ - public ICellModifier getCellModifier(IPresentationContext context, Object element) { - return new ControlCellModifier(); - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlEventHandler.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlEventHandler.java deleted file mode 100644 index a09df84d3..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlEventHandler.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * 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 java.util.Timer; -import java.util.TimerTask; - -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.examples.core.midi.launcher.ClockControl; -import org.eclipse.debug.examples.core.midi.launcher.MidiLaunch; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; -import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta; -import org.eclipse.debug.internal.ui.viewers.update.DebugEventHandler; - -/** - * Listens to events from sequencer controls and fires corresponding - * deltas to update the viewer. - * - * @since 1.0 - */ -public class ControlEventHandler extends DebugEventHandler { - - /** - * Associated launch - */ - private MidiLaunch fLaunch; - - /** - * Timer used to update clock - */ - private Timer fTimer; - - /** - * @param proxy - */ - public ControlEventHandler(SequencerControlsModelProxy proxy) { - super(proxy); - fLaunch = proxy.getMidiLaunch(); - } - - protected void init() { - if (!fLaunch.isSuspended() && !fLaunch.isTerminated() && !fLaunch.isDisconnected()) { - startTimer(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.update.DebugEventHandler#handlesEvent(org.eclipse.debug.core.DebugEvent) - */ - protected boolean handlesEvent(DebugEvent event) { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.update.DebugEventHandler#dispose() - */ - public synchronized void dispose() { - super.dispose(); - if (fTimer != null) { - fTimer.cancel(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.update.DebugEventHandler#refreshRoot(org.eclipse.debug.core.DebugEvent) - */ - protected void refreshRoot(DebugEvent event) { - ModelDelta delta = new ModelDelta(fLaunch, IModelDelta.CONTENT); - fireDelta(delta); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.update.DebugEventHandler#handleResume(org.eclipse.debug.core.DebugEvent) - */ - protected void handleResume(DebugEvent event) { - super.handleResume(event); - startTimer(); - } - - /** - * Starts a timer to update the clock - */ - private void startTimer() { - fTimer = new Timer(true); - fTimer.schedule(new TimerTask() { - public void run() { - ModelDelta delta = new ModelDelta(fLaunch, IModelDelta.NO_CHANGE); - delta = delta.addNode(new ClockControl(fLaunch), IModelDelta.STATE | IModelDelta.CONTENT); - fireDelta(delta); - } - }, 0, 100); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.update.DebugEventHandler#handleSuspend(org.eclipse.debug.core.DebugEvent) - */ - protected void handleSuspend(DebugEvent event) { - super.handleSuspend(event); - if (fTimer != null) { - fTimer.cancel(); - fTimer = null; - } - } - - - - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlLabelProvider.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlLabelProvider.java deleted file mode 100644 index f54234bf8..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlLabelProvider.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * 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.CoreException; -import org.eclipse.debug.examples.core.midi.launcher.SequencerControl; -import org.eclipse.debug.internal.ui.model.elements.ElementLabelProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.jface.viewers.TreePath; - -/** - * Label provider for a sequencer control. - * - * @since 1.0 - */ -public class ControlLabelProvider extends ElementLabelProvider { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementLabelProvider#getLabel(org.eclipse.jface.viewers.TreePath, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.String) - */ - protected String getLabel(TreePath elementPath, IPresentationContext presentationContext, String columnId) throws CoreException { - SequencerControl control = (SequencerControl) elementPath.getLastSegment(); - if (SequencerColumnPresentation.COL_NAME.equals(columnId)) { - return control.getName(); - } - if (SequencerColumnPresentation.COL_VALUE.equals(columnId)) { - return control.getValue(); - } - return ""; - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlsMementoProvider.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlsMementoProvider.java deleted file mode 100644 index 6df637fc8..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlsMementoProvider.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * 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.CoreException; -import org.eclipse.debug.examples.core.midi.launcher.MidiLaunch; -import org.eclipse.debug.examples.core.midi.launcher.TempoControl; -import org.eclipse.debug.internal.ui.model.elements.DebugElementMementoProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; - -/** - * Provides mementos for sequencer elements. - * - * @since 1.0 - */ -public class ControlsMementoProvider extends DebugElementMementoProvider { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.DebugElementMementoProvider#getElementName(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext) - */ - protected String getElementName(Object element, IPresentationContext context) throws CoreException { - if (element instanceof MidiLaunch) { - return "SEQUENCER"; - } - if (element instanceof TempoControl) { - return "TEMPO_CONTROL"; - } - return null; - } - - - -} 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 deleted file mode 100644 index 9ddbf24df..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiAdapterFactory.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 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 - * Patrick Chuong (Texas Instruments) - Checkbox support for Flexible Hierachy view (Bug 286310) - *******************************************************************************/ -package org.eclipse.debug.examples.ui.midi.adapters; - -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; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementEditor; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory; - -/** - * Adapter factory for MIDI elements. - * - * @since 1.0 - */ -public class MidiAdapterFactory implements IAdapterFactory { - - private static IElementContentProvider fgSequencerContentProvider = new SequencerContentProvider(); - private static IElementContentProvider fgTackContentProvider = new TrackContentProvider(); - - private static IElementLabelProvider fgTrackLabelProvider = new TrackLabelProvider(); - private static IElementLabelProvider fgControlLabelProvider = new ControlLabelProvider(); - private static IElementLabelProvider fgMidiEventLabelProvdier = new MidiEventLabelProvider(); - - private static IColumnPresentationFactory fgSequencerColumnFactory = new SequencerColumnFactory(); - private static IColumnPresentationFactory fgTrackColumnFactory = new TrackColumnFactory(); - - private static IModelProxyFactory fgSequencerModelProxyFactory = new SequencerModelProxyFactory(); - - private static IElementMementoProvider fgMementoProvider = new ControlsMementoProvider(); - - private static IStepOverHandler fgStepOverHandler = new MidiStepOverHandler(); - - private static IModelProxyFactory fgCheckboxModelProxyFactory = new CheckboxModelProxyFactory(); - - public Object getAdapter(Object adaptableObject, Class adapterType) { - if (IElementContentProvider.class.equals(adapterType)) { - if (adaptableObject instanceof MidiLaunch) { - return fgSequencerContentProvider; - } - if (adaptableObject instanceof Track) { - return fgTackContentProvider; - } - } - if (IElementLabelProvider.class.equals(adapterType)) { - if (adaptableObject instanceof Track) { - return fgTrackLabelProvider; - } - if (adaptableObject instanceof SequencerControl) { - return fgControlLabelProvider; - } - if (adaptableObject instanceof MidiEvent) { - return fgMidiEventLabelProvdier; - } - } - - if (IColumnPresentationFactory.class.equals(adapterType)) { - if (adaptableObject instanceof MidiLaunch) { - return fgSequencerColumnFactory; - } - if (adaptableObject instanceof Track) { - return fgTrackColumnFactory; - } - } - if (IElementEditor.class.equals(adapterType)) { - if (adaptableObject instanceof SequencerControl) { - return new ControlEditor(); - } - } - - if (IModelProxyFactory.class.equals(adapterType)) { - if (adaptableObject instanceof MidiLaunch) { - return fgSequencerModelProxyFactory; - } else if (adaptableObject instanceof Track) { - return fgCheckboxModelProxyFactory; - } else if (adaptableObject instanceof MidiEvent) { - return fgCheckboxModelProxyFactory; - } - } - 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, IStepOverHandler.class,}; - } -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventLabelProvider.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventLabelProvider.java deleted file mode 100644 index 6ea60ef96..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventLabelProvider.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 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 - * Patrick Chuong (Texas Instruments) - Checkbox support for Flexible Hierachy view (Bug 286310) - *******************************************************************************/ -package org.eclipse.debug.examples.ui.midi.adapters; - -import javax.sound.midi.MidiEvent; -import javax.sound.midi.MidiMessage; -import javax.sound.midi.ShortMessage; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.internal.ui.model.elements.ElementLabelProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.jface.viewers.TreePath; - -/** - * Provides labels for MIDI tracks. - * - * @since 1.0 - */ -public class MidiEventLabelProvider extends ElementLabelProvider { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementLabelProvider#getLabel(org.eclipse.jface.viewers.TreePath, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.String) - */ - protected String getLabel(TreePath elementPath, IPresentationContext presentationContext, String columnId) throws CoreException { - MidiEvent event = (MidiEvent) elementPath.getLastSegment(); - MidiMessage message = event.getMessage(); - if (TrackColumnPresentation.COL_TICK.equals(columnId)) { - return Long.toString(event.getTick()); - } else if (TrackColumnPresentation.COL_BYTES.equals(columnId)) { - byte[] bytes = message.getMessage(); - StringBuffer buffer = new StringBuffer(); - for (int i = 0; i < message.getLength(); i++) { - buffer.append(' '); - appendByte(buffer, bytes[i]); - } - return buffer.toString(); - } else if (TrackColumnPresentation.COL_COMMAND.equals(columnId)) { - if (message instanceof ShortMessage) { - ShortMessage sm = (ShortMessage) message; - StringBuffer buf = new StringBuffer(); - appendByte(buf, (byte)sm.getCommand()); - return buf.toString(); - } - } else if (TrackColumnPresentation.COL_CHANNEL.equals(columnId)) { - if (message instanceof ShortMessage) { - return Integer.toString(((ShortMessage)message).getChannel()); - } - } - return ""; - } - - - /* - * (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementLabelProvider#getChecked(org.eclipse.jface.viewers.TreePath, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext) - */ - public boolean getChecked(TreePath path, IPresentationContext presentationContext) throws CoreException { - Boolean result = (Boolean) MidiEventModelProxy.gChecked.get(path); - return result == null ? false : result.booleanValue(); - } - - /** - * Appends a byte to the buffer with 2 hex characters. - * - * @param buffer - * @param b - */ - private void appendByte(StringBuffer buffer, byte b) { - String hex = Integer.toHexString(b & 0xFF).toUpperCase(); - for (int i = hex.length(); i < 2; i++) { - buffer.append('0'); - } - buffer.append(hex); - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventModelProxy.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventModelProxy.java deleted file mode 100644 index b535c3d2d..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventModelProxy.java +++ /dev/null @@ -1,34 +0,0 @@ -/***************************************************************** - * Copyright (c) 2009 Texas Instruments 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: - * Patrick Chuong (Texas Instruments) - Initial API and implementation (Bug 286310) - *****************************************************************/ -package org.eclipse.debug.examples.ui.midi.adapters; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.debug.internal.ui.viewers.model.provisional.ICheckboxModelProxy; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy; -import org.eclipse.jface.viewers.TreePath; - -public class MidiEventModelProxy extends AbstractModelProxy implements ICheckboxModelProxy { - static Map gChecked = new HashMap(); - - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.ICheckboxModelProxy#setChecked(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.Object, org.eclipse.jface.viewers.TreePath, boolean) - */ - public boolean setChecked(IPresentationContext context, Object viewerInput, TreePath path, boolean checked) { - System.out.println("TrackCheckListener.setChecked() element = " + path.getLastSegment() + " checked = " + checked); - gChecked.put(path, Boolean.valueOf(checked)); - return true; - } - -} 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 deleted file mode 100644 index fb2bdaafa..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiStepOverHandler.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * 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; - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerColumnFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerColumnFactory.java deleted file mode 100644 index 5a9fc55b1..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerColumnFactory.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 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 - * Patrick Chuong (Texas Instruments) - Checkbox support for Flexible Hierachy view (Bug 286310) - *******************************************************************************/ -package org.eclipse.debug.examples.ui.midi.adapters; - -import org.eclipse.debug.examples.ui.pda.views.CheckboxView; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.debug.ui.IDebugUIConstants; - -/** - * Column presentation factory for a sequencer. - * - * @since 1.0 - */ -public class SequencerColumnFactory implements IColumnPresentationFactory { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory#createColumnPresentation(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.Object) - */ - public IColumnPresentation createColumnPresentation(IPresentationContext context, Object element) { - if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId()) || CheckboxView.ID.equals(context.getId())) { - return new SequencerColumnPresentation(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory#getColumnPresentationId(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.Object) - */ - public String getColumnPresentationId(IPresentationContext context, Object element) { - if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId()) || CheckboxView.ID.equals(context.getId())) { - return SequencerColumnPresentation.ID; - } - return null; - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerColumnPresentation.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerColumnPresentation.java deleted file mode 100644 index 4542f844e..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerColumnPresentation.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * 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.debug.internal.ui.viewers.provisional.AbstractColumnPresentation; - -/** - * Columns for sequencer in the variables view. - * - * @since 1.0 - */ -public class SequencerColumnPresentation extends AbstractColumnPresentation { - - /** - * Column identifiers - */ - public static final String COL_NAME = "NAME"; - public static final String COL_VALUE = "VALUE"; - - /** - * All columns - */ - public static final String[] COLUMN_IDS = new String[]{COL_NAME, COL_VALUE}; - - /** - * Column presentation ID. - */ - public static final String ID = "org.eclipse.debug.examples.ui.midi.columnPresentation"; - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation#getAvailableColumns() - */ - public String[] getAvailableColumns() { - return COLUMN_IDS; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation#getHeader(java.lang.String) - */ - public String getHeader(String id) { - if (COL_NAME.equals(id)) { - return "Control"; - } - if (COL_VALUE.equals(id)) { - return "Value"; - } - return ""; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation#getId() - */ - public String getId() { - return ID; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation#getInitialColumns() - */ - public String[] getInitialColumns() { - return COLUMN_IDS; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation#isOptional() - */ - public boolean isOptional() { - return false; - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerContentProvider.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerContentProvider.java deleted file mode 100644 index 348e854e2..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerContentProvider.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * 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 javax.sound.midi.Sequencer; -import javax.sound.midi.Track; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.examples.core.midi.launcher.ClockControl; -import org.eclipse.debug.examples.core.midi.launcher.LengthControl; -import org.eclipse.debug.examples.core.midi.launcher.MidiLaunch; -import org.eclipse.debug.examples.core.midi.launcher.SequencerControl; -import org.eclipse.debug.examples.core.midi.launcher.TempoControl; -import org.eclipse.debug.internal.ui.model.elements.ElementContentProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate; -import org.eclipse.debug.ui.IDebugUIConstants; - -/** - * Provides content for a MIDI sequencer element (MIDI launch). - * - * @since 1.0 - */ -public class SequencerContentProvider extends ElementContentProvider { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#getChildCount(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate) - */ - protected int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException { - if (IDebugUIConstants.ID_DEBUG_VIEW.equals(context.getId())) { - return getTracks((MidiLaunch) element).length; - } else if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId())) { - if (((MidiLaunch)element).isTerminated()) { - return 0; - } - return 3; - } - return 0; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#getChildren(java.lang.Object, int, int, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate) - */ - protected Object[] getChildren(Object parent, int index, int length, IPresentationContext context, IViewerUpdate monitor) throws CoreException { - if (IDebugUIConstants.ID_DEBUG_VIEW.equals(context.getId())) { - return getElements(getTracks((MidiLaunch) parent), index, length); - } else if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId())) { - return getElements(getControls((MidiLaunch) parent), index, length); - } - return EMPTY; - } - - /** - * Returns the controls for this sequencer. - * - * @param launch midi launch - * @return controls - */ - public SequencerControl[] getControls(MidiLaunch launch) { - return new SequencerControl[]{ - new TempoControl(launch), - new ClockControl(launch), - new LengthControl(launch) - }; - } - - /** - * Returns all tracks in the sequence. - * - * @param launch MIDI launch - *@return tracks - */ - public Track[] getTracks(MidiLaunch launch) { - Sequencer sequencer = launch.getSequencer(); - if (sequencer != null && sequencer.isOpen()) { - return sequencer.getSequence().getTracks(); - } - return new Track[0]; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#supportsContextId(java.lang.String) - */ - protected boolean supportsContextId(String id) { - return IDebugUIConstants.ID_DEBUG_VIEW.equals(id) - || IDebugUIConstants.ID_VARIABLE_VIEW.equals(id); - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerControlsModelProxy.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerControlsModelProxy.java deleted file mode 100644 index 3faf1c4f0..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerControlsModelProxy.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * 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 javax.sound.midi.Sequencer; - -import org.eclipse.debug.core.DebugEvent; -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.update.DebugEventHandler; -import org.eclipse.debug.internal.ui.viewers.update.EventHandlerModelProxy; -import org.eclipse.jface.viewers.Viewer; - -/** - * Model proxy for a sequencer in the variables view. Listens - * to events from controls to update the viewer when the user - * changes a control's value. - * - * @since 1.0 - */ -public class SequencerControlsModelProxy extends EventHandlerModelProxy { - - /** - * Associated launch - */ - private MidiLaunch fLaunch; - - /** - * Event handler - */ - private ControlEventHandler fHandler; - - /** - * Constructs a model proxy to update based on changes in controls - * for the associated sequencer. - * - * @param launch MIDI launch - */ - public SequencerControlsModelProxy(MidiLaunch launch) { - fLaunch = launch; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy#installed(org.eclipse.jface.viewers.Viewer) - */ - public void installed(Viewer viewer) { - super.installed(viewer); - fHandler.init(); - } - - /** - * Returns the launch assocaited with this proxy. - * - * @return MIDI launch - */ - protected MidiLaunch getMidiLaunch() { - return fLaunch; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.update.EventHandlerModelProxy#createEventHandlers() - */ - protected DebugEventHandler[] createEventHandlers() { - fHandler = new ControlEventHandler(this); - return new DebugEventHandler[]{fHandler}; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.update.EventHandlerModelProxy#containsEvent(org.eclipse.debug.core.DebugEvent) - */ - protected boolean containsEvent(DebugEvent event) { - if (event.getSource() instanceof SequencerControl) { - return ((SequencerControl)event.getSource()).getLaunch().equals(fLaunch); - } - if (event.getSource() instanceof Sequencer) { - return fLaunch.getSequencer().equals(event.getSource()); - } - if (event.getSource().equals(fLaunch)) { - return true; - } - return false; - } - - - - - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerModelProxyFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerModelProxyFactory.java deleted file mode 100644 index 52e48c1e7..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerModelProxyFactory.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * 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.debug.core.ILaunch; -import org.eclipse.debug.examples.core.midi.launcher.MidiLaunch; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.debug.internal.ui.viewers.update.LaunchProxy; -import org.eclipse.debug.ui.IDebugUIConstants; - -/** - * Factory to create a model proxy for sequencer controls in - * the variables view. - * - * @since 1.0 - */ -public class SequencerModelProxyFactory implements IModelProxyFactory { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory#createModelProxy(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext) - */ - public IModelProxy createModelProxy(Object element, IPresentationContext context) { - if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId())) { - if (element instanceof MidiLaunch) { - return new SequencerControlsModelProxy((MidiLaunch)element); - } - } - if (IDebugUIConstants.ID_DEBUG_VIEW.equals(context.getId())) { - if (element instanceof MidiLaunch) { - return new LaunchProxy((ILaunch)element); - } - } - return null; - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackColumnFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackColumnFactory.java deleted file mode 100644 index 66b9063e1..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackColumnFactory.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 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 - * Patrick Chuong (Texas Instruments) - Checkbox support for Flexible Hierachy view (Bug 286310) - *******************************************************************************/ -package org.eclipse.debug.examples.ui.midi.adapters; - -import org.eclipse.debug.examples.ui.pda.views.CheckboxView; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.debug.ui.IDebugUIConstants; - -/** - * Column presentation factory for a track. - * - * @since 1.0 - */ -public class TrackColumnFactory implements IColumnPresentationFactory { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory#createColumnPresentation(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.Object) - */ - public IColumnPresentation createColumnPresentation(IPresentationContext context, Object element) { - if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId()) || CheckboxView.ID.equals(context.getId())) { - return new TrackColumnPresentation(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory#getColumnPresentationId(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.Object) - */ - public String getColumnPresentationId(IPresentationContext context, Object element) { - if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId()) || CheckboxView.ID.equals(context.getId())) { - return TrackColumnPresentation.ID; - } - return null; - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackColumnPresentation.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackColumnPresentation.java deleted file mode 100644 index 05713db26..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackColumnPresentation.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * 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.debug.internal.ui.viewers.provisional.AbstractColumnPresentation; - -/** - * Columns for sequencer in the variables view. - * - * @since 1.0 - */ -public class TrackColumnPresentation extends AbstractColumnPresentation { - - /** - * Column identifiers - */ - public static final String COL_TICK = "TICK"; - public static final String COL_BYTES = "BYTES"; - public static final String COL_COMMAND = "COMMAND"; - public static final String COL_CHANNEL = "CHANNEL"; - - /** - * All columns - */ - public static final String[] COLUMN_IDS = new String[]{COL_TICK, COL_BYTES, COL_COMMAND, COL_CHANNEL}; - - /** - * Initial columns - */ - public static final String[] COLUMN_INITIAL = new String[]{COL_TICK, COL_BYTES}; - - /** - * Column presentation ID. - */ - public static final String ID = "org.eclipse.debug.examples.ui.midi.trackColumns"; - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation#getAvailableColumns() - */ - public String[] getAvailableColumns() { - return COLUMN_IDS; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation#getHeader(java.lang.String) - */ - public String getHeader(String id) { - if (COL_TICK.equals(id)) { - return "Tick"; - } - if (COL_BYTES.equals(id)) { - return "Bytes"; - } - if (COL_CHANNEL.equals(id)) { - return "Channel"; - } - if (COL_COMMAND.equals(id)) { - return "Command"; - } - return ""; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation#getId() - */ - public String getId() { - return ID; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation#getInitialColumns() - */ - public String[] getInitialColumns() { - return COLUMN_INITIAL; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation#isOptional() - */ - public boolean isOptional() { - return false; - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackContentProvider.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackContentProvider.java deleted file mode 100644 index 1606038d0..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackContentProvider.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 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 - * Patrick Chuong (Texas Instruments) - Checkbox support for Flexible Hierachy view (Bug 286310) - *******************************************************************************/ -package org.eclipse.debug.examples.ui.midi.adapters; - -import javax.sound.midi.MidiEvent; -import javax.sound.midi.Track; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.examples.ui.pda.views.CheckboxView; -import org.eclipse.debug.internal.ui.model.elements.ElementContentProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate; -import org.eclipse.debug.ui.IDebugUIConstants; - -/** - * Content provider for track in the variables view. Returns MIDI events - * in the track. - * - * @since 1.0 - */ -public class TrackContentProvider extends ElementContentProvider { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#getChildCount(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate) - */ - protected int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException { - Track track = (Track) element; - if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId()) || CheckboxView.ID.equals(context.getId()) ) { - return track.size(); - } - return 0; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#getChildren(java.lang.Object, int, int, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate) - */ - protected Object[] getChildren(Object parent, int index, int length, IPresentationContext context, IViewerUpdate monitor) throws CoreException { - if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId()) || CheckboxView.ID.equals(context.getId())) { - Track track = (Track) parent; - MidiEvent[] events= new MidiEvent[length]; - for (int i = 0; i < length; i++) { - events[i] = track.get(i+index); - } - return events; - } - return EMPTY; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#supportsContextId(java.lang.String) - */ - protected boolean supportsContextId(String id) { - return IDebugUIConstants.ID_VARIABLE_VIEW.equals(id) || CheckboxView.ID.equals(id); - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackLabelProvider.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackLabelProvider.java deleted file mode 100644 index fa8f891fb..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackLabelProvider.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * 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 javax.sound.midi.Track; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.examples.core.midi.launcher.MidiLaunch; -import org.eclipse.debug.internal.ui.model.elements.ElementLabelProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.jface.viewers.TreePath; - -/** - * Provides labels for MIDI tracks. - * - * @since 1.0 - */ -public class TrackLabelProvider extends ElementLabelProvider { - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementLabelProvider#getLabel(org.eclipse.jface.viewers.TreePath, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.String) - */ - protected String getLabel(TreePath elementPath, IPresentationContext presentationContext, String columnId) throws CoreException { - Track track = (Track) elementPath.getLastSegment(); - MidiLaunch launch = (MidiLaunch) elementPath.getSegment(0); - Track[] tracks = launch.getSequencer().getSequence().getTracks(); - int i = 0; - for (i = 0; i < tracks.length; i++) { - if (track.equals(tracks[i])) { - break; - } - } - StringBuffer buf = new StringBuffer(); - buf.append("Track "); - buf.append(i); - buf.append(" ["); - buf.append(track.size()); - buf.append(" events]"); - return buf.toString(); - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackModelProxy.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackModelProxy.java deleted file mode 100644 index 4fe083c60..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackModelProxy.java +++ /dev/null @@ -1,43 +0,0 @@ -/***************************************************************** - * Copyright (c) 2009 Texas Instruments 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: - * Patrick Chuong (Texas Instruments) - Initial API and implementation (Bug 286310) - * IBM Corporation - ongoing maintenance and enhancements - *****************************************************************/ -package org.eclipse.debug.examples.ui.midi.adapters; - -import javax.sound.midi.Track; - -import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; -import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta; -import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy; -import org.eclipse.jface.viewers.Viewer; - -public class TrackModelProxy extends AbstractModelProxy { - protected Track fTrack; - - public TrackModelProxy(Track track) { - fTrack = track; - } - - public void installed(Viewer viewer) { - super.installed(viewer); - - ModelDelta delta = new ModelDelta(fTrack, IModelDelta.NO_CHANGE); - for (int i = 0; i < fTrack.size(); ++i) { - delta.addNode(fTrack.get(i), IModelDelta.INSTALL); - } - - fireModelChanged(delta); - } - - public synchronized void dispose() { - super.dispose(); - MidiEventModelProxy.gChecked.clear(); - } -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/detailpanes/ClockSliderDetailPane.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/detailpanes/ClockSliderDetailPane.java deleted file mode 100644 index 234618f4a..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/detailpanes/ClockSliderDetailPane.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * 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.detailpanes; - -import org.eclipse.debug.examples.core.midi.launcher.ClockControl; -import org.eclipse.debug.ui.IDetailPane; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Slider; -import org.eclipse.ui.IWorkbenchPartSite; - -/** - * A slider to control the clock position. - * - * @since 1.0 - */ -public class ClockSliderDetailPane implements IDetailPane { - - private Slider fSlider; - private ClockControl fControl; - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPane#createControl(org.eclipse.swt.widgets.Composite) - */ - public Control createControl(Composite parent) { - fSlider = new Slider(parent, SWT.HORIZONTAL); - fSlider.setMinimum(0); - fSlider.setMaximum(1000); - fSlider.addSelectionListener(new SelectionAdapter(){ - public void widgetSelected(SelectionEvent e) { - int selection = fSlider.getSelection(); - if (fControl != null) { - fControl.setValue(Integer.toString(selection)); - } - } - }); - return fSlider; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPane#display(org.eclipse.jface.viewers.IStructuredSelection) - */ - public void display(IStructuredSelection selection) { - fControl = null; - if (selection == null || selection.isEmpty()) { - fSlider.setEnabled(false); - } else { - fSlider.setEnabled(true); - fControl = (ClockControl) selection.getFirstElement(); - int max = (int)fControl.getSequencer().getMicrosecondLength() / 1000000; - long micro = fControl.getSequencer().getMicrosecondPosition(); - int seconds = (int) micro / 1000000; - fSlider.setMaximum(max); - fSlider.setSelection(seconds); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPane#dispose() - */ - public void dispose() { - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPane#getDescription() - */ - public String getDescription() { - return "Location (seconds)"; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPane#getID() - */ - public String getID() { - return ControlDetailPaneFactory.ID_CLOCK_SLIDER; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPane#getName() - */ - public String getName() { - return "Clock Slider (seconds)"; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPane#init(org.eclipse.ui.IWorkbenchPartSite) - */ - public void init(IWorkbenchPartSite partSite) { - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPane#setFocus() - */ - public boolean setFocus() { - fSlider.setFocus(); - return true; - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/detailpanes/ControlDetailPaneFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/detailpanes/ControlDetailPaneFactory.java deleted file mode 100644 index 10353fd57..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/detailpanes/ControlDetailPaneFactory.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * 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.detailpanes; - -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.debug.examples.core.midi.launcher.ClockControl; -import org.eclipse.debug.examples.core.midi.launcher.TempoControl; -import org.eclipse.debug.ui.IDetailPane; -import org.eclipse.debug.ui.IDetailPaneFactory; -import org.eclipse.jface.viewers.IStructuredSelection; - -/** - * Creates detail panes for sequencer controls. - * - * @since 1.0 - */ -public class ControlDetailPaneFactory implements IDetailPaneFactory { - - /** - * Identifier for the tempo slider detail pane - */ - public static final String ID_TEMPO_SLIDER = "TEMPO_SLIDER"; - - /** - * Identifier for the clock slider detail pane - */ - public static final String ID_CLOCK_SLIDER = "CLOCK_SLIDER"; - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPaneFactory#createDetailPane(java.lang.String) - */ - public IDetailPane createDetailPane(String paneID) { - if (ID_TEMPO_SLIDER.equals(paneID)) { - return new TempoSliderDetailPane(); - } - if (ID_CLOCK_SLIDER.equals(paneID)) { - return new ClockSliderDetailPane(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPaneFactory#getDefaultDetailPane(org.eclipse.jface.viewers.IStructuredSelection) - */ - public String getDefaultDetailPane(IStructuredSelection selection) { - if (selection.size() == 1) { - Object element = selection.getFirstElement(); - if (element instanceof TempoControl) { - return ID_TEMPO_SLIDER; - } - if (element instanceof ClockControl) { - return ID_CLOCK_SLIDER; - } - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPaneFactory#getDetailPaneDescription(java.lang.String) - */ - public String getDetailPaneDescription(String paneID) { - if (ID_TEMPO_SLIDER.equals(paneID)) { - return "Tempo Slider"; - } - if (ID_CLOCK_SLIDER.equals(paneID)) { - return "Clock Slider"; - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPaneFactory#getDetailPaneName(java.lang.String) - */ - public String getDetailPaneName(String paneID) { - if (ID_TEMPO_SLIDER.equals(paneID)) { - return "Tempo Slider"; - } - if (ID_CLOCK_SLIDER.equals(paneID)) { - return "Clock Slider"; - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPaneFactory#getDetailPaneTypes(org.eclipse.jface.viewers.IStructuredSelection) - */ - public Set getDetailPaneTypes(IStructuredSelection selection) { - Set set = new HashSet(); - if (selection.size() == 1) { - Object element = selection.getFirstElement(); - if (element instanceof TempoControl) { - set.add(ID_TEMPO_SLIDER); - } - if (element instanceof ClockControl) { - set.add(ID_CLOCK_SLIDER); - } - } - return set; - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/detailpanes/TempoSliderDetailPane.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/detailpanes/TempoSliderDetailPane.java deleted file mode 100644 index d5e1c7bb7..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/detailpanes/TempoSliderDetailPane.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * 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.detailpanes; - -import org.eclipse.debug.examples.core.midi.launcher.TempoControl; -import org.eclipse.debug.ui.IDetailPane; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Slider; -import org.eclipse.ui.IWorkbenchPartSite; - -/** - * A slider to control tempo. - * - * @since 1.0 - */ -public class TempoSliderDetailPane implements IDetailPane { - - private Slider fSlider; - private TempoControl fControl; - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPane#createControl(org.eclipse.swt.widgets.Composite) - */ - public Control createControl(Composite parent) { - fSlider = new Slider(parent, SWT.HORIZONTAL); - fSlider.setMinimum(20); - fSlider.setMaximum(500); - fSlider.addSelectionListener(new SelectionAdapter(){ - public void widgetSelected(SelectionEvent e) { - int selection = fSlider.getSelection(); - if (fControl != null) { - fControl.setValue(Integer.toString(selection)); - } - } - }); - return fSlider; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPane#display(org.eclipse.jface.viewers.IStructuredSelection) - */ - public void display(IStructuredSelection selection) { - fControl = null; - if (selection == null || selection.isEmpty()) { - fSlider.setEnabled(false); - } else { - fSlider.setEnabled(true); - fControl = (TempoControl) selection.getFirstElement(); - int bpm = (int)fControl.getSequencer().getTempoInBPM(); - fSlider.setSelection(bpm); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPane#dispose() - */ - public void dispose() { - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPane#getDescription() - */ - public String getDescription() { - return "Tempo (beats per minute)"; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPane#getID() - */ - public String getID() { - return ControlDetailPaneFactory.ID_TEMPO_SLIDER; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPane#getName() - */ - public String getName() { - return "Tempo Slider (BPM)"; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPane#init(org.eclipse.ui.IWorkbenchPartSite) - */ - public void init(IWorkbenchPartSite partSite) { - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDetailPane#setFocus() - */ - public boolean setFocus() { - fSlider.setFocus(); - return true; - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/MidiLaunchShortcut.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/MidiLaunchShortcut.java deleted file mode 100644 index f20448b53..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/MidiLaunchShortcut.java +++ /dev/null @@ -1,163 +0,0 @@ -/******************************************************************************* - * 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.launcher; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.examples.core.midi.launcher.MidiLaunchDelegate; -import org.eclipse.debug.examples.ui.pda.DebugUIPlugin; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.IDebugModelPresentation; -import org.eclipse.debug.ui.ILaunchShortcut; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.dialogs.ElementListSelectionDialog; - -/** - * Launch shortcut for a MIDI file. - * - * @since 1.0 - */ -public class MidiLaunchShortcut implements ILaunchShortcut { - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchShortcut#launch(org.eclipse.jface.viewers.ISelection, java.lang.String) - */ - public void launch(ISelection selection, String mode) { - if (selection instanceof IStructuredSelection) { - IStructuredSelection ss = (IStructuredSelection) selection; - if (ss.size() == 1) { - Object element = ss.getFirstElement(); - if (element instanceof IFile) { - IFile file = (IFile) element; - ILaunchConfiguration configuration = getConfiguration(file); - if (configuration != null) { - DebugUITools.launch(configuration, mode); - } - } - } - } - } - - /** - * Returns a MIDI configuration to use for the given file or - * <code>null</code> to cancel. Creates a new configuration - * if required. - * - * @param file file - * @return associated launch configuration or <code>null</code> - */ - private ILaunchConfiguration getConfiguration(IFile file) { - List candiates = new ArrayList(); - try { - ILaunchConfiguration[] configurations = getLaunchManager().getLaunchConfigurations(getLaunchType()); - for (int i = 0; i < configurations.length; i++) { - ILaunchConfiguration configuration = configurations[i]; - IResource[] resources = configuration.getMappedResources(); - if (resources != null && resources.length == 1 && - resources[0].equals(file)) { - candiates.add(configuration); - } - } - } catch (CoreException e) { - } - if (!candiates.isEmpty()) { - return chooseConfiguration(candiates); - } - return newConfiguration(file); - } - - /** - * Returns the MIDI launch configuration type. - * - * @return the MIDI launch configuration type - */ - private ILaunchConfigurationType getLaunchType() { - ILaunchManager manager = getLaunchManager(); - ILaunchConfigurationType type = manager.getLaunchConfigurationType(MidiLaunchDelegate.ID_MIDI_LAUNCH_CONFIGURATION_TYPE); - return type; - } - - /** - * Returns the launch manager. - * - * @return launch manager - */ - private ILaunchManager getLaunchManager() { - ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); - return manager; - } - - /** - * Returns a configuration from the given collection of configurations that should be launched, - * or <code>null</code> to cancel. - * - * @param configList list of configurations to choose from - * @return configuration to launch or <code>null</code> to cancel - */ - private ILaunchConfiguration chooseConfiguration(List configList) { - if (configList.size() == 1) { - return (ILaunchConfiguration) configList.get(0); - } - IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation(); - ElementListSelectionDialog dialog= new ElementListSelectionDialog(DebugUIPlugin.getActiveWorkbenchShell(), labelProvider); - dialog.setElements(configList.toArray()); - dialog.setTitle("Select Configuraiton"); - dialog.setMessage("&Select an existing configuration:"); - dialog.setMultipleSelection(false); - int result = dialog.open(); - labelProvider.dispose(); - if (result == Window.OK) { - return (ILaunchConfiguration) dialog.getFirstResult(); - } - return null; - } - - /** - * Creates and returns a new MIDI launch configuration for the - * given file. - * - * @param file MIDI file - * @return new launch configuration - */ - private ILaunchConfiguration newConfiguration(IFile file) { - ILaunchConfigurationType type = getLaunchType(); - try { - ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, getLaunchManager(). - generateUniqueLaunchConfigurationNameFrom( - "[" + file.getProject().getName() + "] " + file.getName())); - workingCopy.setAttribute(MidiLaunchDelegate.ATTR_MIDI_FILE, file.getFullPath().toString()); - workingCopy.setMappedResources(new IResource[]{file}); - return workingCopy.doSave(); - } catch (CoreException e) { - e.printStackTrace(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchShortcut#launch(org.eclipse.ui.IEditorPart, java.lang.String) - */ - public void launch(IEditorPart editor, String mode) { - // nothing - currently no editor - } -} 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 deleted file mode 100644 index fca24e5b4..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/MidiMainTab.java +++ /dev/null @@ -1,177 +0,0 @@ -/******************************************************************************* - * 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.launcher; - - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.examples.core.midi.launcher.MidiLaunchDelegate; -import org.eclipse.debug.examples.ui.pda.DebugUIPlugin; -import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; -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.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.ResourceListSelectionDialog; - - -/** - * Tab to specify the MIDI file to play. - * - * @since 1.0 - */ -public class MidiMainTab extends AbstractLaunchConfigurationTab { - - private Text fFileText; - private Button fFileButton; - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent) { - Font font = parent.getFont(); - - Composite comp = new Composite(parent, SWT.NONE); - setControl(comp); - GridLayout topLayout = new GridLayout(); - topLayout.verticalSpacing = 0; - topLayout.numColumns = 3; - comp.setLayout(topLayout); - comp.setFont(font); - - createVerticalSpacer(comp, 3); - - Label programLabel = new Label(comp, SWT.NONE); - programLabel.setText("&Midi File:"); - GridData gd = new GridData(GridData.BEGINNING); - programLabel.setLayoutData(gd); - programLabel.setFont(font); - - fFileText = new Text(comp, SWT.SINGLE | SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - fFileText.setLayoutData(gd); - fFileText.setFont(font); - fFileText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - updateLaunchConfigurationDialog(); - } - }); - - fFileButton = createPushButton(comp, "&Browse...", null); //$NON-NLS-1$ - fFileButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - browseMidiFiles(); - } - }); - } - - /** - * Open a resource chooser to select a MIDI file - */ - protected void browseMidiFiles() { - ResourceListSelectionDialog dialog = new ResourceListSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), IResource.FILE); - dialog.setTitle("MIDI File"); - dialog.setMessage("Select MIDI File"); - if (dialog.open() == Window.OK) { - Object[] files = dialog.getResult(); - IFile file = (IFile) files[0]; - fFileText.setText(file.getFullPath().toString()); - } - - } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) - */ - public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { - } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) - */ - public void initializeFrom(ILaunchConfiguration configuration) { - try { - String file = null; - file = configuration.getAttribute(MidiLaunchDelegate.ATTR_MIDI_FILE, (String)null); - if (file != null) { - fFileText.setText(file); - } - } catch (CoreException e) { - setErrorMessage(e.getMessage()); - } - } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) - */ - public void performApply(ILaunchConfigurationWorkingCopy configuration) { - String file = fFileText.getText().trim(); - if (file.length() == 0) { - file = null; - } - IResource[] resources = null; - if (file!= null) { - IPath path = new Path(file); - IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(path); - if (res != null) { - resources = new IResource[]{res}; - } - } - configuration.setAttribute(MidiLaunchDelegate.ATTR_MIDI_FILE, file); - configuration.setMappedResources(resources); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() - */ - public String getName() { - return "Main"; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration) - */ - public boolean isValid(ILaunchConfiguration launchConfig) { - setErrorMessage(null); - setMessage(null); - String text = fFileText.getText(); - if (text.length() > 0) { - IPath path = new Path(text); - if (ResourcesPlugin.getWorkspace().getRoot().findMember(path) == null) { - setErrorMessage("File does not exist"); - return false; - } - } else { - setMessage("Select a MIDI file"); - } - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage() - */ - public Image getImage() { - return DebugUIPlugin.getDefault().getImageRegistry().get(DebugUIPlugin.IMG_OBJ_MIDI); - } -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/MidiTabGroup.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/MidiTabGroup.java deleted file mode 100644 index 52e8b9dbd..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/MidiTabGroup.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * 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.launcher; - -import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup; -import org.eclipse.debug.ui.CommonTab; -import org.eclipse.debug.ui.ILaunchConfigurationDialog; -import org.eclipse.debug.ui.ILaunchConfigurationTab; - -/** - * Tab group for a MIDI file. - * - * @since 1.0 - */ -public class MidiTabGroup extends AbstractLaunchConfigurationTabGroup { - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String) - */ - public void createTabs(ILaunchConfigurationDialog dialog, String mode) { - setTabs(new ILaunchConfigurationTab[] { - new MidiMainTab(), - new CommonTab() - }); - } -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/DebugUIPlugin.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/DebugUIPlugin.java deleted file mode 100644 index f46234338..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/DebugUIPlugin.java +++ /dev/null @@ -1,212 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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 - * Bjorn Freeman-Benson - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda; - -import java.net.URL; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.ResourceBundle; -import java.util.Map.Entry; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.internal.util.BundleUtility; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The main plugin class to be used in the desktop. - */ -public class DebugUIPlugin extends AbstractUIPlugin { - //The shared instance. - private static DebugUIPlugin plugin; - //Resource bundle. - private ResourceBundle resourceBundle; - - private final static String ICONS_PATH = "icons/full/";//$NON-NLS-1$ - private final static String PATH_OBJECT = ICONS_PATH + "obj16/"; //Model object icons //$NON-NLS-1$ - private final static String PATH_ELOCALTOOL = ICONS_PATH + "elcl16/"; //Enabled local toolbar icons //$NON-NLS-1$ - private final static String PATH_DLOCALTOOL = ICONS_PATH + "dlcl16/"; //Disabled local toolbar icons //$NON-NLS-1$ - - /** - * Toolbar action to pop data stack - */ - public final static String IMG_ELCL_POP = "IMG_ELCL_POP"; - public final static String IMG_DLCL_POP = "IMG_DLCL_POP"; - - /** - * Toolbar action to push onto data stack - */ - public final static String IMG_ELCL_PUSH = "IMG_ELCL_PUSH"; - public final static String IMG_DLCL_PUSH = "IMG_DLCL_PUSH"; - - /** - * PDA program image - */ - public final static String IMG_OBJ_PDA = "IMB_OBJ_PDA"; - - /** - * MIDI file image - */ - public final static String IMG_OBJ_MIDI = "IMB_OBJ_MIDI"; - - /** - * Keyword color - */ - public final static RGB KEYWORD = new RGB(0,0,255); - public final static RGB LABEL = new RGB(128, 128, 0); - - /** - * Managed colors - */ - private Map fColors = new HashMap(); - - /** - * The constructor. - */ - public DebugUIPlugin() { - super(); - plugin = this; - } - - /** - * This method is called upon plug-in activation - */ - public void start(BundleContext context) throws Exception { - super.start(context); -// Toggles single threaded adapter example -// IAdapterManager adapterManager = Platform.getAdapterManager(); -// IAdapterFactory factory = new AdapterFactory(); -// adapterManager.registerAdapters(factory, PDADebugTarget.class); - } - - /** - * This method is called when the plug-in is stopped - */ - public void stop(BundleContext context) throws Exception { - super.stop(context); - plugin = null; - resourceBundle = null; - Iterator colors = fColors.entrySet().iterator(); - while (colors.hasNext()) { - Map.Entry entry = (Entry) colors.next(); - ((Color)entry.getValue()).dispose(); - } - } - - /** - * Returns the shared instance. - */ - public static DebugUIPlugin getDefault() { - return plugin; - } - - /** - * Returns the string from the plugin's resource bundle, - * or 'key' if not found. - */ - public static String getResourceString(String key) { - ResourceBundle bundle = DebugUIPlugin.getDefault().getResourceBundle(); - try { - return (bundle != null) ? bundle.getString(key) : key; - } catch (MissingResourceException e) { - return key; - } - } - - /** - * Returns the plugin's resource bundle, - */ - public ResourceBundle getResourceBundle() { - try { - if (resourceBundle == null) - resourceBundle = ResourceBundle.getBundle("org.eclipse.debug.examples.ui.pda.DebugUIPluginResources"); - } catch (MissingResourceException x) { - resourceBundle = null; - } - return resourceBundle; - } - - - /* (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry) - */ - protected void initializeImageRegistry(ImageRegistry reg) { - declareImage(IMG_OBJ_PDA, PATH_OBJECT + "pda.gif"); - declareImage(IMG_OBJ_MIDI, PATH_OBJECT + "note.gif"); - declareImage(IMG_ELCL_POP, PATH_ELOCALTOOL + "pop.gif"); - declareImage(IMG_DLCL_POP, PATH_DLOCALTOOL + "pop.gif"); - declareImage(IMG_ELCL_PUSH, PATH_ELOCALTOOL + "push.gif"); - declareImage(IMG_DLCL_PUSH, PATH_DLOCALTOOL + "push.gif"); - } - - /** - * Declares a workbench image given the path of the image file (relative to - * the workbench plug-in). This is a helper method that creates the image - * descriptor and passes it to the main <code>declareImage</code> method. - * - * @param symbolicName the symbolic name of the image - * @param path the path of the image file relative to the base of the workbench - * plug-ins install directory - * <code>false</code> if this is not a shared image - */ - private void declareImage(String key, String path) { - URL url = BundleUtility.find("org.eclipse.debug.examples.ui", path); - ImageDescriptor desc = ImageDescriptor.createFromURL(url); - getImageRegistry().put(key, desc); - } - - /** - * Returns the color described by the given RGB. - * - * @param rgb - * @return color - */ - public Color getColor(RGB rgb) { - Color color = (Color) fColors.get(rgb); - if (color == null) { - color= new Color(Display.getCurrent(), rgb); - fColors.put(rgb, color); - } - return color; - } - - /** - * Returns the active workbench window - * - * @return the active workbench window - */ - public static IWorkbenchWindow getActiveWorkbenchWindow() { - return getDefault().getWorkbench().getActiveWorkbenchWindow(); - } - - /** - * Returns the active workbench shell or <code>null</code> if none - * - * @return the active workbench shell or <code>null</code> if none - */ - public static Shell getActiveWorkbenchShell() { - IWorkbenchWindow window = getActiveWorkbenchWindow(); - if (window != null) { - return window.getShell(); - } - return null; - } - - } diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/AdapterFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/AdapterFactory.java deleted file mode 100644 index 3e4153fd5..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/AdapterFactory.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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 - * Bjorn Freeman-Benson - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.adapters; - -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.debug.examples.core.pda.model.PDADebugTarget; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory; - - -/** - * - * @since 3.2 - * - */ -public class AdapterFactory implements IAdapterFactory { - - private static IElementContentProvider fgTargetAdapter = new PDADebugTargetContentProvider(); - private static IModelProxyFactory fgFactory = new ModelProxyFactory(); - - public Object getAdapter(Object adaptableObject, Class adapterType) { - if (IElementContentProvider.class.equals(adapterType)) { - if (adaptableObject instanceof PDADebugTarget) { - return fgTargetAdapter; - } - } - if (IModelProxyFactory.class.equals(adapterType)) { - if (adaptableObject instanceof PDADebugTarget) { - return fgFactory; - } - } - return null; - } - - public Class[] getAdapterList() { - return new Class[]{IElementContentProvider.class, IModelProxyFactory.class}; - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java deleted file mode 100644 index 3375fb088..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Wind River Systems 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.adapters; - -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.debug.core.commands.IRestartHandler; -import org.eclipse.debug.examples.core.pda.model.PDADebugTarget; - -/** - * Adapter factory that provides debug command handler adapters for the - * PDA debugger. - * - * @since 3.6 - */ -public class CommandAdapterFactory implements IAdapterFactory { - - private static IRestartHandler fgRestartHandler = new PDARestartDebugCommand(); - - public Object getAdapter(Object adaptableObject, Class adapterType) { - if (IRestartHandler.class.equals(adapterType)) { - if (adaptableObject instanceof PDADebugTarget) { - return fgRestartHandler; - } - } - return null; - } - - public Class[] getAdapterList() { - return new Class[]{IRestartHandler.class}; - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/ModelProxyFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/ModelProxyFactory.java deleted file mode 100644 index a8e5959f1..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/ModelProxyFactory.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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.pda.adapters; - -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.examples.core.pda.model.PDADebugTarget; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.debug.ui.IDebugUIConstants; - - -public class ModelProxyFactory implements IModelProxyFactory { - - public IModelProxy createModelProxy(Object element, IPresentationContext context) { - if (IDebugUIConstants.ID_DEBUG_VIEW.equals(context.getId())) { - if (element instanceof PDADebugTarget){ - return new PDADebugTargetProxy((IDebugTarget) element); - } - } - return null; - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetContentProvider.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetContentProvider.java deleted file mode 100644 index ed0c069ee..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetContentProvider.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 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 - * Pawel Piech (Wind River) - ported PDA Virtual Machine to Java (Bug 261400) - *******************************************************************************/ - -package org.eclipse.debug.examples.ui.pda.adapters; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.examples.core.pda.model.PDADebugTarget; -import org.eclipse.debug.examples.core.pda.model.PDAThread; -import org.eclipse.debug.internal.ui.model.elements.ElementContentProvider; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate; -import org.eclipse.debug.ui.IDebugUIConstants; - - -public class PDADebugTargetContentProvider extends ElementContentProvider { - - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#getChildCount(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate) - */ - protected int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException { - PDAThread thread = ((PDADebugTarget) element).getThread(0); - if (thread != null) { - if (thread.hasStackFrames()) { - return thread.getStackFrames().length; - } - } - return 0; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#hasChildren(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate) - */ - protected boolean hasChildren(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException { - PDAThread thread = ((PDADebugTarget) element).getThread(0); - if (thread != null) { - return thread.hasStackFrames(); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#getChildren(java.lang.Object, int, int, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate) - */ - protected Object[] getChildren(Object parent, int index, int length, IPresentationContext context, IViewerUpdate monitor) throws CoreException { - if (context.getId().equals(IDebugUIConstants.ID_DEBUG_VIEW)) { - PDAThread thread = ((PDADebugTarget) parent).getThread(0); - if (thread != null) { - return getElements(thread.getStackFrames(), index, length); - } - } - return EMPTY; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#supportsContextId(java.lang.String) - */ - protected boolean supportsContextId(String id) { - return IDebugUIConstants.ID_DEBUG_VIEW.equals(id); - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetProxy.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetProxy.java deleted file mode 100644 index e905e12fe..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetProxy.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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.pda.adapters; - -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.internal.ui.viewers.update.DebugEventHandler; -import org.eclipse.debug.internal.ui.viewers.update.DebugTargetEventHandler; -import org.eclipse.debug.internal.ui.viewers.update.DebugTargetProxy; - -/** - * @since 3.2 - * - */ -public class PDADebugTargetProxy extends DebugTargetProxy { - - /** - * @param target - */ - public PDADebugTargetProxy(IDebugTarget target) { - super(target); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.viewers.update.DebugTargetProxy#createEventHandlers() - */ - protected DebugEventHandler[] createEventHandlers() { - return new DebugEventHandler[] { new DebugTargetEventHandler(this), new PDAThreadEventHandler(this) }; - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java deleted file mode 100644 index 7bb788b24..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Wind River Systems 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.adapters; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.debug.core.IRequest; -import org.eclipse.debug.core.commands.AbstractDebugCommand; -import org.eclipse.debug.core.commands.IEnabledStateRequest; -import org.eclipse.debug.core.commands.IRestartHandler; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.examples.core.pda.model.PDADebugTarget; - -/** - * Restart debug command handler. It restarts the current debug session. - */ -public class PDARestartDebugCommand extends AbstractDebugCommand implements IRestartHandler { - - protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException { - for (int i = 0; i < targets.length; i++) { - ((PDADebugTarget)targets[i]).restart(); - monitor.worked(1); - } - } - - protected Object getTarget(Object element) { - IDebugTarget target = (IDebugTarget)getAdapter(element, IDebugTarget.class); - if (target instanceof PDADebugTarget) { - return target; - } - return null; - } - - protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request) - throws CoreException - { - for (int i = 0; i < targets.length; i++) { - if (((PDADebugTarget)targets[i]).isTerminated()) { - return false; - } - monitor.worked(1); - } - return true; - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAThreadEventHandler.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAThreadEventHandler.java deleted file mode 100644 index f7bc12359..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAThreadEventHandler.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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.pda.adapters; - -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.core.model.IStackFrame; -import org.eclipse.debug.core.model.IThread; -import org.eclipse.debug.examples.core.pda.model.PDAThread; -import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; -import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta; -import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy; -import org.eclipse.debug.internal.ui.viewers.update.DebugEventHandler; - - -/** - * @since 3.2 - */ -public class PDAThreadEventHandler extends DebugEventHandler { - - private IStackFrame fPrev = null; - - /** - * Constructs and event handler for a threads in the given viewer. - * - * @param viewer - */ - public PDAThreadEventHandler(AbstractModelProxy proxy) { - super(proxy); - } - - protected void handleSuspend(DebugEvent event) { - IThread thread = (IThread) event.getSource(); - int extras = IModelDelta.STATE; - if (event.getDetail() == DebugEvent.BREAKPOINT | event.getDetail() == DebugEvent.CLIENT_REQUEST) { - extras = IModelDelta.EXPAND; - } - fireDeltaUpdatingTopFrame(thread, IModelDelta.NO_CHANGE | extras); - } - - private boolean isEqual(Object o1, Object o2) { - if (o1 == o2) { - return true; - } - if (o1 == null) { - return false; - } - return o1.equals(o2); - } - - protected void handleResume(DebugEvent event) { - IThread thread = (IThread) event.getSource(); - fireDeltaAndClearTopFrame(thread, IModelDelta.STATE | IModelDelta.CONTENT); - } - - protected void handleCreate(DebugEvent event) { - fireDeltaAndClearTopFrame((IThread) event.getSource(), IModelDelta.ADDED); - } - - protected void handleTerminate(DebugEvent event) { - fireDeltaAndClearTopFrame((IThread) event.getSource(), IModelDelta.REMOVED); - } - - protected void handleChange(DebugEvent event) { - fireDeltaUpdatingTopFrame((IThread) event.getSource(), IModelDelta.STATE); - } - - protected void handleLateSuspend(DebugEvent suspend, DebugEvent resume) { - IThread thread = (IThread) suspend.getSource(); - fireDeltaUpdatingTopFrame(thread, IModelDelta.CONTENT | IModelDelta.EXPAND); - } - - protected void handleSuspendTimeout(DebugEvent event) { - IThread thread = (IThread) event.getSource(); - fireDeltaAndClearTopFrame(thread, IModelDelta.CONTENT); - } - - private ModelDelta buildRootDelta() { - return new ModelDelta(getLaunchManager(), IModelDelta.NO_CHANGE); - } - - private ILaunchManager getLaunchManager() { - return DebugPlugin.getDefault().getLaunchManager(); - } - - protected ModelDelta addTarget(ModelDelta delta, IThread thread) { - ILaunch launch = thread.getLaunch(); - Object[] children = launch.getChildren(); - delta = delta.addNode(launch, indexOf(getLaunchManager().getLaunches(), launch), IModelDelta.NO_CHANGE, children.length); - IDebugTarget debugTarget = thread.getDebugTarget(); - int numFrames = -1; - try { - numFrames = thread.getStackFrames().length; - } catch (DebugException e) { - } - return delta.addNode(debugTarget, indexOf(children, debugTarget), IModelDelta.NO_CHANGE, numFrames); - } - - private void fireDeltaAndClearTopFrame(IThread thread, int flags) { - ModelDelta delta = buildRootDelta(); - addTarget(delta, thread); - synchronized (this) { - fPrev = null; - } - fireDelta(delta); - } - - private void fireDeltaUpdatingTopFrame(IThread thread, int flags) { - ModelDelta delta = buildRootDelta(); - ModelDelta node = addTarget(delta, thread); - synchronized (this) { - IStackFrame prev = fPrev; - IStackFrame frame = null; - try { - frame = thread.getTopStackFrame(); - } catch (DebugException e) { - } - if (isEqual(frame, prev)) { - node.setFlags(flags); - } else { - node.setFlags(flags | IModelDelta.CONTENT); - } - if (frame != null) { - node.addNode(frame, 0, IModelDelta.STATE | IModelDelta.SELECT, 0); - } - fPrev = frame; - } - fireDelta(delta); - } - - protected boolean handlesEvent(DebugEvent event) { - return event.getSource() instanceof PDAThread; - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDABreakpointAdapter.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDABreakpointAdapter.java deleted file mode 100644 index 0f2639f7c..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDABreakpointAdapter.java +++ /dev/null @@ -1,227 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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 - * Bjorn Freeman-Benson - initial API and implementation - * Wind River Systems - added support for IToggleBreakpointsTargetFactory - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.breakpoints; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.debug.core.model.ILineBreakpoint; -import org.eclipse.debug.examples.core.pda.DebugCorePlugin; -import org.eclipse.debug.examples.core.pda.breakpoints.PDALineBreakpoint; -import org.eclipse.debug.examples.core.pda.breakpoints.PDAWatchpoint; -import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.texteditor.IDocumentProvider; -import org.eclipse.ui.texteditor.ITextEditor; - - -/** - * Adapter to create breakpoints in PDA files. - */ -public class PDABreakpointAdapter implements IToggleBreakpointsTargetExtension { - /* (non-Javadoc) - * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) - */ - public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException { - ITextEditor textEditor = getEditor(part); - if (textEditor != null) { - IResource resource = (IResource) textEditor.getEditorInput().getAdapter(IResource.class); - ITextSelection textSelection = (ITextSelection) selection; - int lineNumber = textSelection.getStartLine(); - IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(DebugCorePlugin.ID_PDA_DEBUG_MODEL); - for (int i = 0; i < breakpoints.length; i++) { - IBreakpoint breakpoint = breakpoints[i]; - if (breakpoint instanceof ILineBreakpoint && resource.equals(breakpoint.getMarker().getResource())) { - if (((ILineBreakpoint)breakpoint).getLineNumber() == (lineNumber + 1)) { - // remove - breakpoint.delete(); - return; - } - } - } - // create line breakpoint (doc line numbers start at 0) - PDALineBreakpoint lineBreakpoint = new PDALineBreakpoint(resource, lineNumber + 1); - DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(lineBreakpoint); - } - } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) - */ - public boolean canToggleLineBreakpoints(IWorkbenchPart part, ISelection selection) { - return getEditor(part) != null; - } - - /** - * Returns the editor being used to edit a PDA file, associated with the - * given part, or <code>null</code> if none. - * - * @param part workbench part - * @return the editor being used to edit a PDA file, associated with the - * given part, or <code>null</code> if none - */ - private ITextEditor getEditor(IWorkbenchPart part) { - if (part instanceof ITextEditor) { - ITextEditor editorPart = (ITextEditor) part; - IResource resource = (IResource) editorPart.getEditorInput().getAdapter(IResource.class); - if (resource != null) { - String extension = resource.getFileExtension(); - if (extension != null && extension.equals("pda")) { - return editorPart; - } - } - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) - */ - public void toggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException { - } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) - */ - public boolean canToggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) { - return false; - } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) - */ - public void toggleWatchpoints(IWorkbenchPart part, ISelection selection) throws CoreException { - String[] variableAndFunctionName = getVariableAndFunctionName(part, selection); - if (variableAndFunctionName != null && part instanceof ITextEditor && selection instanceof ITextSelection) { - ITextEditor editorPart = (ITextEditor)part; - int lineNumber = ((ITextSelection)selection).getStartLine(); - IResource resource = (IResource) editorPart.getEditorInput().getAdapter(IResource.class); - String var = variableAndFunctionName[0]; - String fcn = variableAndFunctionName[1]; - toggleWatchpoint(resource, lineNumber, fcn, var, true, true); - } - } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) - */ - public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) { - return getVariableAndFunctionName(part, selection) != null; - } - - protected void toggleWatchpoint(IResource resource, int lineNumber, String fcn, String var, boolean access, - boolean modification) throws CoreException - { - // look for existing watchpoint to delete - IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(DebugCorePlugin.ID_PDA_DEBUG_MODEL); - for (int i = 0; i < breakpoints.length; i++) { - IBreakpoint breakpoint = breakpoints[i]; - if (breakpoint instanceof PDAWatchpoint && resource.equals(breakpoint.getMarker().getResource())) { - PDAWatchpoint watchpoint = (PDAWatchpoint)breakpoint; - String otherVar = watchpoint.getVariableName(); - String otherFcn = watchpoint.getFunctionName(); - if (otherVar.equals(var) && otherFcn.equals(fcn)) { - breakpoint.delete(); - return; - } - } - } - // create watchpoint - PDAWatchpoint watchpoint = new PDAWatchpoint(resource, lineNumber + 1, fcn, var, access, modification); - DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(watchpoint); - } - - /** - * Returns the variable and function names at the current line, or <code>null</code> if none. - * - * @param part text editor - * @param selection text selection - * @return the variable and function names at the current line, or <code>null</code> if none. - * The array has two elements, the first is the variable name, the second is the function name. - */ - protected String[] getVariableAndFunctionName(IWorkbenchPart part, ISelection selection) { - ITextEditor editor = getEditor(part); - if (editor != null && selection instanceof ITextSelection) { - ITextSelection textSelection = (ITextSelection) selection; - IDocumentProvider documentProvider = editor.getDocumentProvider(); - try { - documentProvider.connect(this); - IDocument document = documentProvider.getDocument(editor.getEditorInput()); - IRegion region = document.getLineInformationOfOffset(textSelection.getOffset()); - String string = document.get(region.getOffset(), region.getLength()).trim(); - if (string.startsWith("var ")) { - String varName = string.substring(4).trim(); - String fcnName = getFunctionName(document, varName, document.getLineOfOffset(textSelection.getOffset())); - return new String[] {varName, fcnName}; - } - } catch (CoreException e) { - } catch (BadLocationException e) { - } finally { - documentProvider.disconnect(this); - } - } - return null; - } - - /** - * Returns the name of the function containing the given variable defined at the given - * line number in the specified document. - * - * @param document PDA source file - * @param varName variable name - * @param line line numbner at which the variable is defined - * @return name of function defining the variable - */ - private String getFunctionName(IDocument document, String varName, int line) { - // This is a simple guess at the function name - look for the labels preceeding - // the variable definition, and then see if there are any 'calls' to that - // label. If none, assumet the variable is in the "_main_" function - String source = document.get(); - int lineIndex = line - 1; - while (lineIndex >= 0) { - try { - IRegion information = document.getLineInformation(lineIndex); - String lineText = document.get(information.getOffset(), information.getLength()); - if (lineText.startsWith(":")) { - String label = lineText.substring(1); - if (source.indexOf("call " + label) >= 0) { - return label; - } - } - lineIndex--; - } catch (BadLocationException e) { - } - } - return "_main_"; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#toggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) - */ - public void toggleBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException { - if (canToggleWatchpoints(part, selection)) { - toggleWatchpoints(part, selection); - } else { - toggleLineBreakpoints(part, selection); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#canToggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) - */ - public boolean canToggleBreakpoints(IWorkbenchPart part, ISelection selection) { - return canToggleLineBreakpoints(part, selection) || canToggleWatchpoints(part, selection); - } -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAEditorAdapterFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAEditorAdapterFactory.java deleted file mode 100644 index c67200a40..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAEditorAdapterFactory.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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 - * Bjorn Freeman-Benson - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.breakpoints; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.debug.examples.ui.pda.editor.PDAEditor; -import org.eclipse.debug.ui.actions.IRunToLineTarget; -import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget; -import org.eclipse.ui.texteditor.ITextEditor; - - -/** - * Creates a toggle breakpoint adapter - */ -public class PDAEditorAdapterFactory implements IAdapterFactory { - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) - */ - public Object getAdapter(Object adaptableObject, Class adapterType) { - if (adaptableObject instanceof PDAEditor) { - ITextEditor editorPart = (ITextEditor) adaptableObject; - IResource resource = (IResource) editorPart.getEditorInput().getAdapter(IResource.class); - if (resource != null) { - String extension = resource.getFileExtension(); - if (extension != null && extension.equals("pda")) { - if (adapterType.equals(IToggleBreakpointsTarget.class)) { - return new PDABreakpointAdapter(); - } - //#ifdef ex7 -//# // TODO: Exercise 7 - create run to line adapter - //#else - if (adapterType.equals(IRunToLineTarget.class)) { - return new PDARunToLineAdapter(); - } - //#endif - } - } - } - return null; - } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() - */ - public Class[] getAdapterList() { - return new Class[]{IToggleBreakpointsTarget.class}; - } -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDARunToLineAdapter.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDARunToLineAdapter.java deleted file mode 100644 index 3d5fa42d0..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDARunToLineAdapter.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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 - * Bjorn Freeman-Benson - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.breakpoints; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.debug.core.model.IDebugElement; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.core.model.ISuspendResume; -import org.eclipse.debug.examples.core.pda.DebugCorePlugin; -import org.eclipse.debug.examples.core.pda.breakpoints.PDARunToLineBreakpoint; -import org.eclipse.debug.ui.actions.IRunToLineTarget; -import org.eclipse.debug.ui.actions.RunToLineHandler; -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.texteditor.ITextEditor; - - -/** - * Run to line target for the Java debugger - */ -public class PDARunToLineAdapter implements IRunToLineTarget { - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.actions.IRunToLineTarget#runToLine(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection, org.eclipse.debug.core.model.ISuspendResume) - */ - public void runToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException { - IEditorPart editorPart = (IEditorPart)part; - ITextEditor textEditor = (ITextEditor)editorPart; - ITextSelection textSelection = (ITextSelection) selection; - int lineNumber = textSelection.getStartLine() + 1; - if (lineNumber > 0) { - if (target instanceof IAdaptable) { - IDebugTarget debugTarget = (IDebugTarget) ((IAdaptable)target).getAdapter(IDebugTarget.class); - if (debugTarget != null) { - //#ifdef ex7 -//# // TODO: Exercise 7 - perform the run-to-line with a run-to-line breakpoint and handler - //#else - IFile resource = (IFile) textEditor.getEditorInput().getAdapter(IResource.class); - IBreakpoint breakpoint= new PDARunToLineBreakpoint(resource, lineNumber); - RunToLineHandler handler = new RunToLineHandler(debugTarget, target, breakpoint); - handler.run(new NullProgressMonitor()); - //#endif - } - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.actions.IRunToLineTarget#canRunToLine(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection, org.eclipse.debug.core.model.ISuspendResume) - */ - public boolean canRunToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) { - //#ifdef ex7 -//# // TODO: Exercise 7 - ensure the target is a PDA target -//# return false; - //#else - return target instanceof IDebugElement && - ((IDebugElement)target).getModelIdentifier().equals(DebugCorePlugin.ID_PDA_DEBUG_MODEL); - //#endif - } -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java deleted file mode 100644 index 4c51afeb9..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java +++ /dev/null @@ -1,168 +0,0 @@ -/******************************************************************************* - * 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.breakpoints; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.debug.core.model.ISourceLocator; -import org.eclipse.debug.examples.core.pda.model.PDAStackFrame; -import org.eclipse.debug.examples.core.pda.model.PDAVariable; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.progress.WorkbenchJob; -import org.eclipse.ui.texteditor.ITextEditor; - - -/** - * Adapter to create specialized watchpoints in PDA files and the variables views. - */ -public class PDAToggleWatchpointsTarget extends PDABreakpointAdapter { - - final private boolean fAccessModeEnabled; - final private boolean fModificationModeEnabled; - - PDAToggleWatchpointsTarget(boolean access, boolean modification) { - fAccessModeEnabled = access; - fModificationModeEnabled = modification; - } - - public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) { - if (super.canToggleWatchpoints(part, selection)) { - return true; - } else { - if (selection instanceof IStructuredSelection) { - IStructuredSelection ss = (IStructuredSelection)selection; - return ss.getFirstElement() instanceof PDAVariable; - } - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) - */ - public void toggleWatchpoints(IWorkbenchPart part, ISelection selection) throws CoreException { - String[] variableAndFunctionName = getVariableAndFunctionName(part, selection); - - if (variableAndFunctionName != null && part instanceof ITextEditor && selection instanceof ITextSelection) { - // Selection inside text editor. Create a watchpoint based on - // current source line. - ITextEditor editorPart = (ITextEditor)part; - int lineNumber = ((ITextSelection)selection).getStartLine(); - IResource resource = (IResource) editorPart.getEditorInput().getAdapter(IResource.class); - String var = variableAndFunctionName[0]; - String fcn = variableAndFunctionName[1]; - toggleWatchpoint(resource, lineNumber, fcn, var, fAccessModeEnabled, fModificationModeEnabled); - } else if (selection instanceof IStructuredSelection && - ((IStructuredSelection)selection).getFirstElement() instanceof PDAVariable ) - { - // Selection is inside a variables view. Create a watchpoint - // using information from the variable. Retrieving information - // from the model requires performing source lookup which should be - // done on a background thread. - final PDAVariable var = (PDAVariable)((IStructuredSelection)selection).getFirstElement(); - final PDAStackFrame frame = var.getStackFrame(); - final Shell shell = part.getSite().getShell(); - - new Job("Toggle PDA Watchpoint") { - { setSystem(true); } - - protected IStatus run(IProgressMonitor monitor) { - try { - IFile file = getResource(var.getStackFrame()); - String varName = var.getName(); - int line = findLine(file, varName); - toggleWatchpoint(file, line, frame.getName(), varName, - fAccessModeEnabled, fModificationModeEnabled); - } catch (final CoreException e) { - // Need to switch back to the UI thread to show the error - // dialog. - new WorkbenchJob(shell.getDisplay(), "Toggle PDA Watchpoint") { - { setSystem(true); } - - public IStatus runInUIThread(IProgressMonitor monitor) { - ErrorDialog.openError(shell, "Failed to create PDA watchpoint", "Failed to create PDA watchpoint.\n", e.getStatus()); - return Status.OK_STATUS; - } - }.schedule(); - } - return Status.OK_STATUS; - } - }.schedule(); - } - } - - private IFile getResource(PDAStackFrame frame) { - ISourceLocator locator = frame.getLaunch().getSourceLocator(); - Object sourceElement = locator.getSourceElement(frame); - if (sourceElement instanceof IFile) { - return (IFile)sourceElement; - } - return null; - } - - private int findLine(IFile file, String var) throws CoreException { - BufferedReader reader = new BufferedReader(new InputStreamReader(file.getContents())); - - int lineNum = 0; - try { - while(true) { - String line = reader.readLine().trim(); - if (line.startsWith("var")) { - String varName = line.substring("var".length()).trim(); - if (varName.equals(var)) { - break; - } - } - lineNum++; - } - } catch (IOException e) { - // end of file reached and line wasn't found - return -1; - } finally { - try { - reader.close(); - } catch (IOException e) {} - } - return lineNum; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#toggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) - */ - public void toggleBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException { - if (canToggleWatchpoints(part, selection)) { - toggleWatchpoints(part, selection); - } else { - toggleLineBreakpoints(part, selection); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#canToggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) - */ - public boolean canToggleBreakpoints(IWorkbenchPart part, ISelection selection) { - return canToggleLineBreakpoints(part, selection) || canToggleWatchpoints(part, selection); - } -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTargetFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTargetFactory.java deleted file mode 100644 index 9c9ebd9cc..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTargetFactory.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Wind River Systems 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.breakpoints; - -import java.util.HashMap; -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Set; - -import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget; -import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetFactory; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IWorkbenchPart; - -/** - * Toggle breakpoints target factory for creating PDA watchpoints. It allows the - * user the select the type of watchpoint that will be created when the watchpoint - * is toggles inside the editor or variables view. - */ -public class PDAToggleWatchpointsTargetFactory implements IToggleBreakpointsTargetFactory { - - private static final String TOGGLE_WATCHPOINT_TARGET_ACCESS = "org.eclipse.debug.examples.ui.pda.watchpoint_access"; - private static final String TOGGLE_WATCHPOINT_TARGET_MODIFICATION = "org.eclipse.debug.examples.ui.pda.watchpoint_modification"; - private static final String TOGGLE_WATCHPOINT_TARGET_BOTH = "org.eclipse.debug.examples.ui.pda.watchpoint_both"; - - private static Set TOGGLE_WATCHPOINTS_TARGETS = new LinkedHashSet(); - - private Map fToggleWatchpointTargets = new HashMap(3); - - static { - TOGGLE_WATCHPOINTS_TARGETS.add(TOGGLE_WATCHPOINT_TARGET_BOTH); - TOGGLE_WATCHPOINTS_TARGETS.add(TOGGLE_WATCHPOINT_TARGET_ACCESS); - TOGGLE_WATCHPOINTS_TARGETS.add(TOGGLE_WATCHPOINT_TARGET_MODIFICATION); - } - - public IToggleBreakpointsTarget createToggleTarget(String targetID) { - IToggleBreakpointsTarget target = (IToggleBreakpointsTarget)fToggleWatchpointTargets.get(targetID); - if (target == null) { - if (TOGGLE_WATCHPOINT_TARGET_BOTH.equals(targetID)) { - target = new PDAToggleWatchpointsTarget(true, true); - } else if (TOGGLE_WATCHPOINT_TARGET_ACCESS.equals(targetID)) { - target = new PDAToggleWatchpointsTarget(true, false); - } else if (TOGGLE_WATCHPOINT_TARGET_MODIFICATION.equals(targetID)) { - target = new PDAToggleWatchpointsTarget(false, true); - } else { - return null; - } - fToggleWatchpointTargets.put(targetID, target); - } - return target; - } - - public String getDefaultToggleTarget(IWorkbenchPart part, ISelection selection) { - return TOGGLE_WATCHPOINT_TARGET_BOTH; - } - - public Set getToggleTargets(IWorkbenchPart part, ISelection selection) { - return TOGGLE_WATCHPOINTS_TARGETS; - } - - public String getToggleTargetName(String targetID) { - if (TOGGLE_WATCHPOINT_TARGET_BOTH.equals(targetID)) { - return "Watchpoints (Read/Write)"; - } else if (TOGGLE_WATCHPOINT_TARGET_ACCESS.equals(targetID)) { - return "Watchpoints (Read)"; - } else if (TOGGLE_WATCHPOINT_TARGET_MODIFICATION.equals(targetID)) { - return "Watchpoints (Write)"; - } else { - return null; - } - } - - public String getToggleTargetDescription(String targetID) { - return getToggleTargetName(targetID); - } -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/AnnotationHover.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/AnnotationHover.java deleted file mode 100644 index 6b79056b7..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/AnnotationHover.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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 - * Bjorn Freeman-Benson - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.editor; - -import java.util.Iterator; - -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.Position; -import org.eclipse.jface.text.source.Annotation; -import org.eclipse.jface.text.source.IAnnotationHover; -import org.eclipse.jface.text.source.IAnnotationModel; -import org.eclipse.jface.text.source.ISourceViewer; - -/** - * Returns hover for breakpoints. - */ -public class AnnotationHover implements IAnnotationHover { - - public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) { - IAnnotationModel annotationModel = sourceViewer.getAnnotationModel(); - Iterator iterator = annotationModel.getAnnotationIterator(); - while (iterator.hasNext()) { - Annotation annotation = (Annotation) iterator.next(); - Position position = annotationModel.getPosition(annotation); - try { - int lineOfAnnotation = sourceViewer.getDocument().getLineOfOffset(position.getOffset()); - if (lineNumber == lineOfAnnotation) { - return annotation.getText(); - } - } catch (BadLocationException e) { - } - } - return null; - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistProcessor.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistProcessor.java deleted file mode 100644 index 5d7089472..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistProcessor.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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 - * Bjorn Freeman-Benson - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.editor; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jface.text.contentassist.CompletionProposal; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.text.contentassist.IContextInformation; -import org.eclipse.jface.text.contentassist.IContextInformationValidator; - -public class PDAContentAssistProcessor implements IContentAssistProcessor { - - public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { - int index = offset - 1; - StringBuffer prefix = new StringBuffer(); - IDocument document = viewer.getDocument(); - while (index > 0) { - try { - char prev = document.getChar(index); - if (Character.isWhitespace(prev)) { - break; - } - prefix.insert(0, prev); - index--; - } catch (BadLocationException e) { - } - } - - List proposals = new ArrayList(); - String[] keywords = PDAScanner.fgKeywords; - if (prefix.length() > 0) { - String word = prefix.toString(); - for (int i = 0; i < keywords.length; i++) { - String keyword = keywords[i]; - if (keyword.startsWith(word) && word.length() < keyword.length()) { - proposals.add(new CompletionProposal(keyword + " ", index + 1, offset - (index + 1), keyword.length() + 1)); - } - } - } else { - // propose all keywords - for (int i = 0; i < keywords.length; i++) { - String keyword = keywords[i]; - proposals.add(new CompletionProposal(keyword + " ", offset, 0, keyword.length() + 1)); - } - } - if (!proposals.isEmpty()) { - return (ICompletionProposal[]) proposals.toArray(new ICompletionProposal[proposals.size()]); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, int) - */ - public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters() - */ - public char[] getCompletionProposalAutoActivationCharacters() { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters() - */ - public char[] getContextInformationAutoActivationCharacters() { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage() - */ - public String getErrorMessage() { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator() - */ - public IContextInformationValidator getContextInformationValidator() { - return null; - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistant.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistant.java deleted file mode 100644 index 01f71928e..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistant.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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 - * Bjorn Freeman-Benson - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.editor; - -import org.eclipse.jface.text.DefaultInformationControl; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IInformationControl; -import org.eclipse.jface.text.IInformationControlCreator; -import org.eclipse.jface.text.contentassist.ContentAssistant; -import org.eclipse.swt.widgets.Shell; - -public class PDAContentAssistant extends ContentAssistant { - - public PDAContentAssistant() { - super(); - - PDAContentAssistProcessor processor= new PDAContentAssistProcessor(); - setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE); - - enableAutoActivation(false); - enableAutoInsert(false); - - setInformationControlCreator(getInformationControlCreator()); - } - - private IInformationControlCreator getInformationControlCreator() { - return new IInformationControlCreator() { - public IInformationControl createInformationControl(Shell parent) { - return new DefaultInformationControl(parent); - } - }; - } -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAEditor.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAEditor.java deleted file mode 100644 index 3617cb172..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAEditor.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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 - * Bjorn Freeman-Benson - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.editor; - -import java.util.ResourceBundle; - -import org.eclipse.jface.action.IAction; -import org.eclipse.ui.texteditor.AbstractDecoratedTextEditor; -import org.eclipse.ui.texteditor.ContentAssistAction; -import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; - -/** - * PDA editor - */ -public class PDAEditor extends AbstractDecoratedTextEditor { - - /** - * Creates a PDE editor - */ - public PDAEditor() { - super(); - setSourceViewerConfiguration(new PDASourceViewerConfiguration()); - setRulerContextMenuId("pda.editor.rulerMenu"); - setEditorContextMenuId("pda.editor.editorMenu"); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.AbstractTextEditor#createActions() - */ - protected void createActions() { - super.createActions(); - ResourceBundle bundle = ResourceBundle.getBundle("org.eclipse.debug.examples.ui.pda.editor.PDAEditorMessages"); //$NON-NLS-1$ - IAction action = new ContentAssistAction(bundle, "ContentAssistProposal.", this); //$NON-NLS-1$ - action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); - setAction("ContentAssistProposal", action); //$NON-NLS-1$ - } - - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAEditorMessages.properties b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAEditorMessages.properties deleted file mode 100644 index 3215e8892..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAEditorMessages.properties +++ /dev/null @@ -1,15 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 2007 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 -############################################################################### - -ContentAssistProposal.label=Content &Assist -ContentAssistProposal.tooltip=Content Assist -ContentAssistProposal.image= -ContentAssistProposal.description=Content Assist
\ No newline at end of file diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAScanner.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAScanner.java deleted file mode 100644 index b62d0ba45..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAScanner.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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 - * Bjorn Freeman-Benson - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.editor; - -import org.eclipse.debug.examples.ui.pda.DebugUIPlugin; -import org.eclipse.jface.text.TextAttribute; -import org.eclipse.jface.text.rules.BufferedRuleBasedScanner; -import org.eclipse.jface.text.rules.IRule; -import org.eclipse.jface.text.rules.IWordDetector; -import org.eclipse.jface.text.rules.Token; -import org.eclipse.jface.text.rules.WordRule; - - -/** - * PDA editor keyword scanner. - */ -public class PDAScanner extends BufferedRuleBasedScanner { - - /** - * PDA keywods - */ - public static final String[] fgKeywords = new String[] { - "add", "branch_not_zero", "call", "dec", "dup", - "halt", "output", "pop", "push", "return", "var" - }; - - /** - * Detects potential keywords - */ - class PDAWordDetector implements IWordDetector { - - /* (non-Javadoc) - * @see org.eclipse.jface.text.rules.IWordDetector#isWordStart(char) - */ - public boolean isWordStart(char c) { - return Character.isLetter(c); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.text.rules.IWordDetector#isWordPart(char) - */ - public boolean isWordPart(char c) { - return Character.isLetter(c) || c == '_'; - } - } - - /** - * Detects PDA branch labels - */ - class PDALabelDetector extends PDAWordDetector { - - /* (non-Javadoc) - * @see org.eclipse.jface.text.rules.IWordDetector#isWordStart(char) - */ - public boolean isWordStart(char c) { - return c == ':'; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.text.rules.IWordDetector#isWordPart(char) - */ - public boolean isWordPart(char c) { - return super.isWordPart(c) || Character.isDigit(c); - } - } - - /** - * Constructs a scanner that identifies PDA keywords. - */ - public PDAScanner() { - // keywords - Token token = new Token(new TextAttribute(DebugUIPlugin.getDefault().getColor(DebugUIPlugin.KEYWORD))); - WordRule keywords = new WordRule(new PDAWordDetector()); - for (int i = 0; i < fgKeywords.length; i++) { - String keyword = fgKeywords[i]; - keywords.addWord(keyword, token); - } - // labels - token = new Token(new TextAttribute(DebugUIPlugin.getDefault().getColor(DebugUIPlugin.LABEL))); - WordRule labels = new WordRule(new PDALabelDetector(), token); - setRules(new IRule[]{keywords, labels}); - } -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDASourceViewerConfiguration.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDASourceViewerConfiguration.java deleted file mode 100644 index 6c24c36a0..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDASourceViewerConfiguration.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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 - * Bjorn Freeman-Benson - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.editor; - -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.ITextHover; -import org.eclipse.jface.text.contentassist.IContentAssistant; -import org.eclipse.jface.text.presentation.IPresentationReconciler; -import org.eclipse.jface.text.presentation.PresentationReconciler; -import org.eclipse.jface.text.rules.DefaultDamagerRepairer; -import org.eclipse.jface.text.source.IAnnotationHover; -import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.ui.editors.text.TextSourceViewerConfiguration; - -/** - * Source view configuration for the PDA editor - */ -public class PDASourceViewerConfiguration extends TextSourceViewerConfiguration { - - /* (non-Javadoc) - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getTextHover(org.eclipse.jface.text.source.ISourceViewer, java.lang.String) - */ - public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) { - return new TextHover(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAnnotationHover(org.eclipse.jface.text.source.ISourceViewer) - */ - public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) { - return new AnnotationHover(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(org.eclipse.jface.text.source.ISourceViewer) - */ - public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) { - PresentationReconciler reconciler = new PresentationReconciler(); - reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer)); - DefaultDamagerRepairer dr = new DefaultDamagerRepairer(new PDAScanner()); - reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE); - reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE); - return reconciler; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(org.eclipse.jface.text.source.ISourceViewer) - */ - public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { - return new PDAContentAssistant(); - } - - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PopFrameActionDelegate.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PopFrameActionDelegate.java deleted file mode 100644 index 43e35dc26..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PopFrameActionDelegate.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 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 - * Bjorn Freeman-Benson - initial API and implementation - * Pawel Piech (Wind River) - ported PDA Virtual Machine to Java (Bug 261400) - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.editor; - -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.examples.core.pda.model.PDAStackFrame; -import org.eclipse.debug.examples.core.pda.model.PDAThread; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.widgets.Event; -import org.eclipse.ui.IActionDelegate2; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IWorkbenchPart; - - -public class PopFrameActionDelegate implements IObjectActionDelegate, IActionDelegate2 { - - private PDAThread fThread = null; - - /* (non-Javadoc) - * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart) - */ - public void setActivePart(IAction action, IWorkbenchPart targetPart) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) { - //#ifdef ex5 -//# // TODO: Exercise 5 - pop the top frame - //#else - try { - fThread.popFrame(); - } catch (DebugException e) { - } - //#endif - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged(IAction action, ISelection selection) { - if (selection instanceof IStructuredSelection) { - IStructuredSelection ss = (IStructuredSelection) selection; - Object element = ss.getFirstElement(); - if (element instanceof PDAStackFrame) { - PDAStackFrame frame = (PDAStackFrame) element; - //#ifdef ex5 -//# // TODO: Exercise 5 - enable the action if the frame's thread supports it - //#else - fThread = (PDAThread) frame.getThread(); - try { - action.setEnabled(fThread.canPopFrame() && fThread.getTopStackFrame().equals(frame)); - } catch (DebugException e) { - } - return; - //#endif - } - - } - action.setEnabled(false); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction) - */ - public void init(IAction action) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate2#dispose() - */ - public void dispose() { - fThread = null; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event) - */ - public void runWithEvent(IAction action, Event event) { - run(action); - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/TextHover.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/TextHover.java deleted file mode 100644 index 6b14e4c74..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/TextHover.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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 - * Bjorn Freeman-Benson - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.editor; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IThread; -import org.eclipse.debug.core.model.IVariable; -import org.eclipse.debug.examples.core.pda.model.PDADebugTarget; -import org.eclipse.debug.examples.core.pda.model.PDAStackFrame; -import org.eclipse.debug.examples.core.pda.model.PDAThread; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.ITextHover; -import org.eclipse.jface.text.ITextViewer; - - -/** - * Produces debug hover for the PDA debugger. - */ -public class TextHover implements ITextHover { - - /* (non-Javadoc) - * @see org.eclipse.jface.text.ITextHover#getHoverInfo(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion) - */ - public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) { - String varName = null; - try { - varName = textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength()); - } catch (BadLocationException e) { - return null; - } - if (varName.startsWith("$") && varName.length() > 1) { - varName = varName.substring(1); - } - - PDAStackFrame frame = null; - IAdaptable debugContext = DebugUITools.getDebugContext(); - if (debugContext instanceof PDAStackFrame) { - frame = (PDAStackFrame) debugContext; - } else if (debugContext instanceof PDAThread) { - PDAThread thread = (PDAThread) debugContext; - try { - frame = (PDAStackFrame) thread.getTopStackFrame(); - } catch (DebugException e) { - return null; - } - } else if (debugContext instanceof PDADebugTarget) { - PDADebugTarget target = (PDADebugTarget) debugContext; - try { - IThread[] threads = target.getThreads(); - if (threads.length > 0) { - frame = (PDAStackFrame) threads[0].getTopStackFrame(); - } - } catch (DebugException e) { - return null; - } - } - if (frame != null) { - try { - IVariable[] variables = frame.getVariables(); - for (int i = 0; i < variables.length; i++) { - IVariable variable = variables[i]; - if (variable.getName().equals(varName)) { - return varName + " = " + variable.getValue().getValueString(); - } - } - } catch (DebugException e) { - } - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.text.ITextHover#getHoverRegion(org.eclipse.jface.text.ITextViewer, int) - */ - public IRegion getHoverRegion(ITextViewer textViewer, int offset) { - return WordFinder.findWord(textViewer.getDocument(), offset); - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/WordFinder.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/WordFinder.java deleted file mode 100644 index e60d98203..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/WordFinder.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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 - * Bjorn Freeman-Benson - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.editor; - - -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.Region; - -/** - * Looks for an identifier in a source file - */ -public class WordFinder { - - /** - * Returns the region in the given document that contains an identifier, or - * <code>null</code> if none. - * - * @param document document to search - * @param offset offset at which to look for an identifier - * @return region containing an identifier, or <code>null</code> - */ - public static IRegion findWord(IDocument document, int offset) { - - int start= -1; - int end= -1; - - - try { - - int pos= offset; - char c; - - while (pos >= 0) { - c= document.getChar(pos); - if (!Character.isJavaIdentifierPart(c)) - break; - --pos; - } - - start= pos; - - pos= offset; - int length= document.getLength(); - - while (pos < length) { - c= document.getChar(pos); - if (!Character.isJavaIdentifierPart(c)) - break; - ++pos; - } - - end= pos; - - } catch (BadLocationException x) { - } - - if (start > -1 && end > -1) { - if (start == offset && end == offset) - return new Region(offset, 0); - else if (start == offset) - return new Region(start, end - start); - else - return new Region(start + 1, end - start - 1); - } - - return null; - } -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDALaunchShortcut.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDALaunchShortcut.java deleted file mode 100644 index 78fc73d48..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDALaunchShortcut.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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 - * Bjorn Freeman-Benson - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.launcher; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.examples.core.pda.DebugCorePlugin; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.ILaunchShortcut; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IEditorPart; - - -/** - * Launches a PDA file - */ -public class PDALaunchShortcut implements ILaunchShortcut { - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchShortcut#launch(org.eclipse.jface.viewers.ISelection, java.lang.String) - */ - public void launch(ISelection selection, String mode) { - // must be a structured selection with one file selected - IFile file = (IFile) ((IStructuredSelection)selection).getFirstElement(); - - // check for an existing launch config for the pda file - String path = file.getFullPath().toString(); - ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); - ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(DebugCorePlugin.ID_PDA_LAUNCH_CONFIGURATION_TYPE); - try { - ILaunchConfiguration[] configurations = launchManager.getLaunchConfigurations(type); - for (int i = 0; i < configurations.length; i++) { - ILaunchConfiguration configuration = configurations[i]; - String attribute = configuration.getAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, (String)null); - if (path.equals(attribute)) { - DebugUITools.launch(configuration, mode); - return; - } - } - } catch (CoreException e) { - return; - } - - try { - // create a new configuration for the pda file - ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, file.getName()); - workingCopy.setAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, path); - workingCopy.setMappedResources(new IResource[]{file}); - ILaunchConfiguration configuration = workingCopy.doSave(); - DebugUITools.launch(configuration, mode); - } catch (CoreException e1) { - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchShortcut#launch(org.eclipse.ui.IEditorPart, java.lang.String) - */ - public void launch(IEditorPart editor, String mode) { - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDAMainTab.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDAMainTab.java deleted file mode 100644 index 27b3a2fcc..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDAMainTab.java +++ /dev/null @@ -1,196 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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 - * Bjorn Freeman-Benson - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.launcher; - - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.examples.core.pda.DebugCorePlugin; -import org.eclipse.debug.examples.ui.pda.DebugUIPlugin; -import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; -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.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.ResourceListSelectionDialog; - - -/** - * Tab to specify the PDA program to run/debug. - */ -public class PDAMainTab extends AbstractLaunchConfigurationTab { - - private Text fProgramText; - private Button fProgramButton; - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent) { - Font font = parent.getFont(); - - Composite comp = new Composite(parent, SWT.NONE); - setControl(comp); - GridLayout topLayout = new GridLayout(); - topLayout.verticalSpacing = 0; - topLayout.numColumns = 3; - comp.setLayout(topLayout); - comp.setFont(font); - - createVerticalSpacer(comp, 3); - - Label programLabel = new Label(comp, SWT.NONE); - programLabel.setText("&Program:"); - GridData gd = new GridData(GridData.BEGINNING); - programLabel.setLayoutData(gd); - programLabel.setFont(font); - - fProgramText = new Text(comp, SWT.SINGLE | SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - fProgramText.setLayoutData(gd); - fProgramText.setFont(font); - fProgramText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - updateLaunchConfigurationDialog(); - } - }); - - fProgramButton = createPushButton(comp, "&Browse...", null); //$NON-NLS-1$ - fProgramButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - browsePDAFiles(); - } - }); - } - - /** - * Open a resource chooser to select a PDA program - */ - protected void browsePDAFiles() { - ResourceListSelectionDialog dialog = new ResourceListSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), IResource.FILE); - dialog.setTitle("PDA Program"); - dialog.setMessage("Select PDA Program"); - if (dialog.open() == Window.OK) { - Object[] files = dialog.getResult(); - IFile file = (IFile) files[0]; - fProgramText.setText(file.getFullPath().toString()); - } - - } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) - */ - public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { - } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) - */ - public void initializeFrom(ILaunchConfiguration configuration) { - //#ifdef ex1 -//# // TODO: Exercise 1 - retrieve the program path attribute from the launch configuration -//# String program = null; -//# if (program != null) { -//# fProgramText.setText(program); -//# } - //#else - try { - String program = null; - program = configuration.getAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, (String)null); - if (program != null) { - fProgramText.setText(program); - } - } catch (CoreException e) { - setErrorMessage(e.getMessage()); - } - //#endif - } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) - */ - public void performApply(ILaunchConfigurationWorkingCopy configuration) { - String program = fProgramText.getText().trim(); - if (program.length() == 0) { - program = null; - } - //#ifdef ex1 -//# // TODO: Exercise 1 - update the launch configuration with the path to -//# // currently specified program - //#else - configuration.setAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, program); - //#endif - - // perform resource mapping for contextual launch - IResource[] resources = null; - if (program!= null) { - IPath path = new Path(program); - IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(path); - if (res != null) { - resources = new IResource[]{res}; - } - } - configuration.setMappedResources(resources); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() - */ - public String getName() { - return "Main"; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration) - */ - public boolean isValid(ILaunchConfiguration launchConfig) { - setErrorMessage(null); - setMessage(null); - String text = fProgramText.getText(); - //#ifdef ex1 -//# // TODO: Exercise 1 - validate the currently specified program exists and is not -//# // empty, providing the user with feedback. - //#else - if (text.length() > 0) { - IPath path = new Path(text); - if (ResourcesPlugin.getWorkspace().getRoot().findMember(path) == null) { - setErrorMessage("Specified program does not exist"); - return false; - } - } else { - setMessage("Specify a program"); - } - //#endif - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage() - */ - public Image getImage() { - return DebugUIPlugin.getDefault().getImageRegistry().get(DebugUIPlugin.IMG_OBJ_PDA); - } -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDATabGroup.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDATabGroup.java deleted file mode 100644 index 6f1753c45..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDATabGroup.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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 - * Bjorn Freeman-Benson - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.launcher; - -import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup; -import org.eclipse.debug.ui.CommonTab; -import org.eclipse.debug.ui.ILaunchConfigurationDialog; -import org.eclipse.debug.ui.ILaunchConfigurationTab; -import org.eclipse.debug.ui.sourcelookup.SourceLookupTab; - -/** - * Tab group for a PDA application - */ -public class PDATabGroup extends AbstractLaunchConfigurationTabGroup { - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String) - */ - public void createTabs(ILaunchConfigurationDialog dialog, String mode) { - //#ifdef ex1 -//# // TODO: Exercise 1 - add the PDA main tab, source lookup tab and common -//# // tab to the tab group - //#else - setTabs(new ILaunchConfigurationTab[] { - new PDAMainTab(), - new SourceLookupTab(), - new CommonTab() - }); - //#endif - } -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/presentation/PDAModelPresentation.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/presentation/PDAModelPresentation.java deleted file mode 100644 index 7d5d3ba91..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/presentation/PDAModelPresentation.java +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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 - * Bjorn Freeman-Benson - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.presentation; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.debug.core.model.ILineBreakpoint; -import org.eclipse.debug.core.model.IValue; -import org.eclipse.debug.examples.core.pda.DebugCorePlugin; -import org.eclipse.debug.examples.core.pda.breakpoints.PDALineBreakpoint; -import org.eclipse.debug.examples.core.pda.breakpoints.PDAWatchpoint; -import org.eclipse.debug.examples.core.pda.model.PDADebugTarget; -import org.eclipse.debug.examples.core.pda.model.PDAStackFrame; -import org.eclipse.debug.examples.core.pda.model.PDAThread; -import org.eclipse.debug.ui.IDebugModelPresentation; -import org.eclipse.debug.ui.IValueDetailListener; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.part.FileEditorInput; - - -/** - * Renders PDA debug elements - */ -public class PDAModelPresentation extends LabelProvider implements IDebugModelPresentation { - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDebugModelPresentation#setAttribute(java.lang.String, java.lang.Object) - */ - public void setAttribute(String attribute, Object value) { - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) - */ - public String getText(Object element) { - if (element instanceof PDADebugTarget) { - return getTargetText((PDADebugTarget)element); - } else if (element instanceof PDAThread) { - return getThreadText((PDAThread)element); - } else if (element instanceof PDAStackFrame) { - return getStackFrameText((PDAStackFrame)element); - } else if (element instanceof PDAWatchpoint) { - return getWatchpointText((PDAWatchpoint)element); - } - return null; - } - - /** - * Returns a label for the given watchpoint. - * - * @param watchpoint - * @return a label for the given watchpoint - */ - private String getWatchpointText(PDAWatchpoint watchpoint) { - try { - String label = watchpoint.getVariableName() + " (" + watchpoint.getFunctionName() + ")"; - if (watchpoint.isAccess()) { - label += " [read]"; - } - if (watchpoint.isModification()) { - label += " [write]"; - } - return label; - } catch (CoreException e) { - return null; - } - } - /** - * Returns a label for the given debug target - * - * @param target debug target - * @return a label for the given debug target - */ - private String getTargetText(PDADebugTarget target) { - try { - String pgmPath = target.getLaunch().getLaunchConfiguration().getAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, (String)null); - if (pgmPath != null) { - IPath path = new Path(pgmPath); - String label = ""; - if (target.isTerminated()) { - label = "<terminated>"; - } - return label + "PDA [" + path.lastSegment() + "]"; - } - } catch (CoreException e) { - } - return "PDA"; - - } - - /** - * Returns a label for the given stack frame - * - * @param frame a stack frame - * @return a label for the given stack frame - */ - private String getStackFrameText(PDAStackFrame frame) { - try { - return frame.getName() + " (line: " + frame.getLineNumber() + ")"; - } catch (DebugException e) { - } - return null; - - } - - /** - * Returns a label for the given thread - * - * @param thread a thread - * @return a label for the given thread - */ - private String getThreadText(PDAThread thread) { - String label = thread.getName(); - if (thread.isStepping()) { - label += " (stepping)"; - } else if (thread.isSuspended()) { - IBreakpoint[] breakpoints = thread.getBreakpoints(); - if (breakpoints.length == 0) { - if (thread.getError() == null) { - label += " (suspended)"; - } else { - label += " (" + thread.getError() + ")"; - } - } else { - IBreakpoint breakpoint = breakpoints[0]; // there can only be one in PDA - if (breakpoint instanceof PDALineBreakpoint) { - PDALineBreakpoint pdaBreakpoint = (PDALineBreakpoint) breakpoint; - if (pdaBreakpoint instanceof PDAWatchpoint) { - try { - PDAWatchpoint watchpoint = (PDAWatchpoint)pdaBreakpoint; - label += " (watchpoint: " + watchpoint.getSuspendType() + " " + watchpoint.getVariableName() + ")"; - } catch (CoreException e) { - } - } else if (pdaBreakpoint.isRunToLineBreakpoint()) { - label += " (run to line)"; - } else { - label += " (suspended at line breakpoint)"; - } - } - } - } else if (thread.isTerminated()) { - label = "<terminated> " + label; - } - return label; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IDebugModelPresentation#computeDetail(org.eclipse.debug.core.model.IValue, org.eclipse.debug.ui.IValueDetailListener) - */ - public void computeDetail(IValue value, IValueDetailListener listener) { - String detail = ""; - try { - detail = value.getValueString(); - } catch (DebugException e) { - } - listener.detailComputed(value, detail); - } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ISourcePresentation#getEditorInput(java.lang.Object) - */ - public IEditorInput getEditorInput(Object element) { - if (element instanceof IFile) { - return new FileEditorInput((IFile)element); - } - if (element instanceof ILineBreakpoint) { - return new FileEditorInput((IFile)((ILineBreakpoint)element).getMarker().getResource()); - } - return null; - } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.ISourcePresentation#getEditorId(org.eclipse.ui.IEditorInput, java.lang.Object) - */ - public String getEditorId(IEditorInput input, Object element) { - if (element instanceof IFile || element instanceof ILineBreakpoint) { - return "pda.editor"; - } - return null; - } -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/AbstractDataStackViewHandler.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/AbstractDataStackViewHandler.java deleted file mode 100644 index d9a279f4b..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/AbstractDataStackViewHandler.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Wind River Systems 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.views; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.debug.examples.core.pda.model.PDAStackFrame; -import org.eclipse.debug.examples.core.pda.model.PDAThread; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.handlers.HandlerUtil; - -/** - * Base class for command handlers for data stack view. - */ -abstract public class AbstractDataStackViewHandler extends AbstractHandler { - - public Object execute(ExecutionEvent event) throws ExecutionException { - IWorkbenchPart part = HandlerUtil.getActivePartChecked(event); - if (part instanceof DataStackView) { - DataStackView view = (DataStackView)part; - - ISelection selection = DebugUITools.getDebugContextForEventChecked(event); - if (selection instanceof IStructuredSelection) { - Object element = ((IStructuredSelection)selection).getFirstElement(); - - PDAThread thread = null; - if (element instanceof PDAThread) { - thread = (PDAThread)element; - } else if (element instanceof PDAStackFrame) { - thread = (PDAThread)((PDAStackFrame)element).getThread(); - } - - if (element != null) { - doExecute( - view, - thread, - HandlerUtil.getCurrentSelectionChecked(event)); - } - } - } else { - throw new ExecutionException("Handler must be with DataStackView only"); - } - return null; - } - - /** - * Performs the actual handler operation. - * - * @param view The view that the handler was invoked in. - * @param target The current active debug target. - * @param selection The current selection in view. - */ - abstract protected void doExecute(DataStackView view, PDAThread target, ISelection selection) throws ExecutionException; -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CanPushTester.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CanPushTester.java deleted file mode 100644 index 10b5acd31..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CanPushTester.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Wind River Systems 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.views; - -import org.eclipse.core.expressions.PropertyTester; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.examples.core.pda.model.PDADebugElement; -import org.eclipse.debug.examples.core.pda.model.PDAStackFrame; -import org.eclipse.debug.examples.core.pda.model.PDAThread; - -/** - * Property tester for use with standard expressions to determine whether - * the given debug target can perform a push operation. - */ -public class CanPushTester extends PropertyTester { - - private static final String CAN_PUSH_PROPERTY = "canPush"; - - public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { - if (CAN_PUSH_PROPERTY.equals(property)) { - if (receiver instanceof IAdaptable) { - PDADebugElement element = (PDADebugElement) - ((IAdaptable)receiver).getAdapter(PDADebugElement.class); - PDAThread thread = null; - if (element instanceof PDAThread) { - thread = (PDAThread)element; - } else if (element instanceof PDAStackFrame) { - thread = (PDAThread)((PDAStackFrame)element).getThread(); - } - - if (thread != null) { - return thread.canPushData(); - } - } - } - return false; - } -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CheckboxView.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CheckboxView.java deleted file mode 100644 index 13c5cb885..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CheckboxView.java +++ /dev/null @@ -1,31 +0,0 @@ -/***************************************************************** - * Copyright (c) 2009 Texas Instruments 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: - * Patrick Chuong (Texas Instruments) - Initial API and implementation (Bug 286310) - * IBM Corporation - ongoing maintenance and enhancements - *****************************************************************/ -package org.eclipse.debug.examples.ui.pda.views; - -import org.eclipse.debug.internal.ui.views.variables.VariablesView; -import org.eclipse.swt.SWT; - -public class CheckboxView extends VariablesView { - public static String ID = "CHECKBOX_VIEW_ID"; - - protected int getViewerStyle() { - return SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.VIRTUAL | SWT.FULL_SELECTION | SWT.CHECK; - } - - protected String getHelpContextId() { - return ID; - } - - protected String getPresentationContextId() { - return ID; - } -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/DataStackView.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/DataStackView.java deleted file mode 100644 index 5e204755b..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/DataStackView.java +++ /dev/null @@ -1,175 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 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 - * Bjorn Freeman-Benson - initial API and implementation - * Wind River - Pawel Piech - replaced actions with handlers (bug 229219) - * Pawel Piech (Wind River) - ported PDA Virtual Machine to Java (Bug 261400) -******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.views; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.examples.core.pda.model.PDAStackFrame; -import org.eclipse.debug.examples.core.pda.model.PDAThread; -import org.eclipse.debug.ui.AbstractDebugView; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.contexts.DebugContextEvent; -import org.eclipse.debug.ui.contexts.IDebugContextListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.progress.UIJob; - - -/** - * View of the PDA VM data stack - */ -public class DataStackView extends AbstractDebugView implements IDebugContextListener { - - private PDAThread fThread; - - class StackViewContentProvider implements ITreeContentProvider { - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object) - */ - public Object[] getChildren(Object parentElement) { - if (parentElement instanceof PDAThread) { - try { - return ((PDAThread)parentElement).getDataStack(); - } catch (DebugException e) { - } - } - return new Object[0]; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object) - */ - public Object getParent(Object element) { - if (element instanceof PDAThread) { - return null; - } else { - return fThread; - } - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object) - */ - public boolean hasChildren(Object element) { - return element instanceof PDAThread; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) - */ - public Object[] getElements(Object inputElement) { - return getChildren(inputElement); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IContentProvider#dispose() - */ - public void dispose() { - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) - */ - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#createViewer(org.eclipse.swt.widgets.Composite) - */ - protected Viewer createViewer(Composite parent) { - TreeViewer viewer = new TreeViewer(parent); - viewer.setLabelProvider(DebugUITools.newDebugModelPresentation()); - viewer.setContentProvider(new StackViewContentProvider()); - DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).addDebugContextListener(this); - getSite().setSelectionProvider(viewer); - return viewer; - } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#createActions() - */ - protected void createActions() { - } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#getHelpContextId() - */ - protected String getHelpContextId() { - return null; - } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#fillContextMenu(org.eclipse.jface.action.IMenuManager) - */ - protected void fillContextMenu(IMenuManager menu) { - menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); - } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#configureToolBar(org.eclipse.jface.action.IToolBarManager) - */ - protected void configureToolBar(IToolBarManager tbm) { - } - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#dispose() - */ - public void dispose() { - DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).removeDebugContextListener(this); - super.dispose(); - } - - public void debugContextChanged(final DebugContextEvent event) { - new UIJob(getSite().getShell().getDisplay(), "DataStackView update") { - { - setSystem(true); - } - - public IStatus runInUIThread(IProgressMonitor monitor) { - update(event.getContext()); - return Status.OK_STATUS; - } - }.schedule(); - } - - /** - * Updates the view for the selected thread (if suspended) - */ - private void update(ISelection context) { - fThread = null; - - if (context instanceof IStructuredSelection) { - Object element = ((IStructuredSelection)context).getFirstElement(); - if (element instanceof PDAThread) { - fThread = (PDAThread)element; - } else if (element instanceof PDAStackFrame) { - fThread = (PDAThread)((PDAStackFrame)element).getThread(); - } - } - Object input = null; - if (fThread != null && fThread.isSuspended()) { - input = fThread; - } - getViewer().setInput(input); - getViewer().refresh(); - } -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PopHandler.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PopHandler.java deleted file mode 100644 index 1c0c5bc72..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PopHandler.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Wind River Systems 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.views; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IValue; -import org.eclipse.debug.examples.core.pda.model.PDAThread; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; - -/** - * Pops a selected value off the data stack. The selection does <b>not</b> have to be - * the top element on the stack. - */ -public class PopHandler extends AbstractDataStackViewHandler { - - protected void doExecute(DataStackView view, PDAThread thread, ISelection selection) throws ExecutionException { - TreeViewer viewer = (TreeViewer)view.getViewer(); - Object popee = selection instanceof IStructuredSelection - ? ((IStructuredSelection)selection).getFirstElement() : null; - if (popee != null) { - try { - IValue[] stack = thread.getDataStack(); - List restore = new ArrayList(); - for (int i = 0; i < stack.length; i++) { - Object value = stack[i]; - if (popee.equals(value)) { - // pop & stop - thread.popData(); - break; - } else { - // remember value to push back on - restore.add(thread.popData()); - } - } - while (!restore.isEmpty()) { - IValue value = (IValue) restore.remove(restore.size() - 1); - thread.pushData(value.getValueString()); - } - } catch (DebugException e) { - throw new ExecutionException("Failed to execute push command", e); - } - viewer.refresh(); - } - } - -} diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PushHandler.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PushHandler.java deleted file mode 100644 index 58fbc7c0e..000000000 --- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PushHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Wind River Systems 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.examples.ui.pda.views; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.examples.core.pda.model.PDAThread; -import org.eclipse.jface.dialogs.InputDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.window.Window; - -/** - * Pushes a value onto the data stack. - */ -public class PushHandler extends AbstractDataStackViewHandler { - - protected void doExecute(DataStackView view, PDAThread thread, ISelection selection) throws ExecutionException { - InputDialog dialog = new InputDialog(view.getSite().getShell(), "Specify Value", "Enter value to push", null, null); - if (dialog.open() == Window.OK) { - try { - thread.pushData(dialog.getValue()); - } catch (DebugException e) { - throw new ExecutionException("Failed to execute push command", e); - } - } - view.getViewer().refresh(); - } - -} |