Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorMikhail Khodjaiants2007-02-12 15:53:41 +0000
committerMikhail Khodjaiants2007-02-12 15:53:41 +0000
commit603cc6b75b574866846369c1aa5264e898088b22 (patch)
treeb5a6ea40692421acc99c74ad69e7d7ae14cc012a /debug
parenta1966c4e4665e96ce0a54f7553d2124c9ee18933 (diff)
downloadorg.eclipse.cdt-603cc6b75b574866846369c1aa5264e898088b22.tar.gz
org.eclipse.cdt-603cc6b75b574866846369c1aa5264e898088b22.tar.xz
org.eclipse.cdt-603cc6b75b574866846369c1aa5264e898088b22.zip
Bug 173792: Modules view needs to catch up with 3.3M5. Added ModuleLabelProvider.
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.ui/plugin.xml6
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/Startup.java28
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java12
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleLabelProvider.java82
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModulesView.java17
5 files changed, 144 insertions, 1 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml
index 6e261973f58..4cf8bf83319 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml
@@ -1260,5 +1260,11 @@
id="org.eclipse.cdt.debug.internal.ui.sourcelookup.CSourceNotFoundEditor">
</editor>
</extension>
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup
+ class="org.eclipse.cdt.debug.internal.ui.Startup">
+ </startup>
+ </extension>
</plugin>
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/Startup.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/Startup.java
new file mode 100644
index 00000000000..8d29be7af56
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/Startup.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007 ARM 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:
+ * ARM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui;
+
+import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.ui.IStartup;
+
+/**
+ * Forces the org.eclipse.cdt.debug.ui plugin to be loaded. The Modules view requires
+ * CElementAdapterFactory to be registered to display the labels and images of ICElement's.
+ */
+public class Startup implements IStartup {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IStartup#earlyStartup()
+ */
+ public void earlyStartup() {
+ CUIPlugin.getDefault();
+ }
+}
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 9b895ba784f..1931722717d 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
@@ -14,9 +14,11 @@ import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.debug.core.model.ICModule;
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.ModuleLabelProvider;
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.IElementLabelProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactoryAdapter;
/**
@@ -24,6 +26,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactor
*/
public class CDebugElementAdapterFactory implements IAdapterFactory {
+ private static IElementLabelProvider fgModuleLabelProvider = new ModuleLabelProvider();
private static IElementContentProvider fgModuleContentProvider = new ModuleContentProvider();
private static IModelProxyFactoryAdapter fgModuleProxyFactory = new ModuleProxyFactory();
@@ -35,6 +38,14 @@ public class CDebugElementAdapterFactory implements IAdapterFactory {
if ( adapterType.isInstance( adaptableObject ) ) {
return adaptableObject;
}
+ if ( adapterType.equals( IElementLabelProvider.class ) ) {
+ if ( adaptableObject instanceof ICModule ) {
+ return fgModuleLabelProvider;
+ }
+ if ( adaptableObject instanceof ICElement ) {
+ return fgModuleLabelProvider;
+ }
+ }
if ( adapterType.equals( IElementContentProvider.class ) ) {
if ( adaptableObject instanceof IModuleRetrieval ) {
return fgModuleContentProvider;
@@ -59,6 +70,7 @@ public class CDebugElementAdapterFactory implements IAdapterFactory {
*/
public Class[] getAdapterList() {
return new Class[] {
+ IElementLabelProvider.class,
IElementContentProvider.class,
IModelProxyFactoryAdapter.class
};
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
new file mode 100644
index 00000000000..9ee1826bbb0
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModuleLabelProvider.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2007 ARM 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:
+ * ARM - Initial API and implementation
+ *******************************************************************************/
+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.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider;
+import org.eclipse.cdt.ui.CElementLabelProvider;
+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.launch.ImageImageDescriptor;
+import org.eclipse.debug.ui.IDebugModelPresentation;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+
+/**
+ * org.eclipse.cdt.debug.internal.ui.views.modules.CElementLabelProvider:
+ * //TODO Add description.
+ */
+public class ModuleLabelProvider extends ElementLabelProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.ElementLabelProvider#getLabel(org.eclipse.jface.viewers.TreePath, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.String)
+ */
+ protected String getLabel( TreePath elementPath, IPresentationContext presentationContext, String columnId ) throws CoreException {
+ Object element = elementPath.getLastSegment();
+ if ( element instanceof ICModule && presentationContext instanceof ModulesViewPresentationContext ) {
+ IDebugModelPresentation presentation = ((ModulesViewPresentationContext)presentationContext).getModelPresentation();
+ return presentation.getText( element );
+ }
+ if ( element instanceof IAdaptable ) {
+ IWorkbenchAdapter adapter = (IWorkbenchAdapter)(((IAdaptable)element).getAdapter( IWorkbenchAdapter.class ));
+ if ( adapter != null )
+ return adapter.getLabel( element );
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.ElementLabelProvider#getImageDescriptor(org.eclipse.jface.viewers.TreePath, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.String)
+ */
+ protected ImageDescriptor getImageDescriptor( TreePath elementPath, IPresentationContext presentationContext, String columnId ) throws CoreException {
+ Object element = elementPath.getLastSegment();
+ if ( element instanceof ICModule ) {
+ ICModule module = (ICModule)element;
+ switch( module.getType() ) {
+ case ICModule.EXECUTABLE:
+ if ( module.areSymbolsLoaded() ) {
+ return CDebugImages.DESC_OBJS_EXECUTABLE_WITH_SYMBOLS;
+ }
+ return CDebugImages.DESC_OBJS_EXECUTABLE;
+ case ICModule.SHARED_LIBRARY:
+ if ( module.areSymbolsLoaded() ) {
+ return CDebugImages.DESC_OBJS_SHARED_LIBRARY_WITH_SYMBOLS;
+ }
+ return CDebugImages.DESC_OBJS_SHARED_LIBRARY;
+ }
+ }
+ if ( element instanceof ICElement ) {
+ IWorkbenchAdapter adapter = (IWorkbenchAdapter)(((IAdaptable)element).getAdapter( IWorkbenchAdapter.class ));
+ if ( adapter != null )
+ return adapter.getImageDescriptor( element );
+ }
+ return super.getImageDescriptor( elementPath, presentationContext, columnId );
+ }
+}
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
index a4fd3939b74..1acd54816f7 100644
--- 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
@@ -40,6 +40,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationConte
import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
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;
@@ -102,6 +103,20 @@ import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
*/
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.
@@ -881,7 +896,7 @@ public class ModulesView extends AbstractDebugView implements IDebugContextListe
}
private IPresentationContext getPresentationContext() {
- return new PresentationContext( ICDebugUIConstants.ID_MODULES_VIEW );
+ return new ModulesViewPresentationContext( CDebugUIPlugin.getDebugModelPresentation() );
}
private void clearDetails() {

Back to the top