Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2006-12-06 15:47:25 +0000
committerDarin Wright2006-12-06 15:47:25 +0000
commitf8d86449702b15b7d19efdb2a84618e8092f5b5b (patch)
treef9c233ea585b9da0e980e227e76543260469a7ad
parent2b70a6a413dd46a4287b952094b541389844115f (diff)
downloadeclipse.platform.debug-f8d86449702b15b7d19efdb2a84618e8092f5b5b.tar.gz
eclipse.platform.debug-f8d86449702b15b7d19efdb2a84618e8092f5b5b.tar.xz
eclipse.platform.debug-f8d86449702b15b7d19efdb2a84618e8092f5b5b.zip
Bug 75852 [variables] Support for custom details view widgets.
-rw-r--r--org.eclipse.debug.ui/component.xml2
-rw-r--r--org.eclipse.debug.ui/plugin.properties6
-rw-r--r--org.eclipse.debug.ui/plugin.xml67
-rw-r--r--org.eclipse.debug.ui/schema/detailPaneFactories.exsd144
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneAssignValueAction.java (renamed from org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/AssignValueAction.java)56
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneMaxLengthAction.java43
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneMaxLengthDialog.java (renamed from org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/MaxDetailsLengthDialog.java)20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneWordWrapAction.java54
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java34
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/DetailPaneWordWrapAction.java37
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/MaxDetailsLengthAction.java43
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java940
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesViewMessages.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesViewMessages.properties10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/AbstractDetailPane.java158
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/AvailableDetailPanesAction.java175
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java829
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPaneFactory.java69
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailMessages.java37
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailMessages.properties24
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java488
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneProxy.java226
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPane.java100
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPaneFactory.java85
28 files changed, 2666 insertions, 1058 deletions
diff --git a/org.eclipse.debug.ui/component.xml b/org.eclipse.debug.ui/component.xml
index 1a010acc3..90e576480 100644
--- a/org.eclipse.debug.ui/component.xml
+++ b/org.eclipse.debug.ui/component.xml
@@ -22,6 +22,8 @@
<type name="IBreakpointTypeCategory" />
<type name="IDebugEditorPresentation" />
<type name="IDebugModelPresentation" />
+ <type name="IDetailPane" />
+ <type name="IDetailPaneFactory" />
<type name="IDebugUIConstants" implement="false" />
<type name="IDebugView" />
<type name= "IInstructionPointerPresentation" />
diff --git a/org.eclipse.debug.ui/plugin.properties b/org.eclipse.debug.ui/plugin.properties
index b7130ba1b..b9539d095 100644
--- a/org.eclipse.debug.ui/plugin.properties
+++ b/org.eclipse.debug.ui/plugin.properties
@@ -56,6 +56,7 @@ DebugViewsCategory.name=Debug
DebugWithConfigurationAction.label=Debu&g As
DetailPaneFontDefinition.label=Detail pane text font
DetailPaneFontDefinition.description=The detail pane text font is used in the detail panes of debug views.
+DetailPaneFactoriesExtension.name=Detail Pane Factories
DisableBreakpointsAction.label=&Disable
EnableBreakpointsAction.label=&Enable
ExpandAll.label=Expand All
@@ -149,11 +150,6 @@ runCategory.description= Run/Debug command category
NoSourceFoundEditor.name= No Source Found
-DetailPaneWordWrapAction.label=&Wrap Text in Details Pane
-DetailPaneWordWrapAction.tooltip=Wrap text in the Details pane
-DetailPaneMaxLengthAction.label=&Detail Pane...
-DetailPaneMaxLengthAction.tooltip=Configure detail pane settings
-
Context.debugging.description= Debugging Programs
Context.debugging.name= Debugging
diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml
index 590167281..e7edd71a6 100644
--- a/org.eclipse.debug.ui/plugin.xml
+++ b/org.eclipse.debug.ui/plugin.xml
@@ -19,6 +19,7 @@
<extension-point id="breakpointOrganizers" name="%BreakpointOrganizersName" schema="schema/breakpointOrganizers.exsd"/>
<extension-point id="variableValueEditors" name="%VariableValueEditorsName" schema="schema/variableValueEditors.exsd"/>
<extension-point id="launchConfigurationTabs" name="%LaunchConfigurationTabsExtension.name" schema="schema/launchConfigurationTabs.exsd"/>
+ <extension-point id="detailPaneFactories" name="%DetailPaneFactoriesExtension.name" schema="schema/detailPaneFactories.exsd"/>
<!-- Extensions -->
<extension
@@ -655,27 +656,6 @@
</viewContribution>
<!-- Contributions to Expression View Toolbar -->
<viewContribution
- targetID="org.eclipse.debug.ui.VariableView"
- id="org.eclipse.debug.ui.variableView.toolbar">
- <action
- label="%DetailPaneWordWrapAction.label"
- style="toggle"
- helpContextId="detail_pane_word_wrap_action_context"
- class="org.eclipse.debug.internal.ui.views.variables.DetailPaneWordWrapAction"
- tooltip="%DetailPaneWordWrapAction.tooltip"
- menubarPath="viewActions"
- id="org.eclipse.debug.ui.variableViewActions.toolbar.detailPaneWordWrap">
- </action>
- <action
- class="org.eclipse.debug.internal.ui.views.variables.MaxDetailsLengthAction"
- helpContextId="detail_pane_max_length_action_context"
- id="org.eclipse.debug.ui.variableViewActions.pulldown.MaxDetailsLength"
- label="%DetailPaneMaxLengthAction.label"
- menubarPath="viewActions"
- style="push"
- tooltip="%DetailPaneMaxLengthAction.tooltip"/>
- </viewContribution>
- <viewContribution
targetID="org.eclipse.debug.ui.ExpressionView"
id="org.eclipse.debug.ui.expressionsView.toolbar">
<action
@@ -706,44 +686,6 @@
class="org.eclipse.debug.core.model.IVariable">
</selection>
</action>
- <action
- label="%DetailPaneWordWrapAction.label"
- helpContextId="detail_pane_word_wrap_action_context"
- class="org.eclipse.debug.internal.ui.views.variables.DetailPaneWordWrapAction"
- state="false"
- tooltip="%DetailPaneWordWrapAction.tooltip"
- menubarPath="viewActions"
- id="org.eclipse.debug.ui.expresssionsView.toolbar.detailPaneWordWrap">
- </action>
- <action
- class="org.eclipse.debug.internal.ui.views.variables.MaxDetailsLengthAction"
- helpContextId="detail_pane_max_length_action_context"
- id="org.eclipse.debug.ui.expresssionsView.pulldown.MaxDetailsLength"
- label="%DetailPaneMaxLengthAction.label"
- menubarPath="viewActions"
- style="push"
- tooltip="%DetailPaneMaxLengthAction.tooltip"/>
- </viewContribution>
- <viewContribution
- targetID="org.eclipse.debug.ui.RegistersView"
- id="org.eclipse.debug.ui.registersView.toolbar">
- <action
- label="%DetailPaneWordWrapAction.label"
- style="toggle"
- helpContextId="detail_pane_word_wrap_action_context"
- tooltip="%DetailPaneWordWrapAction.tooltip"
- class="org.eclipse.debug.internal.ui.views.variables.DetailPaneWordWrapAction"
- menubarPath="viewActions"
- id="org.eclipse.debug.ui.registersView.toolbar.detailPaneWordWrap">
- </action>
- <action
- class="org.eclipse.debug.internal.ui.views.variables.MaxDetailsLengthAction"
- helpContextId="detail_pane_max_length_action_context"
- id="org.eclipse.debug.ui.registersView.pulldown.MaxDetailsLength"
- label="%DetailPaneMaxLengthAction.label"
- menubarPath="viewActions"
- style="push"
- tooltip="%DetailPaneMaxLengthAction.tooltip"/>
</viewContribution>
<viewContribution
targetID="org.eclipse.debug.ui.MemoryView"
@@ -2315,5 +2257,12 @@ M4 = Platform-specific fourth key
<selection class="org.eclipse.core.resources.IResource"/>
</wizard>
</extension>
+ <extension
+ point="org.eclipse.debug.ui.detailPaneFactories">
+ <detailFactories
+ class="org.eclipse.debug.internal.ui.views.variables.details.DefaultDetailPaneFactory"
+ id="org.eclipse.debug.ui.defaultDetailPaneFactory">
+ </detailFactories>
+ </extension>
</plugin>
diff --git a/org.eclipse.debug.ui/schema/detailPaneFactories.exsd b/org.eclipse.debug.ui/schema/detailPaneFactories.exsd
new file mode 100644
index 000000000..6401e983a
--- /dev/null
+++ b/org.eclipse.debug.ui/schema/detailPaneFactories.exsd
@@ -0,0 +1,144 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.debug.ui">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.debug.ui" id="detaiPaneFactories" name="Detail Pane Factories Extension"/>
+ </appInfo>
+ <documentation>
+ This extension point allows clients to contribute custom renderings for the detail pane in the variables, registers and expression views. To contribute a custom detail pane, an implementation of &lt;code&gt;IDetailPaneFactory&lt;/code&gt; is registered using this extension point. A detail pane factory creates an &lt;code&gt;IDetailPane&lt;/code&gt; for each custom rendering.
+&lt;p&gt;
+Views with detail panes allow users select from available detail panes via the context menu. All contributions to this extension point are checked agaist the current selection. A detail factory should provide an enablement expression to ensure lazy plug-in loading. A factory will only be instantiated if its expression evaluates to true for the current selection (see the example extension point for an example enablement expression). Each applicable factory is then consulted for the types of detail panes it can produce for the current selection.
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/>
+
+ <element name="extension">
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="detailFactories"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="detailFactories">
+ <complexType>
+ <sequence>
+ <element ref="enablement" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ specifies a unique identifier for this factory
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ fully qualified name of a class that implements &lt;code&gt;org.eclipse.debug.ui.IDetailPaneFactory&lt;/code&gt;
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.debug.ui.IDetailPaneFactory"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.3
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ Following in an example of a detail pane factory extension with an expression that enables for selections containing exactly two Java variables:
+&lt;p&gt;
+&lt;pre&gt;
+&lt;extension point=&quot;org.eclipse.debug.ui.detailPaneFactories&quot;&gt;
+ &lt;detailFactories
+ class=&quot;org.eclipse.temp.JavaTableDetailPaneFactory&quot;
+ name=&quot;javaTableDetailPaneFactory&quot;&gt;
+ &lt;enablement&gt;
+ &lt;with
+ variable=&quot;selection&quot;&gt;
+ &lt;count
+ value=&quot;2&quot;&gt;
+ &lt;/count&gt;
+ &lt;iterate&gt;
+ &lt;instanceof
+ value=&quot;org.eclipse.jdt.debug.core.IJavaVariable&quot;&gt;
+ &lt;/instanceof&gt;
+ &lt;/iterate&gt;
+ &lt;/with&gt;
+ &lt;/enablement&gt;
+ &lt;/detailFactories&gt;
+&lt;/extension&gt;
+&lt;/pre&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ Value of the attribute &lt;b&gt;class&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.debug.ui.IDetailPaneFactory&lt;/b&gt;.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ The debug platform contributes a detail pane factory providing a default text source viewer detail pane. The default detail pane displays textual details of a selected element based on the corresponding debug model presentation&apos;s implementation of &lt;code&gt;computeDetail(IValue value, IValueDetailListener listener)&lt;/code&gt;.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2000, 2006 IBM Corporation and others.&lt;br&gt;
+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
+&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java
index b1436d34c..2eb377747 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java
@@ -35,6 +35,7 @@ public interface IDebugHelpContextIds {
public static final String SHOW_TYPES_ACTION = PREFIX + "show_types_action_context"; //$NON-NLS-1$
public static final String VARIABLES_CONTENT_PROVIDERS_ACTION = PREFIX + "variables_content_providers_action_context"; //$NON-NLS-1$
public static final String VARIABLES_SELECT_LOGICAL_STRUCTURE = PREFIX + "variables_select_logical_structure"; //$NON-NLS-1$
+ public static final String VARIABLES_SELECT_DETAIL_PANE = PREFIX + "variables_select_detail_pane_action_context"; //$NON-NLS-1$
public static final String SELECT_WORKING_SET_ACTION = PREFIX + "select_working_set_context"; //$NON-NLS-1$
public static final String CLEAR_WORKING_SET_ACTION = PREFIX + "clear_working_set_context"; //$NON-NLS-1$
public static final String EDIT_LAUNCH_CONFIGURATION_ACTION = PREFIX + "edit_launch_configuration_action_context"; //$NON-NLS-1$
@@ -45,7 +46,16 @@ public interface IDebugHelpContextIds {
public static final String SKIP_ALL_BREAKPOINT_ACTION = PREFIX + "skip_all_breakpoints_context"; //$NON-NLS-1$
public static final String AUTO_MANAGE_VIEWS_ACTION = PREFIX + "auto_manage_views_context"; //$NON-NLS-1$
public static final String FIND_ELEMENT_ACTION = PREFIX + "find_element_context"; //$NON-NLS-1$
- public static final String ASSIGN_VALUE_ACTION = PREFIX + "assign_value_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE = PREFIX + "detail_pane_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE_ASSIGN_VALUE_ACTION = PREFIX + "detail_pane_assign_value_action_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE_CONTENT_ASSIST_ACTION = PREFIX + "detail_pane_content_assist_action_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE_CUT_ACTION = PREFIX + "detail_pane_cut_action_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE_COPY_ACTION = PREFIX + "detail_pane_copy_action_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE_PASTE_ACTION = PREFIX + "detail_pane_paste_action_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE_SELECT_ALL_ACTION = PREFIX + "detail_pane_select_all_action_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE_FIND_REPLACE_ACTION = PREFIX + "detail_pane_find_replace_action_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE_WORD_WRAP_ACTION = PREFIX + "detail_pane_word_wrap_action_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE_MAX_LENGTH_ACTION = PREFIX + "detail_pane_max_length_action_context"; //$NON-NLS-1$
public static final String CONSOLE_TERMINATE_ACTION = PREFIX + "console_terminate_action_context"; //$NON-NLS-1$
public static final String CONSOLE_REMOVE_ALL_TERMINATED = PREFIX + "console_remove_all_terminated_context"; //$NON-NLS-1$
public static final String CONSOLE_REMOVE_LAUNCH = PREFIX + "console_remove_launch_context"; //$NON-NLS-1$;
@@ -95,7 +105,6 @@ public interface IDebugHelpContextIds {
public static final String CONFIGURE_COLUMNS_DIALOG = PREFIX + "configure_columns_dialog_context"; //$NON-NLS-1$;
public static final String GROUP_BREAKPOINTS_DIALOG = PREFIX + "group_breakpoints_dialog_context"; //$NON-NLS-1$
public static final String ORGANIZE_FAVORITES_DIALOG = PREFIX + "organize_favorites_dialog_context"; //$NON-NLS-1$
- public static final String MAX_DETAILS_LENGTH_DIALOG = PREFIX + "max_details_length_dialog_context"; //$NON-NLS-1$
public static final String SELECT_DEFAULT_WORKINGSET_DIALOG = PREFIX + "select_breakpoint_workingset_dialog"; //$NON-NLS-1$
public static final String DELETE_ASSOCIATED_LAUNCH_CONFIGS_DIALOG = PREFIX + "delete_associated_launch_configs_dialog"; //$NON-NLS-1$
public static final String SELECT_LAUNCH_MODES_DIALOG = PREFIX + "select_launch_modes_dialog"; //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java
index 03d8aa257..3d0a04ec3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java
@@ -32,6 +32,19 @@ public class ActionMessages extends NLS {
public static String CopyToClipboardActionDelegate_Problem_Copying_to_Clipboard_1;
public static String CopyToClipboardActionDelegate_There_was_a_problem_when_accessing_the_system_clipboard__Retry__2;
+ public static String DetailPaneAssignValueAction_0;
+
+ public static String DetailPaneAssignValueAction_1;
+
+ public static String DetailPaneAssignValueAction_2;
+
+ public static String DetailPaneAssignValueAction_3;
+
+ public static String DetailPaneAssignValueAction_4;
+
+ public static String DetailPaneWordWrapAction_0;
+ public static String DetailPaneMaxLengthAction_0;
+
public static String DisconnectActionDelegate_Disconnect_failed_1;
public static String DisconnectActionDelegate_Exceptions_occurred_attempting_to_disconnect__2;
@@ -123,11 +136,6 @@ public class ActionMessages extends NLS {
public static String WatchAction_1;
public static String SkipAllBreakpointsAction_0;
public static String SkipAllBreakpointsAction_2;
- public static String AssignValueAction_1;
- public static String AssignValueAction_2;
- public static String AssignValueAction_3;
- public static String AssignValueAction_4;
-
public static String RunToLineAction_0;
public static String RunToLineAction_1;
public static String RunToLineHandler_0;
@@ -147,8 +155,6 @@ public class ActionMessages extends NLS {
NLS.initializeMessages(BUNDLE_NAME, ActionMessages.class);
}
- public static String AssignValueAction_0;
-
public static String AbstractDebugActionDelegate_0;
public static String RetargetAddMemoryBlockAction_0;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties
index 15ae76a7a..28aaf991c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties
@@ -134,11 +134,13 @@ WatchAction_0=Error creating watch
WatchAction_1=An exception occurred while attempting to create watch item.
SkipAllBreakpointsAction_0=Skip All Breakpoints
SkipAllBreakpointsAction_2=Skip all breakpoints, whether they are enabled or not
-AssignValueAction_1=Assign Value
-AssignValueAction_2=Invalid Value
-AssignValueAction_3=The value {0} cannot be assigned to {1}
-AssignValueAction_4=Invalid Value
-AssignValueAction_0=Error Setting Value
+DetailPaneAssignValueAction_1=Assign Value
+DetailPaneAssignValueAction_2=Invalid Value
+DetailPaneAssignValueAction_3=The value {0} cannot be assigned to {1}
+DetailPaneAssignValueAction_4=Invalid Value
+DetailPaneAssignValueAction_0=Error Setting Value
+DetailPaneWordWrapAction_0=&Wrap Text
+DetailPaneMaxLengthAction_0=&Max Length...
RunToLineAction_0=Error
RunToLineAction_1=Run to line failed
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/AssignValueAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneAssignValueAction.java
index 1e9d4118e..3154db28e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/AssignValueAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneAssignValueAction.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.debug.internal.ui.actions.variables;
+package org.eclipse.debug.internal.ui.actions.variables.details;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.debug.core.DebugException;
@@ -19,19 +19,18 @@ import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.internal.ui.VariableValueEditorManager;
import org.eclipse.debug.internal.ui.actions.ActionMessages;
import org.eclipse.debug.internal.ui.actions.StatusInfo;
-import org.eclipse.debug.internal.ui.views.variables.VariablesView;
import org.eclipse.debug.ui.actions.IVariableValueEditor;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.commands.ActionHandler;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.SelectionProviderAction;
import org.eclipse.ui.handlers.IHandlerActivation;
import org.eclipse.ui.handlers.IHandlerService;
@@ -41,39 +40,38 @@ import com.ibm.icu.text.MessageFormat;
* Action which assigns a value to a variable from the detail pane
* of the variables view.
*/
-public class AssignValueAction extends SelectionProviderAction {
- private VariablesView variablesView;
- private ISourceViewer detailsViewer;
+public class DetailPaneAssignValueAction extends Action{
+
private IHandlerActivation fHandlerActivation;
+ private IViewSite fViewSite;
+ private ITextViewer fTextViewer;
+ private IStructuredSelection fCurrentSelection;
+
+ public DetailPaneAssignValueAction(ITextViewer textViewer, IViewSite viewSite) {
+ super(ActionMessages.DetailPaneAssignValueAction_1);
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.DETAIL_PANE_ASSIGN_VALUE_ACTION);
- public AssignValueAction(VariablesView varView, ISourceViewer detailViewer) {
- super(varView.getViewer(), ActionMessages.AssignValueAction_1);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.ASSIGN_VALUE_ACTION);
- variablesView = varView;
- detailsViewer = detailViewer;
+ fTextViewer = textViewer;
+ fViewSite = viewSite;
+
setEnabled(false);
- IWorkbenchPartSite site = variablesView.getSite();
- IHandlerService service = (IHandlerService) site.getService(IHandlerService.class);
+ IHandlerService service = (IHandlerService) fViewSite.getService(IHandlerService.class);
ActionHandler handler = new ActionHandler(this);
fHandlerActivation = service.activateHandler(getActionDefinitionId(), handler);
}
public void dispose() {
- IWorkbenchPartSite site = variablesView.getSite();
- IHandlerService service = (IHandlerService) site.getService(IHandlerService.class);
+ IHandlerService service = (IHandlerService) fViewSite.getService(IHandlerService.class);
service.deactivateHandler(fHandlerActivation);
- super.dispose();
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.SelectionProviderAction#selectionChanged(org.eclipse.jface.viewers.IStructuredSelection)
- */
- public void selectionChanged(IStructuredSelection selection) {
+ public void updateCurrentVariable(IStructuredSelection selection) {
boolean enabled = false;
if ((selection.size() == 1) && (selection.getFirstElement() instanceof IValueModification)) {
IValueModification valMod = (IValueModification) selection.getFirstElement();
if (valMod.supportsValueModification()) {
- super.selectionChanged(selection);
+ fCurrentSelection = selection;
enabled = true;
}
}
@@ -84,15 +82,15 @@ public class AssignValueAction extends SelectionProviderAction {
* @see org.eclipse.jface.action.IAction#run()
*/
public void run() {
- IVariable variable = (IVariable) getStructuredSelection().getFirstElement();
+ IVariable variable = (IVariable) fCurrentSelection.getFirstElement();
- Point selection = detailsViewer.getSelectedRange();
+ Point selection = fTextViewer.getSelectedRange();
String value = null;
if (selection.y == 0) {
- value = detailsViewer.getDocument().get();
+ value = fTextViewer.getDocument().get();
} else {
try {
- value = detailsViewer.getDocument().get(selection.x, selection.y);
+ value = fTextViewer.getDocument().get(selection.x, selection.y);
} catch (BadLocationException e1) {
}
}
@@ -118,11 +116,11 @@ public class AssignValueAction extends SelectionProviderAction {
variable.setValue(value);
} else {
if (activeShell != null) {
- DebugUIPlugin.errorDialog(activeShell, ActionMessages.AssignValueAction_2, MessageFormat.format(ActionMessages.AssignValueAction_3, new String[] {value, variable.getName()}), new StatusInfo(IStatus.ERROR, ActionMessages.AssignValueAction_4)); //
+ DebugUIPlugin.errorDialog(activeShell, ActionMessages.DetailPaneAssignValueAction_2, MessageFormat.format(ActionMessages.DetailPaneAssignValueAction_3, new String[] {value, variable.getName()}), new StatusInfo(IStatus.ERROR, ActionMessages.DetailPaneAssignValueAction_4)); //
}
}
} catch (DebugException e) {
- MessageDialog.openError(activeShell, ActionMessages.AssignValueAction_0, e.getStatus().getMessage());
+ MessageDialog.openError(activeShell, ActionMessages.DetailPaneAssignValueAction_0, e.getStatus().getMessage());
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneMaxLengthAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneMaxLengthAction.java
new file mode 100644
index 000000000..032958bd0
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneMaxLengthAction.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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.internal.ui.actions.variables.details;
+
+import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
+import org.eclipse.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.jface.action.Action;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Opens a dialog so that the user can enter the maximum length in characters that
+ * the detail pane should display.
+ *
+ * @see DetailPaneMaxLengthDialog
+ * @since 3.0
+ */
+public class DetailPaneMaxLengthAction extends Action {
+
+ private Shell fDialogShell;
+
+ public DetailPaneMaxLengthAction(Shell dialogShell){
+ super(ActionMessages.DetailPaneMaxLengthAction_0);
+ fDialogShell = dialogShell;
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.DETAIL_PANE_MAX_LENGTH_ACTION);
+
+ }
+
+ public void run() {
+ DetailPaneMaxLengthDialog dialog = new DetailPaneMaxLengthDialog(fDialogShell);
+ dialog.open();
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/MaxDetailsLengthDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneMaxLengthDialog.java
index 94ae1efa7..e8ff586ab 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/MaxDetailsLengthDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneMaxLengthDialog.java
@@ -8,10 +8,11 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.debug.internal.ui.views.variables;
+package org.eclipse.debug.internal.ui.actions.variables.details;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
+import org.eclipse.debug.internal.ui.views.variables.VariablesViewMessages;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
@@ -29,10 +30,11 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
/**
- * Provides a dialog for changing the default length allowed in the details pane
+ * Provides a dialog for changing the maximum length allowed in the detail pane
+ *
* @since 3.0
*/
-public class MaxDetailsLengthDialog extends TrayDialog {
+public class DetailPaneMaxLengthDialog extends TrayDialog {
private static final String SETTINGS_ID = ".MAX_DETAILS_LENGTH_DIALOG"; //$NON-NLS-1$
@@ -47,7 +49,7 @@ public class MaxDetailsLengthDialog extends TrayDialog {
*
* @param parent shell
*/
- public MaxDetailsLengthDialog(Shell parent) {
+ public DetailPaneMaxLengthDialog(Shell parent) {
super(parent);
setShellStyle(getShellStyle() | SWT.RESIZE);
fValue = Integer.toString(DebugUIPlugin.getDefault().getPreferenceStore().getInt(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH));
@@ -56,10 +58,10 @@ public class MaxDetailsLengthDialog extends TrayDialog {
try {
int num = Integer.parseInt(newText);
if (num < 0) {
- return VariablesViewMessages.MaxDetailsLengthDialog_2;
+ return VariablesViewMessages.DetailPaneMaxLengthDialog_2;
}
} catch (NumberFormatException e) {
- return VariablesViewMessages.MaxDetailsLengthDialog_3;
+ return VariablesViewMessages.DetailPaneMaxLengthDialog_3;
}
return null;
}
@@ -83,9 +85,9 @@ public class MaxDetailsLengthDialog extends TrayDialog {
* @see org.eclipse.jface.dialogs.Dialog#createContents(org.eclipse.swt.widgets.Composite)
*/
protected Control createContents(Composite parent) {
- getShell().setText(VariablesViewMessages.MaxDetailsLengthDialog_0);
+ getShell().setText(VariablesViewMessages.DetailPaneMaxLengthDialog_0);
Control contents = super.createContents(parent);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getDialogArea(), IDebugHelpContextIds.MAX_DETAILS_LENGTH_DIALOG);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getDialogArea(), IDebugHelpContextIds.DETAIL_PANE_MAX_LENGTH_ACTION);
return contents;
}
@@ -95,7 +97,7 @@ public class MaxDetailsLengthDialog extends TrayDialog {
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
Label label = new Label(composite, SWT.WRAP);
- label.setText(VariablesViewMessages.MaxDetailsLengthDialog_1);
+ label.setText(VariablesViewMessages.DetailPaneMaxLengthDialog_1);
GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
label.setLayoutData(data);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneWordWrapAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneWordWrapAction.java
new file mode 100644
index 000000000..107ca9876
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneWordWrapAction.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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.internal.ui.actions.variables.details;
+
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
+import org.eclipse.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * An check box action that allows the word wrap property to be set, determining if the detail pane
+ * should wrap text.
+ */
+public class DetailPaneWordWrapAction extends Action {
+
+ ITextViewer fTextViewer;
+
+ public DetailPaneWordWrapAction(ITextViewer textViewer) {
+ super(ActionMessages.DetailPaneWordWrapAction_0,IAction.AS_CHECK_BOX);
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.DETAIL_PANE_WORD_WRAP_ACTION);
+
+ fTextViewer = textViewer;
+ setEnabled(true);
+
+ boolean prefSetting = DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugPreferenceConstants.PREF_DETAIL_PANE_WORD_WRAP);
+ fTextViewer.getTextWidget().setWordWrap(prefSetting);
+ setChecked(prefSetting);
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IAction#run()
+ */
+ public void run() {
+ fTextViewer.getTextWidget().setWordWrap(isChecked());
+ DebugUIPlugin.getDefault().getPreferenceStore().setValue(IDebugPreferenceConstants.PREF_DETAIL_PANE_WORD_WRAP,isChecked());
+ DebugUIPlugin.getDefault().savePluginPreferences();
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java
index cc3b250c6..af95e38bd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java
@@ -12,26 +12,24 @@ package org.eclipse.debug.internal.ui.views.expression;
import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
import org.eclipse.debug.internal.ui.views.variables.AvailableLogicalStructuresAction;
import org.eclipse.debug.internal.ui.views.variables.VariablesView;
import org.eclipse.debug.internal.ui.views.variables.VariablesViewMessages;
+import org.eclipse.debug.internal.ui.views.variables.details.AvailableDetailPanesAction;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.action.IAction;
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.SelectionChangedEvent;
import org.eclipse.swt.SWT;
import org.eclipse.ui.IWorkbenchActionConstants;
/**
* Displays expressions and their values with a detail
- * area.
+ * pane.
*/
public class ExpressionView extends VariablesView {
@@ -70,12 +68,17 @@ public class ExpressionView extends VariablesView {
menu.add(new Separator(IDebugUIConstants.EMPTY_EXPRESSION_GROUP));
menu.add(new Separator(IDebugUIConstants.EXPRESSION_GROUP));
- menu.add(getAction(FIND_ELEMENT));
+ menu.add(getAction(VARIABLES_FIND_ELEMENT_ACTION));
menu.add(getAction("ChangeVariableValue")); //$NON-NLS-1$
+ menu.add(new Separator());
IAction action = new AvailableLogicalStructuresAction(this);
if (action.isEnabled()) {
menu.add(action);
}
+ action = new AvailableDetailPanesAction(this);
+ if (isDetailPaneVisible() && action.isEnabled()) {
+ menu.add(action);
+ }
menu.add(new Separator(IDebugUIConstants.EMPTY_RENDER_GROUP));
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
@@ -86,30 +89,11 @@ public class ExpressionView extends VariablesView {
}
// update actions
updateAction("ContentAssist"); //$NON-NLS-1$
- updateAction(FIND_ELEMENT);
+ updateAction(VARIABLES_FIND_ELEMENT_ACTION);
updateAction(FIND_ACTION);
}
/* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#treeSelectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- protected void treeSelectionChanged(SelectionChangedEvent event) {
- super.treeSelectionChanged(event);
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ssel= (IStructuredSelection)selection;
- if (ssel.size() == 1) {
- Object input= ssel.getFirstElement();
- if (input instanceof IDebugElement) {
- getDetailViewer().setEditable(true);
- return;
- }
- }
- }
- getDetailViewer().setEditable(false);
- }
-
- /* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.views.variables.VariablesView#getDetailPanePreferenceKey()
*/
protected String getDetailPanePreferenceKey() {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/DetailPaneWordWrapAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/DetailPaneWordWrapAction.java
deleted file mode 100644
index dbd0ce401..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/DetailPaneWordWrapAction.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 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.internal.ui.views.variables;
-
-
-import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
-import org.eclipse.jface.action.IAction;
-
-/**
- * An action delegate that toggles the state of its viewer to
- * use word wrap in the details pane.
- */
-public class DetailPaneWordWrapAction extends VariableViewToggleAction {
-
- /**
- * @see VariableFilterAction#getPreferenceKey()
- */
- protected String getPreferenceKey() {
- return IDebugPreferenceConstants.PREF_DETAIL_PANE_WORD_WRAP;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
- super.run(action);
- ((VariablesView)getView()).toggleDetailPaneWordWrap(action.isChecked());
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/MaxDetailsLengthAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/MaxDetailsLengthAction.java
deleted file mode 100644
index 68bc22c99..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/MaxDetailsLengthAction.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 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.internal.ui.views.variables;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-
-public class MaxDetailsLengthAction implements IViewActionDelegate {
-
- private IViewPart fView;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
- */
- public void init(IViewPart view) {
- fView = view;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
- MaxDetailsLengthDialog dialog = new MaxDetailsLengthDialog(fView.getSite().getShell());
- dialog.open();
- }
-
- /* (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) {
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java
index 281494cdf..73f17390d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java
@@ -17,24 +17,12 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ResourceBundle;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IDebugElement;
-import org.eclipse.debug.core.model.IExpression;
-import org.eclipse.debug.core.model.IValue;
-import org.eclipse.debug.core.model.IVariable;
-import org.eclipse.debug.internal.ui.DebugPluginImages;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.DelegatingModelPresentation;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
@@ -43,7 +31,6 @@ import org.eclipse.debug.internal.ui.LazyModelPresentation;
import org.eclipse.debug.internal.ui.VariablesViewModelPresentation;
import org.eclipse.debug.internal.ui.actions.CollapseAllAction;
import org.eclipse.debug.internal.ui.actions.ConfigureColumnsAction;
-import org.eclipse.debug.internal.ui.actions.variables.AssignValueAction;
import org.eclipse.debug.internal.ui.actions.variables.ChangeVariableValueAction;
import org.eclipse.debug.internal.ui.actions.variables.ShowTypesAction;
import org.eclipse.debug.internal.ui.actions.variables.ToggleDetailPaneAction;
@@ -58,16 +45,15 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdateList
import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
import org.eclipse.debug.internal.ui.views.DebugModelPresentationContext;
import org.eclipse.debug.internal.ui.views.IDebugExceptionHandler;
+import org.eclipse.debug.internal.ui.views.variables.details.AvailableDetailPanesAction;
+import org.eclipse.debug.internal.ui.views.variables.details.DetailPaneProxy;
import org.eclipse.debug.ui.AbstractDebugView;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.debug.ui.IDebugView;
-import org.eclipse.debug.ui.IValueDetailListener;
import org.eclipse.debug.ui.commands.IStatusMonitor;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.debug.ui.contexts.IDebugContextListener;
-import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -75,48 +61,26 @@ import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.commands.ActionHandler;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.jface.text.IFindReplaceTarget;
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.IUndoManager;
-import org.eclipse.jface.text.IUndoManagerExtension;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.ISourceViewerExtension2;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPerspectiveDescriptor;
@@ -126,25 +90,11 @@ import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.XMLMemento;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.console.actions.TextViewerAction;
-import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.operations.OperationHistoryActionHandler;
-import org.eclipse.ui.operations.RedoActionHandler;
-import org.eclipse.ui.operations.UndoActionHandler;
import org.eclipse.ui.progress.UIJob;
-import org.eclipse.ui.progress.WorkbenchJob;
-import org.eclipse.ui.texteditor.FindReplaceAction;
-import org.eclipse.ui.texteditor.IAbstractTextEditorHelpContextIds;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import org.eclipse.ui.texteditor.IUpdate;
-import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
-import com.ibm.icu.text.MessageFormat;
/**
* This view shows variables and their values for a particular stack frame
@@ -153,201 +103,6 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
IPropertyChangeListener, IDebugExceptionHandler,
IPerspectiveListener, IModelChangedListener,
IViewerUpdateListener {
-
- /**
- * Internal interface for a cursor listener. I.e. aggregation
- * of mouse and key listener.
- * @since 3.0
- */
- interface ICursorListener extends MouseListener, KeyListener {
- }
-
- /**
- * The selection provider for the variables view changes depending on whether
- * the variables viewer or detail pane source viewer have focus. This "super"
- * provider ensures the correct selection is sent to all listeners.
- */
- class VariablesViewSelectionProvider implements ISelectionProvider {
- private ListenerList fListeners= new ListenerList();
- private ISelectionProvider fUnderlyingSelectionProvider;
- /**
- * @see ISelectionProvider#addSelectionChangedListener(ISelectionChangedListener)
- */
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- fListeners.add(listener);
- }
-
- /**
- * @see ISelectionProvider#getSelection()
- */
- public ISelection getSelection() {
- return getUnderlyingSelectionProvider().getSelection();
- }
-
- /**
- * @see ISelectionProvider#removeSelectionChangedListener(ISelectionChangedListener)
- */
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- fListeners.remove(listener);
- }
-
- /**
- * @see ISelectionProvider#setSelection(ISelection)
- */
- public void setSelection(ISelection selection) {
- getUnderlyingSelectionProvider().setSelection(selection);
- }
-
- protected ISelectionProvider getUnderlyingSelectionProvider() {
- return fUnderlyingSelectionProvider;
- }
-
- protected void setUnderlyingSelectionProvider(ISelectionProvider underlyingSelectionProvider) {
- fUnderlyingSelectionProvider = underlyingSelectionProvider;
- }
-
- protected void fireSelectionChanged(SelectionChangedEvent event) {
- Object[] listeners= fListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- ISelectionChangedListener listener = (ISelectionChangedListener)listeners[i];
- listener.selectionChanged(event);
- }
- }
- }
-
- /**
- * Re-targets the find action to the details area or tree viewer.
- *
- * @since 3.2
- */
- class DelegatingFindAction extends Action implements IUpdate {
- private IAction getFindAction() {
- if (getDetailViewer().getTextWidget().isFocusControl()) {
- return getAction("FindReplaceText"); //$NON-NLS-1$
- } else {
- return getAction(FIND_ELEMENT);
- }
- }
- public void run() {
- IAction findAction = getFindAction();
- if (findAction != null) {
- findAction.run();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- IAction findAction = getFindAction();
- if (findAction != null) {
- setEnabled(findAction.isEnabled());
- } else {
- setEnabled(false);
- }
- }
- }
-
- /**
- * Job to compute the details for a selection
- */
- class DetailJob extends Job implements IValueDetailListener {
-
- private IStructuredSelection fElements;
- private boolean fFirst = true;
- private IProgressMonitor fMonitor;
-
- public DetailJob(IStructuredSelection elements) {
- super("compute variable details"); //$NON-NLS-1$
- setSystem(true);
- fElements = elements;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus run(IProgressMonitor monitor) {
- fMonitor = monitor;
- Iterator iterator = fElements.iterator();
- while (iterator.hasNext()) {
- if (monitor.isCanceled()) {
- break;
- }
- Object element = iterator.next();
- IValue val = null;
- if (element instanceof IVariable) {
- try {
- val = ((IVariable)element).getValue();
- } catch (DebugException e) {
- detailComputed(null, e.getStatus().getMessage());
- }
- } else if (element instanceof IExpression) {
- val = ((IExpression)element).getValue();
- }
- if (val instanceof IndexedValuePartition) {
- val = null;
- }
- if (val != null && !monitor.isCanceled()) {
- if (monitor.isCanceled()) {
- break;
- }
- getModelPresentation().computeDetail(val, this);
- synchronized (this) {
- try {
- wait();
- } catch (InterruptedException e) {
- break;
- }
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IValueDetailListener#detailComputed(org.eclipse.debug.core.model.IValue, java.lang.String)
- */
- public void detailComputed(IValue value, final String result) {
- if (!fMonitor.isCanceled()) {
- WorkbenchJob append = new WorkbenchJob("append details") { //$NON-NLS-1$
- public IStatus runInUIThread(IProgressMonitor monitor) {
- if (!fMonitor.isCanceled()) {
- String insert = result;
- int length = 0;
- if (!fFirst) {
- length = getDetailDocument().getLength();
- }
- if (length > 0) {
- insert = "\n" + result; //$NON-NLS-1$
- }
- try {
- int max = DebugUIPlugin.getDefault().getPreferenceStore().getInt(IInternalDebugUIConstants.PREF_MAX_DETAIL_LENGTH);
- if (max > 0 && insert.length() > max) {
- insert = insert.substring(0, max) + "..."; //$NON-NLS-1$
- }
- if (fFirst) {
- setDetails(insert);
- fFirst = false;
- } else {
- getDetailDocument().replace(length, 0,insert);
- }
- } catch (BadLocationException e) {
- DebugUIPlugin.log(e);
- }
- }
- return Status.OK_STATUS;
- }
- };
- append.setSystem(true);
- append.schedule();
- }
- synchronized (this) {
- notifyAll();
- }
-
- }
-
- }
/**
* The model presentation used as the label provider for the tree viewer,
@@ -362,51 +117,23 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
private SashForm fSashForm;
/**
- * The detail pane viewer and its associated document.
- */
- private SourceViewer fDetailViewer;
- private IDocument fDetailDocument;
-
- /**
- * Job computing details for selected variables
- */
- private DetailJob fDetailsJob = null;
-
- /**
- * The identifier of the debug model that is/was being displayed
- * in this view. When the type of model being displayed changes,
- * the details area needs to be reconfigured.
+ * The detail pane that displays detailed information about the current selection
+ * @since 3.3
*/
- private String fDebugModelIdentifier;
+ private DetailPaneProxy fDetailPane;
/**
- * The configuration being used in the details area
+ * Stores whether the tree viewer was the last control to have focus in the
+ * view. Used to give focus to the correct component if the user leaves the view.
+ * @since 3.3
*/
- private SourceViewerConfiguration fSourceViewerConfiguration;
+ private boolean fTreeHasFocus;
/**
* Various listeners used to update the enabled state of actions and also to
* populate the detail pane.
*/
private ISelectionChangedListener fTreeSelectionChangedListener;
- private ISelectionChangedListener fDetailSelectionChangedListener;
- private IDocumentListener fDetailDocumentListener;
-
- /**
- * Selection provider for this view.
- */
- private VariablesViewSelectionProvider fSelectionProvider= new VariablesViewSelectionProvider();
-
- /**
- * Collections for tracking actions.
- */
- private List fSelectionActions = new ArrayList(3);
-
- /**
- * Remembers which viewer (tree viewer or details viewer) had focus, so we
- * can reset the focus properly when re-activated.
- */
- private Viewer fFocusViewer = null;
/**
* These are used to initialize and persist the position of the sash that
@@ -421,11 +148,6 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
protected String PREF_STATE_MEMENTO = "pref_state_memento."; //$NON-NLS-1$
- protected static final String DETAIL_SELECT_ALL_ACTION = SELECT_ALL_ACTION + ".Detail"; //$NON-NLS-1$
- protected static final String VARIABLES_SELECT_ALL_ACTION= SELECT_ALL_ACTION + ".Variables"; //$NON-NLS-1$
-
- protected static final String DETAIL_COPY_ACTION = ActionFactory.COPY.getId() + ".Detail"; //$NON-NLS-1$
-
public static final String LOGICAL_STRUCTURE_TYPE_PREFIX = "VAR_LS_"; //$NON-NLS-1$
/**
@@ -449,30 +171,13 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
/**
* Key for "Find..." action.
*/
- protected static final String FIND_ELEMENT = "FindElement"; //$NON-NLS-1$
-
- private StatusLineContributionItem fStatusLineItem;
- private ICursorListener fCursorListener;
+ protected static final String VARIABLES_FIND_ELEMENT_ACTION = FIND_ACTION + ".Variables"; //$NON-NLS-1$
+
/**
- * Data structure for the position label value.
+ * Key for "Select All" action.
*/
- private static class PositionLabelValue {
-
- public int fValue;
-
- public String toString() {
- return String.valueOf(fValue);
- }
- }
- /** The pattern used to show the position label in the status line. */
- private final String fPositionLabelPattern= VariablesViewMessages.VariablesView_56;
- /** The position label value of the current line. */
- private final PositionLabelValue fLineLabel= new PositionLabelValue();
- /** The position label value of the current column. */
- private final PositionLabelValue fColumnLabel= new PositionLabelValue();
- /** The arguments for the position label pattern. */
- private final Object[] fPositionLabelPatternArguments= new Object[] { fLineLabel, fColumnLabel };
-
+ protected static final String VARIABLES_SELECT_ALL_ACTION = SELECT_ALL_ACTION + ".Variables"; //$NON-NLS-1$
+
/**
* Visits deltas to determine if details should be displayed
*/
@@ -530,17 +235,17 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
* @see IWorkbenchPart#dispose()
*/
public void dispose() {
- getViewSite().getActionBars().getStatusLineManager().remove(fStatusLineItem);
+
DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).removeDebugContextListener(this);
getSite().getWorkbenchWindow().removePerspectiveListener(this);
DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
JFaceResources.getFontRegistry().removeListener(this);
TreeModelViewer viewer = getVariablesViewer();
if (viewer != null) {
- getDetailDocument().removeDocumentListener(getDetailDocumentListener());
viewer.removeModelChangedListener(this);
viewer.removeViewerUpdateListener(this);
}
+ if (fDetailPane != null) fDetailPane.dispose();
super.dispose();
}
@@ -550,12 +255,11 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
*/
protected void setViewerInput(Object context) {
- getDetailViewer().setEditable(context != null);
if (context == null) {
- setDetails(""); //$NON-NLS-1$
+ clearDetails();
}
- Object current= getViewer().getInput();
+ Object current = getViewer().getInput();
if (current == null && context == null) {
return;
@@ -563,44 +267,11 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
if (current != null && current.equals(context)) {
return;
- }
-
- if (context instanceof IDebugElement) {
- setDebugModel(((IDebugElement)context).getModelIdentifier());
}
+
showViewer();
getViewer().setInput(context);
}
-
- /**
- * Configures the details viewer for the debug model
- * currently being displayed
- */
- protected void configureDetailsViewer() {
- LazyModelPresentation mp = (LazyModelPresentation)fModelPresentation.getPresentation(getDebugModel());
- SourceViewerConfiguration svc = null;
- if (mp != null) {
- try {
- svc = mp.newDetailsViewerConfiguration();
- } catch (CoreException e) {
- DebugUIPlugin.errorDialog(getSite().getShell(), VariablesViewMessages.VariablesView_Error_1, VariablesViewMessages.VariablesView_Unable_to_configure_variable_details_area__2, e);
- }
- }
- ISourceViewer detailViewer = getDetailViewer();
- if (svc == null) {
- svc = new SourceViewerConfiguration();
- detailViewer.setEditable(false);
- }
- if (detailViewer instanceof ISourceViewerExtension2) {
- ISourceViewerExtension2 sourceViewer = (ISourceViewerExtension2) detailViewer;
- sourceViewer.unconfigure();
- }
- detailViewer.configure(svc);
- //update actions that depend on the configuration of the details viewer
- updateAction("ContentAssist"); //$NON-NLS-1$
- setDetailViewerConfiguration(svc);
- createUndoRedoActions();
- }
/**
* @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
@@ -610,10 +281,6 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
if (propertyName.equals(IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR) ||
propertyName.equals(IInternalDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND)) {
getViewer().refresh();
- } else if (propertyName.equals(IInternalDebugUIConstants.DETAIL_PANE_FONT)) {
- getDetailViewer().getTextWidget().setFont(JFaceResources.getFont(IInternalDebugUIConstants.DETAIL_PANE_FONT));
- } else if (propertyName.equals(IInternalDebugUIConstants.PREF_MAX_DETAIL_LENGTH)) {
- populateDetailPane();
}
}
@@ -621,23 +288,28 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
* @see org.eclipse.debug.ui.AbstractDebugView#createViewer(Composite)
*/
public Viewer createViewer(Composite parent) {
+
fTriggerDetailsJob.setSystem(true);
- TreeModelViewer variablesViewer = createTreeViewer(parent);
- variablesViewer.getPresentationContext().addPropertyChangeListener(
- new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (IPresentationContext.PROPERTY_COLUMNS.equals(event.getProperty())) {
- IAction action = getAction("ShowTypeNames"); //$NON-NLS-1$
- if (action != null) {
- action.setEnabled(event.getNewValue() == null);
- }
- }
- }
- });
- createDetailsViewer();
- fSashForm.setMaximizedControl(variablesViewer.getControl());
+ // create the sash form that will contain the tree viewer & text viewer
+ fSashForm = new SashForm(parent, SWT.NONE);
+
+ fModelPresentation = new VariablesViewModelPresentation();
+ DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
+ TreeModelViewer variablesViewer = createTreeViewer(fSashForm);
+
+ fSashForm.setMaximizedControl(variablesViewer.getControl());
+
+ Listener activateListener = new Listener() {
+ public void handleEvent(Event event) {
+ fTreeHasFocus = false;
+ }
+ };
+
+ fDetailPane = new DetailPaneProxy(fSashForm,this.getSite(),activateListener);
+
+
createOrientationActions(variablesViewer);
IPreferenceStore prefStore = DebugUIPlugin.getDefault().getPreferenceStore();
String orientation = prefStore.getString(getDetailPanePreferenceKey());
@@ -649,8 +321,10 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
if (memento != null) {
variablesViewer.initState(memento);
}
+
variablesViewer.addModelChangedListener(this);
variablesViewer.addViewerUpdateListener(this);
+
return variablesViewer;
}
@@ -695,7 +369,6 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
site.getWorkbenchWindow().addPerspectiveListener(this);
}
-
/* (non-Javadoc)
* @see org.eclipse.ui.part.PageBookView#partDeactivated(org.eclipse.ui.IWorkbenchPart)
*/
@@ -739,7 +412,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
}
/**
- * @return the preference key for the variables view details pane
+ * @return the pref key for the variables view details pane
*/
protected String getDetailPanePreferenceKey() {
return IDebugPreferenceConstants.VARIABLES_DETAIL_PANE_ORIENTATION;
@@ -749,34 +422,43 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
* Create and return the main tree viewer that displays variable.
*/
protected TreeModelViewer createTreeViewer(Composite parent) {
- fModelPresentation = new VariablesViewModelPresentation();
- DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
- JFaceResources.getFontRegistry().addListener(this);
- // create the sash form that will contain the tree viewer & text viewer
- fSashForm = new SashForm(parent, SWT.NONE);
-
- // add tree viewer
int style = getViewerStyle();
- final TreeModelViewer variablesViewer = new TreeModelViewer(fSashForm, style,
+ final TreeModelViewer variablesViewer = new TreeModelViewer(parent, style,
new DebugModelPresentationContext(getPresentationContextId(), fModelPresentation));
+
variablesViewer.getControl().addFocusListener(new FocusAdapter() {
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.FocusListener#focusGained(FocusEvent)
- */
public void focusGained(FocusEvent e) {
- getVariablesViewSelectionProvider().setUnderlyingSelectionProvider(variablesViewer);
+ fTreeHasFocus = true;
+ getViewSite().setSelectionProvider(variablesViewer);
setAction(SELECT_ALL_ACTION, getAction(VARIABLES_SELECT_ALL_ACTION));
- setAction(COPY_ACTION, getAction(IDebugView.COPY_ACTION));
+ // TODO Copy action is not in the map, added through XML, see bug 166794
+// setAction(COPY_ACTION, getAction(IDebugView.COPY_ACTION));
+ setAction(FIND_ACTION, getAction(VARIABLES_FIND_ELEMENT_ACTION));
+ getViewSite().getActionBars().updateActionBars();
+ }
+
+ public void focusLost(FocusEvent e){
+ getViewSite().setSelectionProvider(null);
+ setAction(SELECT_ALL_ACTION, null);
+ setAction(COPY_ACTION,null);
+ setAction(FIND_ACTION, null);
getViewSite().getActionBars().updateActionBars();
- setFocusViewer(getViewer());
}
});
+ variablesViewer.getPresentationContext().addPropertyChangeListener(
+ new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ if (IPresentationContext.PROPERTY_COLUMNS.equals(event.getProperty())) {
+ IAction action = getAction("ShowTypeNames"); //$NON-NLS-1$
+ if (action != null) {
+ action.setEnabled(event.getNewValue() == null);
+ }
+ }
+ }
+ });
+
variablesViewer.addPostSelectionChangedListener(getTreeSelectionChangedListener());
- getVariablesViewSelectionProvider().setUnderlyingSelectionProvider(variablesViewer);
- getSite().setSelectionProvider(getVariablesViewSelectionProvider());
-
- // listen to debug context
DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).addDebugContextListener(this);
return variablesViewer;
}
@@ -799,42 +481,6 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
return SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.VIRTUAL | SWT.FULL_SELECTION;
}
- /**
- * Create the widgets for the details viewer.
- */
- protected void createDetailsViewer() {
- // Create & configure a SourceViewer
- SourceViewer detailsViewer= new SourceViewer(fSashForm, null, SWT.V_SCROLL | SWT.H_SCROLL);
- fDetailViewer = detailsViewer;
- detailsViewer.setDocument(getDetailDocument());
- detailsViewer.getTextWidget().setFont(JFaceResources.getFont(IInternalDebugUIConstants.DETAIL_PANE_FONT));
- getDetailDocument().addDocumentListener(getDetailDocumentListener());
- detailsViewer.setEditable(false);
- Control control = detailsViewer.getControl();
- GridData gd = new GridData(GridData.FILL_BOTH);
- control.setLayoutData(gd);
-
- detailsViewer.getSelectionProvider().addSelectionChangedListener(getDetailSelectionChangedListener());
- detailsViewer.getControl().addFocusListener(new FocusAdapter() {
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.FocusListener#focusGained(FocusEvent)
- */
- public void focusGained(FocusEvent e) {
- getVariablesViewSelectionProvider().setUnderlyingSelectionProvider(getDetailViewer().getSelectionProvider());
- setAction(SELECT_ALL_ACTION, getAction(DETAIL_SELECT_ALL_ACTION));
- setAction(COPY_ACTION, getAction(DETAIL_COPY_ACTION));
- getViewSite().getActionBars().updateActionBars();
- setFocusViewer((Viewer)getDetailViewer());
- }
- });
-
- // add a context menu to the detail area
- createDetailContextMenu(detailsViewer.getTextWidget());
-
- detailsViewer.getTextWidget().addMouseListener(getCursorListener());
- detailsViewer.getTextWidget().addKeyListener(getCursorListener());
- }
-
/* (non-Javadoc)
* @see org.eclipse.debug.ui.AbstractDebugView#getHelpContextId()
*/
@@ -903,13 +549,6 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
}
/**
- * Set on or off the word wrap flag for the detail pane.
- */
- public void toggleDetailPaneWordWrap(boolean on) {
- fDetailViewer.getTextWidget().setWordWrap(on);
- }
-
- /**
* Return the relative weights that were in effect the last time both panes were
* visible in the sash form, or the default weights if:
* <ul>
@@ -936,28 +575,6 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
fLastSashWeights = weights;
}
- /**
- * Create the context menu particular to the detail pane. Note that anyone
- * wishing to contribute an action to this menu must use
- * <code>IDebugUIConstants.VARIABLE_VIEW_DETAIL_ID</code> as the
- * <code>targetID</code> in the extension XML.
- */
- protected void createDetailContextMenu(Control menuControl) {
- MenuManager menuMgr= new MenuManager();
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager mgr) {
- fillDetailContextMenu(mgr);
- }
- });
- Menu menu= menuMgr.createContextMenu(menuControl);
- menuControl.setMenu(menu);
-
- // register the context menu such that other plug-ins may contribute to it
- getSite().registerContextMenu(IDebugUIConstants.VARIABLE_VIEW_DETAIL_ID, menuMgr, getDetailViewer().getSelectionProvider());
- addContextMenuManager(menuMgr);
- }
-
/* (non-Javadoc)
* @see org.eclipse.debug.ui.AbstractDebugView#createActions()
*/
@@ -975,111 +592,9 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
action.setEnabled(false);
setAction("ChangeVariableValue", action); //$NON-NLS-1$
- TextViewerAction textAction= new TextViewerAction(getDetailViewer(), ISourceViewer.CONTENTASSIST_PROPOSALS);
- textAction.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
- textAction.configureAction(VariablesViewMessages.VariablesView_Co_ntent_Assist_3, "",""); //$NON-NLS-1$ //$NON-NLS-2$
- textAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_ELCL_CONTENT_ASSIST));
- textAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_CONTENT_ASSIST));
- textAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_DLCL_CONTENT_ASSIST));
- setAction("ContentAssist", textAction); //$NON-NLS-1$
-
- ActionHandler actionHandler = new ActionHandler(textAction);
- IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
- handlerService.activateHandler(textAction.getActionDefinitionId(), actionHandler);
-
- textAction= new TextViewerAction(getDetailViewer(), ITextOperationTarget.SELECT_ALL);
- textAction.configureAction(VariablesViewMessages.VariablesView_Select__All_5, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
- textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.SELECT_ALL);
- setAction(DETAIL_SELECT_ALL_ACTION, textAction);
-
- textAction= new TextViewerAction(getDetailViewer(), ITextOperationTarget.COPY);
- textAction.configureAction(VariablesViewMessages.VariablesView__Copy_8, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
- textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY);
- setAction(DETAIL_COPY_ACTION, textAction);
-
- textAction= new TextViewerAction(getDetailViewer(), ITextOperationTarget.CUT);
- textAction.configureAction(VariablesViewMessages.VariablesView_Cu_t_11, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
- textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.CUT);
- setAction(ActionFactory.CUT.getId(), textAction);
-
- textAction= new TextViewerAction(getDetailViewer(), ITextOperationTarget.PASTE);
- textAction.configureAction(VariablesViewMessages.VariablesView__Paste_14, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
- textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.PASTE);
- setAction(ActionFactory.PASTE.getId(), textAction);
-
action= new VirtualFindAction(getVariablesViewer());
- setAction(FIND_ELEMENT, action);
-
- // TODO: Still using "old" resource access
- ResourceBundle bundle= ResourceBundle.getBundle("org.eclipse.debug.internal.ui.views.variables.VariablesViewResourceBundleMessages"); //$NON-NLS-1$
- action = new FindReplaceAction(bundle, "find_replace_action_", VariablesView.this); //$NON-NLS-1$
- action.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_REPLACE);
- setAction("FindReplaceText", action); //$NON-NLS-1$
-
- setAction(FIND_ACTION, new DelegatingFindAction());
-
- fSelectionActions.add(ActionFactory.COPY.getId());
- fSelectionActions.add(ActionFactory.CUT.getId());
- fSelectionActions.add(ActionFactory.PASTE.getId());
- fSelectionActions.add("FindReplaceText"); //$NON-NLS-1$
- updateAction("FindReplaceText"); //$NON-NLS-1$
-
- action = new AssignValueAction(this, fDetailViewer);
- setAction("AssignValue", action); //$NON-NLS-1$
-
- fStatusLineItem = new StatusLineContributionItem("ModeContributionItem"); //$NON-NLS-1$
- IActionBars actionBars = getViewSite().getActionBars();
- IStatusLineManager manager= actionBars.getStatusLineManager();
- manager.add(fStatusLineItem);
- }
-
- /**
- * Creates this editor's undo/re-do actions.
- * <p>
- * Subclasses may override or extend.</p>
- *
- * @since 3.2
- */
- protected void createUndoRedoActions() {
- disposeUndoRedoAction(ITextEditorActionConstants.UNDO);
- disposeUndoRedoAction(ITextEditorActionConstants.REDO);
- IUndoContext undoContext= getUndoContext();
- if (undoContext != null) {
- // Use actions provided by global undo/re-do
-
- // Create the undo action
- OperationHistoryActionHandler undoAction= new UndoActionHandler(getSite(), undoContext);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(undoAction, IAbstractTextEditorHelpContextIds.UNDO_ACTION);
- undoAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.UNDO);
- setAction(ITextEditorActionConstants.UNDO, undoAction);
-
- // Create the re-do action.
- OperationHistoryActionHandler redoAction= new RedoActionHandler(getSite(), undoContext);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(redoAction, IAbstractTextEditorHelpContextIds.REDO_ACTION);
- redoAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.REDO);
- setAction(ITextEditorActionConstants.REDO, redoAction);
- }
- }
-
- private void disposeUndoRedoAction(String actionId) {
- OperationHistoryActionHandler action = (OperationHistoryActionHandler) getAction(actionId);
- if (action != null) {
- action.dispose();
- setAction(actionId, null);
- }
- }
- /**
- * Returns this editor's viewer's undo manager undo context.
- *
- * @return the undo context or <code>null</code> if not available
- * @since 3.2
- */
- private IUndoContext getUndoContext() {
- IUndoManager undoManager= fDetailViewer.getUndoManager();
- if (undoManager instanceof IUndoManagerExtension)
- return ((IUndoManagerExtension)undoManager).getUndoContext();
- return null;
- }
+ setAction(VARIABLES_FIND_ELEMENT_ACTION, action);
+ }
private void createOrientationActions(TreeModelViewer viewer) {
IActionBars actionBars = getViewSite().getActionBars();
@@ -1146,39 +661,23 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
menu.add(new Separator(IDebugUIConstants.EMPTY_VARIABLE_GROUP));
menu.add(new Separator(IDebugUIConstants.VARIABLE_GROUP));
- menu.add(getAction(FIND_ELEMENT));
+ menu.add(getAction(VARIABLES_FIND_ELEMENT_ACTION));
menu.add(getAction("ChangeVariableValue")); //$NON-NLS-1$
+ menu.add(new Separator());
IAction action = new AvailableLogicalStructuresAction(this);
if (action.isEnabled()) {
menu.add(action);
}
+ action = new AvailableDetailPanesAction(this);
+ if (isDetailPaneVisible() && action.isEnabled()) {
+ menu.add(action);
+ }
menu.add(new Separator(IDebugUIConstants.EMPTY_RENDER_GROUP));
menu.add(new Separator(IDebugUIConstants.EMPTY_NAVIGATION_GROUP));
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
/**
- * Adds items to the detail area's context menu including any extension defined
- * actions.
- *
- * @param menu The menu to add the item to.
- */
- protected void fillDetailContextMenu(IMenuManager menu) {
-
- menu.add(new Separator(IDebugUIConstants.VARIABLE_GROUP));
- menu.add(getAction("AssignValue")); //$NON-NLS-1$
- menu.add(getAction("ContentAssist")); //$NON-NLS-1$
- menu.add(new Separator());
- menu.add(getAction(ActionFactory.CUT.getId()));
- menu.add(getAction(ActionFactory.COPY.getId() + ".Detail")); //$NON-NLS-1$
- menu.add(getAction(ActionFactory.PASTE.getId()));
- menu.add(getAction(DETAIL_SELECT_ALL_ACTION));
- menu.add(new Separator("FIND")); //$NON-NLS-1$
- menu.add(getAction("FindReplaceText")); //$NON-NLS-1$
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
- /**
* Lazily instantiate and return a selection listener that populates the detail pane,
* but only if the detail is currently visible.
*/
@@ -1187,8 +686,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
fTreeSelectionChangedListener = new ISelectionChangedListener() {
public void selectionChanged(final SelectionChangedEvent event) {
if (event.getSelectionProvider().equals(getViewer())) {
- clearStatusLine();
- getVariablesViewSelectionProvider().fireSelectionChanged(event);
+ clearStatusLine();
// if the detail pane is not visible, don't waste time retrieving details
if (fSashForm.getMaximizedControl() == getViewer().getControl()) {
return;
@@ -1201,7 +699,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
}
return fTreeSelectionChangedListener;
}
-
+
/**
* Selection in the variable tree changed. Perform any updates.
*
@@ -1228,69 +726,14 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
* detail pane.
*/
protected void populateDetailPaneFromSelection(IStructuredSelection selection) {
- synchronized (this) {
- if (fDetailsJob != null) {
- fDetailsJob.cancel();
- }
- if (selection.isEmpty()) {
- setDetails(""); //$NON-NLS-1$
- } else {
- fDetailsJob = new DetailJob(selection);
- fDetailsJob.schedule();
- }
- }
+ fDetailPane.display(selection);
}
/**
* Clears the detail pane
*/
- private void setDetails(final String value) {
- getDetailDocument().set(value);
- }
-
- /**
- * Lazily instantiate and return a selection listener that updates the enabled
- * state of the selection oriented actions in this view.
- */
- protected ISelectionChangedListener getDetailSelectionChangedListener() {
- if (fDetailSelectionChangedListener == null) {
- fDetailSelectionChangedListener = new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- if (event.getSelectionProvider().equals(getVariablesViewSelectionProvider().getUnderlyingSelectionProvider())) {
- getVariablesViewSelectionProvider().fireSelectionChanged(event);
- updateSelectionDependentActions();
- }
- }
- };
- }
- return fDetailSelectionChangedListener;
- }
-
- /**
- * Lazily instantiate and return a document listener that updates the enabled state
- * of the 'Find/Replace' action.
- */
- protected IDocumentListener getDetailDocumentListener() {
- if (fDetailDocumentListener == null) {
- fDetailDocumentListener = new IDocumentListener() {
- public void documentAboutToBeChanged(DocumentEvent event) {
- }
- public void documentChanged(DocumentEvent event) {
- updateAction(ActionFactory.FIND.getId());
- }
- };
- }
- return fDetailDocumentListener;
- }
-
- /**
- * Lazily instantiate and return a Document for the detail pane text viewer.
- */
- protected IDocument getDetailDocument() {
- if (fDetailDocument == null) {
- fDetailDocument = new Document();
- }
- return fDetailDocument;
+ private void clearDetails() {
+ fDetailPane.display(null);
}
protected IDebugModelPresentation getModelPresentation() {
@@ -1301,15 +744,6 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
}
/**
- * Returns the viewer used to display value details
- *
- * @return source viewer
- */
- protected ISourceViewer getDetailViewer() {
- return fDetailViewer;
- }
-
- /**
* Returns the sash form
* @return the current sash form
*/
@@ -1321,23 +755,14 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
* @see org.eclipse.ui.part.WorkbenchPart#getAdapter(Class)
*/
public Object getAdapter(Class required) {
- if (IFindReplaceTarget.class.equals(required)) {
- return getDetailViewer().getFindReplaceTarget();
- }
- if (ITextViewer.class.equals(required)) {
- return getDetailViewer();
- }
if (IDebugModelPresentation.class.equals(required)) {
return getModelPresentation();
}
- return super.getAdapter(required);
- }
-
- protected void updateSelectionDependentActions() {
- Iterator iterator= fSelectionActions.iterator();
- while (iterator.hasNext()) {
- updateAction((String)iterator.next());
+ else if (fDetailPane != null){
+ Object adapter = fDetailPane.getAdapter(required);
+ if (adapter != null) return adapter;
}
+ return super.getAdapter(required);
}
protected void updateAction(String actionId) {
@@ -1351,58 +776,6 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
return !fToggleDetailPaneActions[2].isChecked();
}
- /**
- * Sets the identifier of the debug model being displayed
- * in this view, or <code>null</code> if none.
- *
- * @param id debug model identifier of the type of debug
- * elements being displayed in this view
- */
- protected void setDebugModel(String id) {
- if (id != fDebugModelIdentifier) {
- fDebugModelIdentifier = id;
- configureDetailsViewer();
- // force actions to initialize
- getVariablesViewSelectionProvider().fireSelectionChanged(new SelectionChangedEvent(
- getVariablesViewer(), new StructuredSelection(new Object())));
- getVariablesViewSelectionProvider().fireSelectionChanged(new SelectionChangedEvent(
- getVariablesViewer(), getSelectionProvider().getSelection()));
- } else {
- updateAction("ContentAssist"); //$NON-NLS-1$
- }
- }
-
- /**
- * Returns the identifier of the debug model being displayed
- * in this view, or <code>null</code> if none.
- *
- * @return debug model identifier
- */
- protected String getDebugModel() {
- return fDebugModelIdentifier;
- }
-
-
- /**
- * Sets the current configuration being used in the
- * details area.
- *
- * @param config source viewer configuration
- */
- private void setDetailViewerConfiguration(SourceViewerConfiguration config) {
- fSourceViewerConfiguration = config;
- }
-
- /**
- * Returns the current configuration being used in the
- * details area.
- *
- * @return source viewer configuration
- */
- protected SourceViewerConfiguration getDetailViewerConfiguration() {
- return fSourceViewerConfiguration;
- }
-
/* (non-Javadoc)
* @see org.eclipse.debug.ui.AbstractDebugView#getDefaultControl()
*/
@@ -1417,16 +790,15 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
showMessage(e.getMessage());
}
- protected VariablesViewSelectionProvider getVariablesViewSelectionProvider() {
- return fSelectionProvider;
- }
-
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextEvent(org.eclipse.debug.internal.ui.contexts.provisional.DebugContextEvent)
+ */
public void debugContextChanged(DebugContextEvent event) {
if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
contextActivated(event.getContext());
}
}
-
+
protected void contextActivated(ISelection selection) {
if (!isAvailable() || !isVisible()) {
return;
@@ -1437,11 +809,10 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
}
showViewer();
- updateAction("ContentAssist"); //$NON-NLS-1$
- updateAction(FIND_ELEMENT);
+ updateAction(VARIABLES_FIND_ELEMENT_ACTION);
updateAction(FIND_ACTION);
}
-
+
/**
* Delegate to the <code>DOUBLE_CLICK_ACTION</code>,
* if any.
@@ -1454,34 +825,6 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
action.run();
}
}
- /**
- * @see org.eclipse.ui.IWorkbenchPart#setFocus()
- */
- public void setFocus() {
- if (getFocusViewer() == null) {
- super.setFocus();
- } else {
- getFocusViewer().getControl().setFocus();
- }
- }
-
- /**
- * Sets the viewer that has focus.
- *
- * @param viewer
- */
- protected void setFocusViewer(Viewer viewer) {
- fFocusViewer = viewer;
- }
-
- /**
- * Returns the viewer that has focus, or <code>null</code>.
- *
- * @return Viewer
- */
- protected Viewer getFocusViewer() {
- return fFocusViewer;
- }
/* (non-Javadoc)
* @see org.eclipse.debug.ui.IDebugView#getPresentation(String)
@@ -1562,80 +905,11 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
ISelection selection = DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).getActiveContext();
contextActivated(selection);
}
-
+
protected TreeModelViewer getVariablesViewer() {
return (TreeModelViewer) getViewer();
}
- /**
- * Returns this view's "cursor" listener to be installed on the view's
- * associated details viewer. This listener is listening to key and mouse button events.
- * It triggers the updating of the status line.
- *
- * @return the listener
- */
- private ICursorListener getCursorListener() {
- if (fCursorListener == null) {
- fCursorListener= new ICursorListener() {
-
- public void keyPressed(KeyEvent e) {
- fStatusLineItem.setText(getCursorPosition());
- }
-
- public void keyReleased(KeyEvent e) {
- }
-
- public void mouseDoubleClick(MouseEvent e) {
- }
-
- public void mouseDown(MouseEvent e) {
- }
-
- public void mouseUp(MouseEvent e) {
- fStatusLineItem.setText(getCursorPosition());
- }
- };
- }
- return fCursorListener;
- }
-
- protected String getCursorPosition() {
-
- if (getDetailViewer() == null) {
- return ""; //$NON-NLS-1$
- }
-
- StyledText styledText= getDetailViewer().getTextWidget();
- int caret= styledText.getCaretOffset();
- IDocument document= getDetailViewer().getDocument();
-
- if (document == null) {
- return ""; //$NON-NLS-1$
- }
-
- try {
-
- int line= document.getLineOfOffset(caret);
-
- int lineOffset= document.getLineOffset(line);
- int tabWidth= styledText.getTabs();
- int column= 0;
- for (int i= lineOffset; i < caret; i++)
- if ('\t' == document.getChar(i)) {
- column += tabWidth - (tabWidth == 0 ? 0 : column % tabWidth);
- } else {
- column++;
- }
-
- fLineLabel.fValue= line + 1;
- fColumnLabel.fValue= column + 1;
- return MessageFormat.format(fPositionLabelPattern, fPositionLabelPatternArguments);
-
- } catch (BadLocationException x) {
- return ""; //$NON-NLS-1$
- }
- }
-
protected void clearStatusLine() {
IStatusLineManager manager = getViewSite().getActionBars().getStatusLineManager();
manager.setErrorMessage(null);
@@ -1690,9 +964,6 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
*/
public synchronized void viewerUpdatesBegin() {
fTriggerDetailsJob.cancel();
- if (fDetailsJob != null) {
- fDetailsJob.cancel();
- }
}
/* (non-Javadoc)
@@ -1703,4 +974,27 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
fTriggerDetailsJob.schedule();
}
}
+
+ /**
+ * @see org.eclipse.ui.IWorkbenchPart#setFocus()
+ */
+ public void setFocus() {
+ boolean success = false;
+ if (!fTreeHasFocus && fDetailPane != null){
+ success = fDetailPane.setFocus();
+ }
+ // Unless the detail pane successfully set focus to a control, set focus to the variables tree
+ if (!success && getViewer() != null){
+ getViewer().getControl().setFocus();
+ }
+ }
+
+ /**
+ * Returns the detail pane or null.
+ */
+ public DetailPaneProxy getDetailPane() {
+ return fDetailPane;
+ }
+
+
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesViewMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesViewMessages.java
index 6a21c4d3d..5730b4e32 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesViewMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesViewMessages.java
@@ -15,6 +15,14 @@ import org.eclipse.osgi.util.NLS;
public class VariablesViewMessages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.debug.internal.ui.views.variables.VariablesViewMessages";//$NON-NLS-1$
+ public static String DetailPaneMaxLengthDialog_0;
+
+ public static String DetailPaneMaxLengthDialog_1;
+
+ public static String DetailPaneMaxLengthDialog_2;
+
+ public static String DetailPaneMaxLengthDialog_3;
+
public static String VariablesView__Copy_8;
public static String VariablesView__Paste_14;
public static String VariablesView_Co_ntent_Assist_3;
@@ -38,14 +46,6 @@ public class VariablesViewMessages extends NLS {
NLS.initializeMessages(BUNDLE_NAME, VariablesViewMessages.class);
}
- public static String MaxDetailsLengthDialog_0;
-
- public static String MaxDetailsLengthDialog_1;
-
- public static String MaxDetailsLengthDialog_2;
-
- public static String MaxDetailsLengthDialog_3;
-
public static String VariablesView_40;
public static String ToggleShowColumnsAction_0;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesViewMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesViewMessages.properties
index 94a2c6c86..a33a70a24 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesViewMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesViewMessages.properties
@@ -28,8 +28,8 @@ ExpressionView_4=Expressions View Only
IndexedVariablePartition_4=Value modification not supported for indexed partitions.
AvailableLogicalStructuresAction_0=Select From Available Logical Structures
-AvailableLogicalStructuresAction_1=&Show As
-MaxDetailsLengthDialog_0=Configure Details Pane
-MaxDetailsLengthDialog_1=&Maximum characters to display in details pane (0 = unlimited):
-MaxDetailsLengthDialog_2=Integer must be non-negative
-MaxDetailsLengthDialog_3=Enter an integer
+AvailableLogicalStructuresAction_1=&Show Structure As
+DetailPaneMaxLengthDialog_0=Configure Details Pane
+DetailPaneMaxLengthDialog_1=&Maximum characters to display in details pane (0 = unlimited):
+DetailPaneMaxLengthDialog_2=Integer must be non-negative
+DetailPaneMaxLengthDialog_3=Enter an integer
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/AbstractDetailPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/AbstractDetailPane.java
new file mode 100644
index 000000000..ba3c257c2
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/AbstractDetailPane.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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.internal.ui.views.variables.details;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.debug.ui.IDetailPane;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.texteditor.IUpdate;
+
+/**
+ * Abstract class that holds common methods used by implementors of IDetailPane.
+ *
+ * @since 3.3
+ */
+public abstract class AbstractDetailPane implements IDetailPane {
+
+ /**
+ * The <code>IWorkbenchPartSite</code> that the details area (and the
+ * variables view) belongs to.
+ */
+ private IWorkbenchPartSite fWorkbenchPartSite;
+
+ /**
+ * Map of actions. Keys are strings, values
+ * are <code>IAction</code>.
+ */
+ private Map fActionMap = new HashMap();
+
+ /**
+ * Collection to track actions that should be updated when selection occurs.
+ */
+ private List fSelectionActions = new ArrayList();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDetailPane#init(org.eclipse.ui.IWorkbenchPartSite)
+ */
+ public void init(IWorkbenchPartSite workbench) {
+ fWorkbenchPartSite = workbench;
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDetailPane#dispose()
+ */
+ public void dispose() {
+ fActionMap.clear();
+ fSelectionActions.clear();
+ }
+
+ /**
+ * Adds an action to the Map storing actions. Removes it if action is null.
+ *
+ * @param actionID The ID of the action, used as the key in the Map
+ * @param action The action associated with the ID
+ */
+ protected void setAction(String actionID, IAction action) {
+ if (action == null) {
+ fActionMap.remove(actionID);
+ } else {
+ fActionMap.put(actionID, action);
+ }
+ }
+
+ /**
+ * Adds the given action to the global action handler for the ViewSite.
+ * A call to <code>updateActionBars()</code> must be called after changes
+ * to propagate changes through the workbench.
+ *
+ * @param actionID The ID of the action
+ * @param action The action to be set globally
+ */
+ protected void setGlobalAction(String actionID, IAction action){
+ getViewSite().getActionBars().setGlobalActionHandler(actionID, action);
+ }
+
+ /**
+ * Adds the given action to the list of actions that will be updated when
+ * <code>updateSelectionDependentActions()</code> is called. If the string
+ * is null it will not be added to the list.
+ *
+ * @param actionID The ID of the action which should be updated
+ */
+ protected void setSelectionDependantAction(String actionID){
+ if (actionID != null) fSelectionActions.add(actionID);
+ }
+
+ /**
+ * Gets the action out of the map, casts it to an <code>IAction</code>
+ *
+ * @param actionID The ID of the action to find
+ * @return The action associated with the ID or null if none is found.
+ */
+ protected IAction getAction(String actionID) {
+ return (IAction) fActionMap.get(actionID);
+ }
+
+ /**
+ * Calls the update method of the action with the given action ID.
+ * The action must exist in the action map and must be an instance of
+ * </code>IUpdate</code>
+ *
+ * @param actionId The ID of the action to update
+ */
+ protected void updateAction(String actionId) {
+ IAction action= getAction(actionId);
+ if (action instanceof IUpdate) {
+ ((IUpdate) action).update();
+ }
+ }
+
+ /**
+ * Iterates through the list of selection dependent actions and
+ * updates them. Use <code>setSelectionDependentAction(String actionID)</code>
+ * to add an action to the list. The action must have been added to the known
+ * actions map by calling <code>setAction(String actionID, IAction action)</code>
+ * before it can be updated by this method.
+ */
+ protected void updateSelectionDependentActions() {
+ Iterator iterator= fSelectionActions.iterator();
+ while (iterator.hasNext()) {
+ updateAction((String)iterator.next());
+ }
+ }
+
+ /**
+ * Gets the view site for this view.
+ *
+ * @return The site for this view
+ */
+ protected IViewSite getViewSite(){
+ return (IViewSite) fWorkbenchPartSite.getPart().getSite();
+ }
+
+ /**
+ * Gets the workbench part site for this view.
+ *
+ * @return The workbench part site
+ */
+ protected IWorkbenchPartSite getWorkbenchPartSite() {
+ return fWorkbenchPartSite;
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/AvailableDetailPanesAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/AvailableDetailPanesAction.java
new file mode 100644
index 000000000..8abfb8451
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/AvailableDetailPanesAction.java
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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.internal.ui.views.variables.details;
+
+
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
+import org.eclipse.debug.internal.ui.views.variables.VariablesView;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Drop down action that displays the available detail panes for a selection.
+ */
+public class AvailableDetailPanesAction extends Action implements IMenuCreator {
+
+ private VariablesView fView;
+ private Menu fMenu;
+ private Set fAvailableIDs;
+
+ /**
+ * Each entry in the menu will be of this type. It represents one possible detail pane
+ * that the user can select. If the user selects it, the display is changed to use that
+ * detail pane and the preferred detail pane map in the pane manager is updated.
+ *
+ * @see DetailPaneManager
+ * @since 3.3
+ */
+ private class SetDetailsViewerAction extends Action {
+
+ private String fPaneID;
+ private Set fPossiblePaneIDs;
+ private VariablesView fVarView;
+
+ public SetDetailsViewerAction(String name, String paneID, Set possiblePaneIDs, VariablesView view){
+ super(name,AS_RADIO_BUTTON);
+ fPaneID = paneID;
+ fPossiblePaneIDs = possiblePaneIDs;
+ fVarView = view;
+ }
+
+ public void run() {
+ // Don't change viewers unless the user is selecting a different viewer than the one currently displayed
+ if (isChecked() && !fVarView.getDetailPane().getCurrentViewerID().equals(fPaneID)){
+ DetailPaneManager.getDefault().setPreferredDetailPane(fPossiblePaneIDs, fPaneID);
+ fVarView.populateDetailPane();
+ }
+ }
+
+ }
+
+ public AvailableDetailPanesAction(VariablesView view) {
+ setView(view);
+
+ setText(DetailMessages.AvailableDetailPanesAction_0);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.VARIABLES_SELECT_DETAIL_PANE);
+
+ setEnabled(false);
+ setMenuCreator(this);
+ init();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IAction#run()
+ */
+ public void run() {
+ }
+
+ protected VariablesView getView() {
+ return fView;
+ }
+
+ protected void setView(VariablesView view) {
+ fView = view;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IMenuCreator#dispose()
+ */
+ public void dispose() {
+ if (fMenu != null) {
+ fMenu.dispose();
+ }
+ setView(null);
+ fAvailableIDs.clear();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
+ */
+ public Menu getMenu(Control parent) {
+ return null;
+ }
+
+ protected void addActionToMenu(Menu parent, IAction action) {
+ ActionContributionItem item= new ActionContributionItem(action);
+ item.fill(parent, -1);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
+ */
+ public Menu getMenu(Menu parent) {
+ if (fMenu != null) {
+ fMenu.dispose();
+ }
+
+ fMenu= new Menu(parent);
+
+ Iterator iter = fAvailableIDs.iterator();
+ int i = 0;
+ String currentViewer = getView().getDetailPane().getCurrentViewerID();
+ while (iter.hasNext()) {
+ String currentID = (String) iter.next();
+
+ StringBuffer name = new StringBuffer();
+ //add the numerical accelerator
+ i++;
+ if (i < 9) {
+ name.append('&');
+ name.append(i);
+ name.append(' ');
+ }
+
+ String typeName = DetailPaneManager.getDefault().getNameFromID(currentID);
+ if (typeName != null && typeName.length() > 0){
+ name.append(typeName);
+ } else {
+ name.append(currentID);
+ }
+
+ IAction action = new SetDetailsViewerAction(name.toString(),currentID,fAvailableIDs,getView());
+
+ if (currentID.equals(currentViewer)){
+ action.setChecked(true);
+ }
+
+ addActionToMenu(fMenu, action);
+ }
+
+ return fMenu;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+ */
+ public void init() {
+
+ ISelection viewerSelection = getView().getViewer().getSelection();
+ if (viewerSelection instanceof IStructuredSelection){
+ IStructuredSelection selection = (IStructuredSelection)viewerSelection;
+ fAvailableIDs = DetailPaneManager.getDefault().getAvailablePaneIDs(selection);
+ if (fAvailableIDs.size() > 1){
+ setEnabled(true);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java
new file mode 100644
index 000000000..23f89632c
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java
@@ -0,0 +1,829 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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
+ * QNX Software Systems - Mikhail Khodjaiants - Registers View (Bug 53640)
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.views.variables.details;
+
+import java.util.Iterator;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+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.DebugException;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IExpression;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.internal.ui.LazyModelPresentation;
+import org.eclipse.debug.internal.ui.VariablesViewModelPresentation;
+import org.eclipse.debug.internal.ui.actions.variables.details.DetailPaneAssignValueAction;
+import org.eclipse.debug.internal.ui.actions.variables.details.DetailPaneMaxLengthAction;
+import org.eclipse.debug.internal.ui.actions.variables.details.DetailPaneWordWrapAction;
+import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
+import org.eclipse.debug.internal.ui.views.variables.IndexedValuePartition;
+import org.eclipse.debug.internal.ui.views.variables.StatusLineContributionItem;
+import org.eclipse.debug.ui.IDebugModelPresentation;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.IDebugView;
+import org.eclipse.debug.ui.IValueDetailListener;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.commands.ActionHandler;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.DocumentEvent;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentListener;
+import org.eclipse.jface.text.IFindReplaceTarget;
+import org.eclipse.jface.text.ITextOperationTarget;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.IUndoManager;
+import org.eclipse.jface.text.IUndoManagerExtension;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.console.actions.TextViewerAction;
+import org.eclipse.ui.handlers.IHandlerService;
+import org.eclipse.ui.operations.OperationHistoryActionHandler;
+import org.eclipse.ui.operations.RedoActionHandler;
+import org.eclipse.ui.operations.UndoActionHandler;
+import org.eclipse.ui.progress.WorkbenchJob;
+import org.eclipse.ui.texteditor.FindReplaceAction;
+import org.eclipse.ui.texteditor.IAbstractTextEditorHelpContextIds;
+import org.eclipse.ui.texteditor.ITextEditorActionConstants;
+import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
+import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
+
+import com.ibm.icu.text.MessageFormat;
+
+/**
+ * This detail pane uses a source viewer to display detailed information about the current
+ * selection. It incorporates a large number of actions into its context menu. It is the
+ * default detail pane.
+ *
+ * @see DefaultDetailPaneFactory
+ * @since 3.3
+ *
+ */
+public class DefaultDetailPane extends AbstractDetailPane implements IAdaptable, IPropertyChangeListener{
+
+ /**
+ * These are the IDs for the actions in the context menu
+ */
+ protected static final String DETAIL_COPY_ACTION = ActionFactory.COPY.getId() + ".SourceDetailPane"; //$NON-NLS-1$
+ protected static final String DETAIL_SELECT_ALL_ACTION = IDebugView.SELECT_ALL_ACTION + ".SourceDetailPane"; //$NON-NLS-1$
+ protected static final String DETAIL_PASTE_ACTION = ActionFactory.PASTE.getId();
+ protected static final String DETAIL_CUT_ACTION = ActionFactory.CUT.getId();
+
+ protected static final String DETAIL_FIND_REPLACE_TEXT_ACTION = "FindReplaceText"; //$NON-NLS-1$
+ protected static final String DETAIL_CONTENT_ASSIST_ACTION = "ContentAssist"; //$NON-NLS-1$
+ protected static final String DETAIL_ASSIGN_VALUE_ACTION = "AssignValue"; //$NON-NLS-1$
+
+ protected static final String DETAIL_WORD_WRAP_ACTION = IDebugPreferenceConstants.PREF_DETAIL_PANE_WORD_WRAP;
+ protected static final String DETAIL_MAX_LENGTH_ACTION = "MaxLength"; //$NON-NLS-1$
+
+ /**
+ * The ID, name and description of this viewer are stored in contants so that the class
+ * does not have to be instantiated to access them.
+ */
+ public static final String ID = DetailMessages.DefaultDetailPane_0;
+ public static final String NAME = DetailMessages.DefaultDetailPane_1;
+ public static final String DESCRIPTION = DetailMessages.DefaultDetailPane_57;
+
+ /**
+ * Data structure for the position label value.
+ */
+ private static class PositionLabelValue {
+
+ public int fValue;
+
+ public String toString() {
+ return String.valueOf(fValue);
+ }
+ }
+
+ /**
+ * Internal interface for a cursor listener. I.e. aggregation
+ * of mouse and key listener.
+ * @since 3.0
+ */
+ interface ICursorListener extends MouseListener, KeyListener {
+ }
+
+ /**
+ * Job to compute the details for a selection
+ */
+ class DetailJob extends Job implements IValueDetailListener {
+
+ private IStructuredSelection fElements;
+ private IDebugModelPresentation fModel;
+ private boolean fFirst = true;
+ private IProgressMonitor fMonitor;
+
+ public DetailJob(IStructuredSelection elements, IDebugModelPresentation model) {
+ super("compute variable details"); //$NON-NLS-1$
+ setSystem(true);
+ fElements = elements;
+ fModel = model;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected IStatus run(IProgressMonitor monitor) {
+ fMonitor = monitor;
+ Iterator iterator = fElements.iterator();
+ while (iterator.hasNext()) {
+ if (monitor.isCanceled()) {
+ break;
+ }
+ Object element = iterator.next();
+ IValue val = null;
+ if (element instanceof IVariable) {
+ try {
+ val = ((IVariable)element).getValue();
+ } catch (DebugException e) {
+ detailComputed(null, e.getStatus().getMessage());
+ }
+ } else if (element instanceof IExpression) {
+ val = ((IExpression)element).getValue();
+ }
+ if (val instanceof IndexedValuePartition) {
+ val = null;
+ }
+ if (val != null && !monitor.isCanceled()) {
+ fModel.computeDetail(val, this);
+ synchronized (this) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ break;
+ }
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IValueDetailListener#detailComputed(org.eclipse.debug.core.model.IValue, java.lang.String)
+ */
+ public void detailComputed(IValue value, final String result) {
+ if (!fMonitor.isCanceled()) {
+ WorkbenchJob append = new WorkbenchJob("append details") { //$NON-NLS-1$
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ if (!fMonitor.isCanceled()) {
+ String insert = result;
+ int length = 0;
+ if (!fFirst) {
+ length = getDetailDocument().getLength();
+ }
+ if (length > 0) {
+ insert = "\n" + result; //$NON-NLS-1$
+ }
+ try {
+ int max = DebugUIPlugin.getDefault().getPreferenceStore().getInt(IInternalDebugUIConstants.PREF_MAX_DETAIL_LENGTH);
+ if (max > 0 && insert.length() > max) {
+ insert = insert.substring(0, max) + "..."; //$NON-NLS-1$
+ }
+ if (fFirst) {
+ getDetailDocument().set(insert);
+ fFirst = false;
+ } else {
+ getDetailDocument().replace(length, 0,insert);
+ }
+ } catch (BadLocationException e) {
+ DebugUIPlugin.log(e);
+ }
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ append.setSystem(true);
+ append.schedule();
+ }
+ synchronized (this) {
+ notifyAll();
+ }
+
+ }
+
+ }
+
+ /**
+ * The model presentation used to produce the string details for a
+ * selected variable.
+ */
+ private VariablesViewModelPresentation fModelPresentation;
+ private String fDebugModelIdentifier;
+
+ /**
+ * Controls the status line while the details area has focus.
+ * Displays the current cursor position in the text (line:character).
+ */
+ private StatusLineContributionItem fStatusLineItem;
+
+ /**
+ * The source viewer in which the computed string detail
+ * of selected variables will be displayed.
+ */
+ private SourceViewer fSourceViewer;
+
+ /**
+ * The last selection displayed in the source viewer.
+ */
+ private IStructuredSelection fLastDisplayed = null;
+
+ /**
+ * Variables used to create the detailed information for a selection
+ */
+ private IDocument fDetailDocument;
+ private DetailJob fDetailJob = null;
+ private final String fPositionLabelPattern = DetailMessages.DefaultDetailPane_56;
+ private final PositionLabelValue fLineLabel = new PositionLabelValue();
+ private final PositionLabelValue fColumnLabel = new PositionLabelValue();
+ private final Object[] fPositionLabelPatternArguments = new Object[] {
+ fLineLabel, fColumnLabel };
+ private ICursorListener fCursorListener;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.details.AbstractDetailPane#init(org.eclipse.ui.IWorkbenchPartSite)
+ */
+ public void init(IWorkbenchPartSite benchPartSite){
+ super.init(benchPartSite);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDetailPane#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public Control createControl(Composite parent) {
+
+ fModelPresentation = new VariablesViewModelPresentation();
+
+ createSourceViewer(parent);
+
+ createActions();
+
+ DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
+ JFaceResources.getFontRegistry().addListener(this);
+
+ fStatusLineItem = new StatusLineContributionItem("ModeContributionItem"); //$NON-NLS-1$
+ IStatusLineManager manager= getViewSite().getActionBars().getStatusLineManager();
+ manager.add(fStatusLineItem);
+
+ return fSourceViewer.getControl();
+ }
+
+ /**
+ * Creates the source viewer in the given parent composite
+ *
+ * @param parent Parent composite to create the source viewer in
+ */
+ private void createSourceViewer(Composite parent) {
+
+ // Create & configure a SourceViewer
+ fSourceViewer = new SourceViewer(parent, null, SWT.V_SCROLL | SWT.H_SCROLL);
+ fSourceViewer.setDocument(getDetailDocument());
+ fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(IInternalDebugUIConstants.DETAIL_PANE_FONT));
+ getDetailDocument().addDocumentListener(new IDocumentListener() {
+ public void documentAboutToBeChanged(DocumentEvent event) {}
+ public void documentChanged(DocumentEvent event) {
+ updateSelectionDependentActions();
+ }
+ });
+ fSourceViewer.setEditable(false);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(fSourceViewer.getTextWidget(), IDebugHelpContextIds.DETAIL_PANE);
+ Control control = fSourceViewer.getControl();
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ control.setLayoutData(gd);
+
+ // Add the selection listener so selection dependant actions get updated.
+ fSourceViewer.getSelectionProvider().addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateSelectionDependentActions();
+ }
+ });
+
+ // Add a focus listener to update actions when details area gains focus
+ fSourceViewer.getControl().addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+
+ getViewSite().setSelectionProvider(fSourceViewer.getSelectionProvider());
+
+ setGlobalAction(IDebugView.SELECT_ALL_ACTION, getAction(DETAIL_SELECT_ALL_ACTION));
+ setGlobalAction(IDebugView.CUT_ACTION, getAction(DETAIL_CUT_ACTION));
+ setGlobalAction(IDebugView.COPY_ACTION, getAction(DETAIL_COPY_ACTION));
+ setGlobalAction(IDebugView.PASTE_ACTION, getAction(DETAIL_PASTE_ACTION));
+ setGlobalAction(IDebugView.FIND_ACTION, getAction(DETAIL_FIND_REPLACE_TEXT_ACTION));
+ IAction action = getAction(DETAIL_ASSIGN_VALUE_ACTION);
+ setGlobalAction(action.getActionDefinitionId(), action);
+ action = getAction(DETAIL_CONTENT_ASSIST_ACTION);
+ setGlobalAction(action.getActionDefinitionId(),action);
+
+ getViewSite().getActionBars().updateActionBars();
+
+ updateAction(DETAIL_FIND_REPLACE_TEXT_ACTION);
+
+ }
+
+ public void focusLost(FocusEvent e) {
+
+ getViewSite().setSelectionProvider(null);
+
+ setGlobalAction(IDebugView.SELECT_ALL_ACTION, null);
+ setGlobalAction(IDebugView.CUT_ACTION, null);
+ setGlobalAction(IDebugView.COPY_ACTION, null);
+ setGlobalAction(IDebugView.PASTE_ACTION, null);
+ setGlobalAction(IDebugView.FIND_ACTION, null);
+ setGlobalAction(getAction(DETAIL_ASSIGN_VALUE_ACTION).getActionDefinitionId(), null);
+ setGlobalAction(getAction(DETAIL_CONTENT_ASSIST_ACTION).getActionDefinitionId(), null);
+
+ getViewSite().getActionBars().updateActionBars();
+
+ }
+ });
+
+ fSourceViewer.getTextWidget().addMouseListener(getCursorListener());
+ fSourceViewer.getTextWidget().addKeyListener(getCursorListener());
+
+ // Add a context menu to the detail area
+ createDetailContextMenu(fSourceViewer.getTextWidget());
+ }
+
+ /**
+ * Creates the actions to add to the context menu
+ */
+ private void createActions() {
+
+ TextViewerAction textAction= new TextViewerAction(fSourceViewer, ISourceViewer.CONTENTASSIST_PROPOSALS);
+ textAction.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ textAction.configureAction(DetailMessages.DefaultDetailPane_Co_ntent_Assist_3, "",""); //$NON-NLS-1$ //$NON-NLS-2$
+ textAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_ELCL_CONTENT_ASSIST));
+ textAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_CONTENT_ASSIST));
+ textAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_DLCL_CONTENT_ASSIST));
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDebugHelpContextIds.DETAIL_PANE_CONTENT_ASSIST_ACTION);
+ setAction(DETAIL_CONTENT_ASSIST_ACTION, textAction);
+
+ ActionHandler actionHandler = new ActionHandler(textAction);
+ IHandlerService handlerService = (IHandlerService) getViewSite().getService(IHandlerService.class);
+ handlerService.activateHandler(textAction.getActionDefinitionId(), actionHandler);
+
+ textAction= new TextViewerAction(fSourceViewer, ITextOperationTarget.SELECT_ALL);
+ textAction.configureAction(DetailMessages.DefaultDetailPane_Select__All_5, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.SELECT_ALL);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDebugHelpContextIds.DETAIL_PANE_SELECT_ALL_ACTION);
+ setAction(DETAIL_SELECT_ALL_ACTION, textAction);
+
+ textAction= new TextViewerAction(fSourceViewer, ITextOperationTarget.COPY);
+ textAction.configureAction(DetailMessages.DefaultDetailPane__Copy_8, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDebugHelpContextIds.DETAIL_PANE_COPY_ACTION);
+ setAction(DETAIL_COPY_ACTION, textAction);
+
+ textAction= new TextViewerAction(fSourceViewer, ITextOperationTarget.CUT);
+ textAction.configureAction(DetailMessages.DefaultDetailPane_Cu_t_11, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.CUT);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDebugHelpContextIds.DETAIL_PANE_CUT_ACTION);
+ setAction(DETAIL_CUT_ACTION, textAction);
+
+ textAction= new TextViewerAction(fSourceViewer, ITextOperationTarget.PASTE);
+ textAction.configureAction(DetailMessages.DefaultDetailPane__Paste_14, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.PASTE);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDebugHelpContextIds.DETAIL_PANE_PASTE_ACTION);
+ setAction(ActionFactory.PASTE.getId(), textAction);
+
+ setSelectionDependantAction(DETAIL_COPY_ACTION);
+ setSelectionDependantAction(DETAIL_CUT_ACTION);
+ setSelectionDependantAction(DETAIL_PASTE_ACTION);
+
+ // TODO: Still using "old" resource access
+ ResourceBundle bundle= ResourceBundle.getBundle("org.eclipse.debug.internal.ui.views.variables.VariablesViewResourceBundleMessages"); //$NON-NLS-1$
+ IAction action = new FindReplaceAction(bundle, "find_replace_action_", getWorkbenchPartSite().getPart()); //$NON-NLS-1$
+ action.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_REPLACE);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(action, IDebugHelpContextIds.DETAIL_PANE_FIND_REPLACE_ACTION);
+ setAction(DETAIL_FIND_REPLACE_TEXT_ACTION, action);
+
+ updateSelectionDependentActions();
+
+ action = new DetailPaneWordWrapAction(fSourceViewer);
+ setAction(DETAIL_WORD_WRAP_ACTION, action);
+
+ action = new DetailPaneMaxLengthAction(getWorkbenchPartSite().getShell());
+ setAction(DETAIL_MAX_LENGTH_ACTION,action);
+
+ action = new DetailPaneAssignValueAction(fSourceViewer,getViewSite());
+ setAction(DETAIL_ASSIGN_VALUE_ACTION, action);
+
+ }
+
+ /**
+ * Create the context menu particular to the detail pane. Note that anyone
+ * wishing to contribute an action to this menu must use
+ * <code>IDebugUIConstants.VARIABLE_VIEW_DETAIL_ID</code> as the
+ * <code>targetID</code> in the extension XML.
+ */
+ protected void createDetailContextMenu(Control menuControl) {
+ MenuManager menuMgr= new MenuManager();
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager mgr) {
+ fillDetailContextMenu(mgr);
+ }
+ });
+ Menu menu= menuMgr.createContextMenu(menuControl);
+ menuControl.setMenu(menu);
+
+ getViewSite().registerContextMenu(IDebugUIConstants.VARIABLE_VIEW_DETAIL_ID, menuMgr, fSourceViewer.getSelectionProvider());
+ }
+
+ /**
+ * Adds items to the detail pane's context menu including any extension defined
+ * actions.
+ *
+ * @param menu The menu to add the item to.
+ */
+ protected void fillDetailContextMenu(IMenuManager menu) {
+
+ menu.add(new Separator(IDebugUIConstants.VARIABLE_GROUP));
+ menu.add(getAction(DETAIL_ASSIGN_VALUE_ACTION));
+ menu.add(getAction(DETAIL_CONTENT_ASSIST_ACTION));
+ menu.add(new Separator());
+ menu.add(getAction(DETAIL_CUT_ACTION));
+ menu.add(getAction(DETAIL_COPY_ACTION));
+ menu.add(getAction(DETAIL_PASTE_ACTION));
+ menu.add(getAction(DETAIL_SELECT_ALL_ACTION));
+ menu.add(new Separator("FIND")); //$NON-NLS-1$
+ menu.add(getAction(DETAIL_FIND_REPLACE_TEXT_ACTION));
+ menu.add(new Separator());
+ menu.add(getAction(DETAIL_WORD_WRAP_ACTION));
+ menu.add(getAction(DETAIL_MAX_LENGTH_ACTION));
+ menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDetailPane#display(org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ public void display(IStructuredSelection selection) {
+
+ if (selection == null){
+ clearSourceViewer();
+ return;
+ }
+
+ fLastDisplayed = selection;
+ fSourceViewer.setEditable(true);
+
+ if (selection.isEmpty()){
+ clearSourceViewer();
+ return;
+ }
+
+ Object firstElement = selection.getFirstElement();
+ if (firstElement != null && firstElement instanceof IDebugElement) {
+ String modelID = ((IDebugElement)firstElement).getModelIdentifier();
+ setDebugModel(modelID);
+ }
+
+ IAction assignAction = getAction(DETAIL_ASSIGN_VALUE_ACTION);
+ if (assignAction instanceof DetailPaneAssignValueAction){
+ ((DetailPaneAssignValueAction)assignAction).updateCurrentVariable(selection);
+ }
+
+ synchronized (this) {
+ if (fDetailJob != null) {
+ fDetailJob.cancel();
+ }
+ fDetailJob = new DetailJob(selection,fModelPresentation);
+ fDetailJob.schedule();
+ }
+
+ }
+
+ public boolean setFocus(){
+ if (fSourceViewer != null){
+ fSourceViewer.getTextWidget().setFocus();
+ return true;
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.details.AbstractDetailPane#dispose()
+ */
+ public void dispose(){
+ super.dispose();
+
+ if (fDetailJob != null) fDetailJob.cancel();
+ if (fModelPresentation != null) fModelPresentation.dispose();
+ fDebugModelIdentifier = null; // Setting this to null makes sure the source viewer is reconfigured with the model presentation after disposal
+ if (fSourceViewer != null && fSourceViewer.getControl() != null) fSourceViewer.getControl().dispose();
+
+ disposeUndoRedoAction(ITextEditorActionConstants.UNDO);
+ disposeUndoRedoAction(ITextEditorActionConstants.REDO);
+
+ getViewSite().getActionBars().getStatusLineManager().remove(fStatusLineItem);
+ DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
+ JFaceResources.getFontRegistry().removeListener(this);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDetailPane#getDescription()
+ */
+ public String getDescription() {
+ return DESCRIPTION;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDetailPane#getID()
+ */
+ public String getID() {
+ return ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDetailPane#getName()
+ */
+ public String getName() {
+ return NAME;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class required) {
+ if (IFindReplaceTarget.class.equals(required)) {
+ return fSourceViewer.getFindReplaceTarget();
+ }
+ if (ITextViewer.class.equals(required)) {
+ return fSourceViewer;
+ }
+ return null;
+ }
+
+ /**
+ * Lazily instantiate and return a Document for the detail pane text viewer.
+ */
+ protected IDocument getDetailDocument() {
+ if (fDetailDocument == null) {
+ fDetailDocument = new Document();
+ }
+ return fDetailDocument;
+ }
+
+ /**
+ * Clears the source viewer, removes all text.
+ */
+ protected void clearSourceViewer(){
+ if (fDetailJob != null) {
+ fDetailJob.cancel();
+ }
+ fLastDisplayed = null;
+ fDetailDocument.set(""); //$NON-NLS-1$
+ fSourceViewer.setEditable(false);
+ }
+
+ /**
+ * Configures the details viewer for the debug model
+ * currently being displayed
+ */
+ protected void configureDetailsViewer() {
+ LazyModelPresentation mp = (LazyModelPresentation)fModelPresentation.getPresentation(getDebugModel());
+ SourceViewerConfiguration svc = null;
+ if (mp != null) {
+ try {
+ svc = mp.newDetailsViewerConfiguration();
+ } catch (CoreException e) {
+ DebugUIPlugin.errorDialog(getViewSite().getShell(), DetailMessages.DefaultDetailPane_Error_1, DetailMessages.DefaultDetailPane_2, e);
+ }
+ }
+
+ if (svc == null) {
+ svc = new SourceViewerConfiguration();
+ fSourceViewer.setEditable(false);
+ }
+ fSourceViewer.unconfigure();
+ fSourceViewer.configure(svc);
+ //update actions that depend on the configuration of the source viewer
+ updateAction(DETAIL_CONTENT_ASSIST_ACTION);
+ updateAction(DETAIL_ASSIGN_VALUE_ACTION);
+
+ createUndoRedoActions();
+ }
+
+ /**
+ * @return The formatted string describing cursor position
+ */
+ protected String getCursorPosition() {
+
+ if (fSourceViewer == null) {
+ return ""; //$NON-NLS-1$
+ }
+
+ StyledText styledText= fSourceViewer.getTextWidget();
+ int caret= styledText.getCaretOffset();
+ IDocument document= fSourceViewer.getDocument();
+
+ if (document == null) {
+ return ""; //$NON-NLS-1$
+ }
+
+ try {
+
+ int line= document.getLineOfOffset(caret);
+
+ int lineOffset= document.getLineOffset(line);
+ int tabWidth= styledText.getTabs();
+ int column= 0;
+ for (int i= lineOffset; i < caret; i++)
+ if ('\t' == document.getChar(i)) {
+ column += tabWidth - (tabWidth == 0 ? 0 : column % tabWidth);
+ } else {
+ column++;
+ }
+
+ fLineLabel.fValue= line + 1;
+ fColumnLabel.fValue= column + 1;
+ return MessageFormat.format(fPositionLabelPattern, fPositionLabelPatternArguments);
+
+ } catch (BadLocationException x) {
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Returns this view's "cursor" listener to be installed on the view's
+ * associated details viewer. This listener is listening to key and mouse button events.
+ * It triggers the updating of the status line.
+ *
+ * @return the listener
+ */
+ private ICursorListener getCursorListener() {
+ if (fCursorListener == null) {
+ fCursorListener= new ICursorListener() {
+
+ public void keyPressed(KeyEvent e) {
+ fStatusLineItem.setText(getCursorPosition());
+ }
+
+ public void keyReleased(KeyEvent e) {
+ }
+
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ public void mouseDown(MouseEvent e) {
+ }
+
+ public void mouseUp(MouseEvent e) {
+ fStatusLineItem.setText(getCursorPosition());
+ }
+ };
+ }
+ return fCursorListener;
+ }
+
+ /**
+ * Returns the identifier of the debug model being displayed
+ * in this view, or <code>null</code> if none.
+ *
+ * @return debug model identifier
+ */
+ protected String getDebugModel() {
+ return fDebugModelIdentifier;
+ }
+
+ /**
+ * Sets the identifier of the debug model being displayed
+ * in this view, or <code>null</code> if none.
+ *
+ * @param id debug model identifier of the type of debug
+ * elements being displayed in this view
+ */
+ protected void setDebugModel(String id) {
+ if (id != fDebugModelIdentifier) {
+ fDebugModelIdentifier = id;
+ configureDetailsViewer();
+ }
+ }
+
+ /**
+ * Creates this editor's undo/re-do actions.
+ * <p>
+ * Subclasses may override or extend.</p>
+ *
+ * @since 3.2
+ */
+ protected void createUndoRedoActions() {
+ disposeUndoRedoAction(ITextEditorActionConstants.UNDO);
+ disposeUndoRedoAction(ITextEditorActionConstants.REDO);
+ IUndoContext undoContext= getUndoContext();
+ if (undoContext != null) {
+ // Use actions provided by global undo/re-do
+
+ // Create the undo action
+ OperationHistoryActionHandler undoAction= new UndoActionHandler(getViewSite(), undoContext);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(undoAction, IAbstractTextEditorHelpContextIds.UNDO_ACTION);
+ undoAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.UNDO);
+ setAction(ITextEditorActionConstants.UNDO, undoAction);
+ setGlobalAction(ITextEditorActionConstants.UNDO, undoAction);
+
+ // Create the re-do action.
+ OperationHistoryActionHandler redoAction= new RedoActionHandler(getViewSite(), undoContext);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(redoAction, IAbstractTextEditorHelpContextIds.REDO_ACTION);
+ redoAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.REDO);
+ setAction(ITextEditorActionConstants.REDO, redoAction);
+ setGlobalAction(ITextEditorActionConstants.REDO, redoAction);
+
+ getViewSite().getActionBars().updateActionBars();
+ }
+ }
+
+ /**
+ * Disposes of the action with the specified ID
+ *
+ * @param actionId the ID of the action to disposed
+ */
+ protected void disposeUndoRedoAction(String actionId) {
+ OperationHistoryActionHandler action = (OperationHistoryActionHandler) getAction(actionId);
+ if (action != null) {
+ action.dispose();
+ setAction(actionId, null);
+ }
+ }
+
+ /**
+ * Returns this editor's viewer's undo manager undo context.
+ *
+ * @return the undo context or <code>null</code> if not available
+ * @since 3.2
+ */
+ private IUndoContext getUndoContext() {
+ IUndoManager undoManager= fSourceViewer.getUndoManager();
+ if (undoManager instanceof IUndoManagerExtension)
+ return ((IUndoManagerExtension)undoManager).getUndoContext();
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event) {
+ String propertyName= event.getProperty();
+ if (propertyName.equals(IInternalDebugUIConstants.DETAIL_PANE_FONT)) {
+ fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(IInternalDebugUIConstants.DETAIL_PANE_FONT));
+ } else if (propertyName.equals(IInternalDebugUIConstants.PREF_MAX_DETAIL_LENGTH)) {
+ display(fLastDisplayed);
+ } else if (propertyName.equals(IDebugPreferenceConstants.PREF_DETAIL_PANE_WORD_WRAP)) {
+ fSourceViewer.getTextWidget().setWordWrap(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugPreferenceConstants.PREF_DETAIL_PANE_WORD_WRAP));
+ getAction(DETAIL_WORD_WRAP_ACTION).setChecked(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugPreferenceConstants.PREF_DETAIL_PANE_WORD_WRAP));
+
+ }
+
+ }
+
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPaneFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPaneFactory.java
new file mode 100644
index 000000000..42a797d18
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPaneFactory.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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.internal.ui.views.variables.details;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.debug.ui.IDetailPane;
+import org.eclipse.debug.ui.IDetailPaneFactory;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+/**
+ * The default detail pane factory is contributed to the <code>org.eclipse.debug.ui.detailPaneFactories</code>
+ * extension without an enablement expression so it is always loaded. For any given selection (even
+ * null or empty selections), the factory can produce a <code>SourceDetailsPane</code>
+ *
+ * @see SourceDetailPane
+ * @since 3.3
+ */
+public class DefaultDetailPaneFactory implements IDetailPaneFactory {
+
+ public static final String DEFAULT_DETAIL_PANE_ID = DefaultDetailPane.ID;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#createDetailsArea(java.lang.String)
+ */
+ public IDetailPane createDetailPane(String id) {
+ return new DefaultDetailPane();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#getDetailsTypes(org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ public Set getDetailPaneTypes(IStructuredSelection selection) {
+ Set possibleIDs = new HashSet(1);
+ possibleIDs.add(DefaultDetailPane.ID);
+ return possibleIDs;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#getName(java.lang.String)
+ */
+ public String getDetailPaneName(String id) {
+ if (id.equals(DefaultDetailPane.ID)){
+ return DefaultDetailPane.NAME;
+ }
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#getDescription(java.lang.String)
+ */
+ public String getDetailPaneDescription(String id) {
+ if (id.equals(DefaultDetailPane.ID)){
+ return DefaultDetailPane.DESCRIPTION;
+ }
+ return null;
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailMessages.java
new file mode 100644
index 000000000..92dd1d9ca
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailMessages.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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.internal.ui.views.variables.details;
+
+import org.eclipse.osgi.util.NLS;
+
+public class DetailMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.debug.internal.ui.views.variables.details.DetailMessages"; //$NON-NLS-1$
+ public static String AvailableDetailPanesAction_0;
+ public static String DefaultDetailPane__Copy_8;
+ public static String DefaultDetailPane__Paste_14;
+ public static String DefaultDetailPane_0;
+ public static String DefaultDetailPane_1;
+ public static String DefaultDetailPane_2;
+ public static String DefaultDetailPane_56;
+ public static String DefaultDetailPane_57;
+ public static String DefaultDetailPane_Co_ntent_Assist_3;
+ public static String DefaultDetailPane_Cu_t_11;
+ public static String DefaultDetailPane_Error_1;
+ public static String DefaultDetailPane_Select__All_5;
+ public static String DetailPane_0;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, DetailMessages.class);
+ }
+
+ private DetailMessages() {
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailMessages.properties
new file mode 100644
index 000000000..b8e8d8a54
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailMessages.properties
@@ -0,0 +1,24 @@
+###############################################################################
+# Copyright (c) 2006 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
+###############################################################################
+
+AvailableDetailPanesAction_0=Show &Details As
+DefaultDetailPane_0=DefaultDetailPane
+DefaultDetailPane_1=Default Viewer
+DefaultDetailPane_56={0} : {1}
+DefaultDetailPane_57=A detail pane that is based on a source viewer. Displays as text and has actions for assigning values, content assist and text modifications.
+DefaultDetailPane_Co_ntent_Assist_3=Co&ntent Assist
+DefaultDetailPane_Select__All_5=Select &All
+DefaultDetailPane__Copy_8=&Copy
+DefaultDetailPane_Cu_t_11=Cu&t
+DefaultDetailPane__Paste_14=&Paste
+DefaultDetailPane_Error_1=Error
+DefaultDetailPane_2=Unable to configure source viewer detail pane
+DetailPane_0=Problem displaying detail pane, see log for details.
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java
new file mode 100644
index 000000000..43cca6947
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java
@@ -0,0 +1,488 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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.internal.ui.views.variables.details;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.Map.Entry;
+
+import org.eclipse.core.expressions.EvaluationContext;
+import org.eclipse.core.expressions.EvaluationResult;
+import org.eclipse.core.expressions.Expression;
+import org.eclipse.core.expressions.ExpressionConverter;
+import org.eclipse.core.expressions.ExpressionTagNames;
+import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.internal.core.IConfigurationElementConstants;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.IDetailPane;
+import org.eclipse.debug.ui.IDetailPaneFactory;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+/**
+ * Organizes the detail factories contributed through the extension point and keeps
+ * track of the detail panes the factories produce. Accessed as a singleton through
+ * the <code>getDefault()</code> method.
+ *
+ * @see IDetailPaneFactory
+ * @see IDetailPane
+ * @since 3.3
+ */
+public class DetailPaneManager {
+
+ /**
+ * Acts as a proxy between the detail pane manager and the factories contributed
+ * to the extension point. Only loads information from the plugin xml and only
+ * instantiates the specified factory if required (lazy loading).
+ */
+ private class DetailPaneFactoryExtension implements IDetailPaneFactory{
+
+ private IConfigurationElement fConfigElement;
+ private IDetailPaneFactory fFactory;
+ private Expression fEnablementExpression;
+
+ public DetailPaneFactoryExtension(IConfigurationElement configElement){
+ fConfigElement = configElement;
+ }
+
+ /**
+ * Instantiates the factory and asks it to produce the IDetailPane for
+ * the given ID
+ */
+ public IDetailPane createDetailPane(String paneID){
+ if (getFactory() != null){
+ return getFactory().createDetailPane(paneID);
+ }
+ return null;
+ }
+
+ /**
+ * Instantiates the factory and asks it to produce the IDetailPane for
+ * the given ID.
+ */
+ public Set getDetailPaneTypes(IStructuredSelection selection){
+ if (getFactory() != null){
+ return getFactory().getDetailPaneTypes(selection);
+ }
+ return new HashSet(0);
+ }
+
+ /**
+ * Instantiates the factory and asks it to produce the name of the detail pane
+ * for the given ID.
+ */
+ public String getDetailPaneName(String paneID) {
+ if (getFactory() != null){
+ return getFactory().getDetailPaneName(paneID);
+ }
+ return null;
+ }
+
+ /**
+ * Instantiates the factory and asks it to produce the description of the
+ * detail pane for the given ID.
+ */
+ public String getDetailPaneDescription(String paneID) {
+ if (getFactory() != null){
+ return getFactory().getDetailPaneDescription(paneID);
+ }
+ return null;
+ }
+
+ /**
+ * Returns the instantiated factory specified by the class property.
+ */
+ private IDetailPaneFactory getFactory(){
+ if (fFactory != null) return fFactory;
+ try{
+ Object obj = fConfigElement.createExecutableExtension(IConfigurationElementConstants.CLASS);
+ if(obj instanceof IDetailPaneFactory) {
+ fFactory = (IDetailPaneFactory)obj;
+ } else {
+ throw new CoreException(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.INTERNAL_ERROR, "org.eclipse.debug.ui.detailFactories extension failed to load a detail factory because the specified class does not implement org.eclipse.debug.ui.IDetailPaneFactory. Class specified was: " + obj, null)); //$NON-NLS-1$
+ }
+ } catch (CoreException e){
+ DebugUIPlugin.log(e.getStatus());
+ fFactory = null;
+ }
+ return fFactory;
+ }
+
+ /**
+ * Checks if the enablement expression for the factory evaluates to true for the
+ * given selection.
+ */
+ public boolean isEnabled(IStructuredSelection selection) {
+ boolean enabled = false;
+ // Only the default factory should be enabled for null selections
+ if (selection == null || selection.isEmpty()){
+ return "org.eclipse.debug.ui.defaultDetailPaneFactory".equals(fConfigElement.getAttribute(IConfigurationElementConstants.ID)); //$NON-NLS-1$
+ }
+ Expression expression = getEnablementExpression();
+ if (expression != null) {
+ List list = selection.toList();
+ IEvaluationContext context = new EvaluationContext(null, list);
+ context.addVariable("selection", list); //$NON-NLS-1$
+ enabled = evalEnablementExpression(context, expression);
+ } else {
+ enabled = true;
+ }
+ return enabled;
+ }
+
+ /**
+ * Evaluate the given expression within the given context and return
+ * the result. Returns <code>true</code> iff result is either TRUE or NOT_LOADED.
+ * This allows optimistic inclusion of shortcuts before plugins are loaded.
+ * Returns <code>false</code> if exp is <code>null</code>.
+ *
+ * @param exp the enablement expression to evaluate or <code>null</code>
+ * @param context the context of the evaluation. Usually, the
+ * user's selection.
+ * @return the result of evaluating the expression
+ */
+ private boolean evalEnablementExpression(IEvaluationContext context, Expression exp) {
+ try{
+ if (exp != null){
+ EvaluationResult result = exp.evaluate(context);
+ if (result == EvaluationResult.TRUE || result == EvaluationResult.NOT_LOADED){
+ return true;
+ }
+ }
+ } catch (CoreException e){
+ DebugUIPlugin.log(e.getStatus());
+ }
+ return false;
+ }
+
+ /**
+ * Returns an expression that represents the enablement logic for the
+ * detail pane factory or <code>null</code> if none.
+ *
+ * @return an evaluatable expression or <code>null</code>
+ */
+ private Expression getEnablementExpression(){
+ // all of this stuff is optional, so...tedius testing is required
+ if (fEnablementExpression == null) {
+ try{
+ IConfigurationElement[] elements = fConfigElement.getChildren(ExpressionTagNames.ENABLEMENT);
+ IConfigurationElement enablement = elements.length > 0 ? elements[0] : null;
+ if (enablement != null) {
+ fEnablementExpression = ExpressionConverter.getDefault().perform(enablement);
+ }
+ } catch (CoreException e){
+ DebugUIPlugin.log(e.getStatus());
+ fEnablementExpression = null;
+ }
+ }
+ return fEnablementExpression;
+ }
+
+ }
+
+ /**
+ * There should only ever be once instance of this manager for the workbench.
+ */
+ private static DetailPaneManager fgSingleton;
+
+ /**
+ * Maps the IDs of types of detail panes to the factory that can create them.
+ * There can currently only be one factory for a given type of details pane.
+ */
+ private Map fFactoriesByPaneID;
+
+ /**
+ * Maps a Set of detail pane ids to the one detail pane id that is preferred.
+ */
+ private Map fPreferredDetailPanes;
+
+ /**
+ * The set of all factories that have been loaded from the extension point.
+ */
+ private Collection fKnownFactories;
+
+ /**
+ * Preference key for storing the preferred detail panes map.
+ * @see {@link #storePreferredDetailsAreas()}
+ * @see {@link #loadPreferredDetailsAreas()}
+ */
+ public static final String PREF_DETAIL_AREAS = "preferredDetailPanes"; //$NON-NLS-1$
+
+ private DetailPaneManager(){
+ fFactoriesByPaneID = new HashMap();
+ }
+
+ public static DetailPaneManager getDefault(){
+ if (fgSingleton == null) fgSingleton = new DetailPaneManager();
+ return fgSingleton;
+ }
+
+ /**
+ * Determines the set of all possible detail panes that can display the given
+ * selection. Selects the preferred pane out of that set and returns it.
+ *
+ * @param selection The selection to display in the detail pane
+ * @return The ID of the preferred detail pane or null
+ */
+ public String getPreferredPaneFromSelection(IStructuredSelection selection){
+ return chooseDetailsAreaIDInSet(getAvailablePaneIDs(selection));
+ }
+
+ /**
+ * Returns the set of all possible detail panes the can display the given
+ * selection.
+ *
+ * @param selection The selection to display in the detail pane
+ * @return The set of IDs of all possible detail panes for the given selection
+ */
+ public Set getAvailablePaneIDs(IStructuredSelection selection){
+ Collection possibleFactories = getEnabledFactories(selection);
+ return getPossiblePaneIDs(possibleFactories, selection);
+ }
+
+ /**
+ * Given the ID of a details pane, this method will try to find the factory
+ * that creates it and return an instantiation of that area.
+ * <p>
+ * This method will not call the init() method of the IDetailsPane.
+ * </p>
+ *
+ * @param ID The ID of the requested pane
+ * @return The instantiated pane or null
+ */
+ public IDetailPane getDetailPaneFromID(String ID){
+ IDetailPaneFactory factory = (IDetailPaneFactory)fFactoriesByPaneID.get(ID);
+ if (factory != null){
+ return factory.createDetailPane(ID);
+ }
+ return null;
+ }
+
+ /**
+ * Given the ID of a details pane, this method will try to find the factory
+ * that creates it and ask it for the name of the details pane.
+ *
+ * @param ID The ID of the requested pane
+ * @return The name of the details pane or null
+ */
+ public String getNameFromID(String ID){
+ IDetailPaneFactory factory = (IDetailPaneFactory)fFactoriesByPaneID.get(ID);
+ if (factory != null){
+ return factory.getDetailPaneName(ID);
+ }
+ return null;
+ }
+
+ /**
+ * Given the ID of a details pane, this method will try to find the factory
+ * that creates it and ask it for the description of the details pane.
+ *
+ * @param ID The ID of the requested pane
+ * @return The description of the details pane or null
+ */
+ public String getDescriptionFromID(String ID){
+ IDetailPaneFactory factory = (IDetailPaneFactory)fFactoriesByPaneID.get(ID);
+ if (factory != null){
+ return factory.getDetailPaneDescription(ID);
+ }
+ return null;
+ }
+
+
+ /**
+ * Returns the set of IDetailPaneFactories (they will be DetailPaneFactoryDelegates) that were
+ * contributed to the extension point and are enabled for the given selection
+ * (enabled if the factory does not have an enablement expression or if the
+ * enablement expression evaluates to true).
+ *
+ * @return The factories enabled for the selection or an empty collection.
+ */
+ private Collection getEnabledFactories(IStructuredSelection selection){
+ Collection factoriesForSelection = new ArrayList();
+ if (fKnownFactories == null) initializeDetailFactories();
+ Iterator iter = fKnownFactories.iterator();
+ while (iter.hasNext()) {
+ IDetailPaneFactory currentFactory = (IDetailPaneFactory) iter.next();
+ if (currentFactory instanceof DetailPaneFactoryExtension){
+ if (((DetailPaneFactoryExtension)currentFactory).isEnabled(selection)){
+ factoriesForSelection.add(currentFactory);
+ }
+ }
+ }
+ return factoriesForSelection;
+ }
+
+ /**
+ * Produces the set of IDs for all possible detail panes that can be used to display
+ * the given selection.
+ *
+ * @param factoriesToQuery The collection of factories to check
+ * @param selection The selection to be displayed
+ * @return Set of pane IDs or an empty set
+ */
+ private Set getPossiblePaneIDs(Collection factoriesToQuery, IStructuredSelection selection){
+ Set idsForSelection = new LinkedHashSet();
+ Iterator factoryIter = factoriesToQuery.iterator();
+ while (factoryIter.hasNext()) {
+ IDetailPaneFactory currentFactory = (IDetailPaneFactory) factoryIter.next();
+ Iterator detailAreaTypes = currentFactory.getDetailPaneTypes(selection).iterator();
+ while (detailAreaTypes.hasNext()) {
+ String currentAreaTypeID = (String) detailAreaTypes.next();
+ fFactoriesByPaneID.put(currentAreaTypeID, currentFactory);
+ idsForSelection.add(currentAreaTypeID);
+ }
+ }
+ return idsForSelection;
+ }
+
+ /**
+ * Given a set of possible detail pane IDs, this method will determine which pane is
+ * preferred and should be used to display the selection. This method chooses a pane
+ * by storing previous choices and can be set using a context menu.
+ *
+ * @param possiblePaneIDs Teh set of possible detail pane IDs
+ * @return The preferred detail pane ID or null
+ */
+ private String chooseDetailsAreaIDInSet(Set possiblePaneIDs){
+ if (possiblePaneIDs == null || possiblePaneIDs.isEmpty()){
+ return null;
+ }
+
+ String preferredID = getPreferredDetailPane(possiblePaneIDs);
+
+ if (preferredID == null){
+ // If there is no preferred pane already set, choose the default pane if possible, or the first in the list
+ Iterator iter = possiblePaneIDs.iterator();
+ preferredID = (String)iter.next();
+ while (iter.hasNext() && preferredID != DefaultDetailPaneFactory.DEFAULT_DETAIL_PANE_ID) {
+ String currentID = (String) iter.next();
+ if (currentID.equals(DefaultDetailPaneFactory.DEFAULT_DETAIL_PANE_ID)){
+ preferredID = currentID;
+ }
+ }
+ setPreferredDetailPane(possiblePaneIDs, preferredID);
+ }
+
+ return preferredID;
+ }
+
+ /**
+ * Initializes the collection of known factories from extension point contributions.
+ */
+ private synchronized void initializeDetailFactories(){
+ if (fKnownFactories == null){
+ fKnownFactories = new ArrayList();
+ IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_DETAIL_FACTORIES);
+ IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
+ DetailPaneFactoryExtension delegate = null;
+ for(int i = 0; i < infos.length; i++) {
+ delegate = new DetailPaneFactoryExtension(infos[i]);
+ fKnownFactories.add(delegate);
+ }
+ }
+ }
+
+ /**
+ * Returns the preferred pane ID from the given set if the mapping has been set.
+ *
+ * @param possibleDetailsAreaIDs Set of possible pane IDs
+ * @return The preferred ID or null
+ */
+ public String getPreferredDetailPane(Set possibleDetailsAreaIDs){
+ if (fPreferredDetailPanes == null){
+ loadPreferredDetailsAreas();
+ }
+ return (String)fPreferredDetailPanes.get(possibleDetailsAreaIDs);
+
+ }
+
+ /**
+ * Adds or updates the mapping to set which pane ID is preferred for a certain
+ * set of possible IDs.
+ *
+ * @param possibleDetailsAreaIDs The set of possible IDs
+ * @param preferredDetailsAreaID The preferred ID in the set.
+ */
+ public void setPreferredDetailPane(Set possibleDetailsAreaIDs, String preferredDetailsAreaID){
+ if (fPreferredDetailPanes == null){
+ loadPreferredDetailsAreas();
+ }
+ String currentKey = (String)fPreferredDetailPanes.get(possibleDetailsAreaIDs);
+ if (currentKey == null || !currentKey.equals(preferredDetailsAreaID)){
+ fPreferredDetailPanes.put(possibleDetailsAreaIDs, preferredDetailsAreaID);
+ storePreferredDetailsAreas();
+ }
+
+ }
+
+ /**
+ * Stores the map of preferred detail pane IDs to the preference store in the format:
+ *
+ * Key1A,Key1B:Value1|Key2A,Key2B,Key2C:Value2|
+ *
+ * Where the sub keys (Key1A, Key1B, etc.) are the elements of the set used at the
+ * key in the mapping and the values are the associated String value in the mapping.
+ */
+ private void storePreferredDetailsAreas() {
+ StringBuffer buffer= new StringBuffer();
+ Iterator iter = fPreferredDetailPanes.entrySet().iterator();
+ while (iter.hasNext()) {
+ Entry entry = (Entry) iter.next();
+ Iterator setIter = ((Set)entry.getKey()).iterator();
+ while (setIter.hasNext()) {
+ String currentID = (String) setIter.next();
+ buffer.append(currentID);
+ buffer.append(',');
+ }
+ buffer.deleteCharAt(buffer.length()-1);
+ buffer.append(':');
+ buffer.append(entry.getValue());
+ buffer.append('|');
+ }
+ DebugUIPlugin.getDefault().getPluginPreferences().setValue(PREF_DETAIL_AREAS, buffer.toString());
+ }
+
+ /**
+ * Loads the map of preferred detail pane IDs from the preference store.
+ *
+ * @see DetailPaneManager#storePreferredDetailsArea()
+ */
+ private void loadPreferredDetailsAreas() {
+ fPreferredDetailPanes = new HashMap();
+ String preferenceValue = DebugUIPlugin.getDefault().getPluginPreferences().getString(PREF_DETAIL_AREAS);
+ StringTokenizer entryTokenizer = new StringTokenizer(preferenceValue,"|"); //$NON-NLS-1$
+ while (entryTokenizer.hasMoreTokens()){
+ String token = entryTokenizer.nextToken();
+ int valueStart = token.indexOf(':');
+ StringTokenizer keyTokenizer = new StringTokenizer(token.substring(0,valueStart),","); //$NON-NLS-1$
+ Set keys = new LinkedHashSet();
+ while (keyTokenizer.hasMoreTokens()){
+ keys.add(keyTokenizer.nextToken());
+ }
+ fPreferredDetailPanes.put(keys, token.substring(valueStart+1));
+ }
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneProxy.java
new file mode 100644
index 000000000..83b8af8f8
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneProxy.java
@@ -0,0 +1,226 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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.internal.ui.views.variables.details;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.IDetailPane;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.ui.IWorkbenchPartSite;
+
+/**
+ * Acts as a proxy between a view and a detail pane. Controls how information is displayed
+ * in the details pane in a view. Currently used by the variables, registers and expression
+ * views. The different types of detail panes use the detailPaneFactories extension and must
+ * implement <code>IDetailPane</code>. This class acts as a proxy to the current detail pane,
+ * each time the detail pane type changes, this class disposes of the old pane and creates the
+ * new one. Uses a <code>DetailPaneManager</code> to organize and find the panes to display.
+ *
+ * @see IDetailPane
+ * @see DetailPaneManager
+ * @since 3.3
+ */
+public class DetailPaneProxy {
+
+ /**
+ * The IDetailPane currently being used to display detailed information.
+ */
+ private IDetailPane fCurrentPane;
+
+ /**
+ * The UI control that the current detail pane is using to display details.
+ */
+ private Control fCurrentControl;
+
+ /**
+ * This is the focus listener submitted by the view containing the details pane.
+ * The listener is added to the control created by the detail pane.
+ * Allows the view to know when the details pane has gained focus and take
+ * appropriate action.
+ */
+ private Listener fActivateListener;
+
+ private IWorkbenchPartSite fWorkbenchPartSite;
+ private Composite fParent;
+
+ /**
+ * Every time a previously unused detail pane is created, it is initialized
+ * and added to this map so that it does not have to be instantiated and
+ * initialized again if the pane is reused.
+ */
+ private Map initializedPanes = new HashMap();
+
+ /**
+ * Constructor that sets up the detail pane for a view. Creates a default pane to retain look of previous versions.
+ *
+ * @param parent Composite that UI components should be added to
+ * @param workbenchPartSite The workbench part site that the pane belongs to
+ * @param activateListener This listener will be added to the main ui control of the detail pane to keep track of focus/activation changes, can be left as null
+ */
+ public DetailPaneProxy(Composite parent, IWorkbenchPartSite workbenchPartSite, Listener activateListener){
+
+ fParent = parent;
+ fWorkbenchPartSite = workbenchPartSite;
+ fActivateListener = activateListener;
+
+ // Create a default viewer so the user does not see an empty composite at startup
+ display(null);
+
+ }
+
+ /**
+ * Displays the given selection in the preferred detail pane for that type of selection.
+ * If a null or empty selection is passed and a current pane exists, taht view will be cleared.
+ * If a null or empty selection is apssed and no pane exists, the default view is created.
+ *
+ * @param selection The selection to display detailed information for
+ */
+ public void display(IStructuredSelection selection){
+
+ if ((selection == null || selection.isEmpty()) && fCurrentPane != null){
+ fCurrentPane.display(selection);
+ return;
+ }
+
+ String preferredPaneID = DetailPaneManager.getDefault().getPreferredPaneFromSelection(selection);
+
+ // Don't change anything if the preferred pane is the current pane
+ if (fCurrentPane != null && preferredPaneID.equals(fCurrentPane.getID())){
+ fCurrentPane.display(selection);
+ return;
+ }
+
+ setupPane(preferredPaneID, selection);
+
+ }
+
+ /**
+ * Tells the current detail pane (if one exists) that it is gaining focus.
+ *
+ * @return true if the current pane successfully set focus to a control, false otherwise
+ */
+ public boolean setFocus(){
+ if (fCurrentPane != null){
+ return fCurrentPane.setFocus();
+ }
+ return false;
+ }
+
+ /**
+ * Disposes of the current pane.
+ */
+ public void dispose(){
+ if (fCurrentPane != null) fCurrentPane.dispose();
+ if (fCurrentControl != null && !fCurrentControl.isDisposed()) fCurrentControl.dispose();
+ }
+
+ /**
+ * Checks if the current pane supports the <code>IAdaptable</code> framework
+ * and if so, calls its <code>getAdapter()</code> method.
+ * @param required
+ * @return
+ */
+ public Object getAdapter(Class required){
+ if (fCurrentPane != null && fCurrentPane instanceof IAdaptable){
+ return ((IAdaptable)fCurrentPane).getAdapter(required);
+ }
+ else{
+ return null;
+ }
+ }
+
+ public Control getCurrentControl(){
+ return fCurrentControl;
+ }
+
+ public String getCurrentViewerID(){
+ if (fCurrentPane != null){
+ return fCurrentPane.getID();
+ }
+ return null;
+ }
+
+ /**
+ * Finds or creates an initialized detail pane with the given ID. Asks the detail
+ * pane to create the control and display the selection.
+ *
+ * @param paneID The ID of the pane to display in
+ * @param selection
+ */
+ private void setupPane(String paneID, IStructuredSelection selection) {
+ if (fCurrentPane != null) fCurrentPane.dispose();
+ if (fCurrentControl != null && !fCurrentControl.isDisposed()) fCurrentControl.dispose();
+ fCurrentPane = findAndInitViewerByID(paneID);
+ if (fCurrentPane != null){
+ fCurrentControl = fCurrentPane.createControl(fParent);
+ if (fCurrentControl != null){
+ if (fActivateListener != null) fCurrentControl.addListener(SWT.Activate,fActivateListener);
+ fParent.layout(true);
+ fCurrentPane.display(selection);
+ }
+ else{
+ createErrorLabel(DetailMessages.DetailPane_0);
+ DebugUIPlugin.log(new CoreException(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.INTERNAL_ERROR, "The detail pane \""+ fCurrentPane.getID() + "\" did not create and return a control.", new NullPointerException()))); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ else {
+ createErrorLabel(DetailMessages.DetailPane_0);
+ DebugUIPlugin.log(new CoreException(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.INTERNAL_ERROR, "Could not create the detail pane with ID " + paneID, new NullPointerException()))); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Returns the initialized detail pane for the given ID if one exists. If one does
+ * not exist, the method asks the pane manager to create one.
+ *
+ * @param paneID The ID of the pane to init
+ * @return The initialized detail pane or null
+ */
+ private IDetailPane findAndInitViewerByID(String paneID){
+ IDetailPane newViewer = (IDetailPane)initializedPanes.get(paneID);
+ if (newViewer == null){
+ newViewer = DetailPaneManager.getDefault().getDetailPaneFromID(paneID);
+ if (newViewer != null){
+ newViewer.init(fWorkbenchPartSite);
+ initializedPanes.put(newViewer.getID(), newViewer);
+ }
+ }
+ return newViewer;
+ }
+
+ /**
+ * Creates a label in the detail pane area with the given message.
+ *
+ * @param message The message to display
+ */
+ private void createErrorLabel(String message){
+ if (fCurrentPane != null) fCurrentPane.dispose();
+ if (fCurrentControl != null && !fCurrentControl.isDisposed()) fCurrentControl.dispose();
+ Label errorLabel = new Label(fParent,SWT.LEFT);
+ errorLabel.setText(message);
+ errorLabel.setLayoutData(new GridData(GridData.FILL_BOTH));
+ fCurrentControl = errorLabel;
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java
index 2f4795da5..8c3e707a1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java
@@ -61,7 +61,10 @@ import org.eclipse.debug.internal.ui.DebugUIPlugin;
* <li>Variable group</li>
* <li>Select all action</li>
* <li>Copy to clipboard action</li>
+ * <li>Find action</li>
* <li>Change value action</li>
+ * <li>Available logical structures action</li>
+ * <li>Available detail panes action</li>
* <li>Empty render group</li>
* <li>Render group</li>
* <li>Show type names action</li>
@@ -91,7 +94,10 @@ import org.eclipse.debug.internal.ui.DebugUIPlugin;
* <li>Copy to clipboard action</li>
* <li>Remove action</li>
* <li>Remove all action</li>
+ * <li>Find action</li>
* <li>Change variable value action</li>
+ * <li>Available logical structures action</li>
+ * <li>Available detail panes action</li>
* <li>Empty Render group</li>
* <li>Render group</li>
* <li>Show type names action</li>
@@ -1039,7 +1045,15 @@ public interface IDebugUIConstants {
* @since 3.1
*/
public static final String EXTENSION_POINT_BREAKPOINT_ORGANIZERS = "breakpointOrganizers"; //$NON-NLS-1$
-
+
+ /**
+ * Simple identifier constant (value <code>"detailPaneFactories"</code>) for the
+ * detail pane factories extension point.
+ *
+ * @since 3.3
+ */
+ public static final String EXTENSION_POINT_DETAIL_FACTORIES = "detailPaneFactories"; //$NON-NLS-1$
+
/**
* Update policies extension point identifier (value
* <code>"updatePolicies"</code>
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPane.java
new file mode 100644
index 000000000..a12e654b2
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPane.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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.ui;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbenchPartSite;
+
+/**
+ * A detail pane is created from a detail pane factory and displays detailed information about
+ * a current selection with an SWT <code>Control</code>. Use the
+ * <code>org.eclipse.debug.ui.detailFactories</code> extension point to contribute a detail pane
+ * factory.
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * <p>
+ * <strong>EXPERIMENTAL</strong>. This interface has been added as
+ * part of a work in progress. There is no guarantee that this API will
+ * remain unchanged during the 3.3 release cycle. Please do not use this API
+ * without consulting with the Platform/Debug team.
+ * </p>
+ * @see IDetailPaneFactory
+ * @since 3.3
+ */
+public interface IDetailPane {
+
+ /**
+ * Initializes this detail pane for the given workbench part site. This is the first method
+ * invoked on a detail pane after instantiation.
+ *
+ * @param workbench The workbench part site that this detail pane has been created in
+ */
+ public void init(IWorkbenchPartSite partSite);
+
+ /**
+ * Creates and returns the main control for this detail pane using the given composite as a
+ * parent.
+ *
+ * @param parent The parent composite that UI components should be added to
+ * @return The main control for this detail pane
+ */
+ public Control createControl(Composite parent);
+
+ /**
+ * Disposes this detail pane. This is the last method invoked on a detail pane and should
+ * dispose of all UI components including the main composite returned in <code>createControl()</code>.
+ */
+ public void dispose();
+
+ /**
+ * Displays details for the given selection, possible <code>null</code>. An empty selection
+ * or <code>null</code> should clear this detail pane.
+ *
+ * @param selection The selection to be displayed, possibly empty or <code>null</code>
+ */
+ public void display(IStructuredSelection selection);
+
+ /**
+ * Allows this detail pane to give focus to an appropriate control, and returns whether
+ * the detail pane accepted focus. If this detail pane does not want focus, it should
+ * return <code>false</code>, allowing the containing view to choose another target
+ * for focus.
+ *
+ * @return whether focus was taken
+ */
+ public boolean setFocus();
+
+ /**
+ * Returns a unique identifier for this detail pane.
+ *
+ * @return A unique identifier for this detail pane
+ */
+ public String getID();
+
+ /**
+ * The human readable name of this detail pane. This is a short description of the type
+ * of details this pane displays that appears in the context menu.
+ *
+ * @return name of this detail pane
+ */
+ public String getName();
+
+ /**
+ * A brief description of this detail pane, or <code>null</code> if none
+ *
+ * @return a description of this detail pane, or <code>null</code> if none
+ */
+ public String getDescription();
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPaneFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPaneFactory.java
new file mode 100644
index 000000000..d719010e0
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPaneFactory.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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.ui;
+
+import java.util.Set;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+/**
+ * A detail pane factory creates one or more types of detail panes.
+ * <p>
+ * Detail pane factories are contributed via the <code>org.eclipse.debug.ui.detailPaneFactories</code>
+ * extension point. Following is an example of a detail pane factory extension:
+ * <pre>
+ * &lt;extension point="org.eclipse.debug.ui.detailPaneFactories"&gt;
+ * &lt;detailFactories
+ * class="org.eclipse.temp.TableDetailPaneFactory"
+ * name="Table Detail Factory"&gt;
+ * &lt;/detailFactories&gt;
+ * &lt;/extension&gt;
+ * </pre>
+ * </p>
+ * <p>
+ * <p>
+ * Clients contributing a detail pane factory are intended to implement this interface.
+ * </p>
+ * <strong>EXPERIMENTAL</strong>. This interface has been added as
+ * part of a work in progress. There is no guarantee that this API will
+ * remain unchanged during the 3.3 release cycle. Please do not use this API
+ * without consulting with the Platform/Debug team.
+ * </p>
+ * @see IDetailPane
+ * @since 3.3
+ *
+ */
+public interface IDetailPaneFactory {
+
+ /**
+ * Returns all possible types detail panes that this factory can
+ * create for the given selection, possibly empty. Detail panes are returned
+ * as a set of detail pane identifiers.
+ *
+ * @param selection The current selection
+ * @return Set of String IDs for possible detail pane types, possibly empty
+ */
+ public Set getDetailPaneTypes(IStructuredSelection selection);
+
+ /**
+ * Creates and returns a detail pane corresponding to the given detail pane
+ * type identifier that this factory can produce (according to
+ * <code>getDetailPaneTypes(IStructuredSelection selection)</code>).
+ *
+ * @param paneID The id of the detain pane type to be created
+ * @return detail pane or <code>null</code> if one could not be created
+ */
+ public IDetailPane createDetailPane(String paneID);
+
+ /**
+ * Returns a name for the detail pane type associated with the given ID
+ * or <code>null</code> if none. Used to
+ * populate the context menu with meaningful names of the pane types.
+ *
+ * @param paneID detail pane type identifier
+ * @return detail pane name or <code>null</code> if none
+ */
+ public String getDetailPaneName(String paneID);
+
+ /**
+ * Returns a description for the detail pane type associated with the given ID
+ * or <code>null</code> if none.
+ *
+ * @param paneID detail pane type identifier
+ * @return detail pane description or <code>null</code> if none
+ */
+ public String getDetailPaneDescription(String paneID);
+
+}

Back to the top