1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-12 10:45:37 +02:00

[cleanup] Simplify ISystemViewElementAdapter class hierarchy

This commit is contained in:
Martin Oberhuber 2009-01-26 11:07:12 +00:00
parent 843464fe69
commit 35924fe422
4 changed files with 155 additions and 157 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2002, 2008 IBM Corporation and others. * Copyright (c) 2002, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -200,7 +200,7 @@ import com.ibm.icu.text.NumberFormat;
*/ */
public class SystemViewRemoteFileAdapter public class SystemViewRemoteFileAdapter
extends AbstractSystemViewAdapter extends AbstractSystemViewAdapter
implements ISystemViewElementAdapter, ISystemRemoteElementAdapter implements ISystemRemoteElementAdapter
{ {
private String xlatedSize = null; private String xlatedSize = null;
@ -319,7 +319,7 @@ public class SystemViewRemoteFileAdapter
boolean supportsSearch = true; boolean supportsSearch = true;
boolean supportsArchiveManagement = false; boolean supportsArchiveManagement = false;
boolean offline = false; boolean offline = false;
// perf improvement... phil // perf improvement... phil
Object firstSelection = selection.getFirstElement(); Object firstSelection = selection.getFirstElement();
IRemoteFile firstFile = null; IRemoteFile firstFile = null;
@ -329,9 +329,9 @@ public class SystemViewRemoteFileAdapter
elementType = firstFile.isDirectory() || firstFile.isRoot() ? 1 : 0; elementType = firstFile.isDirectory() || firstFile.isRoot() ? 1 : 0;
isArchive = firstFile.isArchive(); isArchive = firstFile.isArchive();
canRead = firstFile.canRead(); canRead = firstFile.canRead();
IRemoteFileSubSystem fileSubSystem = firstFile.getParentRemoteFileSubSystem(); IRemoteFileSubSystem fileSubSystem = firstFile.getParentRemoteFileSubSystem();
offline = fileSubSystem.isOffline(); offline = fileSubSystem.isOffline();
supportsSearch = fileSubSystem.getParentRemoteFileSubSystemConfiguration().supportsSearch(); supportsSearch = fileSubSystem.getParentRemoteFileSubSystemConfiguration().supportsSearch();
@ -363,7 +363,7 @@ public class SystemViewRemoteFileAdapter
{ {
if (addNewFile == null) if (addNewFile == null)
{ {
addNewFile = new SystemNewFileAction(shell); addNewFile = new SystemNewFileAction(shell);
} }
addNewFile.setEnabled(canRead && !offline); addNewFile.setEnabled(canRead && !offline);
menu.add(ISystemContextMenuConstants.GROUP_NEW, addNewFile); menu.add(ISystemContextMenuConstants.GROUP_NEW, addNewFile);
@ -372,11 +372,11 @@ public class SystemViewRemoteFileAdapter
{ {
if (addNewFolder == null) if (addNewFolder == null)
{ {
addNewFolder = new SystemNewFolderAction(shell); addNewFolder = new SystemNewFolderAction(shell);
} }
addNewFolder.setEnabled(canRead && !offline); addNewFolder.setEnabled(canRead && !offline);
menu.add(ISystemContextMenuConstants.GROUP_NEW, addNewFolder); menu.add(ISystemContextMenuConstants.GROUP_NEW, addNewFolder);
if (addNewFilter == null) if (addNewFilter == null)
{ {
addNewFilter = new SystemNewFileFilterFromFolderAction(shell); addNewFilter = new SystemNewFileFilterFromFolderAction(shell);
@ -387,7 +387,7 @@ public class SystemViewRemoteFileAdapter
} }
} }
else { else {
// open // open
String label = SystemResources.ACTION_CASCADING_OPEN_LABEL; String label = SystemResources.ACTION_CASCADING_OPEN_LABEL;
String tooltip = SystemResources.ACTION_CASCADING_OPEN_TOOLTIP; String tooltip = SystemResources.ACTION_CASCADING_OPEN_TOOLTIP;
@ -405,7 +405,7 @@ public class SystemViewRemoteFileAdapter
{ {
openWithMenu = new SystemRemoteFileOpenWithMenu(); openWithMenu = new SystemRemoteFileOpenWithMenu();
} }
openWithMenu.updateSelection(selection); openWithMenu.updateSelection(selection);
submenu.add(openWithMenu); submenu.add(openWithMenu);
menu.getMenuManager().appendToGroup(ISystemContextMenuConstants.GROUP_OPENWITH, submenu); menu.getMenuManager().appendToGroup(ISystemContextMenuConstants.GROUP_OPENWITH, submenu);
} }
@ -461,7 +461,7 @@ public class SystemViewRemoteFileAdapter
menu.add(ISystemContextMenuConstants.GROUP_COMPAREWITH, compareFilesAction); menu.add(ISystemContextMenuConstants.GROUP_COMPAREWITH, compareFilesAction);
menu.add(ISystemContextMenuConstants.GROUP_COMPAREWITH, compareEditionAction); menu.add(ISystemContextMenuConstants.GROUP_COMPAREWITH, compareEditionAction);
menu.add(ISystemContextMenuConstants.GROUP_REPLACEWITH, replaceEditionAction); menu.add(ISystemContextMenuConstants.GROUP_REPLACEWITH, replaceEditionAction);
compareFilesAction.setEnabled(canRead && !offline); compareFilesAction.setEnabled(canRead && !offline);
compareEditionAction.setEnabled(canRead && !offline); compareEditionAction.setEnabled(canRead && !offline);
replaceEditionAction.setEnabled(canRead && !offline); replaceEditionAction.setEnabled(canRead && !offline);
@ -471,7 +471,7 @@ public class SystemViewRemoteFileAdapter
if (elementType == 1 || (isArchive && supportsArchiveManagement)) if (elementType == 1 || (isArchive && supportsArchiveManagement))
{ {
menu.add(menuGroup, pasteClipboardAction); menu.add(menuGroup, pasteClipboardAction);
pasteClipboardAction.setEnabled(canRead && !offline); pasteClipboardAction.setEnabled(canRead && !offline);
} }
if (!firstFile.isRoot()) if (!firstFile.isRoot())
{ {
@ -3232,7 +3232,7 @@ public class SystemViewRemoteFileAdapter
names = new String[children.length]; names = new String[children.length];
for (int idx = 0; idx < names.length; idx++) for (int idx = 0; idx < names.length; idx++)
{ {
names[idx] = ((IRemoteFile) children[idx]).getName(); names[idx] = (children[idx]).getName();
} }
return names; return names;

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.rse.processes.ui;singleton:=true Bundle-SymbolicName: org.eclipse.rse.processes.ui;singleton:=true
Bundle-Version: 3.0.1.qualifier Bundle-Version: 3.0.100.qualifier
Bundle-Activator: org.eclipse.rse.internal.processes.ui.ProcessesPlugin Bundle-Activator: org.eclipse.rse.internal.processes.ui.ProcessesPlugin
Bundle-Localization: plugin Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui, Require-Bundle: org.eclipse.ui,

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others. * Copyright (c) 2006, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,10 +7,10 @@
* *
* Initial Contributors: * Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer * The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir, * component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
* *
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
@ -52,7 +52,6 @@ import org.eclipse.rse.ui.SystemMenuManager;
import org.eclipse.rse.ui.actions.SystemCopyToClipboardAction; import org.eclipse.rse.ui.actions.SystemCopyToClipboardAction;
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter; import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
import org.eclipse.swt.dnd.Clipboard; import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.views.properties.IPropertyDescriptor; import org.eclipse.ui.views.properties.IPropertyDescriptor;
@ -60,8 +59,8 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
implements ISystemViewElementAdapter, ISystemRemoteElementAdapter implements ISystemRemoteElementAdapter
{ {
private SystemCopyToClipboardAction copyClipboardAction; private SystemCopyToClipboardAction copyClipboardAction;
public boolean canDrag(Object element) public boolean canDrag(Object element)
{ {
@ -88,15 +87,15 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
private static final Object[] EMPTY_LIST = new Object[0]; private static final Object[] EMPTY_LIST = new Object[0];
private static PropertyDescriptor[] propertyDescriptorArray = null; private static PropertyDescriptor[] propertyDescriptorArray = null;
private SystemKillProcessAction killProcessAction; private SystemKillProcessAction killProcessAction;
public void addActions(SystemMenuManager menu, public void addActions(SystemMenuManager menu,
IStructuredSelection selection, Shell parent, String menuGroup) IStructuredSelection selection, Shell parent, String menuGroup)
{ {
if (killProcessAction == null) if (killProcessAction == null)
killProcessAction = new SystemKillProcessAction(shell); killProcessAction = new SystemKillProcessAction(shell);
menu.add(ISystemContextMenuConstants.GROUP_CHANGE, killProcessAction); menu.add(ISystemContextMenuConstants.GROUP_CHANGE, killProcessAction);
if (copyClipboardAction == null) if (copyClipboardAction == null)
{ {
Clipboard clipboard = RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard(); Clipboard clipboard = RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard();
@ -111,10 +110,10 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
{ {
IRemoteProcess process = (IRemoteProcess)element; IRemoteProcess process = (IRemoteProcess)element;
return process.getParentRemoteProcessSubSystem(); return process.getParentRemoteProcessSubSystem();
} }
return super.getSubSystem(element); return super.getSubSystem(element);
} }
public ImageDescriptor getImageDescriptor(Object element) public ImageDescriptor getImageDescriptor(Object element)
{ {
//return RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PROCESS_ID); //return RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PROCESS_ID);
@ -126,9 +125,9 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
String text = ((IRemoteProcess) element).getLabel(); String text = ((IRemoteProcess) element).getLabel();
return (text == null) ? "" : text; //$NON-NLS-1$ return (text == null) ? "" : text; //$NON-NLS-1$
} }
/** /**
* Used for stuff like clipboard text copy * Used for stuff like clipboard text copy
*/ */
public String getAlternateText(Object element) public String getAlternateText(Object element)
{ {
@ -176,9 +175,9 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
IRemoteProcess process = (IRemoteProcess) element; IRemoteProcess process = (IRemoteProcess) element;
IRemoteProcessSubSystem ss = process.getParentRemoteProcessSubSystem(); IRemoteProcessSubSystem ss = process.getParentRemoteProcessSubSystem();
IHostProcessFilter orgRpfs = process.getFilterString(); IHostProcessFilter orgRpfs = process.getFilterString();
Object[] children = null; Object[] children = null;
try try
{ {
children = ss.listAllProcesses(orgRpfs, process.getContext(), null); children = ss.listAllProcesses(orgRpfs, process.getContext(), null);
@ -195,9 +194,9 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
catch (Exception exc) catch (Exception exc)
{ {
children = new SystemMessageObject[1]; children = new SystemMessageObject[1];
SystemMessage msg = new SimpleSystemMessage(ProcessesPlugin.PLUGIN_ID, SystemMessage msg = new SimpleSystemMessage(ProcessesPlugin.PLUGIN_ID,
ICommonMessageIds.MSG_EXPAND_FAILED, ICommonMessageIds.MSG_EXPAND_FAILED,
IStatus.ERROR, IStatus.ERROR,
CommonMessages.MSG_EXPAND_FAILED); CommonMessages.MSG_EXPAND_FAILED);
children[0] = new SystemMessageObject(msg, ISystemMessageObject.MSGTYPE_ERROR, element); children[0] = new SystemMessageObject(msg, ISystemMessageObject.MSGTYPE_ERROR, element);
SystemBasePlugin.logError("Exception resolving file filter strings", exc); //$NON-NLS-1$ SystemBasePlugin.logError("Exception resolving file filter strings", exc); //$NON-NLS-1$
@ -207,30 +206,30 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
protected IPropertyDescriptor[] internalGetPropertyDescriptors() protected IPropertyDescriptor[] internalGetPropertyDescriptors()
{ {
if (propertyDescriptorArray == null) if (propertyDescriptorArray == null)
{ {
int nbrOfProperties = ISystemProcessRemoteConstants.PROCESS_ATTRIBUTES_COUNT; int nbrOfProperties = ISystemProcessRemoteConstants.PROCESS_ATTRIBUTES_COUNT;
propertyDescriptorArray = new PropertyDescriptor[nbrOfProperties]; propertyDescriptorArray = new PropertyDescriptor[nbrOfProperties];
int idx = -1; int idx = -1;
// pid // pid
propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_PID, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_PID_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_PID_TOOLTIP); propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_PID, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_PID_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_PID_TOOLTIP);
// name // name
propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_NAME, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_NAME_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_NAME_TOOLTIP); propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_NAME, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_NAME_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_NAME_TOOLTIP);
// state // state
propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_STATE, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_STATE_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_STATE_TOOLTIP); propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_STATE, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_STATE_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_STATE_TOOLTIP);
// uid // uid
propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_UID, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_UID_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_UID_TOOLTIP); propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_UID, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_UID_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_UID_TOOLTIP);
// username // username
propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_USERNAME, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_USERNAME_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_USERNAME_TOOLTIP); propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_USERNAME, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_USERNAME_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_USERNAME_TOOLTIP);
// ppid // ppid
propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_PPID, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_PPID_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_PPID_TOOLTIP); propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_PPID, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_PPID_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_PPID_TOOLTIP);
@ -239,7 +238,7 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
// tgid // tgid
propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_TGID, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_TGID_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_TGID_TOOLTIP); propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_TGID, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_TGID_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_TGID_TOOLTIP);
// tracerpid // tracerpid
propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_TRACERPID, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_TRACERPID_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_TRACERPID_TOOLTIP); propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_TRACERPID, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_TRACERPID_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_TRACERPID_TOOLTIP);
@ -261,10 +260,10 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
{ {
return getPropertyValue(key, true); return getPropertyValue(key, true);
} }
/** /**
* Returns the current value for the named property. * Returns the current value for the named property.
* *
* @param property the name or key of the property as named by its property descriptor * @param property the name or key of the property as named by its property descriptor
* @param formatted indication of whether to return the value in formatted or raw form * @param formatted indication of whether to return the value in formatted or raw form
* @return the current value of the given property * @return the current value of the given property
@ -273,7 +272,7 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
{ {
String name = (String) property; String name = (String) property;
IRemoteProcess process = (IRemoteProcess) propertySourceInput; IRemoteProcess process = (IRemoteProcess) propertySourceInput;
if (name.equals(ISystemProcessPropertyConstants.P_PROCESS_GID)) if (name.equals(ISystemProcessPropertyConstants.P_PROCESS_GID))
{ {
if (formatted) if (formatted)
@ -343,7 +342,7 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
{ {
return new Long(process.getTracerPid()); return new Long(process.getTracerPid());
} }
} }
if (name.equals(ISystemProcessPropertyConstants.P_PROCESS_UID)) if (name.equals(ISystemProcessPropertyConstants.P_PROCESS_UID))
{ {
if (formatted) if (formatted)
@ -384,7 +383,7 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
else else
return null; //super.getPropertyValue(name); return null; //super.getPropertyValue(name);
} }
protected String formatState(String state) protected String formatState(String state)
{ {
if (state == null) return ""; //$NON-NLS-1$ if (state == null) return ""; //$NON-NLS-1$
@ -392,8 +391,8 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
String longState = ""; //$NON-NLS-1$ String longState = ""; //$NON-NLS-1$
String[] allStates = state.split(","); //$NON-NLS-1$ String[] allStates = state.split(","); //$NON-NLS-1$
if (allStates == null) return longState; if (allStates == null) return longState;
SystemProcessStatesContentProvider zstates = new SystemProcessStatesContentProvider(); SystemProcessStatesContentProvider zstates = new SystemProcessStatesContentProvider();
for (int i = 0; i < allStates.length; i++) for (int i = 0; i < allStates.length; i++)
{ {
longState = longState + allStates[i].charAt(0) + "-" + zstates.getStateString(allStates[i]); //$NON-NLS-1$ longState = longState + allStates[i].charAt(0) + "-" + zstates.getStateString(allStates[i]); //$NON-NLS-1$
@ -402,7 +401,7 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
} }
return longState; return longState;
} }
/** /**
* Return fully qualified name that uniquely identifies this remote object's remote parent within its subsystem * Return fully qualified name that uniquely identifies this remote object's remote parent within its subsystem
*/ */
@ -419,7 +418,7 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
* spawned it. * spawned it.
* <p> * <p>
* The shell is required in order to set the cursor to a busy state if a remote trip is required. * The shell is required in order to set the cursor to a busy state if a remote trip is required.
* *
* @return an IRemoteProcess object for the parent * @return an IRemoteProcess object for the parent
*/ */
public Object getRemoteParent(Object element, IProgressMonitor monitor) throws Exception public Object getRemoteParent(Object element, IProgressMonitor monitor) throws Exception
@ -429,11 +428,11 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
/** /**
* Given a remote object, return the unqualified names of the objects contained in that parent. This is * Given a remote object, return the unqualified names of the objects contained in that parent. This is
* used for testing for uniqueness on a rename operation, for example. Sometimes, it is not * used for testing for uniqueness on a rename operation, for example. Sometimes, it is not
* enough to just enumerate all the objects in the parent for this purpose, because duplicate * enough to just enumerate all the objects in the parent for this purpose, because duplicate
* names are allowed if the types are different, such as on iSeries. In this case return only * names are allowed if the types are different, such as on iSeries. In this case return only
* the names which should be used to do name-uniqueness validation on a rename operation. * the names which should be used to do name-uniqueness validation on a rename operation.
* *
* @return an array of all file and folder names in the parent of the given IRemoteFile object * @return an array of all file and folder names in the parent of the given IRemoteFile object
*/ */
public String[] getRemoteParentNamesInUse(Object element, IProgressMonitor monitor) throws Exception public String[] getRemoteParentNamesInUse(Object element, IProgressMonitor monitor) throws Exception
@ -475,7 +474,7 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
return ISystemProcessRemoteTypes.TYPECATEGORY; return ISystemProcessRemoteTypes.TYPECATEGORY;
} }
/** /**
* Return the subsystem factory id that owns this remote object * Return the subsystem factory id that owns this remote object
* The value must not be translated, so that property pages registered via xml can subset by it. * The value must not be translated, so that property pages registered via xml can subset by it.
*/ */
@ -496,7 +495,7 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
}*/ }*/
return false; return false;
} }
/* /*
* Return whether deferred queries are supported. * Return whether deferred queries are supported.
*/ */

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2002, 2008 IBM Corporation and others. * Copyright (c) 2002, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,10 +7,10 @@
* *
* Initial Contributors: * Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer * The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir, * component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
* *
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - [180562] dont implement ISystemOutputRemoteTypes * Martin Oberhuber (Wind River) - [180562] dont implement ISystemOutputRemoteTypes
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
@ -79,7 +79,6 @@ import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
import org.eclipse.rse.ui.view.ISystemEditableRemoteObject; import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
import org.eclipse.rse.ui.view.ISystemPropertyConstants; import org.eclipse.rse.ui.view.ISystemPropertyConstants;
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorDescriptor; import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorRegistry; import org.eclipse.ui.IEditorRegistry;
@ -91,13 +90,13 @@ import org.eclipse.ui.views.properties.IPropertyDescriptor;
/** /**
* This is the adapter for smart output from remote commands, such that they can support right click actions and such. * This is the adapter for smart output from remote commands, such that they can support right click actions and such.
*/ */
public class SystemViewRemoteOutputAdapter extends AbstractSystemViewAdapter public class SystemViewRemoteOutputAdapter extends AbstractSystemViewAdapter
implements ISystemViewElementAdapter, ISystemRemoteElementAdapter implements ISystemRemoteElementAdapter
{ {
protected IPropertyDescriptor[] _propertyDescriptors; protected IPropertyDescriptor[] _propertyDescriptors;
private SystemCopyToClipboardAction _copyOutputAction = null; private SystemCopyToClipboardAction _copyOutputAction = null;
private SystemPasteFromClipboardAction _pasteToPromptAction = null; private SystemPasteFromClipboardAction _pasteToPromptAction = null;
@ -107,10 +106,10 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
private IAction _exportShellHistoryAction = null; private IAction _exportShellHistoryAction = null;
private IAction _exportShellOutputAction = null; private IAction _exportShellOutputAction = null;
private List _shellActions = null; private List _shellActions = null;
private IPropertyDescriptor _shellPropertyDescriptors[]; private IPropertyDescriptor _shellPropertyDescriptors[];
private IPropertyDescriptor _outputPropertyDescriptors[]; private IPropertyDescriptor _outputPropertyDescriptors[];
public SystemViewRemoteOutputAdapter() public SystemViewRemoteOutputAdapter()
{ {
_shellActions = new ArrayList(); _shellActions = new ArrayList();
@ -131,9 +130,9 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
{ {
_copyOutputAction = new SystemCopyToClipboardAction(shell, RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard()); _copyOutputAction = new SystemCopyToClipboardAction(shell, RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard());
} }
menu.add(menuGroup, _copyOutputAction); menu.add(menuGroup, _copyOutputAction);
if (selection.size() == 1) if (selection.size() == 1)
{ {
if (firstSelection instanceof IRemoteLineReference) if (firstSelection instanceof IRemoteLineReference)
@ -146,7 +145,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
{ {
_pasteToPromptAction = new SystemPasteFromClipboardAction(shell, RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard()); _pasteToPromptAction = new SystemPasteFromClipboardAction(shell, RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard());
} }
menu.add(menuGroup, _pasteToPromptAction); menu.add(menuGroup, _pasteToPromptAction);
} }
else if (type.equals(ISystemOutputRemoteTypes.TYPE_DIRECTORY)) else if (type.equals(ISystemOutputRemoteTypes.TYPE_DIRECTORY))
@ -155,25 +154,25 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
if (output.getAbsolutePath() != null) if (output.getAbsolutePath() != null)
{ {
// TODO // TODO
// add directory actions here // add directory actions here
} }
} }
else else
{ {
IRemoteOutput output = (IRemoteOutput)firstSelection; IRemoteOutput output = (IRemoteOutput)firstSelection;
if (output.getAbsolutePath() != null) if (output.getAbsolutePath() != null)
{ {
IRemoteFile rfile = SystemRemoteFileLineOpenWithMenu.outputToFile(output); IRemoteFile rfile = SystemRemoteFileLineOpenWithMenu.outputToFile(output);
if (rfile != null && rfile.isFile()) // for 196842 if (rfile != null && rfile.isFile()) // for 196842
{ {
//SystemCreateEditLineActions createActions = new SystemCreateEditLineActions(); //SystemCreateEditLineActions createActions = new SystemCreateEditLineActions();
//createActions.create(menu, selection, shell, menuGroup); //createActions.create(menu, selection, shell, menuGroup);
// open with -> // open with ->
MenuManager submenu = MenuManager submenu =
new MenuManager(ShellResources.ACTION_OPEN_WITH_LABEL, new MenuManager(ShellResources.ACTION_OPEN_WITH_LABEL,
ISystemContextMenuConstants.GROUP_OPENWITH); ISystemContextMenuConstants.GROUP_OPENWITH);
SystemRemoteFileLineOpenWithMenu openWithMenu = new SystemRemoteFileLineOpenWithMenu(); SystemRemoteFileLineOpenWithMenu openWithMenu = new SystemRemoteFileLineOpenWithMenu();
openWithMenu.updateSelection(selection); openWithMenu.updateSelection(selection);
submenu.add(openWithMenu); submenu.add(openWithMenu);
@ -182,9 +181,9 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
} }
} }
} }
} }
} }
else if (firstSelection instanceof IRemoteCommandShell) else if (firstSelection instanceof IRemoteCommandShell)
@ -193,12 +192,12 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
if (_showInShellView == null) if (_showInShellView == null)
{ {
_showInShellView = new SystemShowInShellViewAction(shell); _showInShellView = new SystemShowInShellViewAction(shell);
} }
menu.add(ISystemContextMenuConstants.GROUP_OPEN,_showInShellView); menu.add(ISystemContextMenuConstants.GROUP_OPEN,_showInShellView);
getShellActions(cmdShell.getCommandSubSystem().getParentRemoteCmdSubSystemConfiguration()); getShellActions(cmdShell.getCommandSubSystem().getParentRemoteCmdSubSystemConfiguration());
menu.add(ISystemContextMenuConstants.GROUP_CHANGE, _terminateShellAction); menu.add(ISystemContextMenuConstants.GROUP_CHANGE, _terminateShellAction);
menu.add(ISystemContextMenuConstants.GROUP_CHANGE, _terminateRemoveShellAction); menu.add(ISystemContextMenuConstants.GROUP_CHANGE, _terminateRemoveShellAction);
menu.add(ISystemContextMenuConstants.GROUP_IMPORTEXPORT, _exportShellOutputAction); menu.add(ISystemContextMenuConstants.GROUP_IMPORTEXPORT, _exportShellOutputAction);
@ -210,7 +209,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
return; return;
} }
} }
public List getShellActions(IRemoteCmdSubSystemConfiguration factory) public List getShellActions(IRemoteCmdSubSystemConfiguration factory)
{ {
getShell(); getShell();
@ -219,7 +218,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
{ {
if (_terminateShellAction == null) if (_terminateShellAction == null)
{ {
_terminateShellAction = new SystemTerminateShellAction(shell); _terminateShellAction = new SystemTerminateShellAction(shell);
} }
_shellActions.add(_terminateShellAction); _shellActions.add(_terminateShellAction);
if (_terminateRemoveShellAction == null) if (_terminateRemoveShellAction == null)
@ -227,20 +226,20 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
_terminateRemoveShellAction = new SystemTerminateRemoveShellAction(shell); _terminateRemoveShellAction = new SystemTerminateRemoveShellAction(shell);
} }
_shellActions.add(_terminateRemoveShellAction); _shellActions.add(_terminateRemoveShellAction);
_shellActions.add(new Separator()); _shellActions.add(new Separator());
ShellServiceSubSystemConfigurationAdapter factoryAdapter = (ShellServiceSubSystemConfigurationAdapter)factory.getAdapter(ISubSystemConfigurationAdapter.class); ShellServiceSubSystemConfigurationAdapter factoryAdapter = (ShellServiceSubSystemConfigurationAdapter)factory.getAdapter(ISubSystemConfigurationAdapter.class);
_exportShellOutputAction = factoryAdapter.getCommandShellOutputExportAction(shell); _exportShellOutputAction = factoryAdapter.getCommandShellOutputExportAction(shell);
_shellActions.add(_exportShellOutputAction); _shellActions.add(_exportShellOutputAction);
_exportShellHistoryAction = factoryAdapter.getCommandShellHistoryExportAction(shell); _exportShellHistoryAction = factoryAdapter.getCommandShellHistoryExportAction(shell);
_shellActions.add(_exportShellHistoryAction); _shellActions.add(_exportShellHistoryAction);
} }
return _shellActions; return _shellActions;
} }
/** /**
* Returns the parent command object for a line of output * Returns the parent command object for a line of output
*/ */
@ -268,7 +267,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
{ {
text = translateTabs(text); text = translateTabs(text);
} }
int tagIndex = text.indexOf("BEGIN-END-TAG"); //$NON-NLS-1$ int tagIndex = text.indexOf("BEGIN-END-TAG"); //$NON-NLS-1$
if (tagIndex == 0) if (tagIndex == 0)
{ {
@ -279,7 +278,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
//return text.substring(0, tagIndex - 6); //return text.substring(0, tagIndex - 6);
return text.substring(0, tagIndex); return text.substring(0, tagIndex);
} }
return text; return text;
} }
else if (element instanceof IRemoteCommandShell) else if (element instanceof IRemoteCommandShell)
@ -290,7 +289,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
return null; return null;
} }
protected String translateTabs(String tabbedString) protected String translateTabs(String tabbedString)
{ {
int columnWidth = 8; int columnWidth = 8;
@ -320,9 +319,9 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
{ {
untabbedBuf.append(c); untabbedBuf.append(c);
currentOffset++; currentOffset++;
} }
} }
return untabbedBuf.toString(); return untabbedBuf.toString();
} }
/** /**
@ -348,13 +347,13 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
*/ */
public Object[] getChildren(IAdaptable element, IProgressMonitor monitor) public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
{ {
if (element instanceof IRemoteCommandShell) if (element instanceof IRemoteCommandShell)
{ {
IRemoteCommandShell output = (IRemoteCommandShell) element; IRemoteCommandShell output = (IRemoteCommandShell) element;
return output.listOutput(); return output.listOutput();
} }
return null; return null;
} }
@ -374,7 +373,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
else else
{ {
return false; return false;
} }
} }
/** /**
@ -422,20 +421,20 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
return file; return file;
} }
protected IEditorRegistry getEditorRegistry() protected IEditorRegistry getEditorRegistry()
{ {
return RSEUIPlugin.getDefault().getWorkbench().getEditorRegistry(); return RSEUIPlugin.getDefault().getWorkbench().getEditorRegistry();
} }
protected IEditorDescriptor getDefaultTextEditor() protected IEditorDescriptor getDefaultTextEditor()
{ {
IEditorRegistry registry = getEditorRegistry(); IEditorRegistry registry = getEditorRegistry();
return registry.findEditor("org.eclipse.ui.DefaultTextEditor"); //$NON-NLS-1$ return registry.findEditor("org.eclipse.ui.DefaultTextEditor"); //$NON-NLS-1$
} }
/** /**
* Opens the appropriate editor for a remote output object * Opens the appropriate editor for a remote output object
*/ */
@ -445,10 +444,10 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
if (element instanceof IRemoteOutput) if (element instanceof IRemoteOutput)
{ {
IRemoteOutput output = (IRemoteOutput) element; IRemoteOutput output = (IRemoteOutput) element;
IRemoteFile file = outputToFile(output); IRemoteFile file = outputToFile(output);
if (file != null && file.isFile()) if (file != null && file.isFile())
{ {
doOpen(file, output); doOpen(file, output);
return true; return true;
} }
@ -464,8 +463,8 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
} }
return result; return result;
} }
private void doOpen(IRemoteFile remoteFile, IRemoteOutput output) private void doOpen(IRemoteFile remoteFile, IRemoteOutput output)
{ {
if (!remoteFile.isArchive() || !remoteFile.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement()) if (!remoteFile.isArchive() || !remoteFile.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement())
@ -477,7 +476,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
int line = output.getLine(); int line = output.getLine();
int charStart = output.getCharStart(); int charStart = output.getCharStart();
int charEnd = output.getCharEnd(); int charEnd = output.getCharEnd();
try try
{ {
boolean isOpen = editable.checkOpenInEditor() != ISystemEditableRemoteObject.NOT_OPEN; boolean isOpen = editable.checkOpenInEditor() != ISystemEditableRemoteObject.NOT_OPEN;
@ -495,7 +494,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
{ {
DownloadAndOpenJob oJob = new DownloadAndOpenJob(editable, false, line, charStart, charEnd); DownloadAndOpenJob oJob = new DownloadAndOpenJob(editable, false, line, charStart, charEnd);
oJob.schedule(); oJob.schedule();
} }
} }
catch (Exception e) catch (Exception e)
{ {
@ -503,7 +502,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
} }
} }
} }
private boolean isFileCached(ISystemEditableRemoteObject editable, IRemoteFile remoteFile) private boolean isFileCached(ISystemEditableRemoteObject editable, IRemoteFile remoteFile)
{ {
// DY: check if the file exists and is read-only (because it was previously opened // DY: check if the file exists and is read-only (because it was previously opened
@ -511,15 +510,15 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
IFile file = editable.getLocalResource(); IFile file = editable.getLocalResource();
SystemIFileProperties properties = new SystemIFileProperties(file); SystemIFileProperties properties = new SystemIFileProperties(file);
boolean newFile = !file.exists(); boolean newFile = !file.exists();
// detect whether there exists a temp copy already // detect whether there exists a temp copy already
if (!newFile && file.exists()) if (!newFile && file.exists())
{ {
// we have a local copy of this file, so we need to compare timestamps // we have a local copy of this file, so we need to compare timestamps
// get stored modification stamp // get stored modification stamp
long storedModifiedStamp = properties.getRemoteFileTimeStamp(); long storedModifiedStamp = properties.getRemoteFileTimeStamp();
// get updated remoteFile so we get the current remote timestamp // get updated remoteFile so we get the current remote timestamp
//remoteFile.markStale(true); //remoteFile.markStale(true);
IRemoteFileSubSystem subsystem = remoteFile.getParentRemoteFileSubSystem(); IRemoteFileSubSystem subsystem = remoteFile.getParentRemoteFileSubSystem();
@ -529,36 +528,36 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
} }
catch (Exception e) catch (Exception e)
{ {
} }
// get the remote modified stamp // get the remote modified stamp
long remoteModifiedStamp = remoteFile.getLastModified(); long remoteModifiedStamp = remoteFile.getLastModified();
// get dirty flag // get dirty flag
boolean dirty = properties.getDirty(); boolean dirty = properties.getDirty();
boolean remoteNewer = (storedModifiedStamp != remoteModifiedStamp); boolean remoteNewer = (storedModifiedStamp != remoteModifiedStamp);
String remoteEncoding = remoteFile.getEncoding(); String remoteEncoding = remoteFile.getEncoding();
String storedEncoding = properties.getEncoding(); String storedEncoding = properties.getEncoding();
boolean encodingChanged = storedEncoding == null || !(remoteEncoding.equals(storedEncoding)); boolean encodingChanged = storedEncoding == null || !(remoteEncoding.equals(storedEncoding));
boolean usedBinary = properties.getUsedBinaryTransfer(); boolean usedBinary = properties.getUsedBinaryTransfer();
boolean isBinary = remoteFile.isBinary(); boolean isBinary = remoteFile.isBinary();
return (!dirty && return (!dirty &&
!remoteNewer && !remoteNewer &&
usedBinary == isBinary && usedBinary == isBinary &&
!encodingChanged); !encodingChanged);
} }
return false; return false;
} }
/** /**
* Returns the associated subsystem for this line of remote output or remote command * Returns the associated subsystem for this line of remote output or remote command
*/ */
@ -573,9 +572,9 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
{ {
IRemoteOutput output = (IRemoteOutput) element; IRemoteOutput output = (IRemoteOutput) element;
String type = output.getType(); String type = output.getType();
if (type.equals(ISystemOutputRemoteTypes.TYPE_FILE) || if (type.equals(ISystemOutputRemoteTypes.TYPE_FILE) ||
type.equals(ISystemOutputRemoteTypes.TYPE_DIRECTORY)){ type.equals(ISystemOutputRemoteTypes.TYPE_DIRECTORY)){
// bug 233475, fall back to the file subsystem // bug 233475, fall back to the file subsystem
IRemoteFile file = outputToFile(output); IRemoteFile file = outputToFile(output);
@ -583,7 +582,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
return file.getParentRemoteFileSubSystem(); return file.getParentRemoteFileSubSystem();
} }
} }
Object parent = output.getParent(); Object parent = output.getParent();
if (parent instanceof IRemoteCommandShell) if (parent instanceof IRemoteCommandShell)
{ {
@ -606,15 +605,15 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
return cmd.getId(); return cmd.getId();
} }
else if (element instanceof IRemoteOutput) else if (element instanceof IRemoteOutput)
{ {
IRemoteOutput out = (IRemoteOutput) element; IRemoteOutput out = (IRemoteOutput) element;
String type = out.getType(); String type = out.getType();
if (type.equals(ISystemOutputRemoteTypes.TYPE_FILE) || if (type.equals(ISystemOutputRemoteTypes.TYPE_FILE) ||
type.equals(ISystemOutputRemoteTypes.TYPE_DIRECTORY)){ type.equals(ISystemOutputRemoteTypes.TYPE_DIRECTORY)){
return out.getAbsolutePath(); return out.getAbsolutePath();
} }
String str = getAbsoluteParentName(element); String str = getAbsoluteParentName(element);
return str + ":" + out.getIndex(); //$NON-NLS-1$ return str + ":" + out.getIndex(); //$NON-NLS-1$
} }
@ -694,10 +693,10 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
} }
/** /**
* Some view has updated the name or properties of this remote object. As a result, the * Some view has updated the name or properties of this remote object. As a result, the
* remote object's contents need to be refreshed. You are given the old remote object that has * remote object's contents need to be refreshed. You are given the old remote object that has
* old data, and you are given the new remote object that has the new data. For example, on a * old data, and you are given the new remote object that has the new data. For example, on a
* rename the old object still has the old name attribute while the new object has the new * rename the old object still has the old name attribute while the new object has the new
* new attribute. * new attribute.
* <p> * <p>
* This is called by viewers like SystemView in response to rename and property change events. * This is called by viewers like SystemView in response to rename and property change events.
@ -727,9 +726,9 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
/** /**
* Given a remote object, return the unqualified names of the objects contained in that parent. This is * Given a remote object, return the unqualified names of the objects contained in that parent. This is
* used for testing for uniqueness on a rename operation, for example. Sometimes, it is not * used for testing for uniqueness on a rename operation, for example. Sometimes, it is not
* enough to just enumerate all the objects in the parent for this purpose, because duplicate * enough to just enumerate all the objects in the parent for this purpose, because duplicate
* names are allowed if the types are different, such as on iSeries. In this case return only * names are allowed if the types are different, such as on iSeries. In this case return only
* the names which should be used to do name-uniqueness validation on a rename operation. * the names which should be used to do name-uniqueness validation on a rename operation.
*/ */
public String[] getRemoteParentNamesInUse(Object element, IProgressMonitor monitor) throws Exception public String[] getRemoteParentNamesInUse(Object element, IProgressMonitor monitor) throws Exception
@ -742,7 +741,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
* Returns the current collection of property descriptors. * Returns the current collection of property descriptors.
* By default returns descriptors for name and type only. * By default returns descriptors for name and type only.
* Override if desired. * Override if desired.
* @return an array containing all descriptors. * @return an array containing all descriptors.
*/ */
protected Object internalGetPropertyValue(Object key) protected Object internalGetPropertyValue(Object key)
{ {
@ -775,7 +774,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
} }
else if (type.equals(ISystemOutputRemoteTypes.TYPE_DIRECTORY)) else if (type.equals(ISystemOutputRemoteTypes.TYPE_DIRECTORY))
{ {
imageDescriptor = //PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER); imageDescriptor = //PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FOLDER_ID); RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FOLDER_ID);
} }
else if (type.equals(ISystemOutputRemoteTypes.TYPE_FILE)) else if (type.equals(ISystemOutputRemoteTypes.TYPE_FILE))
@ -828,7 +827,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
IRemoteCommandShell command = (IRemoteCommandShell) element; IRemoteCommandShell command = (IRemoteCommandShell) element;
IRemoteCmdSubSystemConfiguration factory = command.getCommandSubSystem().getParentRemoteCmdSubSystemConfiguration(); IRemoteCmdSubSystemConfiguration factory = command.getCommandSubSystem().getParentRemoteCmdSubSystemConfiguration();
ShellServiceSubSystemConfigurationAdapter factoryAdapter = (ShellServiceSubSystemConfigurationAdapter)factory.getAdapter(ISubSystemConfigurationAdapter.class); ShellServiceSubSystemConfigurationAdapter factoryAdapter = (ShellServiceSubSystemConfigurationAdapter)factory.getAdapter(ISubSystemConfigurationAdapter.class);
ImageDescriptor imageDescriptor = null; ImageDescriptor imageDescriptor = null;
if (command.isActive()) if (command.isActive())
{ {
imageDescriptor = factoryAdapter.getActiveCommandShellImageDescriptor(); imageDescriptor = factoryAdapter.getActiveCommandShellImageDescriptor();
@ -841,7 +840,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
} }
else else
{ // return some default { // return some default
ImageDescriptor imageDescriptor = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_BLANK_ID); ImageDescriptor imageDescriptor = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_BLANK_ID);
return imageDescriptor; return imageDescriptor;
} }
@ -899,7 +898,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
{ {
return false; return false;
} }
/** /**
* Return true if this object is renamable by the user. If so, when selected, * Return true if this object is renamable by the user. If so, when selected,
* the Rename popup menu item will be enabled. * the Rename popup menu item will be enabled.
@ -912,7 +911,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
/** /**
* Perform the rename action. By default does nothing. Override if your object is renamable. * Perform the rename action. By default does nothing. Override if your object is renamable.
* Return true if this was successful. Return false if it failed and you issued a msg. * Return true if this was successful. Return false if it failed and you issued a msg.
* Throw an exception if it failed and you want to use the generic msg. * Throw an exception if it failed and you want to use the generic msg.
*/ */
public boolean doRename(Shell shell, Object element, String name, IProgressMonitor monitor) throws Exception public boolean doRename(Shell shell, Object element, String name, IProgressMonitor monitor) throws Exception
@ -929,7 +928,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
*/ */
public boolean canDrop(Object element) public boolean canDrop(Object element)
{ {
/*DKM -for now disabling - the function doesn't /*DKM -for now disabling - the function doesn't
* make sense for other types of prompts like * make sense for other types of prompts like
* RAD4z * RAD4z
if (element instanceof IRemoteOutput) if (element instanceof IRemoteOutput)
@ -948,15 +947,15 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
if (output.getType().equals(ISystemOutputRemoteTypes.TYPE_DIRECTORY)){ if (output.getType().equals(ISystemOutputRemoteTypes.TYPE_DIRECTORY)){
IRemoteFile file = outputToFile(output); IRemoteFile file = outputToFile(output);
ISystemDragDropAdapter fadapter = (ISystemDragDropAdapter)((IAdaptable)file).getAdapter(ISystemDragDropAdapter.class); ISystemDragDropAdapter fadapter = (ISystemDragDropAdapter)((IAdaptable)file).getAdapter(ISystemDragDropAdapter.class);
return fadapter.canDrop(file); return fadapter.canDrop(file);
} }
} }
return false; return false;
} }
/** /**
* Indicates whether the specified object can be copied * Indicates whether the specified object can be copied
* @param element the object to copy * @param element the object to copy
*/ */
public boolean canDrag(Object element) public boolean canDrag(Object element)
@ -976,7 +975,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
/** /**
* Copy the specified remote output object. This method returns a string representing * Copy the specified remote output object. This method returns a string representing
* the text of the remote output; * the text of the remote output;
* *
* @param element the output to copy * @param element the output to copy
* @param sameSystemType not applicable for remote output * @param sameSystemType not applicable for remote output
* @param monitor the progress monitor * @param monitor the progress monitor
@ -1000,16 +999,16 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
if (element instanceof IRemoteOutput){ if (element instanceof IRemoteOutput){
IRemoteOutput output = (IRemoteOutput)element; IRemoteOutput output = (IRemoteOutput)element;
String type = output.getType(); String type = output.getType();
if (type.equals(ISystemOutputRemoteTypes.TYPE_FILE) || if (type.equals(ISystemOutputRemoteTypes.TYPE_FILE) ||
type.equals(ISystemOutputRemoteTypes.TYPE_DIRECTORY)){ type.equals(ISystemOutputRemoteTypes.TYPE_DIRECTORY)){
IRemoteFile file = outputToFile(output); IRemoteFile file = outputToFile(output);
if (file != null){ if (file != null){
ISystemDragDropAdapter fadapter = (ISystemDragDropAdapter)((IAdaptable)file).getAdapter(ISystemDragDropAdapter.class); ISystemDragDropAdapter fadapter = (ISystemDragDropAdapter)((IAdaptable)file).getAdapter(ISystemDragDropAdapter.class);
return fadapter.doDrag(file, sameSystemType, monitor); return fadapter.doDrag(file, sameSystemType, monitor);
} }
} }
} }
return getText(element); return getText(element);
} }
} }
@ -1120,12 +1119,12 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
{ {
return null; return null;
} }
protected IPropertyDescriptor[] internalGetPropertyDescriptors() protected IPropertyDescriptor[] internalGetPropertyDescriptors()
{ {
return getUniquePropertyDescriptors(); return getUniquePropertyDescriptors();
} }
public IPropertyDescriptor[] getUniquePropertyDescriptors() public IPropertyDescriptor[] getUniquePropertyDescriptors()
{ {
if (propertySourceInput instanceof IRemoteCommandShell) if (propertySourceInput instanceof IRemoteCommandShell)
@ -1133,7 +1132,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
if (_shellPropertyDescriptors == null) if (_shellPropertyDescriptors == null)
{ {
_shellPropertyDescriptors = new IPropertyDescriptor[2]; _shellPropertyDescriptors = new IPropertyDescriptor[2];
_shellPropertyDescriptors[0] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_SHELL_STATUS, ShellResources.RESID_PROPERTY_SHELL_STATUS_LABEL, ShellResources.RESID_PROPERTY_SHELL_STATUS_TOOLTIP); _shellPropertyDescriptors[0] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_SHELL_STATUS, ShellResources.RESID_PROPERTY_SHELL_STATUS_LABEL, ShellResources.RESID_PROPERTY_SHELL_STATUS_TOOLTIP);
_shellPropertyDescriptors[1] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_SHELL_CONTEXT, ShellResources.RESID_PROPERTY_SHELL_CONTEXT_LABEL, ShellResources.RESID_PROPERTY_SHELL_CONTEXT_TOOLTIP); _shellPropertyDescriptors[1] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_SHELL_CONTEXT, ShellResources.RESID_PROPERTY_SHELL_CONTEXT_LABEL, ShellResources.RESID_PROPERTY_SHELL_CONTEXT_TOOLTIP);
} }
@ -1148,10 +1147,10 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
return _outputPropertyDescriptors; return _outputPropertyDescriptors;
} }
} }
/** /**
* Returns the current value for the named property. * Returns the current value for the named property.
* *
* @param property the name or key of the property as named by its property descriptor * @param property the name or key of the property as named by its property descriptor
* @param formatted indication of whether to return the value in formatted or raw form * @param formatted indication of whether to return the value in formatted or raw form
* @return the current value of the given property * @return the current value of the given property
@ -1180,13 +1179,13 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
} }
return ""; //$NON-NLS-1$ return ""; //$NON-NLS-1$
} }
/** /**
* Don't show properties for remote output * Don't show properties for remote output
*/ */
public boolean showProperties(Object element){ public boolean showProperties(Object element){
return false; return false;
} }
} }