mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-30 20:35:38 +02:00
ICElements except ITranslationUnit, ICFolder, ... do not adapt to IResource any more.
This commit is contained in:
parent
140137bb62
commit
697921c9b4
3 changed files with 18 additions and 22 deletions
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.model;
|
||||
|
@ -29,7 +30,6 @@ import org.eclipse.cdt.core.model.ISourceRange;
|
|||
import org.eclipse.cdt.core.model.ISourceReference;
|
||||
import org.eclipse.cdt.core.model.ISourceRoot;
|
||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.ResourceAttributes;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -57,26 +57,14 @@ public abstract class CElement extends PlatformObject implements ICElement {
|
|||
* @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
|
||||
*/
|
||||
public Object getAdapter(Class adapter) {
|
||||
if(adapter == IFile.class)
|
||||
{
|
||||
IResource resource = getUnderlyingResource();
|
||||
if(resource instanceof IFile)
|
||||
{
|
||||
return (IFile) resource;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
// handle all kinds of resources
|
||||
if (IResource.class.isAssignableFrom(adapter)) {
|
||||
IResource r= getResource();
|
||||
if (r != null && adapter.isAssignableFrom(r.getClass())) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
if(adapter == IResource.class)
|
||||
{
|
||||
return getUnderlyingResource();
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.getAdapter(adapter);
|
||||
}
|
||||
return super.getAdapter(adapter);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -174,14 +174,17 @@ public class MainActionGroup extends CViewActionGroup {
|
|||
IStructuredSelection celements = (IStructuredSelection) getCView().getViewer().getSelection();
|
||||
IStructuredSelection resources = SelectionConverter.convertSelectionToResources(celements);
|
||||
|
||||
addNewMenu(menu, resources);
|
||||
|
||||
if (resources.isEmpty()) {
|
||||
menu.add(new Separator(IContextMenuConstants.GROUP_GOTO));
|
||||
menu.add(new Separator(IContextMenuConstants.GROUP_OPEN));
|
||||
menu.add(new Separator(IContextMenuConstants.GROUP_BUILD));
|
||||
menu.add(new Separator(IContextMenuConstants.GROUP_REORGANIZE));
|
||||
menu.add(new Separator("group.private1")); //$NON-NLS-1$
|
||||
importAction.selectionChanged(resources);
|
||||
menu.add(importAction);
|
||||
exportAction.selectionChanged(resources);
|
||||
menu.add(exportAction);
|
||||
menu.add(new Separator("group.private2")); //$NON-NLS-1$
|
||||
//Can be added once support for manually adding external files to index is established
|
||||
/*menu.add(new Separator());
|
||||
menu.add(addToIndexAction);*/
|
||||
|
@ -190,9 +193,14 @@ public class MainActionGroup extends CViewActionGroup {
|
|||
menu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS));
|
||||
menu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS + "-end")); //$NON-NLS-1$
|
||||
menu.add(new Separator());
|
||||
|
||||
openViewActionGroup.fillContextMenu(menu);
|
||||
crefactoringActionGroup.fillContextMenu(menu);
|
||||
return;
|
||||
}
|
||||
|
||||
addNewMenu(menu, resources);
|
||||
|
||||
menu.add(new Separator(IContextMenuConstants.GROUP_GOTO));
|
||||
gotoGroup.fillContextMenu(menu);
|
||||
menu.add(new Separator(IContextMenuConstants.GROUP_OPEN));
|
||||
|
|
|
@ -163,7 +163,7 @@ public class OpenViewActionGroup extends ActionGroup {
|
|||
super.fillContextMenu(menu);
|
||||
// if (!fIsTypeHiararchyViewerOwner)
|
||||
// appendToGroup(menu, fOpenTypeHierarchy);
|
||||
if (!fIsCallHiararchyViewerOwner) {
|
||||
if (!fIsCallHiararchyViewerOwner && fOpenCallHierarchy.isEnabled()) {
|
||||
menu.appendToGroup(fGroupName, fOpenCallHierarchy);
|
||||
}
|
||||
// appendToGroup(menu, fOpenSuperImplementation);
|
||||
|
|
Loading…
Add table
Reference in a new issue