mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 18:56:02 +02:00
Bug 207094: Modules view doesn't compile against platform 3.4M2. Applied patch from Pawel Piech (Wind River).
This commit is contained in:
parent
8b676319be
commit
db41842f23
4 changed files with 48 additions and 133 deletions
|
@ -1205,6 +1205,12 @@
|
|||
class="org.eclipse.cdt.debug.internal.ui.sourcelookup.SourceContainerAdapterFactory">
|
||||
<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">
|
||||
|
|
|
@ -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 ) {
|
||||
Object input = context;
|
||||
|
||||
if ( context == null ) {
|
||||
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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue