Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorMikhail Khodjaiants2008-04-01 15:08:15 +0000
committerMikhail Khodjaiants2008-04-01 15:08:15 +0000
commit78f39429c57b40133f71b54f30dd58b509882af6 (patch)
tree139e204257a5847de88ddaa59f5fba32e1c28744 /debug
parent1aa23a4f5d199e4115b75f17dd06d8d32d853759 (diff)
downloadorg.eclipse.cdt-78f39429c57b40133f71b54f30dd58b509882af6.tar.gz
org.eclipse.cdt-78f39429c57b40133f71b54f30dd58b509882af6.tar.xz
org.eclipse.cdt-78f39429c57b40133f71b54f30dd58b509882af6.zip
Bug 210558: Migrate CDT to use new platform Modules view.
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java7
-rw-r--r--debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF3
-rw-r--r--debug/org.eclipse.cdt.debug.ui/plugin.properties4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/plugin.xml72
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleDetailPaneAction.java87
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java55
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementProxyFactory.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleProxyFactory.java)16
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugTargetContentProvider.java55
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CStackFrameContentProvider.java55
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CStackFrameMementoProvider.java46
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CThreadContentProvider.java55
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleContentProvider.java5
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleDetailPane.java545
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleDetailPaneFactory.java73
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleLabelProvider.java7
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModulesMessages.properties2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModulesView.java1012
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/ICDebugUIConstants.java11
18 files changed, 947 insertions, 1163 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java
index 5ba6634c0a..7241fc8a7e 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java
@@ -8,6 +8,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* Ken Ryall (Nokia) - bugs 118894, 170027, 91771
+ * Wind River Systems - adapted to work with platform Modules view (bug 210558)
*******************************************************************************/
package org.eclipse.cdt.debug.internal.core.model;
@@ -103,6 +104,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
@@ -826,6 +828,11 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
return getMemoryBlockRetrieval();
if ( adapter.equals( IModuleRetrieval.class ) )
return getModuleManager();
+
+ // Force adapters to be loaded. Otherwise the adapter manager may not find
+ // the model proxy adapter for CDT debug elements.
+ Platform.getAdapterManager().loadAdapter(this, adapter.getName());
+
return super.getAdapter( adapter );
}
diff --git a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
index 87f0bd6ea8..79c53ef776 100644
--- a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
+++ b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
@@ -37,6 +37,7 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui.console;bundle-version="[3.1.100,4.0.0)",
org.eclipse.ui.views;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.core.filesystem
+ org.eclipse.core.filesystem,
+ org.eclipse.core.expressions
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.properties b/debug/org.eclipse.cdt.debug.ui/plugin.properties
index 62dfebaa64..fc3e783e1e 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.properties
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.properties
@@ -13,7 +13,6 @@ pluginName=C/C++ Development Tools Debugger UI
providerName=Eclipse.org
MemoryView.name=Memory
-ModulesView.name=Modules
SignalsView.name=Signals
ExecutablesView.name=Executables
@@ -122,9 +121,6 @@ CommonModulePage.label=Common
ModulesDetailPaneFontDefinition.label=Modules View Detail Pane Text Font
ModulesDetailPaneFontDefinition.description=The text font used in the detail pane of the Modules view.
-CollapseAllModulesAction.label=Collapse All
-CollapseAllModulesAction.tooltip=Collapse All
-
ModulePropertiesAction.label=Properties...
ModulePropertiesAction.tooltip=Open Module Properties Dialog
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml
index adb67e005f..fefe0c25d0 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml
@@ -37,12 +37,6 @@
class="org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView"
id="org.eclipse.cdt.debug.ui.DisassemblyView">
</view>
- <view
- icon="icons/view16/modules_view.gif"
- class="org.eclipse.cdt.debug.internal.ui.views.modules.ModulesView"
- category="org.eclipse.debug.ui"
- name="%ModulesView.name"
- id="org.eclipse.cdt.debug.ui.ModulesView"/>
</extension>
<extension
point="org.eclipse.ui.perspectiveExtensions">
@@ -67,6 +61,9 @@
id="org.eclipse.debug.ui.RegisterView">
</viewShortcut>
<viewShortcut
+ id="org.eclipse.debug.ui.ModuleView">
+ </viewShortcut>
+ <viewShortcut
id="org.eclipse.debug.ui.MemoryView">
</viewShortcut>
<view
@@ -82,12 +79,9 @@
visible="false"
relative="org.eclipse.debug.ui.VariableView"
relationship="stack"
- id="org.eclipse.cdt.debug.ui.ModulesView">
+ id="org.eclipse.debug.ui.ModuleView">
</view>
- <viewShortcut
- id="org.eclipse.cdt.debug.ui.ModulesView">
- </viewShortcut>
- <view
+ <view
visible="true"
relative="org.eclipse.ui.console.ConsoleView"
relationship="stack"
@@ -757,7 +751,7 @@
</action>
</objectContribution>
<viewerContribution
- targetID="org.eclipse.cdt.debug.ui.ModulesView"
+ targetID="org.eclipse.debug.ui.ModuleView"
id="org.eclipse.cdt.debug.ui.modulesView.popupMenu">
<action
helpContextId="load_symbols_for_all_context"
@@ -955,7 +949,7 @@
</menu>
</viewContribution>
<viewContribution
- targetID="org.eclipse.cdt.debug.ui.ModulesView"
+ targetID="org.eclipse.debug.ui.ModuleView"
id="org.eclipse.debug.ui.modulesView.toolbar">
<action
helpContextId="load_symbols_for_all_context"
@@ -973,16 +967,6 @@
id="org.eclipse.cdt.debug.ui"/>
</enablement>
</action>
- <action
- helpContextId="collapse_all_modules_context"
- disabledIcon="icons/dlcl16/collapseall.gif"
- toolbarPath="additions"
- label="%CollapseAllModulesAction.label"
- tooltip="%CollapseAllModulesAction.tooltip"
- icon="icons/elcl16/collapseall.gif"
- class="org.eclipse.cdt.debug.internal.ui.actions.CollapseAllModulesAction"
- style="push"
- id="org.eclipse.cdt.debug.ui.CollapseAllModulesAction"/>
</viewContribution>
</extension>
<extension
@@ -1136,7 +1120,7 @@
</contextViewBinding>
<contextViewBinding
contextId="org.eclipse.cdt.debug.ui.debugging"
- viewId="org.eclipse.cdt.debug.ui.ModulesView"/>
+ viewId="org.eclipse.debug.ui.ModuleView"/>
</extension>
<extension
point="org.eclipse.ui.editors.annotationTypes">
@@ -1269,8 +1253,27 @@
<factory
adaptableType="org.eclipse.cdt.debug.core.model.IModuleRetrieval"
class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementAdapterFactory">
+ <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider"/>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.cdt.debug.core.model.ICDebugTarget"
+ class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementAdapterFactory">
+ <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider"/>
+ <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory"/>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.cdt.debug.core.model.ICThread"
+ class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementAdapterFactory">
<adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider"/>
<adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory"/>
+ <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider"/>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.cdt.debug.core.model.ICStackFrame"
+ class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementAdapterFactory">
+ <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider"/>
+ <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory"/>
+ <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider"/>
</factory>
<factory
adaptableType="org.eclipse.cdt.debug.core.model.ICModule"
@@ -1278,6 +1281,7 @@
<adapter
type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider">
</adapter>
+ <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider"/>
</factory>
<factory
adaptableType="org.eclipse.cdt.debug.core.model.ICModule"
@@ -1292,6 +1296,7 @@
<adapter
type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider">
</adapter>
+ <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider"/>
</factory>
<factory
adaptableType="org.eclipse.cdt.core.model.ICElement"
@@ -1507,4 +1512,23 @@
actionType="org.eclipse.cdt.debug.ui.breakpointactions.ExternalToolAction"/>
</extension>
+ <extension point="org.eclipse.debug.ui.detailPaneFactories">
+ <detailFactories
+ class="org.eclipse.cdt.debug.internal.ui.views.modules.ModuleDetailPaneFactory"
+ id="org.eclipse.cdt.debug.ui.moduleDetailPaneFactory">
+ <enablement>
+ <with variable="selection">
+ <count value="1">
+ </count>
+ <iterate>
+ <or>
+ <instanceof value="org.eclipse.cdt.debug.core.model.ICModule"/>
+ <instanceof value="org.eclipse.cdt.core.model.ICElement"/>
+ </or>
+ </iterate>
+ </with>
+ </enablement>
+ </detailFactories>
+ </extension>
+
</plugin>
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleDetailPaneAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleDetailPaneAction.java
deleted file mode 100644
index 2916bbd897..0000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleDetailPaneAction.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions;
-
-import org.eclipse.cdt.debug.internal.ui.CDebugImages;
-import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
-import org.eclipse.cdt.debug.internal.ui.preferences.ICDebugPreferenceConstants;
-import org.eclipse.cdt.debug.internal.ui.views.modules.ModulesView;
-import org.eclipse.jface.action.Action;
-
-/**
- * Action that controls the appearance of the details pane in debug views
- * such as the modules view. Instances of this class can be created to show
- * the detail pane underneath the main tree, to the right of the main tree,
- * or not shown at all.
- */
-public class ToggleDetailPaneAction extends Action {
-
- private ModulesView fModulesView;
-
- private String fOrientation;
-
- /**
- * Constructor for ToggleDetailPaneAction.
- */
- public ToggleDetailPaneAction( ModulesView view, String orientation, String hiddenLabel ) {
- super( "", AS_RADIO_BUTTON ); //$NON-NLS-1$
- setModulesView( view );
- setOrientation( orientation );
- if ( orientation == ICDebugPreferenceConstants.MODULES_DETAIL_PANE_UNDERNEATH ) {
- setText( ActionMessages.getString( "ToggleDetailPaneAction.0" ) ); //$NON-NLS-1$
- setToolTipText( ActionMessages.getString( "ToggleDetailPaneAction.1" ) ); //$NON-NLS-1$
- setDescription( ActionMessages.getString( "ToggleDetailPaneAction.2" ) ); //$NON-NLS-1$
- setImageDescriptor( CDebugImages.DESC_LCL_DETAIL_PANE_UNDER );
- setDisabledImageDescriptor( CDebugImages.DESC_LCL_DETAIL_PANE_UNDER_DISABLED );
- setHoverImageDescriptor( CDebugImages.DESC_LCL_DETAIL_PANE_UNDER );
- }
- else if ( orientation == ICDebugPreferenceConstants.MODULES_DETAIL_PANE_RIGHT ) {
- setText( ActionMessages.getString( "ToggleDetailPaneAction.3" ) ); //$NON-NLS-1$
- setToolTipText( ActionMessages.getString( "ToggleDetailPaneAction.4" ) ); //$NON-NLS-1$
- setDescription( ActionMessages.getString( "ToggleDetailPaneAction.5" ) ); //$NON-NLS-1$
- setImageDescriptor( CDebugImages.DESC_LCL_DETAIL_PANE_RIGHT );
- setDisabledImageDescriptor( CDebugImages.DESC_LCL_DETAIL_PANE_RIGHT_DISABLED );
- setHoverImageDescriptor( CDebugImages.DESC_LCL_DETAIL_PANE_RIGHT );
- }
- else {
- setText( hiddenLabel );
- setToolTipText( ActionMessages.getString( "ToggleDetailPaneAction.6" ) ); //$NON-NLS-1$
- setDescription( ActionMessages.getString( "ToggleDetailPaneAction.7" ) ); //$NON-NLS-1$
- setImageDescriptor( CDebugImages.DESC_LCL_DETAIL_PANE_HIDE );
- setDisabledImageDescriptor( CDebugImages.DESC_LCL_DETAIL_PANE_HIDE_DISABLED );
- setHoverImageDescriptor( CDebugImages.DESC_LCL_DETAIL_PANE_HIDE );
- }
- view.getSite().getWorkbenchWindow().getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.SHOW_DETAIL_PANE_ACTION );
- }
-
- private ModulesView getModulesView() {
- return fModulesView;
- }
-
- private void setModulesView( ModulesView modulesView ) {
- fModulesView = modulesView;
- }
-
- private void setOrientation( String orientation ) {
- fOrientation = orientation;
- }
-
- public String getOrientation() {
- return fOrientation;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- getModulesView().setDetailPaneOrientation( getOrientation() );
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java
index f2cbef5587..352ce28eba 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 QNX Software Systems and others.
+ * Copyright (c) 2004, 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,15 +9,18 @@
* QNX Software Systems - Initial API and implementation
* IBM Corporation
* ARM Limited - https://bugs.eclipse.org/bugs/show_bug.cgi?id=186981
+ * Wind River Systems - adapted to work with platform Modules view (bug 210558)
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.elements.adapters;
import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.debug.core.model.ICDebugTarget;
import org.eclipse.cdt.debug.core.model.ICModule;
+import org.eclipse.cdt.debug.core.model.ICStackFrame;
+import org.eclipse.cdt.debug.core.model.ICThread;
import org.eclipse.cdt.debug.core.model.IModuleRetrieval;
import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleContentProvider;
import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleMementoProvider;
-import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleProxyFactory;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider;
@@ -25,8 +28,14 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactor
public class CDebugElementAdapterFactory implements IAdapterFactory {
+ private static IElementContentProvider fgDebugTargetContentProvider = new CDebugTargetContentProvider();
+ private static IElementContentProvider fgThreadContentProvider = new CThreadContentProvider();
+ private static IElementContentProvider fgStackFrameContentProvider = new CStackFrameContentProvider();
private static IElementContentProvider fgModuleContentProvider = new ModuleContentProvider();
- private static IModelProxyFactory fgModuleProxyFactory = new ModuleProxyFactory();
+
+ private static IModelProxyFactory fgDebugElementProxyFactory = new CDebugElementProxyFactory();
+
+ private static IElementMementoProvider fgStackFrameMementoProvider = new CStackFrameMementoProvider();
private static IElementMementoProvider fgModuleMementoProvider = new ModuleMementoProvider();
/* (non-Javadoc)
@@ -37,23 +46,45 @@ public class CDebugElementAdapterFactory implements IAdapterFactory {
return adaptableObject;
}
if ( adapterType.equals( IElementContentProvider.class ) ) {
- if ( adaptableObject instanceof IModuleRetrieval ) {
- return fgModuleContentProvider;
- }
- if ( adaptableObject instanceof ICModule ) {
- return fgModuleContentProvider;
+ if ( adaptableObject instanceof ICDebugTarget ) {
+ return fgDebugTargetContentProvider;
}
- if ( adaptableObject instanceof ICElement ) {
+ if ( adaptableObject instanceof ICThread ) {
+ return fgThreadContentProvider;
+ }
+ if ( adaptableObject instanceof ICStackFrame ) {
+ return fgStackFrameContentProvider;
+ }
+ if ( adaptableObject instanceof ICModule ||
+ adaptableObject instanceof ICElement )
+ {
return fgModuleContentProvider;
}
}
if ( adapterType.equals( IModelProxyFactory.class ) ) {
- if ( adaptableObject instanceof IModuleRetrieval ) {
- return fgModuleProxyFactory;
+ if ( adaptableObject instanceof ICDebugTarget ) {
+ return fgDebugElementProxyFactory;
+ }
+ if ( adaptableObject instanceof ICThread ) {
+ return fgDebugElementProxyFactory;
+ }
+ if ( adaptableObject instanceof ICStackFrame ) {
+ return fgDebugElementProxyFactory;
}
+ if ( adaptableObject instanceof IModuleRetrieval ) {
+ return fgDebugElementProxyFactory;
+ }
+
}
if ( adapterType.equals( IElementMementoProvider.class ) ) {
- if ( adaptableObject instanceof IModuleRetrieval ) {
+ if ( adaptableObject instanceof ICStackFrame ) {
+ return fgStackFrameMementoProvider;
+ }
+ if ( adaptableObject instanceof IModuleRetrieval ||
+ adaptableObject instanceof ICThread ||
+ adaptableObject instanceof ICModule ||
+ adaptableObject instanceof ICElement)
+ {
return fgModuleMementoProvider;
}
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleProxyFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementProxyFactory.java
index d73ff0e914..bc52028304 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleProxyFactory.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementProxyFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 QNX Software Systems and others.
+ * Copyright (c) 2004, 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,24 +8,26 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* IBM Corporation
+ * Wind River Systems - adapted to work with platform Modules view (bug 210558)
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.views.modules;
+package org.eclipse.cdt.debug.internal.ui.elements.adapters;
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
import org.eclipse.cdt.debug.core.model.IModuleRetrieval;
-import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
+import org.eclipse.cdt.debug.internal.ui.views.modules.ModulesViewModelProxy;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.debug.internal.ui.viewers.update.DefaultModelProxyFactory;
+import org.eclipse.debug.ui.IDebugUIConstants;
-public class ModuleProxyFactory implements IModelProxyFactory {
+public class CDebugElementProxyFactory extends DefaultModelProxyFactory {
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.viewers.provisional.IModelProxyFactoryAdapter#createModelProxy(java.lang.Object, org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext)
*/
public IModelProxy createModelProxy( Object element, IPresentationContext context ) {
- if ( ICDebugUIConstants.ID_MODULES_VIEW.equals( context.getId() ) ) {
+ if ( IDebugUIConstants.ID_MODULE_VIEW.equals( context.getId() ) ) {
IModuleRetrieval mr = null;
if ( element instanceof IAdaptable ) {
ICDebugTarget target = (ICDebugTarget)((IAdaptable)element).getAdapter( ICDebugTarget.class );
@@ -36,6 +38,6 @@ public class ModuleProxyFactory implements IModelProxyFactory {
return new ModulesViewModelProxy( mr );
}
}
- return null;
+ return super.createModelProxy(element, context);
}
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugTargetContentProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugTargetContentProvider.java
new file mode 100644
index 0000000000..4c14893354
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugTargetContentProvider.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.elements.adapters;
+
+import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleContentProvider;
+import org.eclipse.debug.internal.ui.model.elements.DebugTargetContentProvider;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate;
+import org.eclipse.debug.ui.IDebugUIConstants;
+
+/**
+ * Delegating provider implementation. If the memento request is for the
+ * modules view, the provider impelementation delegates the request to the
+ * modules view-specific provider. Otherwise, it calls the default superclass
+ * implementation.
+ */
+public class CDebugTargetContentProvider extends DebugTargetContentProvider {
+ private ModuleContentProvider fModuleContentProvider = new ModuleContentProvider();
+
+ @Override
+ public void update(IChildrenCountUpdate[] updates) {
+ if (updates[0].getPresentationContext().getId().equals(IDebugUIConstants.ID_MODULE_VIEW)) {
+ fModuleContentProvider.update(updates);
+ } else {
+ super.update(updates);
+ }
+ }
+
+ @Override
+ public void update(IHasChildrenUpdate[] updates) {
+ if (updates[0].getPresentationContext().getId().equals(IDebugUIConstants.ID_MODULE_VIEW)) {
+ fModuleContentProvider.update(updates);
+ } else {
+ super.update(updates);
+ }
+ }
+
+ @Override
+ public void update(IChildrenUpdate[] updates) {
+ if (updates[0].getPresentationContext().getId().equals(IDebugUIConstants.ID_MODULE_VIEW)) {
+ fModuleContentProvider.update(updates);
+ } else {
+ super.update(updates);
+ }
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CStackFrameContentProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CStackFrameContentProvider.java
new file mode 100644
index 0000000000..854f75fcef
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CStackFrameContentProvider.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.elements.adapters;
+
+import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleContentProvider;
+import org.eclipse.debug.internal.ui.model.elements.StackFrameContentProvider;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate;
+import org.eclipse.debug.ui.IDebugUIConstants;
+
+/**
+ * Delegating provider implementation. If the memento request is for the
+ * modules view, the provider impelementation delegates the request to the
+ * modules view-specific provider. Otherwise, it calls the default superclass
+ * implementation.
+ */
+public class CStackFrameContentProvider extends StackFrameContentProvider {
+ private ModuleContentProvider fModuleContentProvider = new ModuleContentProvider();
+
+ @Override
+ public void update(IChildrenCountUpdate[] updates) {
+ if (updates[0].getPresentationContext().getId().equals(IDebugUIConstants.ID_MODULE_VIEW)) {
+ fModuleContentProvider.update(updates);
+ } else {
+ super.update(updates);
+ }
+ }
+
+ @Override
+ public void update(IHasChildrenUpdate[] updates) {
+ if (updates[0].getPresentationContext().getId().equals(IDebugUIConstants.ID_MODULE_VIEW)) {
+ fModuleContentProvider.update(updates);
+ } else {
+ super.update(updates);
+ }
+ }
+
+ @Override
+ public void update(IChildrenUpdate[] updates) {
+ if (updates[0].getPresentationContext().getId().equals(IDebugUIConstants.ID_MODULE_VIEW)) {
+ fModuleContentProvider.update(updates);
+ } else {
+ super.update(updates);
+ }
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CStackFrameMementoProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CStackFrameMementoProvider.java
new file mode 100644
index 0000000000..8001b7e5c4
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CStackFrameMementoProvider.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.elements.adapters;
+
+import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleMementoProvider;
+import org.eclipse.debug.internal.ui.model.elements.StackFrameMementoProvider;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoRequest;
+import org.eclipse.debug.ui.IDebugUIConstants;
+
+/**
+ * Delegating provider implementation. If the memento request is for the
+ * modules view, the provider impelementation delegates the request to the
+ * modules view-specific provider. Otherwise, it calls the default superclass
+ * implementation.
+ */
+public class CStackFrameMementoProvider extends StackFrameMementoProvider {
+ private ModuleMementoProvider fModuleMementoProvider = new ModuleMementoProvider();
+
+ @Override
+ public void encodeElements(IElementMementoRequest[] requests) {
+ if (requests[0].getPresentationContext().getId().equals(IDebugUIConstants.ID_MODULE_VIEW)) {
+ fModuleMementoProvider.encodeElements(requests);
+ } else {
+ super.encodeElements(requests);
+ }
+ }
+
+
+ @Override
+ public void compareElements(IElementCompareRequest[] requests) {
+ if (requests[0].getPresentationContext().getId().equals(IDebugUIConstants.ID_MODULE_VIEW)) {
+ fModuleMementoProvider.compareElements(requests);
+ } else {
+ super.compareElements(requests);
+ }
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CThreadContentProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CThreadContentProvider.java
new file mode 100644
index 0000000000..4cba075539
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CThreadContentProvider.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.elements.adapters;
+
+import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleContentProvider;
+import org.eclipse.debug.internal.ui.model.elements.ThreadContentProvider;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate;
+import org.eclipse.debug.ui.IDebugUIConstants;
+
+/**
+ * Delegating provider implementation. If the memento request is for the
+ * modules view, the provider impelementation delegates the request to the
+ * modules view-specific provider. Otherwise, it calls the default superclass
+ * implementation.
+ */
+public class CThreadContentProvider extends ThreadContentProvider {
+ private ModuleContentProvider fModuleContentProvider = new ModuleContentProvider();
+
+ @Override
+ public void update(IChildrenCountUpdate[] updates) {
+ if (updates[0].getPresentationContext().getId().equals(IDebugUIConstants.ID_MODULE_VIEW)) {
+ fModuleContentProvider.update(updates);
+ } else {
+ super.update(updates);
+ }
+ }
+
+ @Override
+ public void update(IHasChildrenUpdate[] updates) {
+ if (updates[0].getPresentationContext().getId().equals(IDebugUIConstants.ID_MODULE_VIEW)) {
+ fModuleContentProvider.update(updates);
+ } else {
+ super.update(updates);
+ }
+ }
+
+ @Override
+ public void update(IChildrenUpdate[] updates) {
+ if (updates[0].getPresentationContext().getId().equals(IDebugUIConstants.ID_MODULE_VIEW)) {
+ fModuleContentProvider.update(updates);
+ } else {
+ super.update(updates);
+ }
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleContentProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleContentProvider.java
index 38c030bf6b..30504e39f5 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleContentProvider.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleContentProvider.java
@@ -7,6 +7,7 @@
*
* Contributors:
* ARM - Initial API and implementation
+ * Wind River Systems - adapted to work with platform Modules view (bug 210558)
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.views.modules;
@@ -17,12 +18,12 @@ import org.eclipse.cdt.debug.core.model.ICModule;
import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.model.ICThread;
import org.eclipse.cdt.debug.core.model.IModuleRetrieval;
-import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.internal.ui.model.elements.ElementContentProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
+import org.eclipse.debug.ui.IDebugUIConstants;
public class ModuleContentProvider extends ElementContentProvider {
@@ -44,7 +45,7 @@ public class ModuleContentProvider extends ElementContentProvider {
* @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#supportsContextId(java.lang.String)
*/
protected boolean supportsContextId( String id ) {
- return ICDebugUIConstants.ID_MODULES_VIEW.equals( id );
+ return IDebugUIConstants.ID_MODULE_VIEW.equals( id );
}
protected Object[] getAllChildren( Object parent, IPresentationContext context ) throws CoreException {
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleDetailPane.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleDetailPane.java
new file mode 100644
index 0000000000..d74bec6dfd
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleDetailPane.java
@@ -0,0 +1,545 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * QNX Software Systems - Mikhail Khodjaiants - Registers View (Bug 53640)
+ * Wind River Systems - adapted to work with platform Modules view (bug 210558)
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.views.modules;
+
+import org.eclipse.cdt.core.IAddress;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.debug.core.model.ICModule;
+import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
+import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
+import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
+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.model.IDebugElement;
+import org.eclipse.debug.internal.ui.views.variables.details.AbstractDetailPane;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.IDebugView;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.resource.JFaceResources;
+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.source.SourceViewer;
+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.graphics.Point;
+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.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.console.actions.TextViewerAction;
+import org.eclipse.ui.progress.WorkbenchJob;
+import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
+
+/**
+ *
+ */
+public class ModuleDetailPane 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$
+
+ /**
+ * The ID, name and description of this pane are stored in constants so that the class
+ * does not have to be instantiated to access them.
+ */
+ public static final String ID = "ModuleDetailPane";
+ public static final String NAME = "Module Viewer";
+ public static final String DESCRIPTION = "A detail pane that is based on a source viewer. Displays as text and has actions for assigning values, content assist and text modifications.";
+
+
+ /**
+ * Job to compute the details for a selection
+ */
+ class DetailJob extends Job {
+
+ private Object fElement;
+ // whether a result was collected
+ private IProgressMonitor fMonitor;
+
+ public DetailJob(Object element) {
+ super("compute module details"); //$NON-NLS-1$
+ setSystem(true);
+ fElement = element;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected IStatus run(IProgressMonitor monitor) {
+ fMonitor = monitor;
+
+ String detail = "";
+ if ( fElement instanceof ICModule ) {
+ detail = getModuleDetail( ((ICModule)fElement) );
+ }
+ if ( fElement instanceof ICElement ) {
+ detail = fElement.toString();
+ }
+
+ detailComputed(detail);
+ return Status.OK_STATUS;
+ }
+
+ private void detailComputed(final String result) {
+ if (!fMonitor.isCanceled()) {
+ WorkbenchJob setDetail = new WorkbenchJob("set details") { //$NON-NLS-1$
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ if (!fMonitor.isCanceled()) {
+ getDetailDocument().set(result);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ setDetail.setSystem(true);
+ setDetail.schedule();
+ }
+ }
+
+ }
+
+ private String getModuleDetail( ICModule module ) {
+ StringBuffer sb = new StringBuffer();
+
+ // Type
+ String type = null;
+ switch( module.getType() ) {
+ case ICModule.EXECUTABLE:
+ type = ModulesMessages.getString( "ModulesView.1" ); //$NON-NLS-1$
+ break;
+ case ICModule.SHARED_LIBRARY:
+ type = ModulesMessages.getString( "ModulesView.2" ); //$NON-NLS-1$
+ break;
+ }
+ if ( type != null ) {
+ sb.append( ModulesMessages.getString( "ModulesView.3" ) ); //$NON-NLS-1$
+ sb.append( type );
+ sb.append( '\n' );
+ }
+
+ // Symbols flag
+ sb.append( ModulesMessages.getString( "ModulesView.4" ) ); //$NON-NLS-1$
+ sb.append( ( module.areSymbolsLoaded() ) ? ModulesMessages.getString( "ModulesView.5" ) : ModulesMessages.getString( "ModulesView.6" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ sb.append( '\n' );
+
+ // Symbols file
+ sb.append( ModulesMessages.getString( "ModulesView.7" ) ); //$NON-NLS-1$
+ sb.append( module.getSymbolsFileName().toOSString() );
+ sb.append( '\n' );
+
+ // CPU
+ String cpu = module.getCPU();
+ if ( cpu != null ) {
+ sb.append( ModulesMessages.getString( "ModulesView.8" ) ); //$NON-NLS-1$
+ sb.append( cpu );
+ sb.append( '\n' );
+ }
+
+ // Base address
+ IAddress baseAddress = module.getBaseAddress();
+ if ( !baseAddress.isZero() ) {
+ sb.append( ModulesMessages.getString( "ModulesView.9" ) ); //$NON-NLS-1$
+ sb.append( baseAddress.toHexAddressString() );
+ sb.append( '\n' );
+ }
+
+ // Size
+ long size = module.getSize();
+ if ( size > 0 ) {
+ sb.append( ModulesMessages.getString( "ModulesView.10" ) ); //$NON-NLS-1$
+ sb.append( size );
+ sb.append( '\n' );
+ }
+
+ return sb.toString();
+ }
+
+
+ /**
+ * The source viewer in which the computed string detail
+ * of selected modules will be displayed.
+ */
+ private SourceViewer fSourceViewer;
+
+ /**
+ * Variables used to create the detailed information for a selection
+ */
+ private IDocument fDetailDocument;
+ private DetailJob fDetailJob = null;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDetailPane#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public Control createControl(Composite parent) {
+
+ createSourceViewer(parent);
+
+ if (isInView()){
+ createViewSpecificComponents();
+ createActions();
+ CDebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
+ JFaceResources.getFontRegistry().addListener(this);
+ }
+
+ 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(IInternalCDebugUIConstants.DETAIL_PANE_FONT));
+ fSourceViewer.setEditable(false);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(fSourceViewer.getTextWidget(), ICDebugHelpContextIds.MODULES_DETAIL_PANE);
+ Control control = fSourceViewer.getControl();
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ control.setLayoutData(gd);
+ }
+
+ /**
+ * Creates listeners and other components that should only be added to the
+ * source viewer when this detail pane is inside a view.
+ */
+ private void createViewSpecificComponents(){
+
+ // Add a document listener so actions get updated when the document changes
+ getDetailDocument().addDocumentListener(new IDocumentListener() {
+ public void documentAboutToBeChanged(DocumentEvent event) {}
+ public void documentChanged(DocumentEvent event) {
+ updateSelectionDependentActions();
+ }
+ });
+
+ // Add the selection listener so selection dependent 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.COPY_ACTION, getAction(DETAIL_COPY_ACTION));
+
+ getViewSite().getActionBars().updateActionBars();
+ }
+
+ 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);
+
+ getViewSite().getActionBars().updateActionBars();
+
+ }
+ });
+
+ // 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, ITextOperationTarget.SELECT_ALL);
+ textAction.configureAction("Select &All", "", "");
+ textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.SELECT_ALL);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, ICDebugHelpContextIds.MODULE_DETAIL_PANE_SELECT_ALL_ACTION);
+ setAction(DETAIL_SELECT_ALL_ACTION, textAction);
+
+ textAction= new TextViewerAction(fSourceViewer, ITextOperationTarget.COPY);
+ textAction.configureAction("&Copy", "", "");
+ textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, ICDebugHelpContextIds.MODULE_DETAIL_PANE_COPY_ACTION);
+ setAction(DETAIL_COPY_ACTION, textAction);
+
+ setSelectionDependantAction(DETAIL_COPY_ACTION);
+
+ updateSelectionDependentActions();
+ }
+
+ /**
+ * Create the context menu particular to the detail pane. Note that anyone
+ * wishing to contribute an action to this menu must use
+ * <code>ICDebugUIConstants.MODULES_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(ICDebugUIConstants.MODULES_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(ICDebugUIConstants.MODULES_GROUP));
+ menu.add(new Separator());
+ menu.add(getAction(DETAIL_COPY_ACTION));
+ menu.add(getAction(DETAIL_SELECT_ALL_ACTION));
+ menu.add(new Separator());
+ 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;
+ }
+
+ if (isInView()){
+ fSourceViewer.setEditable(true);
+ }
+
+ if (selection.isEmpty()){
+ clearSourceViewer();
+ return;
+ }
+
+ Object firstElement = selection.getFirstElement();
+ if (firstElement != null && firstElement instanceof IDebugElement) {
+ String modelID = ((IDebugElement)firstElement).getModelIdentifier();
+ }
+
+ synchronized (this) {
+ if (fDetailJob != null) {
+ fDetailJob.cancel();
+ }
+ fDetailJob = new DetailJob(selection.getFirstElement());
+ fDetailJob.schedule();
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDetailPane#setFocus()
+ */
+ 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 (fSourceViewer != null && fSourceViewer.getControl() != null) fSourceViewer.getControl().dispose();
+
+ if (isInView()){
+ CDebugUIPlugin.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 (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();
+ }
+ fDetailDocument.set("");
+ fSourceViewer.setEditable(false);
+ }
+
+ /* (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(IInternalCDebugUIConstants.DETAIL_PANE_FONT)) {
+ fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(IInternalCDebugUIConstants.DETAIL_PANE_FONT));
+ }
+
+ }
+
+ /**
+ * Wrapper class that wraps around an IFindReplaceTarget. Allows the detail pane to scroll
+ * to text selected by the find/replace action. The source viewer treats the text as a single
+ * line, even when the text is wrapped onto several lines so the viewer will not scroll properly
+ * on it's own. See bug 178106.
+ */
+ class FindReplaceTargetWrapper implements IFindReplaceTarget{
+
+ private IFindReplaceTarget fTarget;
+
+ /**
+ * Constructor
+ *
+ * @param target find/replace target this class will wrap around.
+ */
+ public FindReplaceTargetWrapper(IFindReplaceTarget target){
+ fTarget = target;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IFindReplaceTarget#canPerformFind()
+ */
+ public boolean canPerformFind() {
+ return fTarget.canPerformFind();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IFindReplaceTarget#findAndSelect(int, java.lang.String, boolean, boolean, boolean)
+ */
+ public int findAndSelect(int widgetOffset, String findString, boolean searchForward, boolean caseSensitive, boolean wholeWord) {
+ int position = fTarget.findAndSelect(widgetOffset, findString, searchForward, caseSensitive, wholeWord);
+ // Explicitly tell the widget to show the selection because the viewer thinks the text is all on one line, even if wrapping is turned on.
+ if (fSourceViewer != null){
+ StyledText text = fSourceViewer.getTextWidget();
+ if(text != null && !text.isDisposed()) {
+ text.showSelection();
+ }
+ }
+ return position;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IFindReplaceTarget#getSelection()
+ */
+ public Point getSelection() {
+ return fTarget.getSelection();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IFindReplaceTarget#getSelectionText()
+ */
+ public String getSelectionText() {
+ return fTarget.getSelectionText();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IFindReplaceTarget#isEditable()
+ */
+ public boolean isEditable() {
+ return fTarget.isEditable();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.IFindReplaceTarget#replaceSelection(java.lang.String)
+ */
+ public void replaceSelection(String text) {
+ fTarget.replaceSelection(text);
+ }
+ }
+
+}
+
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleDetailPaneFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleDetailPaneFactory.java
new file mode 100644
index 0000000000..1da40d8a3e
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleDetailPaneFactory.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * 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
+ * Wind River Systems - adapted to work with platform Modules view (bug 210558)
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.views.modules;
+
+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;
+
+/**
+ * Modules view detail pane factory.
+ */
+public class ModuleDetailPaneFactory implements IDetailPaneFactory {
+
+ public static final String MODULE_DETAIL_PANE_ID = ModuleDetailPane.ID;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#createDetailsArea(java.lang.String)
+ */
+ public IDetailPane createDetailPane(String id) {
+ return new ModuleDetailPane();
+ }
+
+ /* (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(ModuleDetailPane.ID);
+ return possibleIDs;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDetailPaneFactory#getDefaultDetailPane(java.util.Set, org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ public String getDefaultDetailPane(IStructuredSelection selection) {
+ // Return null so that any contributed detail pane can override the default
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#getName(java.lang.String)
+ */
+ public String getDetailPaneName(String id) {
+ if (id.equals(ModuleDetailPane.ID)){
+ return ModuleDetailPane.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(ModuleDetailPane.ID)){
+ return ModuleDetailPane.DESCRIPTION;
+ }
+ return null;
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleLabelProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleLabelProvider.java
index 7a30d352dc..1a196ae274 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleLabelProvider.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleLabelProvider.java
@@ -7,17 +7,18 @@
*
* Contributors:
* ARM - Initial API and implementation
+ * Wind River Systems - adapted to work with platform Modules view (bug 210558)
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.views.modules;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.debug.core.model.ICModule;
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
-import org.eclipse.cdt.debug.internal.ui.views.modules.ModulesView.ModulesViewPresentationContext;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.internal.ui.model.elements.ElementLabelProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.debug.internal.ui.views.DebugModelPresentationContext;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.TreePath;
@@ -34,8 +35,8 @@ public class ModuleLabelProvider extends ElementLabelProvider {
*/
protected String getLabel( TreePath elementPath, IPresentationContext presentationContext, String columnId ) throws CoreException {
Object element = elementPath.getLastSegment();
- if ( element instanceof ICModule && presentationContext instanceof ModulesViewPresentationContext ) {
- IDebugModelPresentation presentation = ((ModulesViewPresentationContext)presentationContext).getModelPresentation();
+ if ( element instanceof ICModule && presentationContext instanceof DebugModelPresentationContext ) {
+ IDebugModelPresentation presentation = ((DebugModelPresentationContext)presentationContext).getModelPresentation();
return presentation.getText( element );
}
if ( element instanceof IAdaptable ) {
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModulesMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModulesMessages.properties
index 4c34b69d4d..3223b1082a 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModulesMessages.properties
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModulesMessages.properties
@@ -7,8 +7,8 @@
#
# Contributors:
# QNX Software Systems - initial API and implementation
+# Wind River Systems - adapted to work with platform Modules view (bug 210558)
###############################################################################
-ModulesView.0=Modules View Only
ModulesView.1=executable
ModulesView.10=Size:
ModulesView.11=\ (symbols loaded)
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModulesView.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModulesView.java
deleted file mode 100644
index 123d150286..0000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModulesView.java
+++ /dev/null
@@ -1,1012 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- * Pawel Piech (Wind River) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=207094
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.views.modules;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.eclipse.cdt.core.IAddress;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.debug.core.model.ICDebugTarget;
-import org.eclipse.cdt.debug.core.model.ICModule;
-import org.eclipse.cdt.debug.core.model.IModuleRetrieval;
-import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
-import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
-import org.eclipse.cdt.debug.internal.ui.actions.ToggleDetailPaneAction;
-import org.eclipse.cdt.debug.internal.ui.preferences.ICDebugPreferenceConstants;
-import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
-import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.internal.ui.actions.ConfigureColumnsAction;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelChangedListener;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputRequestor;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdateListener;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ViewerInputService;
-import org.eclipse.debug.internal.ui.views.variables.ToggleShowColumnsAction;
-import org.eclipse.debug.ui.AbstractDebugView;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugModelPresentation;
-import org.eclipse.debug.ui.contexts.DebugContextEvent;
-import org.eclipse.debug.ui.contexts.IDebugContextListener;
-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.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-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.ITextOperationTarget;
-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.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-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.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-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.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IPerspectiveListener;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-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.texteditor.IUpdate;
-import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
-
-/**
- * Displays the modules currently loaded by the process being debugged.
- */
-public class ModulesView extends AbstractDebugView implements IDebugContextListener, IDebugExceptionHandler, IPropertyChangeListener, IPerspectiveListener, IModelChangedListener, IViewerUpdateListener {
-
- public class ModulesViewPresentationContext extends PresentationContext {
-
- private IDebugModelPresentation fModelPresentation;
-
- public ModulesViewPresentationContext( IDebugModelPresentation modelPresentation ) {
- super( ICDebugUIConstants.ID_MODULES_VIEW );
- fModelPresentation = modelPresentation;
- }
-
- public IDebugModelPresentation getModelPresentation() {
- return fModelPresentation;
- }
- }
-
- /**
- * Internal interface for a cursor listener. I.e. aggregation
- * of mouse and key listener.
- */
- interface ICursorListener extends MouseListener, KeyListener {
- }
-
- protected String PREF_STATE_MEMENTO = "pref_state_memento."; //$NON-NLS-1$
-
- /**
- * the preference name for the view part of the sash form
- */
- protected static final String SASH_VIEW_PART = CDebugUIPlugin.getUniqueIdentifier() + ".SASH_VIEW_PART"; //$NON-NLS-1$
-
- /**
- * the preference name for the details part of the sash form
- */
- protected static final String SASH_DETAILS_PART = CDebugUIPlugin.getUniqueIdentifier() + ".SASH_DETAILS_PART"; //$NON-NLS-1$
-
- /**
- * The UI construct that provides a sliding sash between the modules tree
- * and the detail pane.
- */
- private SashForm fSashForm;
-
- /**
- * The detail pane viewer.
- */
- private ISourceViewer fDetailViewer;
-
- /**
- * The document associated with the detail pane viewer.
- */
- private IDocument fDetailDocument;
-
- /**
- * 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.
- */
- private boolean fTreeHasFocus = true;
-
- /**
- * Remembers which viewer (tree viewer or details viewer) had focus, so we
- * can reset the focus properly when re-activated.
- */
- private Viewer fFocusViewer = null;
-
- /**
- * 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;
-
- /**
- * These are used to initialize and persist the position of the sash that
- * separates the tree viewer from the detail pane.
- */
- private static final int[] DEFAULT_SASH_WEIGHTS = { 13, 6 };
- private int[] fLastSashWeights;
- private boolean fToggledDetailOnce;
- private ToggleDetailPaneAction[] fToggleDetailPaneActions;
- protected ConfigureColumnsAction fConfigureColumnsAction;
- private String fCurrentDetailPaneOrientation = ICDebugPreferenceConstants.MODULES_DETAIL_PANE_HIDDEN;
- protected static final String SASH_WEIGHTS = CDebugUIPlugin.getUniqueIdentifier() + ".modulesView.SASH_WEIGHTS"; //$NON-NLS-1$
-
- private ICursorListener fCursorListener;
-
- private HashMap fSelectionStates = new HashMap( 10 );
-
- private HashMap fImageCache = new HashMap( 10 );
-
- /**
- * Viewer input service used to translate active debug context to viewer input.
- */
- private ViewerInputService fInputService;
-
- /**
- * Viewer input requester used to update the viewer once the viewer input has been
- * resolved.
- */
- private IViewerInputRequestor fInputRequestor = new IViewerInputRequestor() {
- public void viewerInputComplete( IViewerInputUpdate update ) {
- if ( !update.isCanceled() ) {
- setViewerInput( update.getInputElement() );
- }
- }
- };
-
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.AbstractDebugView#createViewer(org.eclipse.swt.widgets.Composite)
- */
- protected Viewer createViewer( Composite parent ) {
-
- // create the sash form that will contain the tree viewer & text viewer
- setSashForm( new SashForm( parent, SWT.NONE ) );
-
- CDebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener( this );
- JFaceResources.getFontRegistry().addListener( this );
-
- TreeModelViewer viewer = createTreeViewer( getSashForm() );
- fInputService = new ViewerInputService( viewer, fInputRequestor );
-
- createDetailsViewer();
- getSashForm().setMaximizedControl( viewer.getControl() );
-
- createOrientationActions( viewer );
- IPreferenceStore prefStore = CDebugUIPlugin.getDefault().getPreferenceStore();
- String orientation = prefStore.getString( getDetailPanePreferenceKey() );
- for( int i = 0; i < fToggleDetailPaneActions.length; i++ ) {
- fToggleDetailPaneActions[i].setChecked( fToggleDetailPaneActions[i].getOrientation().equals( orientation ) );
- }
- setDetailPaneOrientation( orientation );
-
- viewer.addModelChangedListener( this );
- viewer.addViewerUpdateListener( this );
-
- return viewer;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.AbstractDebugView#createActions()
- */
- protected void createActions() {
- TextViewerAction textAction = new TextViewerAction( getDetailViewer(), ITextOperationTarget.SELECT_ALL );
- textAction.configureAction( ModulesMessages.getString( "ModulesView.13" ), "", "" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- textAction.setActionDefinitionId( IWorkbenchActionDefinitionIds.SELECT_ALL );
- setAction( ActionFactory.SELECT_ALL.getId(), textAction );
- textAction = new TextViewerAction( getDetailViewer(), ITextOperationTarget.COPY );
- textAction.configureAction( ModulesMessages.getString( "ModulesView.16" ), "", "" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- textAction.setActionDefinitionId( IWorkbenchActionDefinitionIds.COPY );
- setAction( ActionFactory.COPY.getId(), textAction );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.AbstractDebugView#getHelpContextId()
- */
- protected String getHelpContextId() {
- return ICDebugHelpContextIds.MODULES_VIEW;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.AbstractDebugView#fillContextMenu(org.eclipse.jface.action.IMenuManager)
- */
- protected void fillContextMenu( IMenuManager menu ) {
- menu.add( new Separator( ICDebugUIConstants.EMPTY_MODULES_GROUP ) );
- menu.add( new Separator( ICDebugUIConstants.MODULES_GROUP ) );
- menu.add( new Separator( ICDebugUIConstants.EMPTY_REFRESH_GROUP ) );
- menu.add( new Separator( ICDebugUIConstants.REFRESH_GROUP ) );
- menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
- updateObjects();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.AbstractDebugView#configureToolBar(org.eclipse.jface.action.IToolBarManager)
- */
- protected void configureToolBar( IToolBarManager tbm ) {
- tbm.add( new Separator( ICDebugUIConstants.MODULES_GROUP ) );
- tbm.add( new Separator( ICDebugUIConstants.REFRESH_GROUP ) );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler#handleException(org.eclipse.debug.core.DebugException)
- */
- public void handleException( DebugException e ) {
- showMessage( e.getMessage() );
- }
-
- /* (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( IInternalCDebugUIConstants.DETAIL_PANE_FONT ) ) {
- getDetailViewer().getTextWidget().setFont( JFaceResources.getFont( IInternalCDebugUIConstants.DETAIL_PANE_FONT ) );
- }
- }
-
- protected void setViewerInput( Object context ) {
- Object input = context;
-
- if ( context instanceof IAdaptable ) {
- ICDebugTarget target = (ICDebugTarget)((IAdaptable)context).getAdapter( ICDebugTarget.class );
- if ( target != null )
- input = (IModuleRetrieval)target.getAdapter( IModuleRetrieval.class );
- }
-
- if ( input == null ) {
- clearDetails();
- }
- Object current = getViewer().getInput();
- if ( current == null && input == null ) {
- return;
- }
- if ( current != null && current.equals( input ) ) {
- return;
- }
-
- showViewer();
- getViewer().setInput( input );
- }
-
- protected TreeModelViewer createTreeViewer( Composite parent ) {
- // add tree viewer
- final TreeModelViewer modulesViewer = new TreeModelViewer( parent, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.VIRTUAL | SWT.FULL_SELECTION, getPresentationContext() );
- modulesViewer.getControl().addFocusListener( new FocusAdapter() {
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.FocusListener#focusGained(org.eclipse.swt.events.FocusEvent)
- */
- public void focusGained( FocusEvent e ) {
- fTreeHasFocus = true;
- getSite().setSelectionProvider( modulesViewer );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.FocusAdapter#focusLost(org.eclipse.swt.events.FocusEvent)
- */
- public void focusLost( FocusEvent e ) {
- getSite().setSelectionProvider( null );
- }
- } );
-
- getSite().setSelectionProvider( modulesViewer );
- modulesViewer.addPostSelectionChangedListener( getTreeSelectionChangedListener() );
-
- // listen to debug context
- DebugUITools.getDebugContextManager().getContextService( getSite().getWorkbenchWindow() ).addDebugContextListener( this );
- return modulesViewer;
- }
-
- /**
- * Create the widgetry for the details viewer.
- */
- protected void createDetailsViewer() {
- // Create & configure a SourceViewer
- SourceViewer detailsViewer = new SourceViewer( getSashForm(), null, SWT.V_SCROLL | SWT.H_SCROLL );
- Listener activateListener = new Listener() {
-
- public void handleEvent( Event event ) {
- fTreeHasFocus = false;
- }
- };
- detailsViewer.getControl().addListener( SWT.Activate, activateListener );
- setDetailViewer( detailsViewer );
- detailsViewer.setDocument( getDetailDocument() );
- detailsViewer.getTextWidget().setFont( JFaceResources.getFont( IInternalCDebugUIConstants.DETAIL_PANE_FONT ) );
- getDetailDocument().addDocumentListener( getDetailDocumentListener() );
- detailsViewer.configure( new SourceViewerConfiguration() );
- 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(org.eclipse.swt.events.FocusEvent)
- */
- public void focusGained( FocusEvent e ) {
- setFocusViewer( (Viewer)getDetailViewer() );
- }
- } );
- // add a context menu to the detail area
- createDetailContextMenu( detailsViewer.getTextWidget() );
- detailsViewer.getTextWidget().addMouseListener( getCursorListener() );
- detailsViewer.getTextWidget().addKeyListener( getCursorListener() );
- }
-
- private void setDetailViewer( ISourceViewer viewer ) {
- fDetailViewer = viewer;
- }
-
- protected ISourceViewer getDetailViewer() {
- return fDetailViewer;
- }
-
- protected SashForm getSashForm() {
- return fSashForm;
- }
-
- private void setSashForm( SashForm sashForm ) {
- fSashForm = sashForm;
- }
-
- protected TreeModelViewer getModulesViewer() {
- return (TreeModelViewer)getViewer();
- }
-
- protected void setFocusViewer( Viewer viewer ) {
- fFocusViewer = viewer;
- }
-
- protected Viewer getFocusViewer() {
- return fFocusViewer;
- }
-
- /**
- * Lazily instantiate and return a selection listener that populates the detail pane,
- * but only if the detail is currently visible.
- */
- protected ISelectionChangedListener getTreeSelectionChangedListener() {
- if ( fTreeSelectionChangedListener == null ) {
- fTreeSelectionChangedListener = new ISelectionChangedListener() {
-
- public void selectionChanged( SelectionChangedEvent event ) {
- if ( event.getSelectionProvider().equals( getModulesViewer() ) ) {
- clearStatusLine();
- // if the detail pane is not visible, don't waste time retrieving details
- if ( getSashForm().getMaximizedControl() == getViewer().getControl() ) {
- return;
- }
- IStructuredSelection selection = (IStructuredSelection)event.getSelection();
- populateDetailPaneFromSelection( selection );
- treeSelectionChanged( event );
- }
- }
- };
- }
- return fTreeSelectionChangedListener;
- }
-
- protected void treeSelectionChanged( SelectionChangedEvent event ) {
- }
-
- /**
- * Ask the modules tree for its current selection, and use this to populate
- * the detail pane.
- */
- public void populateDetailPane() {
- if ( isDetailPaneVisible() ) {
- Viewer viewer = getViewer();
- if ( viewer != null ) {
- IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
- populateDetailPaneFromSelection( selection );
- }
- }
- }
-
- /**
- * Show the details associated with the first of the selected elements in the
- * detail pane.
- */
- protected void populateDetailPaneFromSelection( IStructuredSelection selection ) {
- getDetailDocument().set( "" ); //$NON-NLS-1$
- if ( !selection.isEmpty() ) {
- computeDetail( selection.getFirstElement() );
- }
- }
-
- /**
- * 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 ) {
- }
- };
- }
- 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 ) {
- }
- };
- }
- 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;
- }
-
- protected void updateSelectionDependentActions() {
- }
-
- protected void updateAction( String actionId ) {
- IAction action = getAction( actionId );
- if ( action instanceof IUpdate ) {
- ((IUpdate)action).update();
- }
- }
-
- 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 plugins may contribute to it
- getSite().registerContextMenu( ICDebugUIConstants.MODULES_VIEW_DETAIL_ID, menuMgr, getDetailViewer().getSelectionProvider() );
- addContextMenuManager( menuMgr );
- }
-
- protected void fillDetailContextMenu( IMenuManager menu ) {
- menu.add( new Separator( ICDebugUIConstants.MODULES_GROUP ) );
- menu.add( new Separator() );
- menu.add( getAction( ActionFactory.COPY.getId() ) );
- menu.add( getAction( ActionFactory.SELECT_ALL.getId() ) );
- menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
- updateObjects();
- }
-
- private ICursorListener getCursorListener() {
- if ( fCursorListener == null ) {
- fCursorListener = new ICursorListener() {
-
- public void keyPressed( KeyEvent e ) {
- }
-
- public void keyReleased( KeyEvent e ) {
- }
-
- public void mouseDoubleClick( MouseEvent e ) {
- }
-
- public void mouseDown( MouseEvent e ) {
- }
-
- public void mouseUp( MouseEvent e ) {
- }
- };
- }
- return fCursorListener;
- }
-
- public void setDetailPaneOrientation( String orientation ) {
- if ( orientation.equals( fCurrentDetailPaneOrientation ) ) {
- return;
- }
- if ( orientation.equals( ICDebugPreferenceConstants.MODULES_DETAIL_PANE_HIDDEN ) ) {
- hideDetailPane();
- }
- else {
- int vertOrHoriz = orientation.equals( ICDebugPreferenceConstants.MODULES_DETAIL_PANE_UNDERNEATH ) ? SWT.VERTICAL : SWT.HORIZONTAL;
- getSashForm().setOrientation( vertOrHoriz );
- if ( ICDebugPreferenceConstants.MODULES_DETAIL_PANE_HIDDEN.equals( fCurrentDetailPaneOrientation ) ) {
- showDetailPane();
- }
- }
- fCurrentDetailPaneOrientation = orientation;
- CDebugUIPlugin.getDefault().getPreferenceStore().setValue( getDetailPanePreferenceKey(), orientation );
- }
-
- private void hideDetailPane() {
- if ( fToggledDetailOnce ) {
- setLastSashWeights( getSashForm().getWeights() );
- }
- getSashForm().setMaximizedControl( getViewer().getControl() );
- }
-
- private void showDetailPane() {
- getSashForm().setMaximizedControl( null );
- getSashForm().setWeights( getLastSashWeights() );
- populateDetailPane();
- revealTreeSelection();
- fToggledDetailOnce = true;
- }
-
- protected String getDetailPanePreferenceKey() {
- return ICDebugPreferenceConstants.MODULES_DETAIL_PANE_ORIENTATION;
- }
-
- protected int[] getLastSashWeights() {
- if ( fLastSashWeights == null ) {
- fLastSashWeights = DEFAULT_SASH_WEIGHTS;
- }
- return fLastSashWeights;
- }
-
- protected void setLastSashWeights( int[] weights ) {
- fLastSashWeights = weights;
- }
-
- private void createOrientationActions( TreeModelViewer viewer ) {
- IActionBars actionBars = getViewSite().getActionBars();
- final IMenuManager viewMenu = actionBars.getMenuManager();
- fToggleDetailPaneActions = new ToggleDetailPaneAction[3];
- fToggleDetailPaneActions[0] = new ToggleDetailPaneAction( this, ICDebugPreferenceConstants.MODULES_DETAIL_PANE_UNDERNEATH, null );
- fToggleDetailPaneActions[1] = new ToggleDetailPaneAction( this, ICDebugPreferenceConstants.MODULES_DETAIL_PANE_RIGHT, null );
- fToggleDetailPaneActions[2] = new ToggleDetailPaneAction( this, ICDebugPreferenceConstants.MODULES_DETAIL_PANE_HIDDEN, getToggleActionLabel() );
- viewMenu.add( new Separator() );
- viewMenu.add( fToggleDetailPaneActions[0] );
- viewMenu.add( fToggleDetailPaneActions[1] );
- viewMenu.add( fToggleDetailPaneActions[2] );
- viewMenu.add( new Separator() );
-
- fConfigureColumnsAction = new ConfigureColumnsAction( viewer );
- setAction( "ToggleColumns", new ToggleShowColumnsAction( viewer ) ); //$NON-NLS-1$
-
- viewMenu.addMenuListener( new IMenuListener() {
- public void menuAboutToShow( IMenuManager manager ) {
- IAction action = getAction( "ToggleColumns" ); //$NON-NLS-1$
- ((IUpdate)action).update();
- if ( action.isEnabled() ) {
- if ( viewMenu.find( action.getId() ) == null )
- viewMenu.add( action );
- }
- else {
- viewMenu.remove( action.getId() );
- }
- fConfigureColumnsAction.update();
- if ( fConfigureColumnsAction.isEnabled() ) {
- if ( viewMenu.find( fConfigureColumnsAction.getId() ) == null )
- viewMenu.add( fConfigureColumnsAction );
- }
- else {
- viewMenu.remove( fConfigureColumnsAction.getId() );
- }
- }
- } );
- }
-
- protected String getToggleActionLabel() {
- return ModulesMessages.getString( "ModulesView.0" ); //$NON-NLS-1$
- }
-
- protected boolean isDetailPaneVisible() {
- return !fToggleDetailPaneActions[2].isChecked();
- }
-
- /**
- * Make sure the currently selected item in the tree is visible.
- */
- protected void revealTreeSelection() {
- StructuredViewer viewer = (StructuredViewer)getViewer();
- if ( viewer != null ) {
- ISelection selection = viewer.getSelection();
- if ( selection instanceof IStructuredSelection ) {
- Object selected = ((IStructuredSelection)selection).getFirstElement();
- if ( selected != null ) {
- viewer.reveal( selected );
- }
- }
- }
- }
-
- /**
- * Set on or off the word wrap flag for the detail pane.
- */
- public void toggleDetailPaneWordWrap( boolean on ) {
- fDetailViewer.getTextWidget().setWordWrap( on );
- }
-
- /**
- * Saves the current state of the viewer
- * @param memento the memento to write the viewer state into
- */
- public void saveViewerState( IMemento memento ) {
- if ( fSashForm != null && !fSashForm.isDisposed() ) {
- int[] weights = fSashForm.getWeights();
- memento.putInteger( SASH_VIEW_PART, weights[0] );
- memento.putInteger( SASH_DETAILS_PART, weights[1] );
- }
- getModulesViewer().saveState( memento );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IViewPart#init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento)
- */
- public void init( IViewSite site, IMemento memento ) throws PartInitException {
- super.init( site, memento );
-
- PREF_STATE_MEMENTO = PREF_STATE_MEMENTO + site.getId();
- IPreferenceStore store = CDebugUIPlugin.getDefault().getPreferenceStore();
- String string = store.getString( PREF_STATE_MEMENTO );
- if ( string.length() > 0 ) {
- ByteArrayInputStream bin = new ByteArrayInputStream( string.getBytes() );
- InputStreamReader reader = new InputStreamReader( bin );
- try {
- XMLMemento stateMemento = XMLMemento.createReadRoot( reader );
- setMemento( stateMemento );
- }
- catch( WorkbenchException e ) {
- }
- finally {
- try {
- reader.close();
- bin.close();
- }
- catch( IOException e ) {
- }
- }
- }
-
- IMemento mem = getMemento();
- setLastSashWeights( DEFAULT_SASH_WEIGHTS );
- setLastSashWeights( DEFAULT_SASH_WEIGHTS );
- if ( mem != null ) {
- Integer sw = mem.getInteger( SASH_VIEW_PART );
- if ( sw != null ) {
- int view = sw.intValue();
- sw = mem.getInteger( SASH_DETAILS_PART );
- if ( sw != null ) {
- int details = sw.intValue();
- if ( view > -1 & details > -1 ) {
- setLastSashWeights( new int[] { view, details } );
- }
- }
- }
- }
- site.getWorkbenchWindow().addPerspectiveListener( this );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.AbstractDebugView#getDefaultControl()
- */
- protected Control getDefaultControl() {
- return getSashForm();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.AbstractDebugView#becomesHidden()
- */
- protected void becomesHidden() {
- setViewerInput( new StructuredSelection() );
- super.becomesHidden();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.AbstractDebugView#becomesVisible()
- */
- protected void becomesVisible() {
- super.becomesVisible();
- ISelection selection = DebugUITools.getDebugContextManager().getContextService( getSite().getWorkbenchWindow() ).getActiveContext();
- contextActivated( selection );
- }
-
- private void computeDetail( final Object element ) {
- if ( element != null ) {
- DebugPlugin.getDefault().asyncExec( new Runnable() {
-
- public void run() {
- detailComputed( element, doComputeDetail( element ) );
- }
- } );
- }
- }
-
- protected String doComputeDetail( Object element ) {
- if ( element instanceof ICModule ) {
- return getModuleDetail( ((ICModule)element) );
- }
- if ( element instanceof ICElement ) {
- return element.toString();
- }
- return ""; //$NON-NLS-1$
- }
-
- private String getModuleDetail( ICModule module ) {
- StringBuffer sb = new StringBuffer();
-
- // Type
- String type = null;
- switch( module.getType() ) {
- case ICModule.EXECUTABLE:
- type = ModulesMessages.getString( "ModulesView.1" ); //$NON-NLS-1$
- break;
- case ICModule.SHARED_LIBRARY:
- type = ModulesMessages.getString( "ModulesView.2" ); //$NON-NLS-1$
- break;
- }
- if ( type != null ) {
- sb.append( ModulesMessages.getString( "ModulesView.3" ) ); //$NON-NLS-1$
- sb.append( type );
- sb.append( '\n' );
- }
-
- // Symbols flag
- sb.append( ModulesMessages.getString( "ModulesView.4" ) ); //$NON-NLS-1$
- sb.append( ( module.areSymbolsLoaded() ) ? ModulesMessages.getString( "ModulesView.5" ) : ModulesMessages.getString( "ModulesView.6" ) ); //$NON-NLS-1$ //$NON-NLS-2$
- sb.append( '\n' );
-
- // Symbols file
- sb.append( ModulesMessages.getString( "ModulesView.7" ) ); //$NON-NLS-1$
- sb.append( module.getSymbolsFileName().toOSString() );
- sb.append( '\n' );
-
- // CPU
- String cpu = module.getCPU();
- if ( cpu != null ) {
- sb.append( ModulesMessages.getString( "ModulesView.8" ) ); //$NON-NLS-1$
- sb.append( cpu );
- sb.append( '\n' );
- }
-
- // Base address
- IAddress baseAddress = module.getBaseAddress();
- if ( !baseAddress.isZero() ) {
- sb.append( ModulesMessages.getString( "ModulesView.9" ) ); //$NON-NLS-1$
- sb.append( baseAddress.toHexAddressString() );
- sb.append( '\n' );
- }
-
- // Size
- long size = module.getSize();
- if ( size > 0 ) {
- sb.append( ModulesMessages.getString( "ModulesView.10" ) ); //$NON-NLS-1$
- sb.append( size );
- sb.append( '\n' );
- }
-
- return sb.toString();
- }
-
- protected void detailComputed( Object element, final String result ) {
- Runnable runnable = new Runnable() {
-
- public void run() {
- if ( isAvailable() ) {
- getDetailDocument().set( result );
- }
- }
- };
- asyncExec( runnable );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- DebugUITools.getDebugContextManager().getContextService( getSite().getWorkbenchWindow() ).removeDebugContextListener( this );
- getSite().getWorkbenchWindow().removePerspectiveListener( this );
- CDebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener( this );
- JFaceResources.getFontRegistry().removeListener( this );
- TreeModelViewer viewer = getModulesViewer();
- if ( viewer != null ) {
- viewer.removeModelChangedListener( this );
- viewer.removeViewerUpdateListener( this );
- }
- if ( viewer != null ) {
- getDetailDocument().removeDocumentListener( getDetailDocumentListener() );
- }
- disposeImageCache();
- super.dispose();
- }
-
- protected Image getImage( ImageDescriptor desc ) {
- Image image = (Image)fImageCache.get( desc );
- if ( image == null ) {
- image = desc.createImage();
- fImageCache.put( desc, image );
- }
- return image;
- }
-
- private void disposeImageCache() {
- Iterator it = fImageCache.values().iterator();
- while( it.hasNext() ) {
- ((Image)it.next()).dispose();
- }
- fImageCache.clear();
- }
-
- public void contextActivated( ISelection selection ) {
- if ( !isAvailable() || !isVisible() ) {
- return;
- }
- if ( selection instanceof IStructuredSelection ) {
- Object source = ((IStructuredSelection)selection).getFirstElement();
- fInputService.resolveViewerInput(source);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.contexts.IDebugContextListener#debugContextChanged(org.eclipse.debug.ui.contexts.DebugContextEvent)
- */
- public void debugContextChanged( DebugContextEvent event ) {
- if ( (event.getFlags() & DebugContextEvent.ACTIVATED) > 0 ) {
- contextActivated( event.getContext() );
- }
- }
-
- private IPresentationContext getPresentationContext() {
- return new ModulesViewPresentationContext( CDebugUIPlugin.getDebugModelPresentation() );
- }
-
- private void clearDetails() {
- getDetailDocument().set( "" ); //$NON-NLS-1$
- }
-
- public void perspectiveActivated( IWorkbenchPage page, IPerspectiveDescriptor perspective ) {
- }
-
- public void perspectiveChanged( IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId ) {
- if ( changeId.equals( IWorkbenchPage.CHANGE_RESET ) ) {
- setLastSashWeights( DEFAULT_SASH_WEIGHTS );
- fSashForm.setWeights( DEFAULT_SASH_WEIGHTS );
- }
- }
-
- public void modelChanged( IModelDelta delta, IModelProxy proxy ) {
- }
-
- public void updateComplete( IViewerUpdate update ) {
- IStatus status = update.getStatus();
- if ( !update.isCanceled() ) {
- if ( status != null && status.getCode() != IStatus.OK ) {
- showMessage( status.getMessage() );
- }
- else {
- showViewer();
- }
- }
- }
-
- public void updateStarted( IViewerUpdate update ) {
- }
-
- public void viewerUpdatesBegin() {
- }
-
- public void viewerUpdatesComplete() {
- }
-
- protected void clearStatusLine() {
- IStatusLineManager manager = getViewSite().getActionBars().getStatusLineManager();
- manager.setErrorMessage( null );
- manager.setMessage( null );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#partDeactivated(org.eclipse.ui.IWorkbenchPart)
- */
- public void partDeactivated( IWorkbenchPart part ) {
- String id = part.getSite().getId();
- if ( id.equals( getSite().getId() ) ) {
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- OutputStreamWriter writer = new OutputStreamWriter( bout );
-
- try {
- XMLMemento memento = XMLMemento.createWriteRoot( "ModulesViewMemento" ); //$NON-NLS-1$
- saveViewerState( memento );
- memento.save( writer );
-
- IPreferenceStore store = CDebugUIPlugin.getDefault().getPreferenceStore();
- String xmlString = bout.toString();
- store.putValue( PREF_STATE_MEMENTO, xmlString );
- }
- catch( IOException e ) {
- }
- finally {
- try {
- writer.close();
- bout.close();
- }
- catch( IOException e ) {
- }
- }
- }
- super.partDeactivated( part );
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/ICDebugUIConstants.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/ICDebugUIConstants.java
index b9324194a8..6988a5a939 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/ICDebugUIConstants.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/ICDebugUIConstants.java
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
+ * Wind River Systems - adapted to work with platform Modules view (bug 210558)
*******************************************************************************/
package org.eclipse.cdt.debug.ui;
@@ -32,16 +33,6 @@ public interface ICDebugUIConstants {
public static final String ID_DISASSEMBLY_VIEW = PREFIX + "DisassemblyView"; //$NON-NLS-1$
/**
- * Modules view identifier (value <code>"org.eclipse.cdt.debug.ui.ModulesView"</code>).
- */
- public static final String ID_MODULES_VIEW = PREFIX + "ModulesView"; //$NON-NLS-1$
-
- /**
- * Id for the popup menu associated with the variables (tree viewer) part of the VariableView
- */
- public static final String MODULES_VIEW_MODULES_ID = PREFIX + "ModulesView.modules"; //$NON-NLS-1$
-
- /**
* Id for the popup menu associated with the detail (text viewer) part of the Modules view
*/
public static final String MODULES_VIEW_DETAIL_ID = PREFIX + "ModulesView.detail"; //$NON-NLS-1$

Back to the top