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

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
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-Localization: plugin
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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,10 +7,10 @@
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
*
* Contributors:
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* 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.view.AbstractSystemViewAdapter;
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
@ -60,8 +59,8 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
{
implements ISystemRemoteElementAdapter
{
private SystemCopyToClipboardAction copyClipboardAction;
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 PropertyDescriptor[] propertyDescriptorArray = null;
private SystemKillProcessAction killProcessAction;
public void addActions(SystemMenuManager menu,
IStructuredSelection selection, Shell parent, String menuGroup)
{
if (killProcessAction == null)
killProcessAction = new SystemKillProcessAction(shell);
menu.add(ISystemContextMenuConstants.GROUP_CHANGE, killProcessAction);
if (copyClipboardAction == null)
{
Clipboard clipboard = RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard();
@ -111,10 +110,10 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
{
IRemoteProcess process = (IRemoteProcess)element;
return process.getParentRemoteProcessSubSystem();
}
}
return super.getSubSystem(element);
}
public ImageDescriptor getImageDescriptor(Object element)
{
//return RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PROCESS_ID);
@ -126,9 +125,9 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
String text = ((IRemoteProcess) element).getLabel();
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)
{
@ -176,9 +175,9 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
IRemoteProcess process = (IRemoteProcess) element;
IRemoteProcessSubSystem ss = process.getParentRemoteProcessSubSystem();
IHostProcessFilter orgRpfs = process.getFilterString();
Object[] children = null;
try
{
children = ss.listAllProcesses(orgRpfs, process.getContext(), null);
@ -195,9 +194,9 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
catch (Exception exc)
{
children = new SystemMessageObject[1];
SystemMessage msg = new SimpleSystemMessage(ProcessesPlugin.PLUGIN_ID,
SystemMessage msg = new SimpleSystemMessage(ProcessesPlugin.PLUGIN_ID,
ICommonMessageIds.MSG_EXPAND_FAILED,
IStatus.ERROR,
IStatus.ERROR,
CommonMessages.MSG_EXPAND_FAILED);
children[0] = new SystemMessageObject(msg, ISystemMessageObject.MSGTYPE_ERROR, element);
SystemBasePlugin.logError("Exception resolving file filter strings", exc); //$NON-NLS-1$
@ -207,30 +206,30 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
protected IPropertyDescriptor[] internalGetPropertyDescriptors()
{
if (propertyDescriptorArray == null)
{
{
int nbrOfProperties = ISystemProcessRemoteConstants.PROCESS_ATTRIBUTES_COUNT;
propertyDescriptorArray = new PropertyDescriptor[nbrOfProperties];
int idx = -1;
// pid
propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_PID, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_PID_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_PID_TOOLTIP);
// name
propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_NAME, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_NAME_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_NAME_TOOLTIP);
// 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
propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_UID, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_UID_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_UID_TOOLTIP);
// username
propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_USERNAME, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_USERNAME_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_USERNAME_TOOLTIP);
// ppid
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
propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemProcessPropertyConstants.P_PROCESS_TGID, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_TGID_LABEL, SystemProcessesViewResources.RESID_PROPERTY_PROCESS_TGID_TOOLTIP);
// tracerpid
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);
}
/**
* Returns the current value for the named property.
*
*
* @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
* @return the current value of the given property
@ -273,7 +272,7 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
{
String name = (String) property;
IRemoteProcess process = (IRemoteProcess) propertySourceInput;
if (name.equals(ISystemProcessPropertyConstants.P_PROCESS_GID))
{
if (formatted)
@ -343,7 +342,7 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
{
return new Long(process.getTracerPid());
}
}
}
if (name.equals(ISystemProcessPropertyConstants.P_PROCESS_UID))
{
if (formatted)
@ -384,7 +383,7 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
else
return null; //super.getPropertyValue(name);
}
protected String formatState(String state)
{
if (state == null) return ""; //$NON-NLS-1$
@ -392,8 +391,8 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
String longState = ""; //$NON-NLS-1$
String[] allStates = state.split(","); //$NON-NLS-1$
if (allStates == null) return longState;
SystemProcessStatesContentProvider zstates = new SystemProcessStatesContentProvider();
SystemProcessStatesContentProvider zstates = new SystemProcessStatesContentProvider();
for (int i = 0; i < allStates.length; i++)
{
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 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.
* <p>
* 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
*/
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
* 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
* 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.
*
*
* @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
@ -475,7 +474,7 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
return ISystemProcessRemoteTypes.TYPECATEGORY;
}
/**
/**
* 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.
*/
@ -496,7 +495,7 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
}*/
return false;
}
/*
* 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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,10 +7,10 @@
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
*
* Contributors:
* Martin Oberhuber (Wind River) - [180562] dont implement ISystemOutputRemoteTypes
* 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.ISystemPropertyConstants;
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorDescriptor;
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.
*/
public class SystemViewRemoteOutputAdapter extends AbstractSystemViewAdapter
implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
public class SystemViewRemoteOutputAdapter extends AbstractSystemViewAdapter
implements ISystemRemoteElementAdapter
{
protected IPropertyDescriptor[] _propertyDescriptors;
private SystemCopyToClipboardAction _copyOutputAction = null;
private SystemPasteFromClipboardAction _pasteToPromptAction = null;
@ -107,10 +106,10 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
private IAction _exportShellHistoryAction = null;
private IAction _exportShellOutputAction = null;
private List _shellActions = null;
private IPropertyDescriptor _shellPropertyDescriptors[];
private IPropertyDescriptor _outputPropertyDescriptors[];
public SystemViewRemoteOutputAdapter()
{
_shellActions = new ArrayList();
@ -131,9 +130,9 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
{
_copyOutputAction = new SystemCopyToClipboardAction(shell, RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard());
}
menu.add(menuGroup, _copyOutputAction);
if (selection.size() == 1)
{
if (firstSelection instanceof IRemoteLineReference)
@ -146,7 +145,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
{
_pasteToPromptAction = new SystemPasteFromClipboardAction(shell, RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard());
}
menu.add(menuGroup, _pasteToPromptAction);
}
else if (type.equals(ISystemOutputRemoteTypes.TYPE_DIRECTORY))
@ -155,25 +154,25 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
if (output.getAbsolutePath() != null)
{
// TODO
// add directory actions here
// add directory actions here
}
}
else
{
IRemoteOutput output = (IRemoteOutput)firstSelection;
if (output.getAbsolutePath() != null)
{
IRemoteFile rfile = SystemRemoteFileLineOpenWithMenu.outputToFile(output);
if (rfile != null && rfile.isFile()) // for 196842
{
//SystemCreateEditLineActions createActions = new SystemCreateEditLineActions();
//createActions.create(menu, selection, shell, menuGroup);
//createActions.create(menu, selection, shell, menuGroup);
// open with ->
MenuManager submenu =
new MenuManager(ShellResources.ACTION_OPEN_WITH_LABEL,
ISystemContextMenuConstants.GROUP_OPENWITH);
SystemRemoteFileLineOpenWithMenu openWithMenu = new SystemRemoteFileLineOpenWithMenu();
openWithMenu.updateSelection(selection);
submenu.add(openWithMenu);
@ -182,9 +181,9 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
}
}
}
}
}
else if (firstSelection instanceof IRemoteCommandShell)
@ -193,12 +192,12 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
if (_showInShellView == null)
{
_showInShellView = new SystemShowInShellViewAction(shell);
}
menu.add(ISystemContextMenuConstants.GROUP_OPEN,_showInShellView);
getShellActions(cmdShell.getCommandSubSystem().getParentRemoteCmdSubSystemConfiguration());
menu.add(ISystemContextMenuConstants.GROUP_CHANGE, _terminateShellAction);
menu.add(ISystemContextMenuConstants.GROUP_CHANGE, _terminateRemoveShellAction);
menu.add(ISystemContextMenuConstants.GROUP_IMPORTEXPORT, _exportShellOutputAction);
@ -210,7 +209,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
return;
}
}
public List getShellActions(IRemoteCmdSubSystemConfiguration factory)
{
getShell();
@ -219,7 +218,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
{
if (_terminateShellAction == null)
{
_terminateShellAction = new SystemTerminateShellAction(shell);
_terminateShellAction = new SystemTerminateShellAction(shell);
}
_shellActions.add(_terminateShellAction);
if (_terminateRemoveShellAction == null)
@ -227,20 +226,20 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
_terminateRemoveShellAction = new SystemTerminateRemoveShellAction(shell);
}
_shellActions.add(_terminateRemoveShellAction);
_shellActions.add(new Separator());
ShellServiceSubSystemConfigurationAdapter factoryAdapter = (ShellServiceSubSystemConfigurationAdapter)factory.getAdapter(ISubSystemConfigurationAdapter.class);
_exportShellOutputAction = factoryAdapter.getCommandShellOutputExportAction(shell);
_shellActions.add(_exportShellOutputAction);
_exportShellHistoryAction = factoryAdapter.getCommandShellHistoryExportAction(shell);
_shellActions.add(_exportShellHistoryAction);
}
return _shellActions;
}
/**
* Returns the parent command object for a line of output
*/
@ -268,7 +267,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
{
text = translateTabs(text);
}
int tagIndex = text.indexOf("BEGIN-END-TAG"); //$NON-NLS-1$
if (tagIndex == 0)
{
@ -279,7 +278,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
//return text.substring(0, tagIndex - 6);
return text.substring(0, tagIndex);
}
return text;
}
else if (element instanceof IRemoteCommandShell)
@ -290,7 +289,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
return null;
}
protected String translateTabs(String tabbedString)
{
int columnWidth = 8;
@ -320,9 +319,9 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
{
untabbedBuf.append(c);
currentOffset++;
}
}
}
return untabbedBuf.toString();
}
/**
@ -348,13 +347,13 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
*/
public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
{
if (element instanceof IRemoteCommandShell)
{
IRemoteCommandShell output = (IRemoteCommandShell) element;
return output.listOutput();
}
return null;
}
@ -374,7 +373,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
else
{
return false;
}
}
}
/**
@ -422,20 +421,20 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
return file;
}
protected IEditorRegistry getEditorRegistry()
{
return RSEUIPlugin.getDefault().getWorkbench().getEditorRegistry();
}
protected IEditorDescriptor getDefaultTextEditor()
{
IEditorRegistry registry = getEditorRegistry();
return registry.findEditor("org.eclipse.ui.DefaultTextEditor"); //$NON-NLS-1$
}
/**
* Opens the appropriate editor for a remote output object
*/
@ -445,10 +444,10 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
if (element instanceof IRemoteOutput)
{
IRemoteOutput output = (IRemoteOutput) element;
IRemoteFile file = outputToFile(output);
if (file != null && file.isFile())
{
{
doOpen(file, output);
return true;
}
@ -464,8 +463,8 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
}
return result;
}
private void doOpen(IRemoteFile remoteFile, IRemoteOutput output)
{
if (!remoteFile.isArchive() || !remoteFile.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement())
@ -477,7 +476,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
int line = output.getLine();
int charStart = output.getCharStart();
int charEnd = output.getCharEnd();
try
{
boolean isOpen = editable.checkOpenInEditor() != ISystemEditableRemoteObject.NOT_OPEN;
@ -495,7 +494,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
{
DownloadAndOpenJob oJob = new DownloadAndOpenJob(editable, false, line, charStart, charEnd);
oJob.schedule();
}
}
}
catch (Exception e)
{
@ -503,7 +502,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
}
}
}
private boolean isFileCached(ISystemEditableRemoteObject editable, IRemoteFile remoteFile)
{
// 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();
SystemIFileProperties properties = new SystemIFileProperties(file);
boolean newFile = !file.exists();
// detect whether there exists a temp copy already
if (!newFile && file.exists())
{
// we have a local copy of this file, so we need to compare timestamps
// get stored modification stamp
long storedModifiedStamp = properties.getRemoteFileTimeStamp();
// get updated remoteFile so we get the current remote timestamp
//remoteFile.markStale(true);
IRemoteFileSubSystem subsystem = remoteFile.getParentRemoteFileSubSystem();
@ -529,36 +528,36 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
}
catch (Exception e)
{
}
// get the remote modified stamp
long remoteModifiedStamp = remoteFile.getLastModified();
// get dirty flag
boolean dirty = properties.getDirty();
boolean remoteNewer = (storedModifiedStamp != remoteModifiedStamp);
String remoteEncoding = remoteFile.getEncoding();
String storedEncoding = properties.getEncoding();
boolean encodingChanged = storedEncoding == null || !(remoteEncoding.equals(storedEncoding));
boolean usedBinary = properties.getUsedBinaryTransfer();
boolean isBinary = remoteFile.isBinary();
return (!dirty &&
!remoteNewer &&
return (!dirty &&
!remoteNewer &&
usedBinary == isBinary &&
!encodingChanged);
}
return false;
}
/**
* Returns the associated subsystem for this line of remote output or remote command
*/
@ -573,9 +572,9 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
{
IRemoteOutput output = (IRemoteOutput) element;
String type = output.getType();
if (type.equals(ISystemOutputRemoteTypes.TYPE_FILE) ||
if (type.equals(ISystemOutputRemoteTypes.TYPE_FILE) ||
type.equals(ISystemOutputRemoteTypes.TYPE_DIRECTORY)){
// bug 233475, fall back to the file subsystem
IRemoteFile file = outputToFile(output);
@ -583,7 +582,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
return file.getParentRemoteFileSubSystem();
}
}
Object parent = output.getParent();
if (parent instanceof IRemoteCommandShell)
{
@ -606,15 +605,15 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
return cmd.getId();
}
else if (element instanceof IRemoteOutput)
{
{
IRemoteOutput out = (IRemoteOutput) element;
String type = out.getType();
if (type.equals(ISystemOutputRemoteTypes.TYPE_FILE) ||
if (type.equals(ISystemOutputRemoteTypes.TYPE_FILE) ||
type.equals(ISystemOutputRemoteTypes.TYPE_DIRECTORY)){
return out.getAbsolutePath();
}
String str = getAbsoluteParentName(element);
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
* 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.
* <p>
* 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
* 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
* 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.
*/
public String[] getRemoteParentNamesInUse(Object element, IProgressMonitor monitor) throws Exception
@ -742,7 +741,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
* Returns the current collection of property descriptors.
* By default returns descriptors for name and type only.
* Override if desired.
* @return an array containing all descriptors.
* @return an array containing all descriptors.
*/
protected Object internalGetPropertyValue(Object key)
{
@ -775,7 +774,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
}
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);
}
else if (type.equals(ISystemOutputRemoteTypes.TYPE_FILE))
@ -828,7 +827,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
IRemoteCommandShell command = (IRemoteCommandShell) element;
IRemoteCmdSubSystemConfiguration factory = command.getCommandSubSystem().getParentRemoteCmdSubSystemConfiguration();
ShellServiceSubSystemConfigurationAdapter factoryAdapter = (ShellServiceSubSystemConfigurationAdapter)factory.getAdapter(ISubSystemConfigurationAdapter.class);
ImageDescriptor imageDescriptor = null;
ImageDescriptor imageDescriptor = null;
if (command.isActive())
{
imageDescriptor = factoryAdapter.getActiveCommandShellImageDescriptor();
@ -841,7 +840,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
}
else
{ // return some default
{ // return some default
ImageDescriptor imageDescriptor = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_BLANK_ID);
return imageDescriptor;
}
@ -899,7 +898,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
{
return false;
}
/**
* Return true if this object is renamable by the user. If so, when selected,
* 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.
* 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.
*/
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)
{
/*DKM -for now disabling - the function doesn't
/*DKM -for now disabling - the function doesn't
* make sense for other types of prompts like
* RAD4z
if (element instanceof IRemoteOutput)
@ -948,15 +947,15 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
if (output.getType().equals(ISystemOutputRemoteTypes.TYPE_DIRECTORY)){
IRemoteFile file = outputToFile(output);
ISystemDragDropAdapter fadapter = (ISystemDragDropAdapter)((IAdaptable)file).getAdapter(ISystemDragDropAdapter.class);
return fadapter.canDrop(file);
return fadapter.canDrop(file);
}
}
return false;
}
/**
* Indicates whether the specified object can be copied
* Indicates whether the specified object can be copied
* @param element the object to copy
*/
public boolean canDrag(Object element)
@ -976,7 +975,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
/**
* Copy the specified remote output object. This method returns a string representing
* the text of the remote output;
*
*
* @param element the output to copy
* @param sameSystemType not applicable for remote output
* @param monitor the progress monitor
@ -1000,16 +999,16 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
if (element instanceof IRemoteOutput){
IRemoteOutput output = (IRemoteOutput)element;
String type = output.getType();
if (type.equals(ISystemOutputRemoteTypes.TYPE_FILE) ||
if (type.equals(ISystemOutputRemoteTypes.TYPE_FILE) ||
type.equals(ISystemOutputRemoteTypes.TYPE_DIRECTORY)){
IRemoteFile file = outputToFile(output);
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 getText(element);
}
}
@ -1120,12 +1119,12 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
{
return null;
}
protected IPropertyDescriptor[] internalGetPropertyDescriptors()
{
return getUniquePropertyDescriptors();
}
public IPropertyDescriptor[] getUniquePropertyDescriptors()
{
if (propertySourceInput instanceof IRemoteCommandShell)
@ -1133,7 +1132,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
if (_shellPropertyDescriptors == null)
{
_shellPropertyDescriptors = new IPropertyDescriptor[2];
_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);
}
@ -1148,10 +1147,10 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
return _outputPropertyDescriptors;
}
}
/**
* Returns the current value for the named property.
*
*
* @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
* @return the current value of the given property
@ -1180,13 +1179,13 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter
}
return ""; //$NON-NLS-1$
}
/**
* Don't show properties for remote output
*/
public boolean showProperties(Object element){
return false;
}
}