Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikhail Khodjaiants2007-11-02 17:33:17 -0400
committerMikhail Khodjaiants2007-11-02 17:33:17 -0400
commitdb41842f235322f1a6b4a336f9894ea49491a829 (patch)
tree955dac7aa97bf90cdc3547ed747619959d6b8f47
parent8b676319befac457aa5cc960962fdfae17338369 (diff)
downloadorg.eclipse.cdt-db41842f235322f1a6b4a336f9894ea49491a829.tar.gz
org.eclipse.cdt-db41842f235322f1a6b4a336f9894ea49491a829.tar.xz
org.eclipse.cdt-db41842f235322f1a6b4a336f9894ea49491a829.zip
Bug 207094: Modules view doesn't compile against platform 3.4M2. Applied patch from Pawel Piech (Wind River).
-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/views/modules/ModulesView.java53
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModulesViewTreeContentProvider.java90
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModulesViewTreeViewer.java34
4 files changed, 49 insertions, 134 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml
index 6b8531adcf8..c2e3dc44562 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml
@@ -1206,6 +1206,12 @@
<adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
</factory>
<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.IElementContentProvider"/>
+ <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory"/>
+ </factory>
+ <factory
adaptableType="org.eclipse.cdt.debug.core.model.ICModule"
class="org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementAdapterFactory">
<adapter
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 146d50066f8..33db2ec06da 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
@@ -7,6 +7,7 @@
*
* 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;
@@ -20,27 +21,33 @@ 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.ConfigureColumnsAction;
import org.eclipse.cdt.debug.internal.ui.actions.ToggleDetailPaneAction;
-import org.eclipse.cdt.debug.internal.ui.actions.ToggleShowColumnsAction;
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;
@@ -196,6 +203,24 @@ public class ModulesView extends AbstractDebugView implements IDebugContextListe
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.getViewerInput());
+ }
+ }
+ };
+
+
/* (non-Javadoc)
* @see org.eclipse.debug.ui.AbstractDebugView#createViewer(org.eclipse.swt.widgets.Composite)
*/
@@ -208,6 +233,7 @@ public class ModulesView extends AbstractDebugView implements IDebugContextListe
JFaceResources.getFontRegistry().addListener( this );
TreeModelViewer viewer = createTreeViewer( getSashForm() );
+ fInputService = new ViewerInputService(fInputRequestor, viewer.getPresentationContext());
createDetailsViewer();
getSashForm().setMaximizedControl( viewer.getControl() );
@@ -285,25 +311,32 @@ public class ModulesView extends AbstractDebugView implements IDebugContextListe
}
protected void setViewerInput( Object context ) {
-
- if ( context == null ) {
+ 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 && context == null ) {
+ if ( current == null && input == null ) {
return;
}
- if ( current != null && current.equals( context ) ) {
+ if ( current != null && current.equals( input ) ) {
return;
}
showViewer();
- getViewer().setInput( context );
+ getViewer().setInput( input );
}
protected TreeModelViewer createTreeViewer( Composite parent ) {
// add tree viewer
- final TreeModelViewer modulesViewer = new ModulesViewTreeViewer( parent, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.VIRTUAL | SWT.FULL_SELECTION, getPresentationContext() );
+ 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)
@@ -883,9 +916,9 @@ public class ModulesView extends AbstractDebugView implements IDebugContextListe
return;
}
if ( selection instanceof IStructuredSelection ) {
- setViewerInput( ((IStructuredSelection)selection).getFirstElement() );
+ Object source = ((IStructuredSelection)selection).getFirstElement();
+ fInputService.resolveViewerInput(source);
}
- showViewer();
}
/* (non-Javadoc)
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModulesViewTreeContentProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModulesViewTreeContentProvider.java
deleted file mode 100644
index 2b7453004b5..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModulesViewTreeContentProvider.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 ARM Limited 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 Limited - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.views.modules;
-
-import org.eclipse.cdt.debug.core.model.ICDebugElement;
-import org.eclipse.cdt.debug.core.model.IModuleRetrieval;
-import org.eclipse.cdt.debug.internal.ui.elements.adapters.CDebugElementAdapterFactory;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory;
-
-/**
- * org.eclipse.cdt.debug.internal.ui.views.modules.ModulesViewTreeContentProvider:
- * //TODO Add description.
- */
-public class ModulesViewTreeContentProvider extends TreeModelContentProvider {
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.viewers.model.ModelContentProvider#getContentAdapter(java.lang.Object)
- */
- protected IElementContentProvider getContentAdapter( Object element ) {
- IElementContentProvider adapter = null;
- if ( !(element instanceof ICDebugElement) ) {
- if ( element instanceof IElementContentProvider ) {
- adapter = (IElementContentProvider)element;
- }
- else if ( element instanceof IAdaptable ) {
- IAdaptable adaptable = (IAdaptable)element;
- adapter = (IElementContentProvider)adaptable.getAdapter( IElementContentProvider.class );
- }
- }
- else {
- IModuleRetrieval moduleRetrieval = (IModuleRetrieval)((ICDebugElement)element).getAdapter( IModuleRetrieval.class );
- if ( moduleRetrieval != null ) {
- adapter = (IElementContentProvider)new CDebugElementAdapterFactory().getAdapter( moduleRetrieval, IElementContentProvider.class );
- }
- }
- return adapter;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.viewers.model.ModelContentProvider#getModelProxyFactoryAdapter(java.lang.Object)
- */
- protected IModelProxyFactory getModelProxyFactoryAdapter( Object element ) {
- IModelProxyFactory adapter = null;
- if ( !(element instanceof ICDebugElement) ) {
- if ( element instanceof IModelProxyFactory ) {
- adapter = (IModelProxyFactory)element;
- }
- else if ( element instanceof IAdaptable ) {
- IAdaptable adaptable = (IAdaptable)element;
- adapter = (IModelProxyFactory)adaptable.getAdapter( IModelProxyFactory.class );
- }
- }
- else {
- IModuleRetrieval moduleRetrieval = (IModuleRetrieval)((ICDebugElement)element).getAdapter( IModuleRetrieval.class );
- if ( moduleRetrieval != null ) {
- adapter = (IModelProxyFactory)new CDebugElementAdapterFactory().getAdapter( moduleRetrieval, IModelProxyFactory.class );
- }
- }
- return adapter;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.viewers.model.ModelContentProvider#getViewerStateAdapter(java.lang.Object)
- */
- protected IElementMementoProvider getViewerStateAdapter( Object element ) {
- IElementMementoProvider adapter = null;
- if ( !(element instanceof ICDebugElement) ) {
- adapter = super.getViewerStateAdapter( element );
- }
- else {
- IModuleRetrieval moduleRetrieval = (IModuleRetrieval)((ICDebugElement)element).getAdapter( IModuleRetrieval.class );
- if ( moduleRetrieval != null ) {
- adapter = (IElementMementoProvider)new CDebugElementAdapterFactory().getAdapter( moduleRetrieval, IElementMementoProvider.class );
- }
- }
- return adapter;
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModulesViewTreeViewer.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModulesViewTreeViewer.java
deleted file mode 100644
index 8f3fc23d2ce..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/modules/ModulesViewTreeViewer.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 ARM Limited 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 Limited - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.views.modules;
-
-import org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * org.eclipse.cdt.debug.internal.ui.views.modules.ModulesViewTreeViewer:
- * //TODO Add description.
- */
-public class ModulesViewTreeViewer extends TreeModelViewer {
-
- public ModulesViewTreeViewer( Composite parent, int style, IPresentationContext context ) {
- super( parent, style, context );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.viewers.model.InternalTreeModelViewer#createContentProvider()
- */
- protected TreeModelContentProvider createContentProvider() {
- return new ModulesViewTreeContentProvider();
- }
-}

Back to the top