mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 18:05:33 +02:00
[170627] use IContextObject for hasChildren
This commit is contained in:
parent
c723286c48
commit
81d2c5fae0
46 changed files with 154 additions and 145 deletions
|
@ -69,7 +69,7 @@ public class DaytimeResourceAdapter extends AbstractSystemViewAdapter implements
|
|||
return null; // not really used, which is good because it is ambiguous
|
||||
}
|
||||
|
||||
public boolean hasChildren(Object element) {
|
||||
public boolean hasChildren(IAdaptable element) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ public class DeveloperResourceAdapter extends AbstractSystemViewAdapter
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#hasChildren(java.lang.Object)
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
public boolean hasChildren(IAdaptable element)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ public class TeamResourceAdapter extends AbstractSystemViewAdapter implements
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#hasChildren(java.lang.Object)
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
public boolean hasChildren(IAdaptable element)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,6 @@ import org.eclipse.rse.services.search.IHostSearchConstants;
|
|||
import org.eclipse.rse.services.search.IHostSearchResultConfiguration;
|
||||
import org.eclipse.rse.services.search.IHostSearchResultSet;
|
||||
import org.eclipse.rse.subsystems.files.core.model.ISystemFileRemoteTypes;
|
||||
import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString;
|
||||
import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
|
||||
import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||
|
@ -115,14 +114,11 @@ import org.eclipse.rse.ui.SystemMenuManager;
|
|||
import org.eclipse.rse.ui.SystemResources;
|
||||
import org.eclipse.rse.ui.actions.SystemCopyToClipboardAction;
|
||||
import org.eclipse.rse.ui.actions.SystemPasteFromClipboardAction;
|
||||
import org.eclipse.rse.ui.actions.SystemShowInMonitorAction;
|
||||
import org.eclipse.rse.ui.actions.SystemShowInTableAction;
|
||||
import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog;
|
||||
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
||||
import org.eclipse.rse.ui.operations.SystemFetchOperation;
|
||||
import org.eclipse.rse.ui.validators.ISystemValidator;
|
||||
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
|
||||
import org.eclipse.rse.ui.view.ContextObject;
|
||||
import org.eclipse.rse.ui.view.IContextObject;
|
||||
import org.eclipse.rse.ui.view.ISystemDragDropAdapter;
|
||||
import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
|
||||
|
@ -495,7 +491,7 @@ public class SystemViewRemoteFileAdapter
|
|||
isOpen = atv.getExpandedState(element);
|
||||
if (!isOpen)
|
||||
{
|
||||
if (!hasChildren(element))
|
||||
if (!hasChildren((IAdaptable)element))
|
||||
isOpen = true;
|
||||
}
|
||||
}
|
||||
|
@ -742,15 +738,48 @@ public class SystemViewRemoteFileAdapter
|
|||
file.markStale(false);
|
||||
return children;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this object has children.
|
||||
* Since we can't predict the outcome of resolving the filter string, we return true.
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
public boolean hasChildren(IContextObject element)
|
||||
{
|
||||
return internalHasChildren(element.getModelObject(), element.getFilterReference());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this object has children.
|
||||
* Since we can't predict the outcome of resolving the filter string, we return true.
|
||||
*/
|
||||
public boolean hasChildren(IAdaptable element)
|
||||
{
|
||||
return internalHasChildren(element, null);
|
||||
}
|
||||
|
||||
public boolean internalHasChildren(IAdaptable element, ISystemFilterReference filterReference)
|
||||
{
|
||||
IRemoteFile file = (IRemoteFile) element;
|
||||
boolean supportsArchiveManagement = file.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement();
|
||||
boolean hasChildren = false;
|
||||
|
||||
String filter = "*"; //$NON-NLS-1$
|
||||
if (filterReference != null)
|
||||
{
|
||||
ISystemFilter filterObject = filterReference.getReferencedFilter();
|
||||
if (filterObject.getFilterStringCount() > 0)
|
||||
{
|
||||
String filterString = filterObject.getFilterStrings()[0];
|
||||
String separator = PathUtility.getSeparator(filterString);
|
||||
|
||||
int sepIndex = filterString.lastIndexOf(separator);
|
||||
if (sepIndex > 0)
|
||||
{
|
||||
filter = filterString.substring(sepIndex + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (file instanceof IVirtualRemoteFile)
|
||||
{
|
||||
hasChildren = ((IVirtualRemoteFile)file).isVirtualFolder();
|
||||
|
@ -777,14 +806,14 @@ public class SystemViewRemoteFileAdapter
|
|||
}
|
||||
}
|
||||
else {
|
||||
hasChildren = file.hasContents(RemoteChildrenContentsType.getInstance());
|
||||
hasChildren = file.hasContents(RemoteChildrenContentsType.getInstance(), filter);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// check that the children are actually there
|
||||
//Object[] contents = file.getContents(RemoteChildrenContentsType.getInstance());
|
||||
hasChildren = file.hasContents(RemoteChildrenContentsType.getInstance());
|
||||
hasChildren = file.hasContents(RemoteChildrenContentsType.getInstance(), filter);
|
||||
if (!hasChildren && !file.isStale())
|
||||
hasChildren = true;
|
||||
// if (!file.isStale() && contents != null && contents.length == 0 )
|
||||
|
|
|
@ -242,7 +242,7 @@ public class SystemViewRemoteSearchResultAdapter extends AbstractSystemViewAdapt
|
|||
/**
|
||||
* Returns false.
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
public boolean hasChildren(IAdaptable element)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ public class SystemViewRemoteSearchResultSetAdapter extends AbstractSystemViewAd
|
|||
/**
|
||||
* Returns <code>true</code> if it has children, otherwise returns <code>false</code>.
|
||||
*/
|
||||
public boolean hasChildren(Object element) {
|
||||
public boolean hasChildren(IAdaptable element) {
|
||||
|
||||
if (element instanceof IHostSearchResultSet) {
|
||||
int num = ((IHostSearchResultSet)element).getNumOfResults();
|
||||
|
|
|
@ -151,7 +151,7 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
|
|||
return parent;
|
||||
}
|
||||
|
||||
public boolean hasChildren(Object element)
|
||||
public boolean hasChildren(IAdaptable element)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.shells.ui;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.rse.core.SystemBasePlugin;
|
||||
import org.eclipse.rse.core.model.IHost;
|
||||
import org.eclipse.rse.core.model.ISubSystemConfigurationCategories;
|
||||
|
@ -148,7 +149,7 @@ public class SystemRemoteCommandEntryForm extends Composite
|
|||
{
|
||||
try
|
||||
{
|
||||
currSubSystem.runCommand(cmd, null);
|
||||
currSubSystem.runCommand(new NullProgressMonitor(), cmd, null);
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
|
|
|
@ -19,6 +19,8 @@ package org.eclipse.rse.shells.ui.actions;
|
|||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.window.Window;
|
||||
|
@ -396,6 +398,7 @@ public class SystemCommandAction extends SystemBaseAction
|
|||
}
|
||||
}
|
||||
|
||||
IProgressMonitor monitor = new NullProgressMonitor();
|
||||
if (_selected != null)
|
||||
{
|
||||
IRemoteCmdSubSystem cmdSubSystem = getCommandSubSystem();
|
||||
|
@ -403,7 +406,7 @@ public class SystemCommandAction extends SystemBaseAction
|
|||
|
||||
if (launchNewShell)
|
||||
{
|
||||
Object[] results = cmdSubSystem.runCommand(cmd, _selected);
|
||||
Object[] results = cmdSubSystem.runCommand(monitor, cmd, _selected);
|
||||
Object cmdObject = results[0];
|
||||
if (cmdObject instanceof IRemoteCommandShell)
|
||||
{
|
||||
|
@ -425,8 +428,8 @@ public class SystemCommandAction extends SystemBaseAction
|
|||
{
|
||||
cdCmd = "cd /d \"" + path + '\"'; //$NON-NLS-1$
|
||||
}
|
||||
cmdSubSystem.sendCommandToShell(cdCmd, defaultShell);
|
||||
cmdSubSystem.sendCommandToShell(cmd, defaultShell);
|
||||
cmdSubSystem.sendCommandToShell(monitor, cdCmd, defaultShell);
|
||||
cmdSubSystem.sendCommandToShell(monitor, cmd, defaultShell);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -434,7 +437,7 @@ public class SystemCommandAction extends SystemBaseAction
|
|||
IRemoteCmdSubSystem cmdSubSystem = getCommandSubSystem();
|
||||
if (cmdSubSystem != null)
|
||||
{
|
||||
Object[] results = cmdSubSystem.runCommand(cmd, _selected);
|
||||
Object[] results = cmdSubSystem.runCommand(monitor, cmd, _selected);
|
||||
Object cmdObject = results[0];
|
||||
if (cmdObject instanceof IRemoteCommandShell)
|
||||
{
|
||||
|
@ -484,7 +487,7 @@ public class SystemCommandAction extends SystemBaseAction
|
|||
{
|
||||
SystemCommandsUI commandsUI = SystemCommandsUI.getInstance();
|
||||
SystemCommandsViewPart cmdsPart = commandsUI.activateCommandsView();
|
||||
IRemoteCommandShell cmd = cmdSubSystem.runShell(_selected);
|
||||
IRemoteCommandShell cmd = cmdSubSystem.runShell(new NullProgressMonitor(), _selected);
|
||||
cmdsPart.updateOutput(cmd);
|
||||
}
|
||||
else
|
||||
|
@ -494,7 +497,7 @@ public class SystemCommandAction extends SystemBaseAction
|
|||
{
|
||||
SystemCommandsUI commandsUI = SystemCommandsUI.getInstance();
|
||||
SystemCommandsViewPart cmdsPart = commandsUI.activateCommandsView();
|
||||
IRemoteCommandShell cmd = cmdSubSystem.runShell( _selected);
|
||||
IRemoteCommandShell cmd = cmdSubSystem.runShell(new NullProgressMonitor(), _selected);
|
||||
cmdsPart.updateOutput(cmd);
|
||||
}
|
||||
//showInView(cmd);
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.eclipse.rse.shells.ui.actions;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.rse.shells.ui.ShellResources;
|
||||
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
|
||||
|
@ -81,7 +82,7 @@ public class SystemTerminateShellAction extends SystemBaseShellAction
|
|||
IRemoteCmdSubSystem cmdSubSystem = command.getCommandSubSystem();
|
||||
if (cmdSubSystem != null)
|
||||
{
|
||||
cmdSubSystem.cancelShell(command);
|
||||
cmdSubSystem.cancelShell(new NullProgressMonitor(), command);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.eclipse.rse.shells.ui.view;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.text.ITextOperationTarget;
|
||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||
|
@ -358,7 +359,7 @@ FocusListener
|
|||
//boolean alreadyHandled = false;
|
||||
if (adapter != null)
|
||||
{
|
||||
if (adapter.hasChildren(element))
|
||||
if (adapter.hasChildren((IAdaptable)element))
|
||||
{
|
||||
// special case for folders
|
||||
if (element instanceof IRemoteFile)
|
||||
|
@ -443,7 +444,7 @@ FocusListener
|
|||
IRemoteCmdSubSystem commandSubSystem = remoteCommand.getCommandSubSystem();
|
||||
try
|
||||
{
|
||||
commandSubSystem.sendCommandToShell(inputStr, remoteCommand);
|
||||
commandSubSystem.sendCommandToShell(new NullProgressMonitor(), inputStr, remoteCommand);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -464,7 +465,7 @@ FocusListener
|
|||
IRemoteCmdSubSystem commandSubSystem = remoteCommand.getCommandSubSystem();
|
||||
try
|
||||
{
|
||||
commandSubSystem.sendCommandToShell("#break", remoteCommand); //$NON-NLS-1$
|
||||
commandSubSystem.sendCommandToShell(new NullProgressMonitor(), "#break", remoteCommand); //$NON-NLS-1$
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -233,7 +233,7 @@ public class SystemBuildErrorViewPart extends ViewPart implements ISelectionList
|
|||
//boolean alreadyHandled = false;
|
||||
if (adapter != null)
|
||||
{
|
||||
if (!adapter.hasChildren(element))
|
||||
if (!adapter.hasChildren((IAdaptable)element))
|
||||
{
|
||||
/*alreadyHandled =*/ adapter.handleDoubleClick(element);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.action.IContributionItem;
|
||||
|
@ -147,7 +148,7 @@ public class SystemCommandsViewPart
|
|||
{
|
||||
try
|
||||
{
|
||||
IRemoteCommandShell cmd = _cmdSubSystem.runShell( null);
|
||||
IRemoteCommandShell cmd = _cmdSubSystem.runShell(new NullProgressMonitor(), null);
|
||||
if (cmd != null)
|
||||
{
|
||||
showInView(cmd);
|
||||
|
|
|
@ -342,7 +342,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter, ISystemOutpu
|
|||
/**
|
||||
* Returns true if the element is a remote command and false if it is a remote output.
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
public boolean hasChildren(IAdaptable element)
|
||||
{
|
||||
if (element instanceof IRemoteCommandShell)
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.Random;
|
|||
import java.util.Stack;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.rse.core.SystemBasePlugin;
|
||||
import org.eclipse.rse.model.ISystemResourceChangeEvent;
|
||||
import org.eclipse.rse.model.ISystemResourceChangeEvents;
|
||||
|
@ -104,7 +105,7 @@ public abstract class RemoteCommandShellOperation implements ISystemResourceChan
|
|||
try
|
||||
{
|
||||
RSEUIPlugin.getTheSystemRegistry().addSystemResourceChangeListener(this);
|
||||
_remoteCmdShell = _cmdSubSystem.runShell( _pwd);
|
||||
_remoteCmdShell = _cmdSubSystem.runShell(new NullProgressMonitor(), _pwd);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -136,7 +137,7 @@ public abstract class RemoteCommandShellOperation implements ISystemResourceChan
|
|||
{
|
||||
try
|
||||
{
|
||||
_cmdSubSystem.cancelShell( _remoteCmdShell);
|
||||
_cmdSubSystem.cancelShell(new NullProgressMonitor(), _remoteCmdShell);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -182,7 +183,7 @@ public abstract class RemoteCommandShellOperation implements ISystemResourceChan
|
|||
|
||||
// echo command appended after ; so that
|
||||
// it isn't treated like stdin for the intial command
|
||||
_cmdSubSystem.sendCommandToShell(cmd + _cmdSeparator + echoCmd, _remoteCmdShell);
|
||||
_cmdSubSystem.sendCommandToShell(new NullProgressMonitor(), cmd + _cmdSeparator + echoCmd, _remoteCmdShell);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -203,7 +204,7 @@ public abstract class RemoteCommandShellOperation implements ISystemResourceChan
|
|||
{
|
||||
try
|
||||
{
|
||||
_cmdSubSystem.sendCommandToShell(input, _remoteCmdShell);
|
||||
_cmdSubSystem.sendCommandToShell(new NullProgressMonitor(), input, _remoteCmdShell);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -40,47 +40,8 @@ public interface IRemoteCmdSubSystem extends ISubSystem{
|
|||
*/
|
||||
public IRemoteCmdSubSystemConfiguration getParentRemoteCmdSubSystemConfiguration();
|
||||
|
||||
/**
|
||||
* Execute a remote command. This is only applicable if the subsystem factory reports
|
||||
* true for supportsCommands().
|
||||
* @param command Command to be executed remotely.
|
||||
* @param context context of a command (i.e. working directory). Null is valid and means to run the
|
||||
* command as a shell command in the default shell.
|
||||
* @return Array of objects that are the result of running this command. Typically, these
|
||||
* are messages logged by the command.
|
||||
* @see org.eclipse.rse.shells.ui.RemoteCommandHelpers
|
||||
*
|
||||
* @deprecated use runCommand(IProgressMonitor monitor, String command, Object context)
|
||||
*/
|
||||
public Object[] runCommand(String command, Object context) throws Exception;
|
||||
|
||||
/**
|
||||
* Execute a remote command. This is only applicable if the subsystem factory reports
|
||||
* true for supportsCommands().
|
||||
* @param command Command to be executed remotely.
|
||||
* @param context context of a command (i.e. working directory). Null is valid and means to run the
|
||||
* command as a shell command in the default shell.
|
||||
* @param interpretOutput whether to interpret the output or not
|
||||
* @return Array of objects that are the result of running this command. Typically, these
|
||||
* are messages logged by the command.
|
||||
* @see org.eclipse.rse.shells.ui.RemoteCommandHelpers
|
||||
*
|
||||
* @deprecated use runCommand(IProgressMonitor monitor, String command, Object conecxt, boolean interpretOutput)
|
||||
*/
|
||||
public Object[] runCommand(String command, Object context, boolean interpretOutput) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Launch a new command shell. This is only applicable if the subsystem factory reports
|
||||
* true for supportsCommands().
|
||||
* @param context context of a shell (i.e. working directory). Null is valid and means to use the default context.
|
||||
* @return An object that represents the command and it's output.
|
||||
* @see org.eclipse.rse.shells.ui.RemoteCommandHelpers
|
||||
*
|
||||
* @deprecated use runShell(IProgressMonitor monitor, Object context)
|
||||
*/
|
||||
public IRemoteCommandShell runShell(Object context) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Execute a remote command. This is only applicable if the subsystem factory reports
|
||||
|
@ -91,7 +52,6 @@ public interface IRemoteCmdSubSystem extends ISubSystem{
|
|||
* command as a shell command in the default shell.
|
||||
* @return Array of objects that are the result of running this command. Typically, these
|
||||
* are messages logged by the command.
|
||||
* @see org.eclipse.rse.shells.ui.RemoteCommandHelpers
|
||||
*/
|
||||
public Object[] runCommand(IProgressMonitor monitor, String command, Object context) throws Exception;
|
||||
|
||||
|
@ -105,7 +65,6 @@ public interface IRemoteCmdSubSystem extends ISubSystem{
|
|||
* @param interpretOutput whether to interpret the output or not
|
||||
* @return Array of objects that are the result of running this command. Typically, these
|
||||
* are messages logged by the command.
|
||||
* @see org.eclipse.rse.shells.ui.RemoteCommandHelpers
|
||||
*/
|
||||
public Object[] runCommand(IProgressMonitor monitor, String command, Object context, boolean interpretOutput) throws Exception;
|
||||
|
||||
|
@ -116,7 +75,6 @@ public interface IRemoteCmdSubSystem extends ISubSystem{
|
|||
* @param monitor the progress monitor
|
||||
* @param context context of a shell (i.e. working directory). Null is valid and means to use the default context.
|
||||
* @return An object that represents the command and it's output.
|
||||
* @see org.eclipse.rse.shells.ui.RemoteCommandHelpers
|
||||
*
|
||||
*/
|
||||
public IRemoteCommandShell runShell(IProgressMonitor monitor, Object context) throws Exception;
|
||||
|
@ -125,7 +83,6 @@ public interface IRemoteCmdSubSystem extends ISubSystem{
|
|||
* Send a command as input to a running command shell.
|
||||
* @param input the command to invoke in the shell.
|
||||
* @param commandObject the shell or command to send the invocation to.
|
||||
* @see org.eclipse.rse.shells.ui.RemoteCommandHelpers
|
||||
*
|
||||
* @deprecated use sendCommandToShell(IProgressMonitor, String input, Object commmandObject)
|
||||
*/
|
||||
|
@ -136,17 +93,9 @@ public interface IRemoteCmdSubSystem extends ISubSystem{
|
|||
* @param monitor the progress monitor
|
||||
* @param input the command to invoke in the shell.
|
||||
* @param commandObject the shell or command to send the invocation to.
|
||||
* @see org.eclipse.rse.shells.ui.RemoteCommandHelpers
|
||||
*/
|
||||
public void sendCommandToShell(IProgressMonitor monitor, String input, Object commandObject) throws Exception;
|
||||
|
||||
/**
|
||||
* Cancel a shell or running command.
|
||||
* @param commandObject the shell or command to cancel.
|
||||
*
|
||||
* @deprecated use cancelShell(IProgressMonitor monitor, Object commandObject)
|
||||
*/
|
||||
public void cancelShell(Object commandObject) throws Exception;
|
||||
|
||||
/**
|
||||
* Cancel a shell or running command.
|
||||
|
|
|
@ -373,7 +373,7 @@ public class SystemSelectRemoteObjectAPIProviderImpl
|
|||
else if (filterString != null)
|
||||
hasroots = true;
|
||||
else
|
||||
hasroots = subsystemAdapter.hasChildren(subsystem);
|
||||
hasroots = subsystemAdapter.hasChildren((IAdaptable)subsystem);
|
||||
|
||||
return hasroots;
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ public class SystemTableTreeViewProvider implements ILabelProvider, ITableLabelP
|
|||
ISystemViewElementAdapter adapter = getAdapterFor(object);
|
||||
if (adapter != null)
|
||||
{
|
||||
return adapter.hasChildren(object);
|
||||
return adapter.hasChildren((IAdaptable)object);
|
||||
}
|
||||
if (manager != null) {
|
||||
if (manager.isDeferredAdapter(object))
|
||||
|
@ -205,7 +205,7 @@ public class SystemTableTreeViewProvider implements ILabelProvider, ITableLabelP
|
|||
|
||||
|
||||
|
||||
if (adapter.hasChildren(element))
|
||||
if (adapter.hasChildren((IAdaptable)element))
|
||||
{
|
||||
if (supportsDeferredQueries())
|
||||
{
|
||||
|
|
|
@ -1245,7 +1245,7 @@ public class SystemTableViewPart extends ViewPart implements ISelectionListener,
|
|||
{
|
||||
alreadyHandled = adapter.handleDoubleClick(element);
|
||||
|
||||
if (!alreadyHandled && adapter.hasChildren(element))
|
||||
if (!alreadyHandled && adapter.hasChildren((IAdaptable)element))
|
||||
{
|
||||
setInput((IAdaptable) element);
|
||||
}
|
||||
|
|
|
@ -294,7 +294,7 @@ public class SystemViewConnectionAdapter
|
|||
/**
|
||||
* Return true if this object has children
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
public boolean hasChildren(IAdaptable element)
|
||||
{
|
||||
IHost conn = (IHost)element;
|
||||
return getInput().hasConnectionChildren(conn);
|
||||
|
|
|
@ -219,7 +219,7 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter implement
|
|||
}
|
||||
// otherwise, get children and then cache
|
||||
else {
|
||||
children = checkForNull(ss.resolveFilterStrings(filterStrings), true);
|
||||
children = checkForNull(ss.resolveFilterStrings(monitor, filterStrings), true);
|
||||
|
||||
if (ss.getSubSystemConfiguration().supportsFilterCaching()) {
|
||||
simpleFilter.setContents(SystemChildrenContentsType.getInstance(), children);
|
||||
|
@ -332,7 +332,7 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter implement
|
|||
/**
|
||||
* Return true if this object has children
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
public boolean hasChildren(IAdaptable element)
|
||||
{
|
||||
ISystemFilter filter = getFilter(element);
|
||||
if (filter.getFilterStringCount() > 0)
|
||||
|
|
|
@ -164,7 +164,7 @@ public class SystemViewFilterPoolAdapter extends AbstractSystemViewAdapter imple
|
|||
/**
|
||||
* Return true if this object has children. That is, has filters.
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
public boolean hasChildren(IAdaptable element)
|
||||
{
|
||||
ISystemFilterPool fp = (ISystemFilterPool)element;
|
||||
return fp.getSystemFilterCount() > 0;
|
||||
|
|
|
@ -212,7 +212,7 @@ public class SystemViewFilterPoolReferenceAdapter
|
|||
/**
|
||||
* Return true if this object has children
|
||||
*/
|
||||
public boolean hasChildren(Object element) {
|
||||
public boolean hasChildren(IAdaptable element) {
|
||||
int count = 0;
|
||||
ISystemFilterPoolReference fpRef = getFilterPoolReference(element);
|
||||
if (fpRef != null) {
|
||||
|
|
|
@ -431,7 +431,7 @@ public class SystemViewFilterReferenceAdapter
|
|||
* Return true if this object has children.
|
||||
* That is, if the referenced filter has nested filters or filter strings.
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
public boolean hasChildren(IAdaptable element)
|
||||
{
|
||||
ISystemFilterReference fRef = getFilterReference(element);
|
||||
ISystemFilter referencedFilter = fRef.getReferencedFilter();
|
||||
|
|
|
@ -161,7 +161,7 @@ public class SystemViewFilterStringAdapter extends AbstractSystemViewAdapter imp
|
|||
/**
|
||||
* Return true if this object has children. We return false;
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
public boolean hasChildren(IAdaptable element)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -377,16 +377,22 @@ public class SystemViewLabelAndContentProvider extends LabelProvider
|
|||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
{
|
||||
//return getChildren(element).hasNext();
|
||||
ISystemViewElementAdapter adapter = getAdapter(element);
|
||||
if (adapter != null)
|
||||
if (element instanceof IContextObject)
|
||||
{
|
||||
return adapter.hasChildren(element);
|
||||
return adapter.hasChildren((IContextObject)element);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (adapter != null)
|
||||
{
|
||||
return adapter.hasChildren((IAdaptable)element);
|
||||
}
|
||||
if (manager != null) {
|
||||
if (manager.isDeferredAdapter(element))
|
||||
return manager.mayHaveChildren(element);
|
||||
}
|
||||
}
|
||||
if (manager != null) {
|
||||
if (manager.isDeferredAdapter(element))
|
||||
return manager.mayHaveChildren(element);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -112,7 +112,7 @@ public class SystemViewMessageAdapter
|
|||
/**
|
||||
* Return true if this object has children. Always false for us.
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
public boolean hasChildren(IAdaptable element)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ public class SystemViewPromptableAdapter
|
|||
* Return true if this object has children.
|
||||
* We return true, as either we'll expand and prompt, or expand and show child prompts
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
public boolean hasChildren(IAdaptable element)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ public class SystemViewRootInputAdapter extends AbstractSystemViewAdapter implem
|
|||
/**
|
||||
* Return true if this object has children
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
public boolean hasChildren(IAdaptable element)
|
||||
{
|
||||
ISystemViewInputProvider provider = (ISystemViewInputProvider)element;
|
||||
if ((provider instanceof ISystemRegistry) && showNewConnectionPrompt())
|
||||
|
|
|
@ -117,7 +117,7 @@ public class SystemViewScratchpadAdapter extends AbstractSystemViewAdapter imple
|
|||
/**
|
||||
* Return true if this object has children
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
public boolean hasChildren(IAdaptable element)
|
||||
{
|
||||
SystemScratchpad pad = (SystemScratchpad)element;
|
||||
return pad.hasChildren();
|
||||
|
|
|
@ -181,7 +181,7 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
|
|||
/**
|
||||
* Return true if this object has children
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
public boolean hasChildren(IAdaptable element)
|
||||
{
|
||||
//System.out.println("INSIDE HASCHILDREN FOR SUBSYSTEM VIEW ADAPTER: "+element);
|
||||
ISubSystem ss = (ISubSystem)element;
|
||||
|
|
|
@ -179,7 +179,7 @@ public class SystemScratchpadViewPart extends ViewPart implements ISelectionList
|
|||
|
||||
if (adapter != null)
|
||||
{
|
||||
if (adapter.hasChildren(element))
|
||||
if (adapter.hasChildren((IAdaptable)element))
|
||||
{
|
||||
setInput((IAdaptable) element);
|
||||
}
|
||||
|
|
|
@ -82,10 +82,18 @@ public class SystemScratchpadViewProvider implements ILabelProvider, ITreeConten
|
|||
|
||||
public boolean hasChildren(Object object)
|
||||
{
|
||||
|
||||
ISystemViewElementAdapter adapter = getAdapterFor(object);
|
||||
if (adapter != null)
|
||||
{
|
||||
return adapter.hasChildren(object);
|
||||
if (object instanceof IContextObject)
|
||||
{
|
||||
return adapter.hasChildren((IContextObject)object);
|
||||
}
|
||||
else
|
||||
{
|
||||
return adapter.hasChildren((IAdaptable)object);
|
||||
}
|
||||
}
|
||||
else if (object instanceof IAdaptable)
|
||||
{
|
||||
|
@ -104,6 +112,10 @@ public class SystemScratchpadViewProvider implements ILabelProvider, ITreeConten
|
|||
|
||||
protected ISystemViewElementAdapter getAdapterFor(Object object)
|
||||
{
|
||||
if (object instanceof IContextObject)
|
||||
{
|
||||
object = ((IContextObject)object).getModelObject();
|
||||
}
|
||||
if (object instanceof IAdaptable)
|
||||
{
|
||||
IAdaptable adapt = (IAdaptable) object;
|
||||
|
@ -130,7 +142,7 @@ public class SystemScratchpadViewProvider implements ILabelProvider, ITreeConten
|
|||
if (element instanceof IAdaptable)
|
||||
{
|
||||
ISystemViewElementAdapter adapter = getAdapterFor(element);
|
||||
if (adapter != null && adapter.hasChildren(element))
|
||||
if (adapter != null && adapter.hasChildren((IAdaptable)element))
|
||||
{
|
||||
if (object instanceof IContextObject)
|
||||
{
|
||||
|
|
|
@ -102,7 +102,7 @@ public class SystemSearchViewContentProvider implements ITreeContentProvider {
|
|||
return false;
|
||||
}
|
||||
else {
|
||||
return adapter.hasChildren(element);
|
||||
return adapter.hasChildren((IAdaptable)element);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ public class SystemTeamViewCategoryAdapter
|
|||
/**
|
||||
* Return true if this profile has children. We return true.
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
public boolean hasChildren(IAdaptable element)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.rse.core.SystemResourceManager;
|
|||
import org.eclipse.rse.core.model.ISystemProfile;
|
||||
import org.eclipse.rse.model.ISystemResourceChangeListener;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.view.IContextObject;
|
||||
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
|
||||
import org.eclipse.rse.ui.view.ISystemViewInputProvider;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
@ -104,6 +105,10 @@ public class SystemTeamViewContentProvider extends WorkbenchContentProvider
|
|||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
{
|
||||
if (element instanceof IContextObject)
|
||||
{
|
||||
element = ((IContextObject)element).getModelObject();
|
||||
}
|
||||
boolean children = false;
|
||||
if (element instanceof IProject)
|
||||
children = (getChildren(element).length > 0);
|
||||
|
@ -111,7 +116,7 @@ public class SystemTeamViewContentProvider extends WorkbenchContentProvider
|
|||
{
|
||||
ISystemViewElementAdapter adapter = getSystemViewAdapter(element);
|
||||
if (adapter != null)
|
||||
children = adapter.hasChildren(element);
|
||||
children = adapter.hasChildren((IAdaptable)element);
|
||||
else
|
||||
children = super.hasChildren(element);
|
||||
}
|
||||
|
|
|
@ -278,7 +278,7 @@ public class SystemTeamViewProfileAdapter
|
|||
/**
|
||||
* Return true if this profile has children. We return true.
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
public boolean hasChildren(IAdaptable element)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ public class SystemTeamViewSubSystemConfigurationAdapter
|
|||
/**
|
||||
* Return true if this profile has children. We return true.
|
||||
*/
|
||||
public boolean hasChildren(Object element)
|
||||
public boolean hasChildren(IAdaptable element)
|
||||
{
|
||||
SystemTeamViewSubSystemConfigurationNode ssConfNode = (SystemTeamViewSubSystemConfigurationNode)element;
|
||||
SystemTeamViewCategoryNode category = ssConfNode.getParentCategory();
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.eclipse.rse.ui.actions;
|
|||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.rse.model.ISystemResourceChangeEvents;
|
||||
import org.eclipse.rse.model.ISystemResourceChangeListener;
|
||||
|
@ -62,7 +63,7 @@ public class SystemCollapseAction extends SystemBaseAction {
|
|||
Object selectedObject = e.next();
|
||||
adapter = getAdapter(selectedObject);
|
||||
if (adapter != null) {
|
||||
if (adapter.hasChildren(selectedObject)) enable = true;
|
||||
if (adapter.hasChildren((IAdaptable)selectedObject)) enable = true;
|
||||
}
|
||||
}
|
||||
return enable;
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.eclipse.rse.ui.actions;
|
|||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.rse.model.ISystemResourceChangeEvents;
|
||||
import org.eclipse.rse.model.ISystemResourceChangeListener;
|
||||
|
@ -65,7 +66,7 @@ public class SystemExpandAction extends SystemBaseAction {
|
|||
Object selectedObject = e.next();
|
||||
adapter = getAdapter(selectedObject);
|
||||
if (adapter != null) {
|
||||
if (adapter.hasChildren(selectedObject)) enable = true;
|
||||
if (adapter.hasChildren((IAdaptable)selectedObject)) enable = true;
|
||||
}
|
||||
}
|
||||
return enable;
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.eclipse.rse.ui.actions;
|
|||
import java.util.Iterator;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.rse.core.model.ISystemContainer;
|
||||
import org.eclipse.rse.model.ISystemResourceChangeEvents;
|
||||
|
@ -91,7 +92,7 @@ public class SystemRefreshAction extends SystemBaseAction
|
|||
|
||||
if (adapter != null) {
|
||||
Object parent = adapter.getParent(obj);
|
||||
boolean hasChildren = adapter.hasChildren(obj);
|
||||
boolean hasChildren = adapter.hasChildren((IAdaptable)obj);
|
||||
|
||||
if ((parent != null) && !hasChildren && (!parents.contains(parent))) {
|
||||
parents.add(parent);
|
||||
|
|
|
@ -91,7 +91,7 @@ public class SystemShowInMonitorAction extends SystemBaseAction
|
|||
if (selected != null && selected instanceof IAdaptable)
|
||||
{
|
||||
ISystemViewElementAdapter va = (ISystemViewElementAdapter) ((IAdaptable) selected).getAdapter(ISystemViewElementAdapter.class);
|
||||
if (va.hasChildren(selected))
|
||||
if (va.hasChildren((IAdaptable)selected))
|
||||
{
|
||||
_selected = selected;
|
||||
enable = true;
|
||||
|
|
|
@ -90,7 +90,7 @@ public class SystemShowInTableAction extends SystemBaseAction
|
|||
if (selected != null && selected instanceof IAdaptable)
|
||||
{
|
||||
ISystemViewElementAdapter va = (ISystemViewElementAdapter) ((IAdaptable) selected).getAdapter(ISystemViewElementAdapter.class);
|
||||
if (va.hasChildren(selected))
|
||||
if (va.hasChildren((IAdaptable)selected))
|
||||
{
|
||||
_selected = selected;
|
||||
enable = true;
|
||||
|
|
|
@ -450,8 +450,18 @@ public abstract class AbstractSystemViewAdapter
|
|||
* <i><b>Abstract</b>. Must be overridden by subclasses.</i><br>
|
||||
* Return true if this object has children.
|
||||
*/
|
||||
public abstract boolean hasChildren(Object element);
|
||||
public abstract boolean hasChildren(IAdaptable element);
|
||||
|
||||
/**
|
||||
* Override this to provide context-specific support
|
||||
* @param element the context object
|
||||
* @return whether the context has children
|
||||
*/
|
||||
public boolean hasChildren(IContextObject element)
|
||||
{
|
||||
return hasChildren(element.getModelObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of IWorkbenchAdapter.getChildren(). Rather than overriding this, adapter implementors
|
||||
* should override the getChildren() methods that take a monitor.
|
||||
|
@ -854,7 +864,6 @@ public abstract class AbstractSystemViewAdapter
|
|||
* If true, then canDelete will be called to decide whether to enable delete or not.
|
||||
* <p>By default, returns true.
|
||||
* @see #canDelete(Object)
|
||||
* @see #doDelete(Shell,Object)
|
||||
*/
|
||||
public boolean showDelete(Object element)
|
||||
{
|
||||
|
@ -867,7 +876,6 @@ public abstract class AbstractSystemViewAdapter
|
|||
* <p>
|
||||
* By default, returns false. Override if your object is deletable.
|
||||
* @see #showDelete(Object)
|
||||
* @see #doDelete(Shell,Object)
|
||||
*/
|
||||
public boolean canDelete(Object element)
|
||||
{
|
||||
|
@ -884,7 +892,7 @@ public abstract class AbstractSystemViewAdapter
|
|||
*/
|
||||
public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception
|
||||
{
|
||||
return doDelete(shell, element);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -904,19 +912,6 @@ public abstract class AbstractSystemViewAdapter
|
|||
return ok;
|
||||
}
|
||||
|
||||
/**
|
||||
* <i><b>Overridable</b> by subclasses, and usually is.</i><br>
|
||||
* Perform the delete action. By default does nothing. Override if your object is deletable.
|
||||
* 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.
|
||||
* @see #showDelete(Object)
|
||||
* @see #canDelete(Object)
|
||||
* @deprecated use the one with the monitor
|
||||
*/
|
||||
public boolean doDelete(Shell shell, Object element) throws Exception
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// ------------------------------------------
|
||||
// METHODS TO SUPPORT COMMON RENAME ACTION...
|
||||
|
@ -1371,7 +1366,7 @@ public abstract class AbstractSystemViewAdapter
|
|||
return value.equals(getType(target));
|
||||
else if (name.equalsIgnoreCase("hasChildren")) //$NON-NLS-1$
|
||||
{
|
||||
return hasChildren(target) ? value.equals("true") : value.equals("false"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
return hasChildren((IAdaptable)target) ? value.equals("true") : value.equals("false"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
else if (name.equalsIgnoreCase("connected")) //$NON-NLS-1$
|
||||
{
|
||||
|
|
|
@ -202,10 +202,17 @@ public interface ISystemViewElementAdapter extends IPropertySource, ISystemDragD
|
|||
* Return the children of this object, using the given Expand-To filter
|
||||
*/
|
||||
public Object[] getChildrenUsingExpandToFilter(Object element, String expandToFilter);
|
||||
|
||||
/**
|
||||
* Return true if this object has children
|
||||
*/
|
||||
public boolean hasChildren(IAdaptable element);
|
||||
|
||||
/**
|
||||
* Return true if this object has children
|
||||
*/
|
||||
public boolean hasChildren(Object element);
|
||||
public boolean hasChildren(IContextObject element);
|
||||
|
||||
/**
|
||||
* Return true if this object is a "prompting" object that prompts the user when expanded.
|
||||
* For such objects, we do not try to save and restore their expansion state on F5 or between
|
||||
|
@ -239,12 +246,7 @@ public interface ISystemViewElementAdapter extends IPropertySource, ISystemDragD
|
|||
* the Edit->Delete menu item will be enabled.
|
||||
*/
|
||||
public boolean canDelete(Object element);
|
||||
/**
|
||||
* Perform the delete on the given item. This is after the user has been asked to confirm deletion.
|
||||
* @deprecated use the one with the monitor
|
||||
*/
|
||||
public boolean doDelete(Shell shell, Object element)
|
||||
throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Perform the delete on the given item. This is after the user has been asked to confirm deletion.
|
||||
|
|
|
@ -116,7 +116,7 @@ public class TestSubSystemNodeAdapter extends AbstractSystemViewAdapter
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#hasChildren(java.lang.Object)
|
||||
*/
|
||||
public boolean hasChildren(Object element) {
|
||||
public boolean hasChildren(IAdaptable element) {
|
||||
if (isTestSubSystemNodeContainer(element))
|
||||
return ((ITestSubSystemNodeContainer)element).hasChildNodes();
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue