1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-05 08:05:24 +02:00

[189711] isRemote method for ISystemViewElementAdapter

This commit is contained in:
David McKnight 2007-05-29 18:17:06 +00:00
parent a18ca0d288
commit be3fbd90d6
17 changed files with 181 additions and 21 deletions

View file

@ -857,32 +857,31 @@ public class SystemView extends SafeTreeViewer
// GO INTO ACTION... // GO INTO ACTION...
// OPEN IN NEW WINDOW ACTION... // OPEN IN NEW WINDOW ACTION...
if (fromSystemViewPart) { if (fromSystemViewPart) {
GoIntoAction goIntoAction = getGoIntoAction();
boolean singleSelection = selection.size() == 1; Object selectedObject = selection.getFirstElement();
goIntoAction.setEnabled(singleSelection); ISystemViewElementAdapter adapter = getViewAdapter(selectedObject);
boolean selectionHasChildren = false; if (!selectionIsRemoteObject)
if (singleSelection)
{ {
// dkm - first find out if the selection will have children GoIntoAction goIntoAction = getGoIntoAction();
// only add this action if there are children boolean singleSelection = selection.size() == 1;
Object selectedObject = selection.getFirstElement(); goIntoAction.setEnabled(singleSelection);
ISystemViewElementAdapter adapter = getViewAdapter(selectedObject); if (singleSelection) {
if (adapter != null) // dkm - first find out if the selection will have children
{ // only add this action if there are children
if (adapter.hasChildren((IAdaptable)selectedObject)) if (adapter.hasChildren((IAdaptable)selectedObject))
{ {
selectionHasChildren = true;
menu.appendToGroup(ISystemContextMenuConstants.GROUP_GOTO, goIntoAction); menu.appendToGroup(ISystemContextMenuConstants.GROUP_GOTO, goIntoAction);
} }
} }
}
if (showOpenViewActions()) { if (showOpenViewActions()) {
SystemOpenExplorerPerspectiveAction opa = getOpenToPerspectiveAction(); SystemOpenExplorerPerspectiveAction opa = getOpenToPerspectiveAction();
opa.setSelection(selection); opa.setSelection(selection);
menu.appendToGroup(opa.getContextMenuGroup(), opa); menu.appendToGroup(opa.getContextMenuGroup(), opa);
}
} }
if (showGenericShowInTableAction()) { if (showGenericShowInTableAction()) {
SystemShowInTableAction showInTableAction = getShowInTableAction(); SystemShowInTableAction showInTableAction = getShowInTableAction();
showInTableAction.setSelection(selection); showInTableAction.setSelection(selection);
@ -1325,6 +1324,11 @@ public class SystemView extends SafeTreeViewer
} }
} }
protected IRemoteObjectIdentifier getRemoteObjectIdentifier(Object o)
{
return (IRemoteObjectIdentifier)((IAdaptable)o).getAdapter(IRemoteObjectIdentifier.class);
}
/** /**
* Returns the implementation of IRemoteObjectIdentifier for the given * Returns the implementation of IRemoteObjectIdentifier for the given
* object. Returns null if this object does not adaptable to this. * object. Returns null if this object does not adaptable to this.
@ -2112,8 +2116,7 @@ public class SystemView extends SafeTreeViewer
else else
{ {
// only do this if the object is "remote" // only do this if the object is "remote"
Object remoteAdapter = getRemoteAdapter(src); if (adapter.isRemote(src))
if (remoteAdapter != null)
{ {
// get up-to-date version of the container (need to make sure it still exists) // get up-to-date version of the container (need to make sure it still exists)
if (ss == null) if (ss == null)
@ -4677,7 +4680,7 @@ public class SystemView extends SafeTreeViewer
if (selectionEnableRenameAction) selectionEnableRenameAction = selectionShowRenameAction && adapter.canRename(element); if (selectionEnableRenameAction) selectionEnableRenameAction = selectionShowRenameAction && adapter.canRename(element);
if (selectionIsRemoteObject) selectionIsRemoteObject = (getRemoteAdapter(element) != null); if (selectionIsRemoteObject) selectionIsRemoteObject = adapter.isRemote(element);
if (selectionIsRemoteObject && !selectionFlagsUpdated) { if (selectionIsRemoteObject && !selectionFlagsUpdated) {
ISubSystem srcSubSystem = adapter.getSubSystem(element); ISubSystem srcSubSystem = adapter.getSubSystem(element);

View file

@ -825,5 +825,15 @@ public class SystemViewConnectionAdapter
{ {
return ISystemMementoConstants.MEMENTO_KEY_CONNECTION; return ISystemMementoConstants.MEMENTO_KEY_CONNECTION;
} }
/**
* This is a local RSE artifact so returning false
*
* @param element the object to check
* @return false since this is not remote
*/
public boolean isRemote(Object element) {
return false;
}
} }

View file

@ -67,6 +67,8 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
*/ */
public class SystemViewFilterAdapter extends AbstractSystemViewAdapter public class SystemViewFilterAdapter extends AbstractSystemViewAdapter
{ {
//private static String translatedFilterString = null; //private static String translatedFilterString = null;
// ------------------- // -------------------
// property descriptors // property descriptors
@ -576,4 +578,14 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter
} }
return result; return result;
} }
/**
* This is a local RSE artifact so returning false
*
* @param element the object to check
* @return false since this is not remote
*/
public boolean isRemote(Object element) {
return false;
}
} }

View file

@ -290,4 +290,14 @@ public class SystemViewFilterPoolAdapter extends AbstractSystemViewAdapter
return (mgrName + "." + newName).toUpperCase(); //$NON-NLS-1$ return (mgrName + "." + newName).toUpperCase(); //$NON-NLS-1$
} }
/**
* This is a local RSE artifact so returning false
*
* @param element the object to check
* @return false since this is not remote
*/
public boolean isRemote(Object element) {
return false;
}
} }

View file

@ -389,4 +389,13 @@ public class SystemViewFilterPoolReferenceAdapter
return ISystemMementoConstants.MEMENTO_KEY_FILTERPOOLREFERENCE; return ISystemMementoConstants.MEMENTO_KEY_FILTERPOOLREFERENCE;
} }
/**
* This is a local RSE artifact so returning false
*
* @param element the object to check
* @return false since this is not remote
*/
public boolean isRemote(Object element) {
return false;
}
} }

View file

@ -995,4 +995,14 @@ public class SystemViewFilterReferenceAdapter
{ {
return subSys.getSubSystemConfiguration().supportsDeferredQueries(); return subSys.getSubSystemConfiguration().supportsDeferredQueries();
} }
/**
* This is a local RSE artifact so returning false
*
* @param element the object to check
* @return false since this is not remote
*/
public boolean isRemote(Object element) {
return false;
}
} }

View file

@ -274,4 +274,14 @@ public class SystemViewFilterStringAdapter extends AbstractSystemViewAdapter
{ {
return false; return false;
} }
/**
* This is a local RSE artifact so returning false
*
* @param element the object to check
* @return false since this is not remote
*/
public boolean isRemote(Object element) {
return false;
}
} }

View file

@ -196,5 +196,15 @@ public class SystemViewMessageAdapter
{ {
return false; return false;
} }
/**
* This is a local RSE artifact so returning false
*
* @param element the object to check
* @return false since this is not remote
*/
public boolean isRemote(Object element) {
return false;
}
} }

View file

@ -214,4 +214,14 @@ public class SystemViewPromptableAdapter
{ {
return false; return false;
} }
/**
* This is a local RSE artifact so returning false
*
* @param element the object to check
* @return false since this is not remote
*/
public boolean isRemote(Object element) {
return false;
}
} }

View file

@ -228,4 +228,14 @@ public class SystemViewRootInputAdapter extends AbstractSystemViewAdapter
return getType(element); return getType(element);
//return "root"; //return "root";
} }
/**
* This is a local RSE artifact so returning false
*
* @param element the object to check
* @return false since this is not remote
*/
public boolean isRemote(Object element) {
return false;
}
} }

View file

@ -278,4 +278,13 @@ public class SystemViewScratchpadAdapter extends AbstractSystemViewAdapter imple
return false; return false;
} }
/**
* This is a local RSE artifact so returning false
*
* @param element the object to check
* @return false since this is not remote
*/
public boolean isRemote(Object element) {
return false;
}
} }

View file

@ -755,4 +755,13 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
return ISystemMementoConstants.MEMENTO_KEY_SUBSYSTEM; return ISystemMementoConstants.MEMENTO_KEY_SUBSYSTEM;
} }
/**
* This is a local RSE artifact so returning false
*
* @param element the object to check
* @return false since this is not remote
*/
public boolean isRemote(Object element) {
return false;
}
} }

View file

@ -273,4 +273,13 @@ public class SystemTeamViewCategoryAdapter
return category.getProfile().getName() + "." + category.getLabel(); //$NON-NLS-1$ return category.getProfile().getName() + "." + category.getLabel(); //$NON-NLS-1$
} }
/**
* This is a local RSE artifact so returning false
*
* @param element the object to check
* @return false since this is not remote
*/
public boolean isRemote(Object element) {
return false;
}
} }

View file

@ -415,5 +415,15 @@ public class SystemTeamViewProfileAdapter
{ {
return ISystemMementoConstants.MEMENTO_KEY_PROFILE; return ISystemMementoConstants.MEMENTO_KEY_PROFILE;
} }
/**
* This is a local RSE artifact so returning false
*
* @param element the object to check
* @return false since this is not remote
*/
public boolean isRemote(Object element) {
return false;
}
} }

View file

@ -305,4 +305,13 @@ public class SystemTeamViewSubSystemConfigurationAdapter
return factory.getProfile().getName() + "." + factory.getParentCategory().getLabel() + "." + factory.getLabel(); //$NON-NLS-1$ //$NON-NLS-2$ return factory.getProfile().getName() + "." + factory.getParentCategory().getLabel() + "." + factory.getLabel(); //$NON-NLS-1$ //$NON-NLS-2$
} }
/**
* This is a local RSE artifact so returning false
*
* @param element the object to check
* @return false since this is not remote
*/
public boolean isRemote(Object element) {
return false;
}
} }

View file

@ -1357,6 +1357,16 @@ public abstract class AbstractSystemViewAdapter implements ISystemViewElementAda
{ {
return (element instanceof ISystemPromptableObject); return (element instanceof ISystemPromptableObject);
} }
/**
* <i><b>Overridable</b> by subclasses, but usually is not.</i><br>
* Return true if this object is remote. In this case, the default is true.
*/
public boolean isRemote(Object element)
{
return true;
}
/** /**
* <i><b>Overridable</b> by subclasses, but usually is not.</i><br> * <i><b>Overridable</b> by subclasses, but usually is not.</i><br>
* Selection has changed in the Remote Systems view. Empty by default, but override if you need * Selection has changed in the Remote Systems view. Empty by default, but override if you need

View file

@ -320,4 +320,14 @@ public class TestSubSystemNodeAdapter extends AbstractSystemViewAdapter
public boolean showRename(Object element) { public boolean showRename(Object element) {
return isTestSubSystemNode(element); return isTestSubSystemNode(element);
} }
/**
* This is a local RSE artifact so returning false
*
* @param element the object to check
* @return false since this is not remote
*/
public boolean isRemote(Object element) {
return false;
}
} }