1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 01:35:39 +02:00

[218304] Improve deferred adapter loading

This commit is contained in:
Martin Oberhuber 2008-04-10 15:32:51 +00:00
parent bd3364cf4c
commit dc383c52f3
21 changed files with 1280 additions and 1134 deletions

View file

@ -1,15 +1,16 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 Wind River Systems, Inc. * Copyright (c) 2006, 2008 Wind River Systems, Inc.
* 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
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - initial API and implementation * Martin Oberhuber (Wind River) - initial API and implementation
* David Dykstal (IBM) - [217556] remove service subsystem types * David Dykstal (IBM) - [217556] remove service subsystem types
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.examples.daytime.subsystems; package org.eclipse.rse.examples.daytime.subsystems;
@ -43,8 +44,8 @@ import org.eclipse.rse.ui.model.ISystemRegistryUI;
*/ */
public class DaytimeSubSystem extends SubSystem { public class DaytimeSubSystem extends SubSystem {
private IDaytimeService fDaytimeService; private IDaytimeService fDaytimeService;
public DaytimeSubSystem(IHost host, IConnectorService connectorService, IDaytimeService daytimeService) { public DaytimeSubSystem(IHost host, IConnectorService connectorService, IDaytimeService daytimeService) {
super(host, connectorService); super(host, connectorService);
fDaytimeService = daytimeService; fDaytimeService = daytimeService;
@ -52,8 +53,9 @@ public class DaytimeSubSystem extends SubSystem {
public void initializeSubSystem(IProgressMonitor monitor) { public void initializeSubSystem(IProgressMonitor monitor) {
//This is called after connect - expand the daytime node. //This is called after connect - expand the daytime node.
//May be called in worker thread. // Always called in worker thread.
//TODO find a more elegant solution for expanding the item, e.g. use implicit connect like filters super.initializeSubSystem(monitor);
//TODO find a more elegant solution for expanding the item, e.g. use implicit connect like filters
final ISystemRegistryUI sr = RSEUIPlugin.getTheSystemRegistryUI(); final ISystemRegistryUI sr = RSEUIPlugin.getTheSystemRegistryUI();
final SystemResourceChangeEvent event = new SystemResourceChangeEvent(this, ISystemResourceChangeEvents.EVENT_SELECT_EXPAND, null); final SystemResourceChangeEvent event = new SystemResourceChangeEvent(this, ISystemResourceChangeEvents.EVENT_SELECT_EXPAND, null);
//TODO bug 150919: postEvent() should not be necessary asynchronously //TODO bug 150919: postEvent() should not be necessary asynchronously
@ -62,15 +64,15 @@ public class DaytimeSubSystem extends SubSystem {
public void run() { sr.postEvent(event); } public void run() { sr.postEvent(event); }
}); });
} }
public boolean hasChildren() { public boolean hasChildren() {
return isConnected(); return isConnected();
} }
public IDaytimeService getDaytimeService() { public IDaytimeService getDaytimeService() {
return fDaytimeService; return fDaytimeService;
} }
public Object[] getChildren() { public Object[] getChildren() {
if (isConnected()) { if (isConnected()) {
try { try {
@ -90,7 +92,7 @@ public class DaytimeSubSystem extends SubSystem {
} }
public void uninitializeSubSystem(IProgressMonitor monitor) { public void uninitializeSubSystem(IProgressMonitor monitor) {
//nothing to do super.uninitializeSubSystem(monitor);
} }
public Class getServiceType() { public Class getServiceType() {
@ -99,7 +101,7 @@ public class DaytimeSubSystem extends SubSystem {
public void switchServiceFactory(ISubSystemConfiguration factory) { public void switchServiceFactory(ISubSystemConfiguration factory) {
// not applicable here // not applicable here
} }
} }

View file

@ -1,17 +1,18 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
* *
* 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) - Adapted original tutorial code to Open RSE. * Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
********************************************************************************/ ********************************************************************************/
package samples.subsystems; package samples.subsystems;
@ -35,7 +36,7 @@ public class DeveloperSubSystem extends SubSystem
{ {
private TeamResource[] teams; // faked-out master list of teams private TeamResource[] teams; // faked-out master list of teams
private Vector devVector = new Vector(); // faked-out master list of developers private Vector devVector = new Vector(); // faked-out master list of developers
private static int employeeId = 123456; // employee Id factory private static int employeeId = 123456; // employee Id factory
/** /**
* @param host * @param host
@ -45,23 +46,28 @@ public class DeveloperSubSystem extends SubSystem
super(host, connectorService); super(host, connectorService);
} }
/* (non-Javadoc) /*
* @see org.eclipse.rse.core.subsystems.SubSystem#initializeSubSystem(org.eclipse.core.runtime.IProgressMonitor) * (non-Javadoc)
* @see SubSystem#initializeSubSystem(IProgressMonitor)
*/ */
public void initializeSubSystem(IProgressMonitor monitor) { public void initializeSubSystem(IProgressMonitor monitor) {
} super.initializeSubSystem(monitor);
/* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.ISubSystem#uninitializeSubSystem(org.eclipse.core.runtime.IProgressMonitor)
*/
public void uninitializeSubSystem(IProgressMonitor monitor) {
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.SubSystem#getObjectWithAbsoluteName(java.lang.String) * @see ISubSystem#uninitializeSubSystem(IProgressMonitor)
*/ */
public Object getObjectWithAbsoluteName(String key) throws Exception public void uninitializeSubSystem(IProgressMonitor monitor) {
super.uninitializeSubSystem(monitor);
}
/*
* (non-Javadoc)
*
* @see SubSystem#getObjectWithAbsoluteName(String, IProgressMonitor)
*/
public Object getObjectWithAbsoluteName(String key, IProgressMonitor monitor) throws Exception
{ {
// Functional opposite of getAbsoluteName(Object) in our resource adapters // Functional opposite of getAbsoluteName(Object) in our resource adapters
if (key.startsWith("Team_")) //$NON-NLS-1$ if (key.startsWith("Team_")) //$NON-NLS-1$
@ -78,10 +84,10 @@ public class DeveloperSubSystem extends SubSystem
DeveloperResource[] devrs = getAllDevelopers(); DeveloperResource[] devrs = getAllDevelopers();
for (int idx=0; idx<devrs.length; idx++) for (int idx=0; idx<devrs.length; idx++)
if (devrs[idx].getId().equals(devrId)) if (devrs[idx].getId().equals(devrId))
return devrs[idx]; return devrs[idx];
} }
// Not a remote object: fall back to return filter reference // Not a remote object: fall back to return filter reference
return super.getObjectWithAbsoluteName(key); return super.getObjectWithAbsoluteName(key, monitor);
} }
/** /**
@ -93,15 +99,15 @@ public class DeveloperSubSystem extends SubSystem
*/ */
protected Object[] internalResolveFilterString(String filterString, IProgressMonitor monitor) protected Object[] internalResolveFilterString(String filterString, IProgressMonitor monitor)
throws java.lang.reflect.InvocationTargetException, throws java.lang.reflect.InvocationTargetException,
java.lang.InterruptedException java.lang.InterruptedException
{ {
int slashIdx = filterString.indexOf('/'); int slashIdx = filterString.indexOf('/');
if (slashIdx < 0) if (slashIdx < 0)
{ {
// Fake it out for now and return dummy list. // Fake it out for now and return dummy list.
// In reality, this would communicate with remote server-side code/data. // In reality, this would communicate with remote server-side code/data.
TeamResource[] allTeams = getAllTeams(); TeamResource[] allTeams = getAllTeams();
// Now, subset master list, based on filter string... // Now, subset master list, based on filter string...
NamePatternMatcher subsetter = new NamePatternMatcher(filterString); NamePatternMatcher subsetter = new NamePatternMatcher(filterString);
Vector v = new Vector(); Vector v = new Vector();
@ -109,7 +115,7 @@ public class DeveloperSubSystem extends SubSystem
{ {
if (subsetter.matches(allTeams[idx].getName())) if (subsetter.matches(allTeams[idx].getName()))
v.addElement(allTeams[idx]); v.addElement(allTeams[idx]);
} }
TeamResource[] teams = new TeamResource[v.size()]; TeamResource[] teams = new TeamResource[v.size()];
for (int idx=0; idx<v.size(); idx++) for (int idx=0; idx<v.size(); idx++)
teams[idx] = (TeamResource)v.elementAt(idx); teams[idx] = (TeamResource)v.elementAt(idx);
@ -134,11 +140,11 @@ public class DeveloperSubSystem extends SubSystem
{ {
if (subsetter.matches(allDevrs[idx].getName())) if (subsetter.matches(allDevrs[idx].getName()))
v.addElement(allDevrs[idx]); v.addElement(allDevrs[idx]);
} }
DeveloperResource[] devrs = new DeveloperResource[v.size()]; DeveloperResource[] devrs = new DeveloperResource[v.size()];
for (int idx=0; idx<v.size(); idx++) for (int idx=0; idx<v.size(); idx++)
devrs[idx] = (DeveloperResource)v.elementAt(idx); devrs[idx] = (DeveloperResource)v.elementAt(idx);
return devrs; return devrs;
} }
} }
return null; return null;
@ -156,31 +162,31 @@ public class DeveloperSubSystem extends SubSystem
throws java.lang.reflect.InvocationTargetException, throws java.lang.reflect.InvocationTargetException,
java.lang.InterruptedException java.lang.InterruptedException
{ {
// typically we ignore the filter string as it is always "*" // typically we ignore the filter string as it is always "*"
// until support is added for "quick filters" the user can specify/select // until support is added for "quick filters" the user can specify/select
// at the time they expand a remote resource. // at the time they expand a remote resource.
TeamResource team = (TeamResource)parent; TeamResource team = (TeamResource)parent;
return team.getDevelopers(); return team.getDevelopers();
} }
// ------------------ // ------------------
// Our own methods... // Our own methods...
// ------------------ // ------------------
/** /**
* Get the list of all teams. Normally this would involve a trip the server, but we * Get the list of all teams. Normally this would involve a trip the server, but we
* fake it out and return a hard-coded local list. * fake it out and return a hard-coded local list.
* @return array of all teams * @return array of all teams
*/ */
public TeamResource[] getAllTeams() public TeamResource[] getAllTeams()
{ {
if (teams == null) if (teams == null)
teams = createTeams("Team ", 4); teams = createTeams("Team ", 4);
return teams; return teams;
} }
/** /**
* Get the list of all developers. Normally this would involve a trip the server, but we * Get the list of all developers. Normally this would involve a trip the server, but we
* fake it out and return a hard-coded local list. * fake it out and return a hard-coded local list.
* @return array of all developers * @return array of all developers
*/ */
public DeveloperResource[] getAllDevelopers() public DeveloperResource[] getAllDevelopers()
@ -188,7 +194,7 @@ public class DeveloperSubSystem extends SubSystem
DeveloperResource[] allDevrs = new DeveloperResource[devVector.size()]; DeveloperResource[] allDevrs = new DeveloperResource[devVector.size()];
for (int idx=0; idx<allDevrs.length; idx++) for (int idx=0; idx<allDevrs.length; idx++)
allDevrs[idx] = (DeveloperResource)devVector.elementAt(idx); allDevrs[idx] = (DeveloperResource)devVector.elementAt(idx);
return allDevrs; return allDevrs;
} }
/* /*
* Create and return a dummy set of teams * Create and return a dummy set of teams

View file

@ -3,13 +3,13 @@
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
* *
* 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) - [182454] improve getAbsoluteName() documentation * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
@ -19,6 +19,7 @@
* David Dykstal (IBM) - [217556] remove service subsystem types * David Dykstal (IBM) - [217556] remove service subsystem types
* Martin Oberhuber (Wind River) - [cleanup] Add API "since" Javadoc tags * Martin Oberhuber (Wind River) - [cleanup] Add API "since" Javadoc tags
* David Dykstal (IBM) - [225089][ssh][shells][api] Canceling connection leads to exception * David Dykstal (IBM) - [225089][ssh][shells][api] Canceling connection leads to exception
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.core.subsystems; package org.eclipse.rse.core.subsystems;
@ -40,14 +41,14 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
/** /**
* Interface implemented by SubSystem objects. * Interface implemented by SubSystem objects.
* *
* While connections contain information to identify a particular remote system, * While connections contain information to identify a particular remote system,
* it is the subsystem objects within a connection that contain information * it is the subsystem objects within a connection that contain information
* unique to a particular tool for that remote system, such as the port the tool * unique to a particular tool for that remote system, such as the port the tool
* uses and the user ID for making the connection. There are a set of default * uses and the user ID for making the connection. There are a set of default
* properties, but these can be extended by subsystem providers, by extending * properties, but these can be extended by subsystem providers, by extending
* SubSystem. * SubSystem.
* *
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
* Clients must extend the abstract <code>SubSystem</code> class * Clients must extend the abstract <code>SubSystem</code> class
* instead. * instead.
@ -73,7 +74,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
/** /**
* Set the connector service for this subsystem * Set the connector service for this subsystem
* *
* @param connectorService connector service object to set * @param connectorService connector service object to set
*/ */
public void setConnectorService(IConnectorService connectorService); public void setConnectorService(IConnectorService connectorService);
@ -90,14 +91,25 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
public IHost getHost(); public IHost getHost();
/** /**
* Called on each subsystem associated with a particular {@link IConnectorService} after it connects. * Called on each subsystem associated with a particular
* @param monitor A progress monitor supporting progress reporting and cancellation. * {@link IConnectorService} after it connects successfully. This call is
* always made on a background Thread, so it's allowed to be long-running.
*
* @param monitor a progress monitor that can be used to show progress
* during long-running operation. Cancellation is typically not
* supported since it might leave the system in an inconsistent
* state.
*/ */
public void initializeSubSystem(IProgressMonitor monitor); public void initializeSubSystem(IProgressMonitor monitor);
/** /**
* Called on each subsystem associated with a particular {@link IConnectorService} after it disconnects * Called on each subsystem associated with a particular
* @param monitor A progress monitor supporting progress reporting and cancellation. * {@link IConnectorService} after it disconnects
*
* @param monitor a progress monitor that can be used to show progress
* during long-running operation. Cancellation is typically not
* supported since it might leave the system in an inconsistent
* state.
*/ */
public void uninitializeSubSystem(IProgressMonitor monitor); public void uninitializeSubSystem(IProgressMonitor monitor);
@ -142,14 +154,14 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
/** /**
* Check if the subsystem is connected, and connect if it's not. * Check if the subsystem is connected, and connect if it's not.
* *
* This is a convenience method which first checks whether the subsystem is * This is a convenience method which first checks whether the subsystem is
* already connected. If not, it automatically checks if it's running on the * already connected. If not, it automatically checks if it's running on the
* dispatch thread or not, and calls the right <code>connect()</code> * dispatch thread or not, and calls the right <code>connect()</code>
* method as appropriate. It also performs some exception parsing, * method as appropriate. It also performs some exception parsing,
* converting Exceptions from connect() into SystemMessageException that can * converting Exceptions from connect() into SystemMessageException that can
* be displayed to the user by using a method in it. * be displayed to the user by using a method in it.
* *
* @throws SystemMessageException in case of an error connecting * @throws SystemMessageException in case of an error connecting
* @since org.eclipse.rse.core 3.0 * @since org.eclipse.rse.core 3.0
*/ */
@ -352,7 +364,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* Return the CacheManager for this subsystem. If the SubSystem returns true for * Return the CacheManager for this subsystem. If the SubSystem returns true for
* supportsCaching() then it must return a valid CacheManager, otherwise it is free * supportsCaching() then it must return a valid CacheManager, otherwise it is free
* to return null. * to return null.
* *
* @see #supportsCaching() * @see #supportsCaching()
*/ */
public ICacheManager getCacheManager(); public ICacheManager getCacheManager();
@ -381,15 +393,15 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
/** /**
* Synchronously connect to the remote system. * Synchronously connect to the remote system.
* *
* Clients are expected to call this method on a background * Clients are expected to call this method on a background
* thread with an existing progress monitor. A signon prompt * thread with an existing progress monitor. A signon prompt
* may optionally be forced even if the password is cached * may optionally be forced even if the password is cached
* in memory or on disk. * in memory or on disk.
* *
* The framework will take care of switching to the UI thread * The framework will take care of switching to the UI thread
* for requesting a password from the user if necessary. * for requesting a password from the user if necessary.
* *
* @param monitor the progress monitor. Must not be <code>null</code>. * @param monitor the progress monitor. Must not be <code>null</code>.
* @param forcePrompt forces the prompt dialog to be displayed * @param forcePrompt forces the prompt dialog to be displayed
* even if the password is currently in memory. * even if the password is currently in memory.
@ -411,7 +423,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* <p/> * <p/>
* Override internalConnect if you want, but by default it calls * Override internalConnect if you want, but by default it calls
* <code>getConnectorService().connect(IProgressMonitor)</code>. * <code>getConnectorService().connect(IProgressMonitor)</code>.
* *
* @param forcePrompt forces the prompt dialog even if the password is in mem * @param forcePrompt forces the prompt dialog even if the password is in mem
* @param callback to call after connect is complete. * @param callback to call after connect is complete.
* May be <code>null</code>. * May be <code>null</code>.
@ -530,7 +542,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* @param key Identifies property to set * @param key Identifies property to set
* @param value Value to set property to * @param value Value to set property to
* @return Object interpretable by subsystem. Might be a Boolean, or the might be new value for confirmation. * @return Object interpretable by subsystem. Might be a Boolean, or the might be new value for confirmation.
* *
* @deprecated this shouldn't be used * @deprecated this shouldn't be used
*/ */
public Object setProperty(Object subject, String key, String value) throws Exception; public Object setProperty(Object subject, String key, String value) throws Exception;
@ -542,7 +554,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* @param subject Identifies which object to get the properties of * @param subject Identifies which object to get the properties of
* @param key Identifies property to get value of * @param key Identifies property to get value of
* @return String The value of the requested key. * @return String The value of the requested key.
* *
* @deprecated this shouldn't be used * @deprecated this shouldn't be used
*/ */
public String getProperty(Object subject, String key) throws Exception; public String getProperty(Object subject, String key) throws Exception;
@ -555,7 +567,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* @param keys Identifies the properties to set * @param keys Identifies the properties to set
* @param values Values to set properties to. One to one mapping to keys by index number * @param values Values to set properties to. One to one mapping to keys by index number
* @return Object interpretable by subsystem. Might be a Boolean, or the might be new values for confirmation. * @return Object interpretable by subsystem. Might be a Boolean, or the might be new values for confirmation.
* *
* @deprecated this shouldn't be used * @deprecated this shouldn't be used
*/ */
public Object setProperties(Object subject, String[] keys, String[] values) throws Exception; public Object setProperties(Object subject, String[] keys, String[] values) throws Exception;
@ -567,7 +579,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* @param subject Identifies which object to get the properties of * @param subject Identifies which object to get the properties of
* @param keys Identifies properties to get value of * @param keys Identifies properties to get value of
* @return The values of the requested keys. * @return The values of the requested keys.
* *
* @deprecated this shouldn't be used * @deprecated this shouldn't be used
*/ */
public String[] getProperties(Object subject, String[] keys) throws Exception; public String[] getProperties(Object subject, String[] keys) throws Exception;
@ -622,7 +634,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
/** /**
* Returns the interface type (i.e. a Class object that is an Interface) of * Returns the interface type (i.e. a Class object that is an Interface) of
* a service subsystem. * a service subsystem.
* *
* @return the service interface on which this service subsystem is * @return the service interface on which this service subsystem is
* implemented. If this subsystem is not a service subsystem it must * implemented. If this subsystem is not a service subsystem it must
* return <code>null</code>. * return <code>null</code>.
@ -638,7 +650,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
* {@link #canSwitchTo(ISubSystemConfiguration)}. If the configuration is * {@link #canSwitchTo(ISubSystemConfiguration)}. If the configuration is
* not compatible with this subsystem then this must do nothing and must * not compatible with this subsystem then this must do nothing and must
* answer false to {@link #canSwitchTo(ISubSystemConfiguration)}. * answer false to {@link #canSwitchTo(ISubSystemConfiguration)}.
* *
* @param configuration the configuration to which to switch. * @param configuration the configuration to which to switch.
* @since org.eclipse.rse.core 3.0 * @since org.eclipse.rse.core 3.0
*/ */
@ -647,7 +659,7 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
/** /**
* Determine is this subsystem is compatible with this specified * Determine is this subsystem is compatible with this specified
* configuration. * configuration.
* *
* @param configuration the configuration which may be switched to * @param configuration the configuration which may be switched to
* @return true if the subsystem can switch to this configuration, false * @return true if the subsystem can switch to this configuration, false
* otherwise. Subsystems which are not service subsystems must * otherwise. Subsystems which are not service subsystems must

View file

@ -15,13 +15,12 @@
* Martin Oberhuber (Wind River) - [180519][api] declaratively register adapter factories * Martin Oberhuber (Wind River) - [180519][api] declaratively register adapter factories
* Martin Oberhuber (wind River) - [203105] Decouple recursive plugin activation of UI adapters * Martin Oberhuber (wind River) - [203105] Decouple recursive plugin activation of UI adapters
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.subsystems.files.core; package org.eclipse.rse.internal.subsystems.files.core;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileEmpty;
import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
@ -47,20 +46,6 @@ public class Activator extends AbstractUIPlugin {
*/ */
public void start(BundleContext context) throws Exception { public void start(BundleContext context) throws Exception {
super.start(context); super.start(context);
// make sure that required adapters factories are loaded
//(will typically activate org.eclipse.rse.files.ui)
//TODO Check that this does not fire up the UI if we want to be headless
//Decouple from the current Thread
new Thread("files.ui adapter loader") { //$NON-NLS-1$
public void run() {
Platform.getAdapterManager().loadAdapter(new RemoteFileEmpty(), "org.eclipse.rse.ui.view.ISystemViewElementAdapter"); //$NON-NLS-1$
}
}.start();
// Others (RemoteSearchResultSet, RemoteSearchResult,
// RemoteFileSystemConfigurationAdapter will be available
// automatically once the plugin is loaded
} }
/** /**

View file

@ -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) - Fix 158534 - NPE in upload/download after conflict * Martin Oberhuber (Wind River) - Fix 158534 - NPE in upload/download after conflict
* Martin Oberhuber (Wind River) - Fix 162962 - recursive removeCachedRemoteFile() * Martin Oberhuber (Wind River) - Fix 162962 - recursive removeCachedRemoteFile()
@ -25,15 +25,16 @@
* David McKnight (IBM) - [162195] new APIs for upload multi and download multi * David McKnight (IBM) - [162195] new APIs for upload multi and download multi
* David McKnight (IBM) - [203114] don't treat XML files specially (no hidden prefs for bin vs text) * David McKnight (IBM) - [203114] don't treat XML files specially (no hidden prefs for bin vs text)
* David McKnight (IBM) - [209552] API changes to use multiple and getting rid of deprecated * David McKnight (IBM) - [209552] API changes to use multiple and getting rid of deprecated
* Kevin Doyle (IBM) - [208778] [efs][api] RSEFileStore#getOutputStream() does not support EFS#APPEND * Kevin Doyle (IBM) - [208778] [efs][api] RSEFileStore#getOutputStream() does not support EFS#APPEND
* David McKnight (IBM) - [209704] added supportsEncodingConversion() * David McKnight (IBM) - [209704] added supportsEncodingConversion()
* David Dykstal (IBM) - [197036] pulling up subsystem switch logic * David Dykstal (IBM) - [197036] pulling up subsystem switch logic
* David Dykstal (IBM) - [217556] remove service subsystem types * David Dykstal (IBM) - [217556] remove service subsystem types
* Martin Oberhuber (Wind River) - [219098][api] FileServiceSubSystem should not be final * Martin Oberhuber (Wind River) - [219098][api] FileServiceSubSystem should not be final
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
* Martin Oberhuber (Wind River) - [220020][api][breaking] SystemFileTransferModeRegistry should be internal * Martin Oberhuber (Wind River) - [220020][api][breaking] SystemFileTransferModeRegistry should be internal
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
* Kevin Doyle (IBM) - [224162] SystemEditableRemoteFile.saveAs does not work because FileServiceSubSytem.upload does invalid check * Kevin Doyle (IBM) - [224162] SystemEditableRemoteFile.saveAs does not work because FileServiceSubSytem.upload does invalid check
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.subsystems.files.core.servicesubsystem; package org.eclipse.rse.subsystems.files.core.servicesubsystem;
@ -84,16 +85,16 @@ import org.eclipse.rse.ui.SystemBasePlugin;
/** /**
* Generic Subsystem implementation for remote files. * Generic Subsystem implementation for remote files.
* *
* Clients may instantiate this class from their subsystem configurations. * Clients may instantiate this class from their subsystem configurations.
* <p> * <p>
* Extending (overriding) this class is discouraged: configuration of the subsystem * Extending (overriding) this class is discouraged: configuration of the subsystem
* behavior should be done by providing a custom {@link IFileService} implementation * behavior should be done by providing a custom {@link IFileService} implementation
* wherever possible. * wherever possible.
*/ */
public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileServiceSubSystem public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileServiceSubSystem
{ {
protected ILanguageUtilityFactory _languageUtilityFactory; protected ILanguageUtilityFactory _languageUtilityFactory;
protected IFileService _hostFileService; protected IFileService _hostFileService;
protected ISearchService _hostSearchService; protected ISearchService _hostSearchService;
@ -105,16 +106,16 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
_hostFileService = hostFileService; _hostFileService = hostFileService;
_hostFileToRemoteFileAdapter = fileAdapter; _hostFileToRemoteFileAdapter = fileAdapter;
_hostSearchService = searchService; _hostSearchService = searchService;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystem#isCaseSensitive() * @see org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystem#isCaseSensitive()
*/ */
public boolean isCaseSensitive() { public boolean isCaseSensitive() {
return getFileService().isCaseSensitive(); return getFileService().isCaseSensitive();
} }
public IRemoteFileContext getContextFor(IRemoteFile file) public IRemoteFileContext getContextFor(IRemoteFile file)
{ {
return getContext(file); return getContext(file);
@ -124,27 +125,27 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
{ {
return getDefaultContextNoFilterString(); return getDefaultContextNoFilterString();
} }
public IFileService getFileService() public IFileService getFileService()
{ {
return _hostFileService; return _hostFileService;
} }
public void setFileService(IFileService service) public void setFileService(IFileService service)
{ {
_hostFileService = service; _hostFileService = service;
} }
public ISearchService getSearchService() public ISearchService getSearchService()
{ {
return _hostSearchService; return _hostSearchService;
} }
public void setSearchService(ISearchService service) public void setSearchService(ISearchService service)
{ {
_hostSearchService = service; _hostSearchService = service;
} }
public IHostFileToRemoteFileAdapter getHostFileToRemoteFileAdapter() public IHostFileToRemoteFileAdapter getHostFileToRemoteFileAdapter()
{ {
return _hostFileToRemoteFileAdapter; return _hostFileToRemoteFileAdapter;
@ -154,43 +155,43 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
{ {
_hostFileToRemoteFileAdapter = hostFileAdapter; _hostFileToRemoteFileAdapter = hostFileAdapter;
} }
/** /**
* Constructs an IRemoteFile object given * Constructs an IRemoteFile object given
* an unqualified file or folder name and its parent folder object. * an unqualified file or folder name and its parent folder object.
* @param parent Folder containing the folder or file * @param parent Folder containing the folder or file
* @param folderOrFileName Un-qualified folder or file name * @param folderOrFileName Un-qualified folder or file name
* @param monitor the progress monitor * @param monitor the progress monitor
* @return an IRemoteFile object for the file. * @return an IRemoteFile object for the file.
* @see IRemoteFile * @see IRemoteFile
*/ */
public IRemoteFile getRemoteFileObject(IRemoteFile parent, String folderOrFileName, IProgressMonitor monitor) throws SystemMessageException public IRemoteFile getRemoteFileObject(IRemoteFile parent, String folderOrFileName, IProgressMonitor monitor) throws SystemMessageException
{ {
// for bug 207095, implicit connect if the connection is not connected // for bug 207095, implicit connect if the connection is not connected
checkIsConnected(monitor); checkIsConnected(monitor);
String fullPath = parent.getAbsolutePath() + getSeparator() + folderOrFileName; String fullPath = parent.getAbsolutePath() + getSeparator() + folderOrFileName;
IRemoteFile file = getCachedRemoteFile(fullPath); IRemoteFile file = getCachedRemoteFile(fullPath);
if (file != null && !file.isStale()) if (file != null && !file.isStale())
{ {
return file; return file;
} }
IHostFile node = getFile(parent.getAbsolutePath(), folderOrFileName, monitor); IHostFile node = getFile(parent.getAbsolutePath(), folderOrFileName, monitor);
return getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), parent, node); return getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), parent, node);
} }
/** /**
* Constructs and returns an IRemoteFile object given a fully-qualified * Constructs and returns an IRemoteFile object given a fully-qualified
* file or folder name. * file or folder name.
* @param folderOrFileName Fully qualified folder or file name * @param folderOrFileName Fully qualified folder or file name
* @param monitor the progress monitor * @param monitor the progress monitor
* @return The constructed IRemoteFile * @return The constructed IRemoteFile
* @see IRemoteFile * @see IRemoteFile
*/ */
public IRemoteFile getRemoteFileObject(String folderOrFileName, IProgressMonitor monitor) throws SystemMessageException public IRemoteFile getRemoteFileObject(String folderOrFileName, IProgressMonitor monitor) throws SystemMessageException
{ {
String fofName = folderOrFileName; String fofName = folderOrFileName;
@ -202,19 +203,19 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
if (file != null && !file.isStale()) { if (file != null && !file.isStale()) {
return file; return file;
} }
// for bug 207095, implicit connect if the connection is not connected // for bug 207095, implicit connect if the connection is not connected
checkIsConnected(monitor); checkIsConnected(monitor);
if (fofName.endsWith(ArchiveHandlerManager.VIRTUAL_SEPARATOR)) if (fofName.endsWith(ArchiveHandlerManager.VIRTUAL_SEPARATOR))
{ {
fofName = fofName.substring(0, fofName.length() - ArchiveHandlerManager.VIRTUAL_SEPARATOR.length()); fofName = fofName.substring(0, fofName.length() - ArchiveHandlerManager.VIRTUAL_SEPARATOR.length());
} }
int j = fofName.indexOf(ArchiveHandlerManager.VIRTUAL_SEPARATOR); int j = fofName.indexOf(ArchiveHandlerManager.VIRTUAL_SEPARATOR);
if (j == -1) if (j == -1)
{ {
if (fofName.equals("/")) //$NON-NLS-1$ if (fofName.equals("/")) //$NON-NLS-1$
{ {
try try
{ {
@ -222,18 +223,18 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
} }
catch (Exception e) catch (Exception e)
{ {
} }
} }
if (fofName.equals(".")) { //$NON-NLS-1$ if (fofName.equals(".")) { //$NON-NLS-1$
IRemoteFile userHome = getUserHome(); IRemoteFile userHome = getUserHome();
if (userHome == null){ if (userHome == null){
// with 207095, it's possible that we could be trying to get user home when not connected // with 207095, it's possible that we could be trying to get user home when not connected
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
ICommonMessageIds.MSG_ERROR_UNEXPECTED, ICommonMessageIds.MSG_ERROR_UNEXPECTED,
IStatus.ERROR, IStatus.ERROR,
CommonMessages.MSG_ERROR_UNEXPECTED); CommonMessages.MSG_ERROR_UNEXPECTED);
throw new SystemMessageException(msg); throw new SystemMessageException(msg);
} }
@ -260,22 +261,22 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
} }
return null; return null;
} }
int lastSep = fofName.lastIndexOf(sep); int lastSep = fofName.lastIndexOf(sep);
if (lastSep > -1) if (lastSep > -1)
{ {
String parentPath = fofName.substring(0, lastSep); String parentPath = fofName.substring(0, lastSep);
if (parentPath.length() == 0) parentPath = "/"; //$NON-NLS-1$ if (parentPath.length() == 0) parentPath = "/"; //$NON-NLS-1$
String name = fofName.substring(lastSep + 1, fofName.length()); String name = fofName.substring(lastSep + 1, fofName.length());
IHostFile node = getFile(parentPath, name, monitor); IHostFile node = getFile(parentPath, name, monitor);
if (node != null) if (node != null)
{ {
IRemoteFile parent = null; IRemoteFile parent = null;
if (!node.isRoot()) if (!node.isRoot())
{ {
//parent = getRemoteFileObject(parentPath); //parent = getRemoteFileObject(parentPath);
} }
@ -304,7 +305,7 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
* @return The IRemoteFile that is the user's home directory on this remote file system. * @return The IRemoteFile that is the user's home directory on this remote file system.
* The remote file system is assumed to have a concept of a home directory. * The remote file system is assumed to have a concept of a home directory.
*/ */
protected IRemoteFile getUserHome() protected IRemoteFile getUserHome()
{ {
if (_userHome != null) if (_userHome != null)
{ {
@ -319,7 +320,7 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
if (userHome == null) { if (userHome == null) {
return null; return null;
} }
IRemoteFile parent = null; IRemoteFile parent = null;
if (!userHome.getParentPath().equals(".")) //$NON-NLS-1$ if (!userHome.getParentPath().equals(".")) //$NON-NLS-1$
{ {
@ -328,7 +329,7 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
//parent = getRemoteFileObject(userHome.getParentPath()); //parent = getRemoteFileObject(userHome.getParentPath());
} }
catch (Exception e) catch (Exception e)
{ {
} }
} }
root = getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), parent, userHome); root = getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), parent, userHome);
@ -340,53 +341,53 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
{ {
return getFileService().list(parentPath, fileNameFilter, fileType, monitor); return getFileService().list(parentPath, fileNameFilter, fileType, monitor);
} }
protected IHostFile getFile(String parentPath, String fileName, IProgressMonitor monitor) throws SystemMessageException protected IHostFile getFile(String parentPath, String fileName, IProgressMonitor monitor) throws SystemMessageException
{ {
return getFileService().getFile(parentPath, fileName, monitor); return getFileService().getFile(parentPath, fileName, monitor);
} }
protected IHostFile[] getRoots(IProgressMonitor monitor) throws InterruptedException, SystemMessageException protected IHostFile[] getRoots(IProgressMonitor monitor) throws InterruptedException, SystemMessageException
{ {
return getFileService().getRoots(monitor); return getFileService().getRoots(monitor);
} }
public IRemoteFile[] getRemoteFileObjects(String[] folderOrFileNames, public IRemoteFile[] getRemoteFileObjects(String[] folderOrFileNames,
IProgressMonitor monitor) throws SystemMessageException IProgressMonitor monitor) throws SystemMessageException
{ {
// for bug 207095, implicit connect if the connection is not connected // for bug 207095, implicit connect if the connection is not connected
checkIsConnected(monitor); checkIsConnected(monitor);
String[] parentPaths = new String[folderOrFileNames.length]; String[] parentPaths = new String[folderOrFileNames.length];
String[] names = new String[folderOrFileNames.length]; String[] names = new String[folderOrFileNames.length];
String sep = null; String sep = null;
for (int i = 0; i < folderOrFileNames.length; i++) for (int i = 0; i < folderOrFileNames.length; i++)
{ {
String fofName = folderOrFileNames[i]; String fofName = folderOrFileNames[i];
if (sep == null) if (sep == null)
sep = PathUtility.getSeparator(fofName); sep = PathUtility.getSeparator(fofName);
String parentPath = null; String parentPath = null;
String name = null; String name = null;
int lastSep = fofName.lastIndexOf(sep); int lastSep = fofName.lastIndexOf(sep);
if (lastSep > -1) if (lastSep > -1)
{ {
parentPath = fofName.substring(0, lastSep); parentPath = fofName.substring(0, lastSep);
if (parentPath.length() == 0) parentPath = "/"; //$NON-NLS-1$ if (parentPath.length() == 0) parentPath = "/"; //$NON-NLS-1$
name = fofName.substring(lastSep + 1, fofName.length()); name = fofName.substring(lastSep + 1, fofName.length());
} }
parentPaths[i] = parentPath; parentPaths[i] = parentPath;
names[i] = name; names[i] = name;
} }
RemoteFileContext context = getDefaultContext(); RemoteFileContext context = getDefaultContext();
IHostFile[] nodes = getFileService().getFileMultiple(parentPaths, names, monitor); IHostFile[] nodes = getFileService().getFileMultiple(parentPaths, names, monitor);
return getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, nodes); return getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, nodes);
} }
@ -405,26 +406,26 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
{ {
parentPaths[i] = parents[i].getAbsolutePath(); parentPaths[i] = parents[i].getAbsolutePath();
} }
IHostFile[] results = getFileService().listMultiple(parentPaths, fileNameFilters, fileTypes, monitor); IHostFile[] results = getFileService().listMultiple(parentPaths, fileNameFilters, fileTypes, monitor);
RemoteFileContext context = getDefaultContext(); RemoteFileContext context = getDefaultContext();
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, results); IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, results);
// caching // caching
for (int i = 0; i < parents.length; i++) for (int i = 0; i < parents.length; i++)
{ {
IRemoteFile parent = parents[i]; IRemoteFile parent = parents[i];
String parentPath = parentPaths[i]; String parentPath = parentPaths[i];
String filter = fileNameFilters[i]; String filter = fileNameFilters[i];
List underParent = new ArrayList(); List underParent = new ArrayList();
// what files are under this one? // what files are under this one?
for (int j = 0; j < farr.length; j++) for (int j = 0; j < farr.length; j++)
{ {
IRemoteFile child = farr[j]; IRemoteFile child = farr[j];
String childParentPath = child.getParentPath(); String childParentPath = child.getParentPath();
if (parentPath.equals(childParentPath)) if (parentPath.equals(childParentPath))
{ {
underParent.add(child); underParent.add(child);
@ -433,7 +434,7 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
if (underParent.size() > 0) if (underParent.size() > 0)
{ {
parent.setContents(RemoteChildrenContentsType.getInstance(), filter, underParent.toArray()); parent.setContents(RemoteChildrenContentsType.getInstance(), filter, underParent.toArray());
} }
} }
return farr; return farr;
@ -455,26 +456,26 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
{ {
parentPaths[i] = parents[i].getAbsolutePath(); parentPaths[i] = parents[i].getAbsolutePath();
} }
IHostFile[] results = getFileService().listMultiple(parentPaths, fileNameFilters, fileType, monitor); IHostFile[] results = getFileService().listMultiple(parentPaths, fileNameFilters, fileType, monitor);
RemoteFileContext context = getDefaultContext(); RemoteFileContext context = getDefaultContext();
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, results); IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, results);
// caching // caching
for (int i = 0; i < parents.length; i++) for (int i = 0; i < parents.length; i++)
{ {
IRemoteFile parent = parents[i]; IRemoteFile parent = parents[i];
String parentPath = parentPaths[i]; String parentPath = parentPaths[i];
String filter = fileNameFilters[i]; String filter = fileNameFilters[i];
List underParent = new ArrayList(); List underParent = new ArrayList();
// what files are under this one? // what files are under this one?
for (int j = 0; j < farr.length; j++) for (int j = 0; j < farr.length; j++)
{ {
IRemoteFile child = farr[j]; IRemoteFile child = farr[j];
String childParentPath = child.getParentPath(); String childParentPath = child.getParentPath();
if (parentPath.equals(childParentPath)) if (parentPath.equals(childParentPath))
{ {
underParent.add(child); underParent.add(child);
@ -483,18 +484,18 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
if (underParent.size() > 0) if (underParent.size() > 0)
{ {
parent.setContents(RemoteChildrenContentsType.getInstance(), filter, underParent.toArray()); parent.setContents(RemoteChildrenContentsType.getInstance(), filter, underParent.toArray());
} }
} }
return farr; return farr;
} }
/** /**
* Return a list of remote folders and/or files in the given folder. * Return a list of remote folders and/or files in the given folder.
* <p> * <p>
* The files part of the list is filtered by the given file name filter. * The files part of the list is filtered by the given file name filter.
* It can be null for no filtering. * It can be null for no filtering.
* This version is called by RemoteFileSubSystemImpl's resolveFilterString(s). * This version is called by RemoteFileSubSystemImpl's resolveFilterString(s).
* @param parent The parent folder to list folders and files in * @param parent The parent folder to list folders and files in
* @param fileNameFilter The name pattern to subset the file list by, or null to return all files. * @param fileNameFilter The name pattern to subset the file list by, or null to return all files.
@ -507,20 +508,20 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
String parentPath = null; String parentPath = null;
if (parent != null) { if (parent != null) {
parentPath = parent.getAbsolutePath(); parentPath = parent.getAbsolutePath();
} else { } else {
parentPath = "/"; //$NON-NLS-1$ parentPath = "/"; //$NON-NLS-1$
} }
if (parent != null && !parent.canRead()) if (parent != null && !parent.canRead())
{ {
String msgTxt = NLS.bind(SystemFileResources.MSG_FOLDER_UNREADABLE, parentPath); String msgTxt = NLS.bind(SystemFileResources.MSG_FOLDER_UNREADABLE, parentPath);
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
ISystemFileMessageIds.MSG_FOLDER_UNREADABLE, ISystemFileMessageIds.MSG_FOLDER_UNREADABLE,
IStatus.INFO, msgTxt); IStatus.INFO, msgTxt);
throw new SystemMessageException(msg); throw new SystemMessageException(msg);
} }
IHostFile[] results = internalList(parentPath, fileNameFilter, fileType, monitor); IHostFile[] results = internalList(parentPath, fileNameFilter, fileType, monitor);
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, parent, results); IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, parent, results);
if (parent != null) if (parent != null)
@ -529,8 +530,8 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
} }
public IRemoteFile[] listRoots(IRemoteFileContext context, IProgressMonitor monitor) throws InterruptedException public IRemoteFile[] listRoots(IRemoteFileContext context, IProgressMonitor monitor) throws InterruptedException
{ {
IHostFile[] roots = null; IHostFile[] roots = null;
try try
@ -539,18 +540,18 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
} }
catch (SystemMessageException e) catch (SystemMessageException e)
{ {
} }
IRemoteFile[] results = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, roots); IRemoteFile[] results = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, roots);
return results; return results;
} }
protected boolean isBinary(String localEncoding, String hostEncoding, String remotePath) protected boolean isBinary(String localEncoding, String hostEncoding, String remotePath)
{ {
return RemoteFileUtility.getSystemFileTransferModeRegistry().isBinary(remotePath); return RemoteFileUtility.getSystemFileTransferModeRegistry().isBinary(remotePath);
} }
protected boolean isBinary(IRemoteFile source) protected boolean isBinary(IRemoteFile source)
{ {
return source.isBinary(); // always use preferences (whether xml or not) return source.isBinary(); // always use preferences (whether xml or not)
@ -573,18 +574,18 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
remoteFileName = avp.getName(); remoteFileName = avp.getName();
} }
getFileService().upload(new File(source), remoteParentPath, remoteFileName, isBinary, srcEncoding, rmtEncoding, monitor); getFileService().upload(new File(source), remoteParentPath, remoteFileName, isBinary, srcEncoding, rmtEncoding, monitor);
// notify that the file was uploaded // notify that the file was uploaded
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
sr.fireEvent(new SystemRemoteChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_UPLOADED, remotePath, remoteParentPath, this)); sr.fireEvent(new SystemRemoteChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_UPLOADED, remotePath, remoteParentPath, this));
} }
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#upload(java.lang.String, org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#upload(java.lang.String, org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/ */
public void upload(String source, IRemoteFile destination, String encoding, IProgressMonitor monitor) throws SystemMessageException public void upload(String source, IRemoteFile destination, String encoding, IProgressMonitor monitor) throws SystemMessageException
{ {
String remoteParentPath = destination.getParentPath(); String remoteParentPath = destination.getParentPath();
String remoteFileName = destination.getName(); String remoteFileName = destination.getName();
@ -595,29 +596,29 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
{ {
String msgTxt = NLS.bind(SystemFileResources.MSG_FILE_CANNOT_BE_SAVED, remoteFileName, getHostName()); String msgTxt = NLS.bind(SystemFileResources.MSG_FILE_CANNOT_BE_SAVED, remoteFileName, getHostName());
String msgDetails = SystemFileResources.MSG_FILE_CANNOT_BE_SAVED_DETAILS; String msgDetails = SystemFileResources.MSG_FILE_CANNOT_BE_SAVED_DETAILS;
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
ISystemFileMessageIds.MSG_FILE_CANNOT_BE_SAVED, ISystemFileMessageIds.MSG_FILE_CANNOT_BE_SAVED,
IStatus.ERROR, msgTxt, msgDetails); IStatus.ERROR, msgTxt, msgDetails);
throw new SystemMessageException(msg); throw new SystemMessageException(msg);
} }
getFileService().upload(new File(source), remoteParentPath, remoteFileName, isBinary, encoding, hostEncoding, monitor); getFileService().upload(new File(source), remoteParentPath, remoteFileName, isBinary, encoding, hostEncoding, monitor);
// notify that the file was uploaded // notify that the file was uploaded
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
sr.fireEvent(new SystemRemoteChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_UPLOADED, destination, destination.getParentRemoteFile(), this)); sr.fireEvent(new SystemRemoteChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_UPLOADED, destination, destination.getParentRemoteFile(), this));
} }
public void uploadMultiple(String[] sources, String[] srcEncodings, public void uploadMultiple(String[] sources, String[] srcEncodings,
String[] remotePaths, String[] rmtEncodings, String[] remotePaths, String[] rmtEncodings,
IProgressMonitor monitor) throws SystemMessageException IProgressMonitor monitor) throws SystemMessageException
{ {
// create list of stuff // create list of stuff
File[] sourceFiles = new File[sources.length]; File[] sourceFiles = new File[sources.length];
boolean[] isBinaries = new boolean[sources.length]; boolean[] isBinaries = new boolean[sources.length];
String[] remoteParentPaths = new String[sources.length]; String[] remoteParentPaths = new String[sources.length];
String[] remoteFileNames = new String[sources.length]; String[] remoteFileNames = new String[sources.length];
// gather info // gather info
for (int i = 0; i < sources.length; i++) for (int i = 0; i < sources.length; i++)
{ {
@ -636,16 +637,16 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
} }
} }
else // unexpected else // unexpected
{ {
// throw an exception here // throw an exception here
//SystemMessage msg = RSEUIPlugin.getPluginMessage("RSEF5003").makeSubstitution(remoteFileNames[i], getHostName()); //$NON-NLS-1$ //SystemMessage msg = RSEUIPlugin.getPluginMessage("RSEF5003").makeSubstitution(remoteFileNames[i], getHostName()); //$NON-NLS-1$
//throw new SystemMessageException(msg); //throw new SystemMessageException(msg);
} }
} }
// upload // upload
getFileService().uploadMultiple(sourceFiles, remoteParentPaths, remoteFileNames, isBinaries, srcEncodings, rmtEncodings, monitor); getFileService().uploadMultiple(sourceFiles, remoteParentPaths, remoteFileNames, isBinaries, srcEncodings, rmtEncodings, monitor);
// notification // notification
// notify that the file was uploaded // notify that the file was uploaded
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
@ -659,43 +660,43 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
public void uploadMultiple(String[] sources, IRemoteFile[] destinations, public void uploadMultiple(String[] sources, IRemoteFile[] destinations,
String[] encodings, IProgressMonitor monitor) String[] encodings, IProgressMonitor monitor)
throws SystemMessageException throws SystemMessageException
{ {
// create list of stuff // create list of stuff
File[] sourceFiles = new File[sources.length]; File[] sourceFiles = new File[sources.length];
boolean[] isBinaries = new boolean[sources.length]; boolean[] isBinaries = new boolean[sources.length];
String[] remoteParentPaths = new String[sources.length]; String[] remoteParentPaths = new String[sources.length];
String[] remoteFileNames = new String[sources.length]; String[] remoteFileNames = new String[sources.length];
String[] hostEncodings = new String[sources.length]; String[] hostEncodings = new String[sources.length];
// gather info // gather info
for (int i = 0; i < sources.length; i++) for (int i = 0; i < sources.length; i++)
{ {
sourceFiles[i] = new File(sources[i]); sourceFiles[i] = new File(sources[i]);
IRemoteFile destination = destinations[i]; IRemoteFile destination = destinations[i];
remoteParentPaths[i] = destination.getAbsolutePath(); remoteParentPaths[i] = destination.getAbsolutePath();
remoteFileNames[i] = destination.getName(); remoteFileNames[i] = destination.getName();
if (!destination.canWrite()) if (!destination.canWrite())
{ {
String msgTxt = NLS.bind(SystemFileResources.MSG_FILE_CANNOT_BE_SAVED, remoteFileNames[i], getHostName()); String msgTxt = NLS.bind(SystemFileResources.MSG_FILE_CANNOT_BE_SAVED, remoteFileNames[i], getHostName());
String msgDetails = SystemFileResources.MSG_FILE_CANNOT_BE_SAVED_DETAILS; String msgDetails = SystemFileResources.MSG_FILE_CANNOT_BE_SAVED_DETAILS;
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
ISystemFileMessageIds.MSG_FILE_CANNOT_BE_SAVED, ISystemFileMessageIds.MSG_FILE_CANNOT_BE_SAVED,
IStatus.ERROR, msgTxt, msgDetails); IStatus.ERROR, msgTxt, msgDetails);
throw new SystemMessageException(msg); throw new SystemMessageException(msg);
} }
hostEncodings[i] = destination.getEncoding(); hostEncodings[i] = destination.getEncoding();
isBinaries[i] = isBinary(encodings[i], hostEncodings[i], destination.getAbsolutePath()); isBinaries[i] = isBinary(encodings[i], hostEncodings[i], destination.getAbsolutePath());
} }
// upload // upload
getFileService().uploadMultiple(sourceFiles, remoteParentPaths, remoteFileNames, isBinaries, encodings, hostEncodings, monitor); getFileService().uploadMultiple(sourceFiles, remoteParentPaths, remoteFileNames, isBinaries, encodings, hostEncodings, monitor);
// notification // notification
// notify that the file was uploaded // notify that the file was uploaded
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
@ -711,7 +712,7 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
* (non-Javadoc) * (non-Javadoc)
* @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#download(org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile, java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#download(org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile, java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/ */
public void download(IRemoteFile file, String localpath, String encoding, IProgressMonitor monitor) throws SystemMessageException public void download(IRemoteFile file, String localpath, String encoding, IProgressMonitor monitor) throws SystemMessageException
{ {
//Fixing bug 158534. TODO remove when bug 162688 is fixed. //Fixing bug 158534. TODO remove when bug 162688 is fixed.
if (monitor==null) { if (monitor==null) {
@ -719,7 +720,7 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
} }
String parentPath = file.getParentPath(); String parentPath = file.getParentPath();
File localFile = new File(localpath); File localFile = new File(localpath);
// FIXME why are we using file.getEncoding() instead of the specified encoding? // FIXME why are we using file.getEncoding() instead of the specified encoding?
getFileService().download(parentPath, file.getName(), localFile, isBinary(file), file.getEncoding(), monitor); getFileService().download(parentPath, file.getName(), localFile, isBinary(file), file.getEncoding(), monitor);
if (monitor.isCanceled()) if (monitor.isCanceled())
@ -734,22 +735,22 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
} }
} }
public void downloadMultiple(IRemoteFile[] sources, String[] destinations, public void downloadMultiple(IRemoteFile[] sources, String[] destinations,
String[] encodings, IProgressMonitor monitor) String[] encodings, IProgressMonitor monitor)
throws SystemMessageException throws SystemMessageException
{ {
//Fixing bug 158534. TODO remove when bug 162688 is fixed. //Fixing bug 158534. TODO remove when bug 162688 is fixed.
if (monitor==null) { if (monitor==null) {
monitor = new NullProgressMonitor(); monitor = new NullProgressMonitor();
} }
// get arrays of parent paths and local files // get arrays of parent paths and local files
String[] parentPaths = new String[sources.length]; String[] parentPaths = new String[sources.length];
String[] names = new String[sources.length]; String[] names = new String[sources.length];
boolean[] isBinaries = new boolean[sources.length]; boolean[] isBinaries = new boolean[sources.length];
File[] localFiles = new File[sources.length]; File[] localFiles = new File[sources.length];
for (int i = 0; i < sources.length; i++) for (int i = 0; i < sources.length; i++)
{ {
IRemoteFile file = sources[i]; IRemoteFile file = sources[i];
@ -758,7 +759,7 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
isBinaries[i] = isBinary(file); isBinaries[i] = isBinary(file);
localFiles[i] = new File(destinations[i]); localFiles[i] = new File(destinations[i]);
} }
getFileService().downloadMultiple(parentPaths, names, localFiles, isBinaries, encodings, monitor); getFileService().downloadMultiple(parentPaths, names, localFiles, isBinaries, encodings, monitor);
if (monitor.isCanceled()) if (monitor.isCanceled())
{ {
@ -772,31 +773,31 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
{ {
// notify that the file was downloaded // notify that the file was downloaded
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
for (int r = 0; r < sources.length; r++) for (int r = 0; r < sources.length; r++)
{ {
IRemoteFile file = sources[r]; IRemoteFile file = sources[r];
sr.fireEvent(new SystemRemoteChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DOWNLOADED, file, file.getParentRemoteFile(), this)); sr.fireEvent(new SystemRemoteChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DOWNLOADED, file, file.getParentRemoteFile(), this));
} }
} }
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#copy(org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile, org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#copy(org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile, org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/ */
public boolean copy(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName, IProgressMonitor monitor) throws SystemMessageException public boolean copy(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName, IProgressMonitor monitor) throws SystemMessageException
{ {
IFileService service = getFileService(); IFileService service = getFileService();
return service.copy(sourceFolderOrFile.getParentPath(), sourceFolderOrFile.getName(), targetFolder.getAbsolutePath(), newName, monitor); return service.copy(sourceFolderOrFile.getParentPath(), sourceFolderOrFile.getName(), targetFolder.getAbsolutePath(), newName, monitor);
} }
public boolean copyBatch(IRemoteFile[] sourceFolderOrFiles, IRemoteFile targetFolder, IProgressMonitor monitor) throws SystemMessageException public boolean copyBatch(IRemoteFile[] sourceFolderOrFiles, IRemoteFile targetFolder, IProgressMonitor monitor) throws SystemMessageException
{ {
IFileService service = getFileService(); IFileService service = getFileService();
String[] sourceParents = new String[sourceFolderOrFiles.length]; String[] sourceParents = new String[sourceFolderOrFiles.length];
String[] sourceNames = new String[sourceFolderOrFiles.length]; String[] sourceNames = new String[sourceFolderOrFiles.length];
for (int i = 0; i < sourceFolderOrFiles.length; i++) for (int i = 0; i < sourceFolderOrFiles.length; i++)
{ {
sourceParents[i] = sourceFolderOrFiles[i].getParentPath(); sourceParents[i] = sourceFolderOrFiles[i].getParentPath();
@ -805,7 +806,7 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
return service.copyBatch(sourceParents, sourceNames, targetFolder.getAbsolutePath(), monitor); return service.copyBatch(sourceParents, sourceNames, targetFolder.getAbsolutePath(), monitor);
} }
public IRemoteFile getParentFolder(IRemoteFile folderOrFile, IProgressMonitor monitor) public IRemoteFile getParentFolder(IRemoteFile folderOrFile, IProgressMonitor monitor)
{ {
try try
{ {
@ -817,7 +818,7 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
} }
} }
public IRemoteFile createFile(IRemoteFile fileToCreate, IProgressMonitor monitor) throws SystemMessageException public IRemoteFile createFile(IRemoteFile fileToCreate, IProgressMonitor monitor) throws SystemMessageException
{ {
IFileService service = getFileService(); IFileService service = getFileService();
String parent = fileToCreate.getParentPath(); String parent = fileToCreate.getParentPath();
@ -826,7 +827,7 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
return getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), fileToCreate.getParentRemoteFile(), newFile); return getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), fileToCreate.getParentRemoteFile(), newFile);
} }
public IRemoteFile createFolder(IRemoteFile folderToCreate, IProgressMonitor monitor) throws SystemMessageException public IRemoteFile createFolder(IRemoteFile folderToCreate, IProgressMonitor monitor) throws SystemMessageException
{ {
IFileService service = getFileService(); IFileService service = getFileService();
String parent = folderToCreate.getParentPath(); String parent = folderToCreate.getParentPath();
@ -835,12 +836,12 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
return getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), folderToCreate.getParentRemoteFile(), newFolder); return getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), folderToCreate.getParentRemoteFile(), newFolder);
} }
public IRemoteFile createFolders(IRemoteFile folderToCreate, IProgressMonitor monitor) throws SystemMessageException public IRemoteFile createFolders(IRemoteFile folderToCreate, IProgressMonitor monitor) throws SystemMessageException
{ {
return createFolder(folderToCreate, monitor); return createFolder(folderToCreate, monitor);
} }
public boolean delete(IRemoteFile folderOrFile, IProgressMonitor monitor) throws SystemMessageException public boolean delete(IRemoteFile folderOrFile, IProgressMonitor monitor) throws SystemMessageException
{ {
IFileService service = getFileService(); IFileService service = getFileService();
String parent = folderOrFile.getParentPath(); String parent = folderOrFile.getParentPath();
@ -849,10 +850,10 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
folderOrFile.markStale(true); folderOrFile.markStale(true);
return result; return result;
} }
public boolean deleteBatch(IRemoteFile[] folderOrFiles, IProgressMonitor monitor) throws SystemMessageException public boolean deleteBatch(IRemoteFile[] folderOrFiles, IProgressMonitor monitor) throws SystemMessageException
{ {
String[] parents = new String[folderOrFiles.length]; String[] parents = new String[folderOrFiles.length];
String[] names = new String[folderOrFiles.length]; String[] names = new String[folderOrFiles.length];
for (int i = 0; i < folderOrFiles.length; i++) for (int i = 0; i < folderOrFiles.length; i++)
@ -867,7 +868,7 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
return service.deleteBatch(parents, names, monitor); return service.deleteBatch(parents, names, monitor);
} }
public boolean rename(IRemoteFile folderOrFile, String newName, IProgressMonitor monitor) throws SystemMessageException public boolean rename(IRemoteFile folderOrFile, String newName, IProgressMonitor monitor) throws SystemMessageException
{ {
removeCachedRemoteFile(folderOrFile); removeCachedRemoteFile(folderOrFile);
IFileService service = getFileService(); IFileService service = getFileService();
@ -878,8 +879,8 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
folderOrFile.getHostFile().renameTo(newPath); folderOrFile.getHostFile().renameTo(newPath);
return result; return result;
} }
public boolean move(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName, IProgressMonitor monitor) throws SystemMessageException public boolean move(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName, IProgressMonitor monitor) throws SystemMessageException
{ {
IFileService service = getFileService(); IFileService service = getFileService();
String srcParent = sourceFolderOrFile.getParentPath(); String srcParent = sourceFolderOrFile.getParentPath();
@ -892,21 +893,21 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
return result; return result;
} }
public boolean setLastModified(IRemoteFile folderOrFile, long newDate, IProgressMonitor monitor) throws SystemMessageException public boolean setLastModified(IRemoteFile folderOrFile, long newDate, IProgressMonitor monitor) throws SystemMessageException
{ {
String name = folderOrFile.getName(); String name = folderOrFile.getName();
String parent = folderOrFile.getParentPath(); String parent = folderOrFile.getParentPath();
return _hostFileService.setLastModified(parent, name, newDate, monitor); return _hostFileService.setLastModified(parent, name, newDate, monitor);
} }
public boolean setReadOnly(IRemoteFile folderOrFile, boolean readOnly, IProgressMonitor monitor) throws SystemMessageException public boolean setReadOnly(IRemoteFile folderOrFile, boolean readOnly, IProgressMonitor monitor) throws SystemMessageException
{ {
String name = folderOrFile.getName(); String name = folderOrFile.getName();
String parent = folderOrFile.getParentPath(); String parent = folderOrFile.getParentPath();
return _hostFileService.setReadOnly(parent, name, readOnly, monitor); return _hostFileService.setReadOnly(parent, name, readOnly, monitor);
} }
public ILanguageUtilityFactory getLanguageUtilityFactory() public ILanguageUtilityFactory getLanguageUtilityFactory()
{ {
if (_languageUtilityFactory == null) if (_languageUtilityFactory == null)
{ {
@ -914,13 +915,13 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
} }
return _languageUtilityFactory; return _languageUtilityFactory;
} }
public void setLanguageUtilityFactory(ILanguageUtilityFactory factory) public void setLanguageUtilityFactory(ILanguageUtilityFactory factory)
{ {
_languageUtilityFactory = factory; _languageUtilityFactory = factory;
} }
public void search(IHostSearchResultConfiguration searchConfig) public void search(IHostSearchResultConfiguration searchConfig)
{ {
ISearchService searchService = getSearchService(); ISearchService searchService = getSearchService();
if (searchService != null) if (searchService != null)
@ -930,7 +931,7 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
} }
} }
public void cancelSearch(IHostSearchResultConfiguration searchConfig) public void cancelSearch(IHostSearchResultConfiguration searchConfig)
{ {
ISearchService searchService = getSearchService(); ISearchService searchService = getSearchService();
if (searchService != null) if (searchService != null)
@ -938,7 +939,7 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
searchService.cancelSearch(searchConfig, null); searchService.cancelSearch(searchConfig, null);
} }
} }
public IHostSearchResultConfiguration createSearchConfiguration(IHostSearchResultSet resultSet, Object searchTarget, SystemSearchString searchString) public IHostSearchResultConfiguration createSearchConfiguration(IHostSearchResultSet resultSet, Object searchTarget, SystemSearchString searchString)
{ {
ISearchService searchService = getSearchService(); ISearchService searchService = getSearchService();
@ -946,7 +947,7 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
{ {
IFileServiceSubSystemConfiguration factory = (IFileServiceSubSystemConfiguration)getParentRemoteFileSubSystemConfiguration(); IFileServiceSubSystemConfiguration factory = (IFileServiceSubSystemConfiguration)getParentRemoteFileSubSystemConfiguration();
if (factory != null) if (factory != null)
{ {
return factory.createSearchConfiguration(getHost(), resultSet, searchTarget, searchString); return factory.createSearchConfiguration(getHost(), resultSet, searchTarget, searchString);
} }
} }
@ -982,7 +983,7 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
{ {
return IFileService.class; return IFileService.class;
} }
public void initializeSubSystem(IProgressMonitor monitor) public void initializeSubSystem(IProgressMonitor monitor)
{ {
super.initializeSubSystem(monitor); super.initializeSubSystem(monitor);
@ -991,9 +992,9 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
public void uninitializeSubSystem(IProgressMonitor monitor) public void uninitializeSubSystem(IProgressMonitor monitor)
{ {
super.uninitializeSubSystem(monitor);
getFileService().uninitService(monitor); getFileService().uninitService(monitor);
_userHome = null; _userHome = null;
super.uninitializeSubSystem(monitor);
} }
/** /**
@ -1003,22 +1004,22 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
public String getRemoteEncoding() { public String getRemoteEncoding() {
try { try {
IHost host = getHost(); IHost host = getHost();
// get the encoding from the host that was not set by the remote system // get the encoding from the host that was not set by the remote system
String encoding = host.getDefaultEncoding(false); String encoding = host.getDefaultEncoding(false);
// get the encoding from the host that was set by querying a remote system // get the encoding from the host that was set by querying a remote system
// this allows us to pick up the host encoding that may have been set by another subsystem // this allows us to pick up the host encoding that may have been set by another subsystem
if (encoding == null) { if (encoding == null) {
encoding = getFileService().getEncoding(null); encoding = getFileService().getEncoding(null);
if (encoding != null) { if (encoding != null) {
host.setDefaultEncoding(encoding, true); host.setDefaultEncoding(encoding, true);
} }
} }
if (encoding != null) { if (encoding != null) {
return encoding; return encoding;
} }
@ -1029,7 +1030,7 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
catch (SystemMessageException e) { catch (SystemMessageException e) {
SystemBasePlugin.logMessage(e.getSystemMessage()); SystemBasePlugin.logMessage(e.getSystemMessage());
} }
return super.getRemoteEncoding(); return super.getRemoteEncoding();
} }
@ -1046,18 +1047,18 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
* @see org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystem#getOutputStream(java.lang.String, java.lang.String, boolean, org.eclipse.core.runtime.IProgressMonitor) * @see org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystem#getOutputStream(java.lang.String, java.lang.String, boolean, org.eclipse.core.runtime.IProgressMonitor)
*/ */
public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException { public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException {
return new FileSubSystemOutputStream(getFileService().getOutputStream(remoteParent, remoteFile, isBinary, monitor), remoteParent, remoteFile, this); return new FileSubSystemOutputStream(getFileService().getOutputStream(remoteParent, remoteFile, isBinary, monitor), remoteParent, remoteFile, this);
} }
public OutputStream getOutputStream(String remoteParent, String remoteFile, int options, IProgressMonitor monitor) throws SystemMessageException { public OutputStream getOutputStream(String remoteParent, String remoteFile, int options, IProgressMonitor monitor) throws SystemMessageException {
return new FileSubSystemOutputStream(getFileService().getOutputStream(remoteParent, remoteFile, options, monitor), remoteParent, remoteFile, this); return new FileSubSystemOutputStream(getFileService().getOutputStream(remoteParent, remoteFile, options, monitor), remoteParent, remoteFile, this);
} }
/** /**
* Defers to the file service. * Defers to the file service.
*/ */
public boolean supportsEncodingConversion(){ public boolean supportsEncodingConversion(){
return getFileService().supportsEncodingConversion(); return getFileService().supportsEncodingConversion();
} }
} }

View file

@ -7,16 +7,16 @@
* *
* 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) - Fix 162962 - recursive removeCachedRemoteFile() * Martin Oberhuber (Wind River) - Fix 162962 - recursive removeCachedRemoteFile()
* 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
* Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
* Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes * Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* David McKnight (IBM) - [196664] prevent unnecessary query on the parent * David McKnight (IBM) - [196664] prevent unnecessary query on the parent
* Rupen Mardirossian (IBM) - [204307] listFolders now deals with a null parameter for fileNameFilter preventing NPE * Rupen Mardirossian (IBM) - [204307] listFolders now deals with a null parameter for fileNameFilter preventing NPE
@ -25,6 +25,7 @@
* David McKnight (IBM) - [211472] [api][breaking] IRemoteObjectResolver.getObjectWithAbsoluteName() needs a progress monitor * David McKnight (IBM) - [211472] [api][breaking] IRemoteObjectResolver.getObjectWithAbsoluteName() needs a progress monitor
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.subsystems.files.core.subsystems; package org.eclipse.rse.subsystems.files.core.subsystems;
@ -49,6 +50,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.osgi.util.NLS; import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterReference; import org.eclipse.rse.core.filters.ISystemFilterReference;
@ -87,7 +89,7 @@ import org.eclipse.ui.dialogs.PropertyPage;
/** /**
* Specialization for file subsystem factories. * Specialization for file subsystem factories.
* It is subclassed via use of a Rose model and MOF/EMF, or better yet * It is subclassed via use of a Rose model and MOF/EMF, or better yet
* by subclassing {@link FileServiceSubSystem}. * by subclassing {@link FileServiceSubSystem}.
* <p> * <p>
* For your convenience, there is built-in name filtering support. To use it, * For your convenience, there is built-in name filtering support. To use it,
@ -96,7 +98,7 @@ import org.eclipse.ui.dialogs.PropertyPage;
* <li>{@link #setListValues(int, String)} or {@link #setListValues(int, String, String)} to set the filter criteria * <li>{@link #setListValues(int, String)} or {@link #setListValues(int, String, String)} to set the filter criteria
* <li>{@link #accept(String, boolean)} to test a given name for a match * <li>{@link #accept(String, boolean)} to test a given name for a match
* </ul> * </ul>
* *
* <p>This class returns instances of {@link RemoteFile} objects. * <p>This class returns instances of {@link RemoteFile} objects.
*/ */
@ -115,10 +117,10 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
protected RemoteFileContext DEFAULT_CONTEXT_NOFILTERSTRING = null; protected RemoteFileContext DEFAULT_CONTEXT_NOFILTERSTRING = null;
protected ArrayList _searchHistory; protected ArrayList _searchHistory;
// all created IRemoteFiles mapped in cache to quick retrieval // all created IRemoteFiles mapped in cache to quick retrieval
protected HashMap _cachedRemoteFiles = new HashMap(); protected HashMap _cachedRemoteFiles = new HashMap();
/** /**
* Default constructor. Do not call directly! Rather, use the mof generated factory method to create. * Default constructor. Do not call directly! Rather, use the mof generated factory method to create.
* After instantiation, be sure to call {@link #setSubSystemConfiguration(ISubSystemConfiguration)}. * After instantiation, be sure to call {@link #setSubSystemConfiguration(ISubSystemConfiguration)}.
@ -136,7 +138,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
{ {
return true; return true;
} }
/** /**
* Return parent subsystem factory, cast to a RemoteFileSubSystemConfiguration * Return parent subsystem factory, cast to a RemoteFileSubSystemConfiguration
* Assumes {@link #setSubSystemConfiguration(ISubSystemConfiguration)} has already been called. * Assumes {@link #setSubSystemConfiguration(ISubSystemConfiguration)} has already been called.
@ -192,7 +194,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
// -------------------------------- // --------------------------------
// FILE SYSTEM ATTRIBUTE METHODS... // FILE SYSTEM ATTRIBUTE METHODS...
// -------------------------------- // --------------------------------
/** /**
* Return in string format the character used to separate folders. Eg, "\" or "/". * Return in string format the character used to separate folders. Eg, "\" or "/".
* <br> * <br>
@ -206,7 +208,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
* Return in character format the character used to separate folders. Eg, "\" or "/" * Return in character format the character used to separate folders. Eg, "\" or "/"
* <br> * <br>
* Shortcut to {@link #getParentRemoteFileSubSystemConfiguration()}.getSeparatorChar() * Shortcut to {@link #getParentRemoteFileSubSystemConfiguration()}.getSeparatorChar()
*/ */
public char getSeparatorChar() public char getSeparatorChar()
{ {
return getParentRemoteFileSubSystemConfiguration().getSeparatorChar(); return getParentRemoteFileSubSystemConfiguration().getSeparatorChar();
@ -215,7 +217,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
* Return in string format the character used to separate paths. Eg, ";" or ":" * Return in string format the character used to separate paths. Eg, ";" or ":"
* <br> * <br>
* Shortcut to {@link #getParentRemoteFileSubSystemConfiguration()}.getPathSeparator() * Shortcut to {@link #getParentRemoteFileSubSystemConfiguration()}.getPathSeparator()
*/ */
public String getPathSeparator() public String getPathSeparator()
{ {
return getParentRemoteFileSubSystemConfiguration().getPathSeparator(); return getParentRemoteFileSubSystemConfiguration().getPathSeparator();
@ -224,7 +226,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
* Return in char format the character used to separate paths. Eg, ";" or ":" * Return in char format the character used to separate paths. Eg, ";" or ":"
* <br> * <br>
* Shortcut to {@link #getParentRemoteFileSubSystemConfiguration()}.getPathSeparatorChar() * Shortcut to {@link #getParentRemoteFileSubSystemConfiguration()}.getPathSeparatorChar()
*/ */
public char getPathSeparatorChar() public char getPathSeparatorChar()
{ {
return getParentRemoteFileSubSystemConfiguration().getPathSeparatorChar(); return getParentRemoteFileSubSystemConfiguration().getPathSeparatorChar();
@ -237,15 +239,15 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
public String getLineSeparator() public String getLineSeparator()
{ {
return getParentRemoteFileSubSystemConfiguration().getLineSeparator(); return getParentRemoteFileSubSystemConfiguration().getLineSeparator();
} }
// ------------------------------------- // -------------------------------------
// GUI methods // GUI methods
// ------------------------------------- // -------------------------------------
/** /**
* Return the single property page to show in the tabbed notebook for the * Return the single property page to show in the tabbed notebook for the
* for SubSystem property of the parent Connection. Return null if no * for SubSystem property of the parent Connection. Return null if no
* page is to be contributed for this. You are limited to a single page, * page is to be contributed for this. You are limited to a single page,
* so you may have to compress. It is recommended you prompt for the port * so you may have to compress. It is recommended you prompt for the port
* if applicable since the common base subsystem property page is not shown * if applicable since the common base subsystem property page is not shown
@ -259,28 +261,28 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
// ------------------------- // -------------------------
// Filter Testing Methods... // Filter Testing Methods...
// ------------------------- // -------------------------
/** /**
* @see org.eclipse.rse.core.subsystems.SubSystem#doesFilterMatch(org.eclipse.rse.core.filters.ISystemFilter, java.lang.String) * @see org.eclipse.rse.core.subsystems.SubSystem#doesFilterMatch(org.eclipse.rse.core.filters.ISystemFilter, java.lang.String)
*/ */
public boolean doesFilterMatch(ISystemFilter filter, String remoteObjectAbsoluteName) { public boolean doesFilterMatch(ISystemFilter filter, String remoteObjectAbsoluteName) {
if (filter.isPromptable() || !doesFilterTypeMatch(filter, remoteObjectAbsoluteName)) { if (filter.isPromptable() || !doesFilterTypeMatch(filter, remoteObjectAbsoluteName)) {
return false; return false;
} }
boolean would = false; boolean would = false;
String[] strings = filter.getFilterStrings(); String[] strings = filter.getFilterStrings();
if (strings != null) { if (strings != null) {
for (int idx = 0; !would && (idx < strings.length); idx++) { for (int idx = 0; !would && (idx < strings.length); idx++) {
// for "Drives" filter on Windows, only return match if the absolute path is a drive letter // for "Drives" filter on Windows, only return match if the absolute path is a drive letter
if (strings[idx].equals("*")) { //$NON-NLS-1$ if (strings[idx].equals("*")) { //$NON-NLS-1$
IPath path = new Path(remoteObjectAbsoluteName); IPath path = new Path(remoteObjectAbsoluteName);
if (path.segmentCount() == 0) { if (path.segmentCount() == 0) {
return true; return true;
} }
@ -296,12 +298,12 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
} }
} }
} }
return would; return would;
} }
/** /**
* Return true if the given remote object name will pass the filtering criteria for * Return true if the given remote object name will pass the filtering criteria for
* the given filter string. * the given filter string.
* <p> * <p>
* Subclasses need to override this. * Subclasses need to override this.
@ -328,24 +330,24 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
String container = rffs.getPath(); String container = rffs.getPath();
if (container == null) if (container == null)
return false; return false;
if (container.equals(".")) //$NON-NLS-1$ if (container.equals(".")) //$NON-NLS-1$
{ {
try try
{ {
container = getRemoteFileObject(container, new NullProgressMonitor()).getAbsolutePath(); container = getRemoteFileObject(container, new NullProgressMonitor()).getAbsolutePath();
} }
catch (Exception e) catch (Exception e)
{ {
} }
//return true; //return true;
} }
// DKM - if the filter and the remote object are the same // DKM - if the filter and the remote object are the same
if (container.equals(remoteObjectAbsoluteName)) if (container.equals(remoteObjectAbsoluteName))
return true; return true;
// trick: use filter string code to parse remote absolute name // trick: use filter string code to parse remote absolute name
RemoteFileFilterString rmtName = new RemoteFileFilterString(getParentRemoteFileSubSystemConfiguration(), remoteObjectAbsoluteName); RemoteFileFilterString rmtName = new RemoteFileFilterString(getParentRemoteFileSubSystemConfiguration(), remoteObjectAbsoluteName);
boolean pathMatch = false; boolean pathMatch = false;
@ -376,7 +378,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
/** /**
* Return true if the given filter string lists the contents of the given remote object. * Return true if the given filter string lists the contents of the given remote object.
* For example, if given a folder, return true if the given filter string * For example, if given a folder, return true if the given filter string
* lists the contents of that folder. Used in impact analysis when a remote object is * lists the contents of that folder. Used in impact analysis when a remote object is
* created, deleted, renamed, copied or moved, so as to establish which filters need to be * created, deleted, renamed, copied or moved, so as to establish which filters need to be
* refreshed or collapsed (if the folder is deleted, say). * refreshed or collapsed (if the folder is deleted, say).
* <p> * <p>
@ -389,11 +391,11 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
{ {
RemoteFileFilterString rffs = new RemoteFileFilterString(getParentRemoteFileSubSystemConfiguration(), filterString.getString()); RemoteFileFilterString rffs = new RemoteFileFilterString(getParentRemoteFileSubSystemConfiguration(), filterString.getString());
String container = rffs.getPath(); String container = rffs.getPath();
if (container == null) if (container == null)
return false; return false;
boolean affected = false; boolean affected = false;
String remoteObjectContainer = remoteObjectAbsoluteName; String remoteObjectContainer = remoteObjectAbsoluteName;
int lastSep = remoteObjectAbsoluteName.lastIndexOf(getSeparator()); int lastSep = remoteObjectAbsoluteName.lastIndexOf(getSeparator());
if (lastSep != -1) if (lastSep != -1)
@ -410,7 +412,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
// "Univ Filter String Testing '" + container + "' versus '" + remoteObjectAbsoluteName + "' => " + affected); // "Univ Filter String Testing '" + container + "' versus '" + remoteObjectAbsoluteName + "' => " + affected);
return affected; return affected;
} }
// ------------------------------- // -------------------------------
@ -434,15 +436,15 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
throws java.lang.reflect.InvocationTargetException, throws java.lang.reflect.InvocationTargetException,
java.lang.InterruptedException java.lang.InterruptedException
{ {
if (!isConnected()) { if (!isConnected()) {
return null; return null;
} }
Object[] children = null; Object[] children = null;
Vector vChildren = new Vector(); Vector vChildren = new Vector();
Vector vMessages = new Vector(); Vector vMessages = new Vector();
boolean oneSuccess = false; boolean oneSuccess = false;
boolean success = false; boolean success = false;
if (filterStrings == null) if (filterStrings == null)
@ -451,27 +453,27 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
System.out.println("connection == "+getHostAliasName()); //$NON-NLS-1$ System.out.println("connection == "+getHostAliasName()); //$NON-NLS-1$
return null; return null;
} }
// TODO - change this to use listMulti to be more efficient // TODO - change this to use listMulti to be more efficient
for (int idx=0; idx<filterStrings.length; idx++) for (int idx=0; idx<filterStrings.length; idx++)
{ {
if (monitor != null) if (monitor != null)
{ {
monitor.setTaskName(getResolvingMessage(filterStrings[idx])); monitor.setTaskName(getResolvingMessage(filterStrings[idx]));
} }
children = internalResolveFilterString(filterStrings[idx], monitor); children = internalResolveFilterString(filterStrings[idx], monitor);
if (!(children != null && children.length == 1 && children[0] instanceof SystemMessageObject)) { if (!(children != null && children.length == 1 && children[0] instanceof SystemMessageObject)) {
success = true; success = true;
// one has been successful // one has been successful
oneSuccess = true; oneSuccess = true;
} }
else { else {
success = false; success = false;
} }
// if successful, then add to list // if successful, then add to list
if (children != null && success) { if (children != null && success) {
addResolvedFilterStringObjects(vChildren, children, filterStrings, idx); addResolvedFilterStringObjects(vChildren, children, filterStrings, idx);
@ -481,28 +483,28 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
super.addResolvedFilterStringObjects(vMessages, children, filterStrings, idx); super.addResolvedFilterStringObjects(vMessages, children, filterStrings, idx);
} }
} }
if (oneSuccess) { if (oneSuccess) {
int nbrChildren = vChildren.size(); int nbrChildren = vChildren.size();
children = new Object[nbrChildren]; children = new Object[nbrChildren];
for (int idx=0; idx<nbrChildren; idx++) for (int idx=0; idx<nbrChildren; idx++)
children[idx] = vChildren.elementAt(idx); children[idx] = vChildren.elementAt(idx);
} }
else { else {
int nbrMessages = vMessages.size(); int nbrMessages = vMessages.size();
children = new Object[nbrMessages]; children = new Object[nbrMessages];
for (int idx=0; idx<nbrMessages; idx++) for (int idx=0; idx<nbrMessages; idx++)
children[idx] = vMessages.elementAt(idx); children[idx] = vMessages.elementAt(idx);
} }
return children; return children;
} }
/** /**
* Overridable parent extension point for adding the results of a filter string * Overridable parent extension point for adding the results of a filter string
* to the overall list of results. * to the overall list of results.
* <p> * <p>
* Can be used to filter out redundant entries in the concatenated list, if this * Can be used to filter out redundant entries in the concatenated list, if this
* is desired. * is desired.
@ -591,7 +593,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
} }
} }
private String fixFilterString(IRemoteFileSubSystemConfiguration rfssf, String filterString) private String fixFilterString(IRemoteFileSubSystemConfiguration rfssf, String filterString)
{ {
boolean windows = !rfssf.isUnixStyle(); boolean windows = !rfssf.isUnixStyle();
@ -604,10 +606,10 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
else else
filterString = filterString.substring(1); filterString = filterString.substring(1);
} }
return filterString; return filterString;
} }
/** /**
* Actually resolve an absolute filter string. This is called by the * Actually resolve an absolute filter string. This is called by the
* run(IProgressMonitor monitor) method, which in turn is called by resolveFilterString. * run(IProgressMonitor monitor) method, which in turn is called by resolveFilterString.
@ -617,7 +619,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
{ {
IRemoteFileSubSystemConfiguration rfssf = getParentRemoteFileSubSystemConfiguration(); IRemoteFileSubSystemConfiguration rfssf = getParentRemoteFileSubSystemConfiguration();
filterString = fixFilterString(rfssf, filterString); filterString = fixFilterString(rfssf, filterString);
RemoteFileFilterString fs = new RemoteFileFilterString(rfssf, filterString); RemoteFileFilterString fs = new RemoteFileFilterString(rfssf, filterString);
currFilterString = fs; currFilterString = fs;
@ -629,11 +631,11 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
boolean showFiles = fs.getShowFiles(); boolean showFiles = fs.getShowFiles();
String path = fs.getPath(); String path = fs.getPath();
boolean windows = !rfssf.isUnixStyle(); boolean windows = !rfssf.isUnixStyle();
if (windows && (path != null) && !path.endsWith(rfssf.getSeparator())) if (windows && (path != null) && !path.endsWith(rfssf.getSeparator()))
path = path + rfssf.getSeparatorChar(); path = path + rfssf.getSeparatorChar();
String filter = fs.getFileOrTypes(); String filter = fs.getFileOrTypes();
IRemoteFile parent = null; IRemoteFile parent = null;
try try
{ {
@ -643,9 +645,9 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
{ {
SystemBasePlugin.logError("RemoteFileSubSystemImpl.logError()", e); //$NON-NLS-1$ SystemBasePlugin.logError("RemoteFileSubSystemImpl.logError()", e); //$NON-NLS-1$
} }
boolean parentExists = true; boolean parentExists = true;
if (parent != null) { if (parent != null) {
parentExists = parent.exists(); parentExists = parent.exists();
} }
@ -660,20 +662,20 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
boolean hasFolderContents = !parent.isStale() && parent.hasContents(RemoteFolderChildrenContentsType.getInstance(), filter); boolean hasFolderContents = !parent.isStale() && parent.hasContents(RemoteFolderChildrenContentsType.getInstance(), filter);
boolean hasFileAndFolderContents = !parent.isStale() && parent.hasContents(RemoteChildrenContentsType.getInstance(), filter); boolean hasFileAndFolderContents = !parent.isStale() && parent.hasContents(RemoteChildrenContentsType.getInstance(), filter);
if (showDirs && showFiles) if (showDirs && showFiles)
{ {
if (hasFileAndFolderContents) if (hasFileAndFolderContents)
{ {
// has everything // has everything
} }
else if (hasFileContents) else if (hasFileContents)
{ {
// already have the files, now add the folders // already have the files, now add the folders
list(parent, filter, IFileService.FILE_TYPE_FOLDERS, monitor); list(parent, filter, IFileService.FILE_TYPE_FOLDERS, monitor);
} }
else if (hasFolderContents) else if (hasFolderContents)
{ {
// already have the folders, now add the files // already have the folders, now add the files
list(parent, filter, IFileService.FILE_TYPE_FILES, monitor); list(parent, filter, IFileService.FILE_TYPE_FILES, monitor);
} }
else else
{ {
@ -709,7 +711,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
else if (parent != null && !parentExists) { else if (parent != null && !parentExists) {
children = new SystemMessageObject[1]; children = new SystemMessageObject[1];
String msgTxt = NLS.bind(SystemFileResources.FILEMSG_FILE_NOTFOUND, parent.getAbsolutePath()); String msgTxt = NLS.bind(SystemFileResources.FILEMSG_FILE_NOTFOUND, parent.getAbsolutePath());
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
ISystemFileMessageIds.FILEMSG_FILE_NOTFOUND, ISystemFileMessageIds.FILEMSG_FILE_NOTFOUND,
IStatus.ERROR, msgTxt); IStatus.ERROR, msgTxt);
children[0] = new SystemMessageObject(msg, ISystemMessageObject.MSGTYPE_ERROR, null); children[0] = new SystemMessageObject(msg, ISystemMessageObject.MSGTYPE_ERROR, null);
@ -822,7 +824,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
} }
return internalResolveOneFilterString(parent, fs, true, monitor); return internalResolveOneFilterString(parent, fs, true, monitor);
} }
catch (SystemMessageException e) catch (SystemMessageException e)
{ {
SystemMessageObject[] children = new SystemMessageObject[1]; SystemMessageObject[] children = new SystemMessageObject[1];
@ -843,7 +845,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
//String path = fs.getPath(); //String path = fs.getPath();
//String filter = fs.getFile(); //String filter = fs.getFile();
//System.out.println("...path='"+path+"', filter='"+filter+"', showDirs="+showDirs+", showFiles="+showFiles); //System.out.println("...path='"+path+"', filter='"+filter+"', showDirs="+showDirs+", showFiles="+showFiles);
//System.out.println("...toStringNoSwitches='"+filterString+"'"); //System.out.println("...toStringNoSwitches='"+filterString+"'");
Object[] children = null; Object[] children = null;
if (parent != null) if (parent != null)
{ {
@ -875,7 +877,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
return listRoots(getDefaultContext(), monitor); return listRoots(getDefaultContext(), monitor);
} }
/** /**
* Return a list of all remote folders and files in the given folder. The list is not subsetted. * Return a list of all remote folders and files in the given folder. The list is not subsetted.
* @param parents The parent folders to list folders and files in * @param parents The parent folders to list folders and files in
@ -889,10 +891,10 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
{ {
fileNameFilters[i] = "*"; // default filter //$NON-NLS-1$ fileNameFilters[i] = "*"; // default filter //$NON-NLS-1$
} }
return listMultiple(parents, fileNameFilters, fileTypes, monitor); return listMultiple(parents, fileNameFilters, fileTypes, monitor);
} }
/** /**
* Return a list of all remote folders and files in the given folder. The list is not subsetted. * Return a list of all remote folders and files in the given folder. The list is not subsetted.
* @param parents The parent folders to list folders and files in * @param parents The parent folders to list folders and files in
@ -906,10 +908,10 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
{ {
fileNameFilters[i] = "*"; // default filter //$NON-NLS-1$ fileNameFilters[i] = "*"; // default filter //$NON-NLS-1$
} }
return listMultiple(parents, fileNameFilters, fileType, monitor); return listMultiple(parents, fileNameFilters, fileType, monitor);
} }
/** /**
* Return a list of all remote folders and files in the given folder. The list is not subsetted. * Return a list of all remote folders and files in the given folder. The list is not subsetted.
* @param parent The parent folder to list folders and files in * @param parent The parent folder to list folders and files in
@ -919,7 +921,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
{ {
return list(parent, IFileService.FILE_TYPE_FILES_AND_FOLDERS, monitor); return list(parent, IFileService.FILE_TYPE_FILES_AND_FOLDERS, monitor);
} }
/** /**
* Return a list of all remote folders and files in the given folder. The list is not subsetted. * Return a list of all remote folders and files in the given folder. The list is not subsetted.
* @param parent The parent folder to list folders and files in * @param parent The parent folder to list folders and files in
@ -932,10 +934,10 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
} }
/** /**
* Return a list of remote folders and files in the given folder. * Return a list of remote folders and files in the given folder.
* <p> * <p>
* The files part of the list is subsetted by the given file name filter. It can be null for no subsetting. * The files part of the list is subsetted by the given file name filter. It can be null for no subsetting.
* *
* @param parent The parent folder to list folders and files in * @param parent The parent folder to list folders and files in
* @param fileNameFilter The name pattern to subset the file list by, or null to return all files. * @param fileNameFilter The name pattern to subset the file list by, or null to return all files.
* @param fileType the type of file * @param fileType the type of file
@ -952,7 +954,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
RemoteFileContext context = new RemoteFileContext(this, parent, filterString); RemoteFileContext context = new RemoteFileContext(this, parent, filterString);
return list(parent, fileNameFilter, context, fileType, monitor); return list(parent, fileNameFilter, context, fileType, monitor);
} }
/** /**
@ -968,29 +970,29 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
* @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#getRemoteSearchResultObject(java.lang.String) * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#getRemoteSearchResultObject(java.lang.String)
*/ */
public IRemoteSearchResult getRemoteSearchResultObject(String key) throws SystemMessageException { public IRemoteSearchResult getRemoteSearchResultObject(String key) throws SystemMessageException {
int idx = key.indexOf(IHostSearchResult.SEARCH_RESULT_DELIMITER); int idx = key.indexOf(IHostSearchResult.SEARCH_RESULT_DELIMITER);
if (idx != -1) { if (idx != -1) {
String remoteFilePath = key.substring(0, idx); String remoteFilePath = key.substring(0, idx);
IRemoteFile remoteFile = getRemoteFileObject(remoteFilePath, new NullProgressMonitor()); IRemoteFile remoteFile = getRemoteFileObject(remoteFilePath, new NullProgressMonitor());
if (remoteFile != null) { if (remoteFile != null) {
int jdx = idx + IHostSearchResult.SEARCH_RESULT_DELIMITER.length() + IHostSearchResult.SEARCH_RESULT_OPEN_DELIMITER.length(); int jdx = idx + IHostSearchResult.SEARCH_RESULT_DELIMITER.length() + IHostSearchResult.SEARCH_RESULT_OPEN_DELIMITER.length();
int kdx = key.indexOf(IHostSearchResult.SEARCH_RESULT_INDEX_DELIMITER, jdx); int kdx = key.indexOf(IHostSearchResult.SEARCH_RESULT_INDEX_DELIMITER, jdx);
String searchString = key.substring(jdx, kdx); String searchString = key.substring(jdx, kdx);
Object[] children = remoteFile.getContents(RemoteSearchResultsContentsType.getInstance(), searchString); Object[] children = remoteFile.getContents(RemoteSearchResultsContentsType.getInstance(), searchString);
if (children != null) { if (children != null) {
int ldx = key.indexOf(IHostSearchResult.SEARCH_RESULT_CLOSE_DELIMITER, kdx+1); int ldx = key.indexOf(IHostSearchResult.SEARCH_RESULT_CLOSE_DELIMITER, kdx+1);
int index = Integer.valueOf(key.substring(kdx+1, ldx)).intValue(); int index = Integer.valueOf(key.substring(kdx+1, ldx)).intValue();
if (children.length > index) { if (children.length > index) {
IRemoteSearchResult result = (IRemoteSearchResult)(children[index]); IRemoteSearchResult result = (IRemoteSearchResult)(children[index]);
return result; return result;
@ -1010,8 +1012,8 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
else { else {
return null; return null;
} }
} }
/** /**
* <b>Overrideable</b> Override this method to provide optimized implementation * <b>Overrideable</b> Override this method to provide optimized implementation
* Given a set of fully qualified file or folder names, return an ISystemResourceSet object for it. * Given a set of fully qualified file or folder names, return an ISystemResourceSet object for it.
@ -1027,30 +1029,17 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
} }
return results; return results;
} }
/** /**
* Return the object within the subsystem that corresponds to * Return the object within the subsystem that corresponds to the specified
* the specified unique ID. * unique ID.
* *
* For remote files, assuming the key is the absolute path of * For remote files, assuming the key is the absolute path of a file, this
* a file, this is simply a wrapper to getRemoteFileObject(). * is simply a wrapper to getRemoteFileObject().
* *
* @see SubSystem#getObjectWithAbsoluteName(String) * @see SubSystem#getObjectWithAbsoluteName(String, IProgressMonitor)
* @param monitor the progress monitor
* @param key the unique id of the remote object.
* Must not be <code>null</code>.
* @return the remote object instance, or <code>null</code> if no
* object is found with the given id.
* @throws Exception in case an error occurs contacting the remote
* system while retrieving the requested remote object.
* Extenders are encouraged to throw {@link SystemMessageException}
* in order to support good user feedback in case of errors.
* Since exceptions should only occur while retrieving new
* remote objects during startup, clients are typically allowed
* to ignore these exceptions and treat them as if the remote
* object were simply not there.
*/ */
public Object getObjectWithAbsoluteName(String key, IProgressMonitor monitor) throws Exception public Object getObjectWithAbsoluteName(String key, IProgressMonitor monitor) throws Exception
{ {
@ -1062,9 +1051,9 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
// look to see if there is a search result delimiter // look to see if there is a search result delimiter
// if not, the key must be for a file // if not, the key must be for a file
if (key.lastIndexOf(IHostSearchResult.SEARCH_RESULT_DELIMITER) < 0) { if (key.lastIndexOf(IHostSearchResult.SEARCH_RESULT_DELIMITER) < 0) {
IRemoteFile remoteFile = getRemoteFileObject(key, monitor); IRemoteFile remoteFile = getRemoteFileObject(key, monitor);
if (remoteFile != null) { if (remoteFile != null) {
return remoteFile; return remoteFile;
} }
@ -1084,12 +1073,12 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
@ -1236,18 +1225,22 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
{ {
} }
return rc; return rc;
} // end runCmd method } // end runCmd method
public void initializeSubSystem(IProgressMonitor monitor) public void initializeSubSystem(IProgressMonitor monitor)
{ {
super.initializeSubSystem(monitor);
// load UI plugin for adapters right after successful connect
Platform.getAdapterManager().loadAdapter(new RemoteFileEmpty(), "org.eclipse.rse.ui.view.ISystemViewElementAdapter"); //$NON-NLS-1$
getConnectorService().addCommunicationsListener(this); getConnectorService().addCommunicationsListener(this);
} }
public void uninitializeSubSystem(IProgressMonitor monitor) public void uninitializeSubSystem(IProgressMonitor monitor)
{ {
getConnectorService().removeCommunicationsListener(this); getConnectorService().removeCommunicationsListener(this);
super.uninitializeSubSystem(monitor);
} }
/** /**
* Store the IRemoteFile in a hashmap to quick subsequent retrieval * Store the IRemoteFile in a hashmap to quick subsequent retrieval
* @param file the file * @param file the file
@ -1264,7 +1257,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
_cachedRemoteFiles.put(path, file); _cachedRemoteFiles.put(path, file);
return; return;
} }
// replace file under parent // replace file under parent
if (oldFile instanceof RemoteFile) { if (oldFile instanceof RemoteFile) {
RemoteFile roldFile = (RemoteFile)oldFile; RemoteFile roldFile = (RemoteFile)oldFile;
@ -1276,11 +1269,11 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
else if (oldFile != null && oldFile.getParentRemoteFile() != null) { else if (oldFile != null && oldFile.getParentRemoteFile() != null) {
oldFile.getParentRemoteFile().replaceContent(oldFile, file); oldFile.getParentRemoteFile().replaceContent(oldFile, file);
} }
// preserve persistent information from old file to new // preserve persistent information from old file to new
if (oldFile != null) if (oldFile != null)
oldFile.copyContentsTo(file); oldFile.copyContentsTo(file);
} }
_cachedRemoteFiles.put(path, file); _cachedRemoteFiles.put(path, file);
} }
@ -1306,7 +1299,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
{ {
if (_cachedRemoteFiles.size() > 0) if (_cachedRemoteFiles.size() > 0)
{ {
path = path.replaceAll("//", "/"); //$NON-NLS-1$ //$NON-NLS-2$ path = path.replaceAll("//", "/"); //$NON-NLS-1$ //$NON-NLS-2$
if (path.endsWith("\\") || (path.endsWith("/") && path.length() > 1)) //$NON-NLS-1$ //$NON-NLS-2$ if (path.endsWith("\\") || (path.endsWith("/") && path.length() > 1)) //$NON-NLS-1$ //$NON-NLS-2$
{ {
path = path.substring(0, path.length() - 1); path = path.substring(0, path.length() - 1);
@ -1314,12 +1307,12 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
if (_cachedRemoteFiles.containsKey(path)) if (_cachedRemoteFiles.containsKey(path))
{ {
{return (IRemoteFile)_cachedRemoteFiles.get(path);} {return (IRemoteFile)_cachedRemoteFiles.get(path);}
} }
} }
return null; return null;
} }
protected void removeCachedRemoteFile(IRemoteFile file) protected void removeCachedRemoteFile(IRemoteFile file)
{ {
if (file != null) if (file != null)
@ -1353,24 +1346,24 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
_cachedRemoteFiles.remove(file.getAbsolutePath()); _cachedRemoteFiles.remove(file.getAbsolutePath());
} }
} }
protected void removeCachedRemoteFile(String path) protected void removeCachedRemoteFile(String path)
{ {
_cachedRemoteFiles.remove(path); _cachedRemoteFiles.remove(path);
} }
public void communicationsStateChange(CommunicationsEvent e) public void communicationsStateChange(CommunicationsEvent e)
{ {
switch (e.getState()) switch (e.getState())
{ {
case CommunicationsEvent.AFTER_DISCONNECT : case CommunicationsEvent.AFTER_DISCONNECT :
_cachedRemoteFiles.clear(); _cachedRemoteFiles.clear();
// DKM - taking this out because it causes an exception when the event occurs in Modal Context // DKM - taking this out because it causes an exception when the event occurs in Modal Context
//ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); //ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
//sr.connectedStatusChange(this, false, true, true); //sr.connectedStatusChange(this, false, true, true);
getConnectorService().removeCommunicationsListener(this); getConnectorService().removeCommunicationsListener(this);
break; break;
case CommunicationsEvent.BEFORE_DISCONNECT : case CommunicationsEvent.BEFORE_DISCONNECT :
@ -1380,7 +1373,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
break; break;
} }
} }
/** /**
* @see ICommunicationsListener#isPassiveCommunicationsListener() * @see ICommunicationsListener#isPassiveCommunicationsListener()
*/ */
@ -1393,11 +1386,11 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
* Returns -1 by default. Subclasses should override if necessary. * Returns -1 by default. Subclasses should override if necessary.
* @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#getUnusedPort() * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#getUnusedPort()
*/ */
public int getUnusedPort() public int getUnusedPort()
{ {
return -1; return -1;
} }
/** /**
* Returns the address found by calling <code>InetAddress.getLocalHost()</code>. If that * Returns the address found by calling <code>InetAddress.getLocalHost()</code>. If that
* call returns the local loopback address, it returns <code>null</code>. * call returns the local loopback address, it returns <code>null</code>.
@ -1407,49 +1400,49 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
* @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#getLocalAddress() * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#getLocalAddress()
*/ */
public InetAddress getLocalAddress() { public InetAddress getLocalAddress() {
InetAddress addr = null; InetAddress addr = null;
try { try {
addr = InetAddress.getLocalHost(); addr = InetAddress.getLocalHost();
} }
catch (UnknownHostException e) { catch (UnknownHostException e) {
SystemBasePlugin.logError("Error occured trying to get local host address", e); //$NON-NLS-1$ SystemBasePlugin.logError("Error occured trying to get local host address", e); //$NON-NLS-1$
} }
// if the address is the loopback address // if the address is the loopback address
if (addr != null && addr.isLoopbackAddress()) { if (addr != null && addr.isLoopbackAddress()) {
return null; return null;
} }
return addr; return addr;
} }
public Object getTargetForFilter(ISystemFilterReference filterRef) public Object getTargetForFilter(ISystemFilterReference filterRef)
{ {
String firstFilterString = filterRef.getReferencedFilter().getFilterStrings()[0]; String firstFilterString = filterRef.getReferencedFilter().getFilterStrings()[0];
RemoteFileFilterString fs = new RemoteFileFilterString(getParentRemoteFileSubSystemConfiguration(), firstFilterString); RemoteFileFilterString fs = new RemoteFileFilterString(getParentRemoteFileSubSystemConfiguration(), firstFilterString);
try try
{ {
// change target to be referenced remote folder // change target to be referenced remote folder
return getRemoteFileObject(fs.getPath(), new NullProgressMonitor()); return getRemoteFileObject(fs.getPath(), new NullProgressMonitor());
} }
catch (Exception e) catch (Exception e)
{ {
} }
return null; return null;
} }
/** /**
* @deprecated * @deprecated
*/ */
public void cancelSearch(IHostSearchResultConfiguration searchConfig) public void cancelSearch(IHostSearchResultConfiguration searchConfig)
{ {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
/** /**
* Returns <code>true</code> by default. Subclasses should override if they do not support encodings. * Returns <code>true</code> by default. Subclasses should override if they do not support encodings.
* @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#supportsEncoding() * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#supportsEncoding()
@ -1458,7 +1451,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
public boolean supportsEncoding() { public boolean supportsEncoding() {
return true; return true;
} }
/** /**
* Returns the local platform encoding if the default encoding of the host was not set. * Returns the local platform encoding if the default encoding of the host was not set.
* Subclasses should override to return the actual remote encoding. * Subclasses should override to return the actual remote encoding.
@ -1466,16 +1459,16 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
*/ */
public String getRemoteEncoding() { public String getRemoteEncoding() {
IHost host = getHost(); IHost host = getHost();
// get the encoding from the host that was not by the remote system // get the encoding from the host that was not by the remote system
String encoding = host.getDefaultEncoding(false); String encoding = host.getDefaultEncoding(false);
// get the encoding from the host that was set by querying a remote system // get the encoding from the host that was set by querying a remote system
// this allows us to pick up the host encoding that may have been set by another subsystem // this allows us to pick up the host encoding that may have been set by another subsystem
if (encoding == null) { if (encoding == null) {
encoding = host.getDefaultEncoding(true); encoding = host.getDefaultEncoding(true);
} }
if (encoding != null) { if (encoding != null) {
return encoding; return encoding;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -13,13 +13,12 @@
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - [180519][api] declaratively register rse.processes.ui adapter factories * Martin Oberhuber (Wind River) - [180519][api] declaratively register rse.processes.ui adapter factories
* Martin Oberhuber (wind River) - [203105] Decouple recursive plugin activation of UI adapters * Martin Oberhuber (wind River) - [203105] Decouple recursive plugin activation of UI adapters
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.subsystems.processes.core; package org.eclipse.rse.internal.subsystems.processes.core;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.rse.subsystems.processes.core.subsystem.impl.RemoteProcessImpl;
import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
@ -41,18 +40,6 @@ public class Activator extends AbstractUIPlugin {
public void start(BundleContext context) throws Exception public void start(BundleContext context) throws Exception
{ {
super.start(context); super.start(context);
// make sure that required adapters factories are loaded
//(will typically activate org.eclipse.rse.processes.ui)
//TODO Check that this does not fire up the UI if we want to be headless
//Decouple from the current Thread
new Thread("processes.ui adapter loader") { //$NON-NLS-1$
public void run() {
Platform.getAdapterManager().loadAdapter(new RemoteProcessImpl(null,null),
"org.eclipse.rse.ui.view.ISystemViewElementAdapter"); //$NON-NLS-1$
}
}.start();
//others will be loaded automatically when the processes.ui plugin is activated
} }
/** /**

View file

@ -1,18 +1,19 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * Copyright (c) 2006, 2008s IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
* *
* 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) - [182454] improve getAbsoluteName() documentation * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
* Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes * Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.subsystems.processes.core.subsystem.impl; package org.eclipse.rse.subsystems.processes.core.subsystem.impl;
@ -20,6 +21,7 @@ package org.eclipse.rse.subsystems.processes.core.subsystem.impl;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.CommunicationsEvent; import org.eclipse.rse.core.subsystems.CommunicationsEvent;
import org.eclipse.rse.core.subsystems.ICommunicationsListener; import org.eclipse.rse.core.subsystems.ICommunicationsListener;
@ -35,7 +37,7 @@ import org.eclipse.rse.ui.SystemBasePlugin;
/** /**
* Default implementation of the IRemoteProcessSubSystem interface. * Default implementation of the IRemoteProcessSubSystem interface.
* <p> * <p>
* Some of the methods are simply convenience methods - these are * Some of the methods are simply convenience methods - these are
* implemented here, whereas the real work takes place in the * implemented here, whereas the real work takes place in the
* ProcessServiceSubSystem. * ProcessServiceSubSystem.
@ -44,12 +46,12 @@ import org.eclipse.rse.ui.SystemBasePlugin;
public abstract class RemoteProcessSubSystemImpl extends SubSystem implements public abstract class RemoteProcessSubSystemImpl extends SubSystem implements
IRemoteProcessSubSystem, ICommunicationsListener IRemoteProcessSubSystem, ICommunicationsListener
{ {
public RemoteProcessSubSystemImpl(IHost host, IConnectorService connectorService) public RemoteProcessSubSystemImpl(IHost host, IConnectorService connectorService)
{ {
super(host, connectorService); super(host, connectorService);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.subsystems.processes.core.subsystem.IRemoteProcessSubSystem#getParentRemoteProcessSubSystemConfiguration() * @see org.eclipse.rse.subsystems.processes.core.subsystem.IRemoteProcessSubSystem#getParentRemoteProcessSubSystemConfiguration()
*/ */
@ -65,7 +67,7 @@ public abstract class RemoteProcessSubSystemImpl extends SubSystem implements
{ {
return true; return true;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.ICommunicationsListener#communicationsStateChange(org.eclipse.rse.core.subsystems.CommunicationsEvent) * @see org.eclipse.rse.core.subsystems.ICommunicationsListener#communicationsStateChange(org.eclipse.rse.core.subsystems.CommunicationsEvent)
*/ */
@ -75,9 +77,9 @@ public abstract class RemoteProcessSubSystemImpl extends SubSystem implements
{ {
case CommunicationsEvent.BEFORE_CONNECT : case CommunicationsEvent.BEFORE_CONNECT :
break; break;
case CommunicationsEvent.AFTER_DISCONNECT : case CommunicationsEvent.AFTER_DISCONNECT :
getConnectorService().removeCommunicationsListener(this); getConnectorService().removeCommunicationsListener(this);
break; break;
case CommunicationsEvent.BEFORE_DISCONNECT : case CommunicationsEvent.BEFORE_DISCONNECT :
@ -87,23 +89,27 @@ public abstract class RemoteProcessSubSystemImpl extends SubSystem implements
break; break;
} }
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.SubSystem#initializeSubSystem(org.eclipse.core.runtime.IProgressMonitor) * @see org.eclipse.rse.core.subsystems.SubSystem#initializeSubSystem(org.eclipse.core.runtime.IProgressMonitor)
*/ */
public void initializeSubSystem(IProgressMonitor monitor) public void initializeSubSystem(IProgressMonitor monitor)
{ {
getConnectorService().addCommunicationsListener(this); super.initializeSubSystem(monitor);
// load UI plugin for adapters right after successful connect
Platform.getAdapterManager().loadAdapter(new RemoteProcessImpl(null, null), "org.eclipse.rse.ui.view.ISystemViewElementAdapter"); //$NON-NLS-1$
getConnectorService().addCommunicationsListener(this);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.SubSystem#uninitializeSubSystem(org.eclipse.core.runtime.IProgressMonitor) * @see org.eclipse.rse.core.subsystems.SubSystem#uninitializeSubSystem(org.eclipse.core.runtime.IProgressMonitor)
*/ */
public void uninitializeSubSystem(IProgressMonitor monitor) public void uninitializeSubSystem(IProgressMonitor monitor)
{ {
getConnectorService().removeCommunicationsListener(this); getConnectorService().removeCommunicationsListener(this);
super.uninitializeSubSystem(monitor);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.subsystems.processes.core.subsystem.IRemoteProcessSubSystem#getParentProcess(org.eclipse.rse.subsystems.processes.core.subsystem.IRemoteProcess) * @see org.eclipse.rse.subsystems.processes.core.subsystem.IRemoteProcessSubSystem#getParentProcess(org.eclipse.rse.subsystems.processes.core.subsystem.IRemoteProcess)
*/ */
@ -111,7 +117,7 @@ public abstract class RemoteProcessSubSystemImpl extends SubSystem implements
{ {
return process.getParentRemoteProcess(); return process.getParentRemoteProcess();
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.SubSystem#internalResolveFilterString(org.eclipse.core.runtime.IProgressMonitor, java.lang.String) * @see org.eclipse.rse.core.subsystems.SubSystem#internalResolveFilterString(org.eclipse.core.runtime.IProgressMonitor, java.lang.String)
*/ */
@ -122,7 +128,7 @@ public abstract class RemoteProcessSubSystemImpl extends SubSystem implements
if (!isConnected()) { if (!isConnected()) {
return null; return null;
} }
HostProcessFilterImpl rpf = new HostProcessFilterImpl(filterString); HostProcessFilterImpl rpf = new HostProcessFilterImpl(filterString);
IRemoteProcessContext context = new RemoteProcessContext(this, null, rpf); IRemoteProcessContext context = new RemoteProcessContext(this, null, rpf);
IRemoteProcess[] ps = null; IRemoteProcess[] ps = null;
@ -134,9 +140,9 @@ public abstract class RemoteProcessSubSystemImpl extends SubSystem implements
{ {
displayAsyncMsg(e); displayAsyncMsg(e);
} }
return ps; return ps;
} }
/** /**
* At this point there is only one root process, the 'init' process with pid 1 * At this point there is only one root process, the 'init' process with pid 1
*/ */
@ -161,11 +167,12 @@ public abstract class RemoteProcessSubSystemImpl extends SubSystem implements
{ {
return true; return true;
} }
/* (non-Javadoc) /*
* @see org.eclipse.rse.core.subsystems.SubSystem#getObjectWithAbsoluteName(java.lang.String) * (non-Javadoc)
* @see SubSystem#getObjectWithAbsoluteName(String, IProgressMonitor)
*/ */
public Object getObjectWithAbsoluteName(String key) throws Exception public Object getObjectWithAbsoluteName(String key, IProgressMonitor monitor) throws Exception
{ {
try try
{ {
@ -174,7 +181,7 @@ public abstract class RemoteProcessSubSystemImpl extends SubSystem implements
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
return super.getObjectWithAbsoluteName(key); return super.getObjectWithAbsoluteName(key, monitor);
} }
} }
} }

View file

@ -1,21 +1,22 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved. * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
* *
* 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) - [182454] improve getAbsoluteName() documentation * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* David Dykstal (IBM) - [197036] refactored switch configuration * David Dykstal (IBM) - [197036] refactored switch configuration
* David Dykstal (IBM) - [217556] remove service subsystem types * David Dykstal (IBM) - [217556] remove service subsystem types
* David McKnight (IBM) - [220524] internalSwitchServiceSubSystemConfiguration -> internalSwitchSubSystemConfiguration * David McKnight (IBM) - [220524] internalSwitchServiceSubSystemConfiguration -> internalSwitchSubSystemConfiguration
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.subsystems.processes.servicesubsystem; package org.eclipse.rse.subsystems.processes.servicesubsystem;
@ -40,18 +41,18 @@ import org.eclipse.rse.subsystems.processes.core.subsystem.impl.RemoteProcessSub
* The subsystem that, coupled with a ProcessService implementation, * The subsystem that, coupled with a ProcessService implementation,
* can query and kill remote processes on a remote system. * can query and kill remote processes on a remote system.
*/ */
public class ProcessServiceSubSystem extends RemoteProcessSubSystemImpl implements IProcessServiceSubSystem public class ProcessServiceSubSystem extends RemoteProcessSubSystemImpl implements IProcessServiceSubSystem
{ {
protected IProcessService _hostProcessService; protected IProcessService _hostProcessService;
protected IHostProcessToRemoteProcessAdapter _hostProcessToRemoteProcessAdapter; protected IHostProcessToRemoteProcessAdapter _hostProcessToRemoteProcessAdapter;
public ProcessServiceSubSystem(IHost host, IConnectorService connectorService, IProcessService hostProcessService, IHostProcessToRemoteProcessAdapter adapter) public ProcessServiceSubSystem(IHost host, IConnectorService connectorService, IProcessService hostProcessService, IHostProcessToRemoteProcessAdapter adapter)
{ {
super(host, connectorService); super(host, connectorService);
_hostProcessService = hostProcessService; _hostProcessService = hostProcessService;
_hostProcessToRemoteProcessAdapter = adapter; _hostProcessToRemoteProcessAdapter = adapter;
} }
/** /**
* @return the process service associated with this subsystem. * @return the process service associated with this subsystem.
*/ */
@ -68,7 +69,7 @@ public class ProcessServiceSubSystem extends RemoteProcessSubSystemImpl implemen
{ {
_hostProcessService = service; _hostProcessService = service;
} }
/** /**
* @return the associated adapter for converting IHostProcess objects to IRemoteProcess objects * @return the associated adapter for converting IHostProcess objects to IRemoteProcess objects
*/ */
@ -76,7 +77,7 @@ public class ProcessServiceSubSystem extends RemoteProcessSubSystemImpl implemen
{ {
return _hostProcessToRemoteProcessAdapter; return _hostProcessToRemoteProcessAdapter;
} }
/** /**
* Sets the associated adapter for converting IHostProcess objects to IRemoteProcess objects * Sets the associated adapter for converting IHostProcess objects to IRemoteProcess objects
*/ */
@ -90,7 +91,7 @@ public class ProcessServiceSubSystem extends RemoteProcessSubSystemImpl implemen
* certain pid. * certain pid.
* @param pid The pid of the process to return * @param pid The pid of the process to return
*/ */
public IRemoteProcess getRemoteProcessObject(long pid) throws SystemMessageException public IRemoteProcess getRemoteProcessObject(long pid) throws SystemMessageException
{ {
checkIsConnected(new NullProgressMonitor()); checkIsConnected(new NullProgressMonitor());
HostProcessFilterImpl rpfs = new HostProcessFilterImpl(); HostProcessFilterImpl rpfs = new HostProcessFilterImpl();
@ -103,7 +104,7 @@ public class ProcessServiceSubSystem extends RemoteProcessSubSystemImpl implemen
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.subsystems.processes.core.subsystem.impl.RemoteProcessSubSystemImpl#getSignalTypes() * @see org.eclipse.rse.subsystems.processes.core.subsystem.impl.RemoteProcessSubSystemImpl#getSignalTypes()
*/ */
public String[] getSignalTypes() throws SystemMessageException public String[] getSignalTypes() throws SystemMessageException
{ {
return getProcessService().getSignalTypes(); return getProcessService().getSignalTypes();
} }
@ -111,7 +112,7 @@ public class ProcessServiceSubSystem extends RemoteProcessSubSystemImpl implemen
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.subsystems.processes.core.subsystem.impl.RemoteProcessSubSystemImpl#kill(org.eclipse.rse.subsystems.processes.core.subsystem.IRemoteProcess, java.lang.String) * @see org.eclipse.rse.subsystems.processes.core.subsystem.impl.RemoteProcessSubSystemImpl#kill(org.eclipse.rse.subsystems.processes.core.subsystem.IRemoteProcess, java.lang.String)
*/ */
public boolean kill(IRemoteProcess process, String signal) throws SystemMessageException public boolean kill(IRemoteProcess process, String signal) throws SystemMessageException
{ {
checkIsConnected(new NullProgressMonitor()); checkIsConnected(new NullProgressMonitor());
return getProcessService().kill(process.getPid(), signal, null); return getProcessService().kill(process.getPid(), signal, null);
@ -120,7 +121,7 @@ public class ProcessServiceSubSystem extends RemoteProcessSubSystemImpl implemen
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.subsystems.processes.core.subsystem.impl.RemoteProcessSubSystemImpl#listAllProcesses(org.eclipse.rse.services.clientserver.processes.IHostProcessFilter, org.eclipse.rse.subsystems.processes.core.subsystem.IRemoteProcessContext) * @see org.eclipse.rse.subsystems.processes.core.subsystem.impl.RemoteProcessSubSystemImpl#listAllProcesses(org.eclipse.rse.services.clientserver.processes.IHostProcessFilter, org.eclipse.rse.subsystems.processes.core.subsystem.IRemoteProcessContext)
*/ */
public IRemoteProcess[] listAllProcesses(IHostProcessFilter processFilter, IRemoteProcessContext context, IProgressMonitor monitor) throws InterruptedException, SystemMessageException public IRemoteProcess[] listAllProcesses(IHostProcessFilter processFilter, IRemoteProcessContext context, IProgressMonitor monitor) throws InterruptedException, SystemMessageException
{ {
checkIsConnected(monitor); checkIsConnected(monitor);
IHostProcess[] processes = getProcessService().listAllProcesses(processFilter, monitor); IHostProcess[] processes = getProcessService().listAllProcesses(processFilter, monitor);
@ -150,21 +151,21 @@ public class ProcessServiceSubSystem extends RemoteProcessSubSystemImpl implemen
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.SubSystem#internalSwitchSubSystemConfiguration(org.eclipse.rse.core.subsystems.ISubSystemConfiguration) * @see org.eclipse.rse.core.subsystems.SubSystem#internalSwitchSubSystemConfiguration(org.eclipse.rse.core.subsystems.ISubSystemConfiguration)
*/ */
protected void internalSwitchSubSystemConfiguration(ISubSystemConfiguration configuration) protected void internalSwitchSubSystemConfiguration(ISubSystemConfiguration configuration)
{ {
IProcessServiceSubSystemConfiguration config = (IProcessServiceSubSystemConfiguration) configuration; IProcessServiceSubSystemConfiguration config = (IProcessServiceSubSystemConfiguration) configuration;
IHost host = getHost(); IHost host = getHost();
setProcessService(config.getProcessService(host)); setProcessService(config.getProcessService(host));
setHostProcessToRemoteProcessAdapter(config.getHostProcessAdapter()); setHostProcessToRemoteProcessAdapter(config.getHostProcessAdapter());
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.SubSystem#canSwitchTo(org.eclipse.rse.core.subsystems.ISubSystemConfiguration) * @see org.eclipse.rse.core.subsystems.SubSystem#canSwitchTo(org.eclipse.rse.core.subsystems.ISubSystemConfiguration)
*/ */
public boolean canSwitchTo(ISubSystemConfiguration configuration) { public boolean canSwitchTo(ISubSystemConfiguration configuration) {
return configuration instanceof IProcessServiceSubSystemConfiguration; return configuration instanceof IProcessServiceSubSystemConfiguration;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.core.servicesubsystem.ISubSystem#getServiceType() * @see org.eclipse.rse.core.servicesubsystem.ISubSystem#getServiceType()
*/ */
@ -172,7 +173,7 @@ public class ProcessServiceSubSystem extends RemoteProcessSubSystemImpl implemen
{ {
return IProcessService.class; return IProcessService.class;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.subsystems.processes.core.subsystem.impl.RemoteProcessSubSystemImpl#initializeSubSystem(org.eclipse.core.runtime.IProgressMonitor) * @see org.eclipse.rse.subsystems.processes.core.subsystem.impl.RemoteProcessSubSystemImpl#initializeSubSystem(org.eclipse.core.runtime.IProgressMonitor)
*/ */
@ -181,14 +182,14 @@ public class ProcessServiceSubSystem extends RemoteProcessSubSystemImpl implemen
super.initializeSubSystem(monitor); super.initializeSubSystem(monitor);
getProcessService().initService(monitor); getProcessService().initService(monitor);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.subsystems.processes.core.subsystem.impl.RemoteProcessSubSystemImpl#initializeSubSystem(org.eclipse.core.runtime.IProgressMonitor) * @see org.eclipse.rse.subsystems.processes.core.subsystem.impl.RemoteProcessSubSystemImpl#initializeSubSystem(org.eclipse.core.runtime.IProgressMonitor)
*/ */
public void uninitializeSubSystem(IProgressMonitor monitor) public void uninitializeSubSystem(IProgressMonitor monitor)
{ {
super.uninitializeSubSystem(monitor);
getProcessService().uninitService(monitor); getProcessService().uninitService(monitor);
super.uninitializeSubSystem(monitor);
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -13,13 +13,12 @@
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - [180519] declaratively register rse.shells.ui. adapter factories * Martin Oberhuber (Wind River) - [180519] declaratively register rse.shells.ui. adapter factories
* Martin Oberhuber (wind River) - [203105] Decouple recursive plugin activation of UI adapters * Martin Oberhuber (wind River) - [203105] Decouple recursive plugin activation of UI adapters
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.subsystems.shells.core; package org.eclipse.rse.internal.subsystems.shells.core;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.rse.subsystems.shells.core.model.RemoteOutput;
import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
@ -43,18 +42,6 @@ public class Activator extends AbstractUIPlugin {
*/ */
public void start(BundleContext context) throws Exception { public void start(BundleContext context) throws Exception {
super.start(context); super.start(context);
// make sure that required adapters factories are loaded
//(will typically activate org.eclipse.rse.shells.ui)
//TODO Check that this does not fire up the UI if we want to be headless
//Decouple from the current Thread
new Thread("shells.ui adapter loader") { //$NON-NLS-1$
public void run() {
Platform.getAdapterManager().loadAdapter(new RemoteOutput(null,""), "org.eclipse.rse.ui.view.ISystemViewElementAdapter"); //$NON-NLS-1$ //$NON-NLS-2$
}
}.start();
// Others (IRemoteError, ShellServiceSubSystemConfigurationAdapter
// will be available automatically once the shells.ui plugin is loaded
} }
/** /**

View file

@ -7,17 +7,18 @@
* *
* 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
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.subsystems.shells.core.subsystems; package org.eclipse.rse.subsystems.shells.core.subsystems;
@ -30,6 +31,7 @@ import java.util.StringTokenizer;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.osgi.util.NLS; import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.events.ISystemResourceChangeEvents; import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
@ -43,6 +45,7 @@ import org.eclipse.rse.core.subsystems.CommunicationsEvent;
import org.eclipse.rse.core.subsystems.ICommunicationsListener; import org.eclipse.rse.core.subsystems.ICommunicationsListener;
import org.eclipse.rse.core.subsystems.IConnectorService; import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.IRemoteSystemEnvVar; import org.eclipse.rse.core.subsystems.IRemoteSystemEnvVar;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.SubSystem; import org.eclipse.rse.core.subsystems.SubSystem;
import org.eclipse.rse.internal.subsystems.shells.core.ShellStrings; import org.eclipse.rse.internal.subsystems.shells.core.ShellStrings;
import org.eclipse.rse.internal.subsystems.shells.subsystems.RemoteSystemEnvVar; import org.eclipse.rse.internal.subsystems.shells.subsystems.RemoteSystemEnvVar;
@ -50,6 +53,7 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility; import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
import org.eclipse.rse.subsystems.shells.core.model.RemoteOutput;
import org.eclipse.rse.ui.SystemBasePlugin; import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
@ -63,7 +67,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
{ {
private static String COMMAND_SHELLS_MEMENTO = "commandshells"; //$NON-NLS-1$ private static String COMMAND_SHELLS_MEMENTO = "commandshells"; //$NON-NLS-1$
private static String ENVIRONMENT_VARS = "EnvironmentVariables"; //$NON-NLS-1$ private static String ENVIRONMENT_VARS = "EnvironmentVariables"; //$NON-NLS-1$
protected ArrayList _cmdShells; protected ArrayList _cmdShells;
protected IRemoteCommandShell _defaultShell; protected IRemoteCommandShell _defaultShell;
@ -76,6 +80,12 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
_cmdShells = new ArrayList(); _cmdShells = new ArrayList();
} }
public void initializeSubSystem(IProgressMonitor monitor) {
super.initializeSubSystem(monitor);
// load UI plugin for adapters right after successful connect
Platform.getAdapterManager().loadAdapter(new RemoteOutput(null, ""), "org.eclipse.rse.ui.view.ISystemViewElementAdapter"); //$NON-NLS-1$ //$NON-NLS-2$
}
/** /**
* Return parent subsystem factory, cast to a RemoteCmdSubSystemConfiguration * Return parent subsystem factory, cast to a RemoteCmdSubSystemConfiguration
*/ */
@ -87,7 +97,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/** /**
* Long running list processing calls this method to check for a user-cancel * Long running list processing calls this method to check for a user-cancel
* event. If user did cancel, an exception is thrown. * event. If user did cancel, an exception is thrown.
* *
* @return true if caller wants to cancel * @return true if caller wants to cancel
*/ */
public boolean checkForCancel(IProgressMonitor monitor) public boolean checkForCancel(IProgressMonitor monitor)
@ -95,7 +105,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
if ((monitor != null) && monitor.isCanceled()) if ((monitor != null) && monitor.isCanceled())
{ {
String msgTxt = NLS.bind(ShellStrings.MSG_CONNECT_FAILED, getHostName()); String msgTxt = NLS.bind(ShellStrings.MSG_CONNECT_FAILED, getHostName());
throw new OperationCanceledException(msgTxt); throw new OperationCanceledException(msgTxt);
} }
return false; return false;
@ -207,7 +217,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
} }
/** /**
* *
*/ */
protected String[] getEnvVarsAsStringArray() { protected String[] getEnvVarsAsStringArray() {
IPropertySet environmentVariables = getEnvironmentVariables(); IPropertySet environmentVariables = getEnvironmentVariables();
@ -303,9 +313,8 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/** /**
* Lists the possible commands for the given context * Lists the possible commands for the given context
* *
* @param context * @param context the context for a command
* the context for a command
* @return the list of possible commands * @return the list of possible commands
*/ */
public ICandidateCommand[] getCandidateCommands(Object context) public ICandidateCommand[] getCandidateCommands(Object context)
@ -362,7 +371,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
* This default implementation just returns "=" (the only invalid character * This default implementation just returns "=" (the only invalid character
* is the = sign.) Subclasses can override this to provide a more * is the = sign.) Subclasses can override this to provide a more
* comprehensive list. * comprehensive list.
* *
* @see org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem#getInvalidEnvironmentVariableNameCharacters() * @see org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem#getInvalidEnvironmentVariableNameCharacters()
*/ */
public String getInvalidEnvironmentVariableNameCharacters() public String getInvalidEnvironmentVariableNameCharacters()
@ -388,7 +397,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
* Actually resolve an absolute filter string. This is called by the * Actually resolve an absolute filter string. This is called by the
* run(IProgressMonitor monitor) method, which in turn is called by * run(IProgressMonitor monitor) method, which in turn is called by
* resolveFilterString. * resolveFilterString.
* *
* @see org.eclipse.rse.core.subsystems.SubSystem#internalResolveFilterString(String,IProgressMonitor) * @see org.eclipse.rse.core.subsystems.SubSystem#internalResolveFilterString(String,IProgressMonitor)
*/ */
protected Object[] internalResolveFilterString(String filterString, IProgressMonitor monitor) protected Object[] internalResolveFilterString(String filterString, IProgressMonitor monitor)
@ -413,7 +422,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/** /**
* Get the default running command shell for this command subsystem. If no * Get the default running command shell for this command subsystem. If no
* such shell exists or is running, a new one is launched. * such shell exists or is running, a new one is launched.
* *
* @return the default running command shell * @return the default running command shell
*/ */
public IRemoteCommandShell getDefaultShell() throws Exception public IRemoteCommandShell getDefaultShell() throws Exception
@ -432,7 +441,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/** /**
* Get all command shells and transient commands that have been run or are * Get all command shells and transient commands that have been run or are
* running for this command subsystem. * running for this command subsystem.
* *
* @return the list of running command shells and commands * @return the list of running command shells and commands
*/ */
public IRemoteCommandShell[] getShells() public IRemoteCommandShell[] getShells()
@ -447,7 +456,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/** /**
* Determine whether the command subsystem can run a shell * Determine whether the command subsystem can run a shell
* *
* @return whether a shell can be run or not * @return whether a shell can be run or not
*/ */
public boolean canRunShell() public boolean canRunShell()
@ -457,7 +466,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/** /**
* Determine whether the command subsystem can run a command * Determine whether the command subsystem can run a command
* *
* @return whether a command can be run or not * @return whether a command can be run or not
*/ */
public boolean canRunCommand() public boolean canRunCommand()
@ -466,25 +475,13 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
} }
/** /**
* Return the object within the subsystem that corresponds to the * Return the object within the subsystem that corresponds to the specified
* specified unique ID. * unique ID. For remote command, the key is determined by the command ID
* For remote command, the key is determined by the command ID * and the output ID.
* and the ouput ID. *
* * @see ISubSystem#getObjectWithAbsoluteName(String, IProgressMonitor)
* @param key the unique id of the remote object.
* Must not be <code>null</code>.
* @return the remote object instance, or <code>null</code> if no
* object is found with the given id.
* @throws Exception in case an error occurs contacting the remote
* system while retrieving the requested remote object.
* Extenders are encouraged to throw {@link SystemMessageException}
* in order to support good user feedback in case of errors.
* Since exceptions should only occur while retrieving new
* remote objects during startup, clients are typically allowed
* to ignore these exceptions and treat them as if the remote
* object were simply not there.
*/ */
public Object getObjectWithAbsoluteName(String key) throws Exception public Object getObjectWithAbsoluteName(String key, IProgressMonitor monitor) throws Exception
{ {
String cmdKey = key; String cmdKey = key;
String outKey = null; String outKey = null;
@ -515,7 +512,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
return theCmd; return theCmd;
} }
//fallback to return filter reference or similar //fallback to return filter reference or similar
return super.getObjectWithAbsoluteName(key); return super.getObjectWithAbsoluteName(key, monitor);
} }
// called by subsystem on disconnect // called by subsystem on disconnect
@ -585,7 +582,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
{ {
this.shell = shellWindow; this.shell = shellWindow;
IRemoteCommandShell[] results = null; IRemoteCommandShell[] results = null;
String shellStr = null; String shellStr = null;
IPropertySet set = getPropertySet("Remote"); //$NON-NLS-1$ IPropertySet set = getPropertySet("Remote"); //$NON-NLS-1$
if (set != null) if (set != null)
@ -626,7 +623,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
public void cancelAllShells() public void cancelAllShells()
{ {
for (int i = _cmdShells.size() - 1; i >= 0; i--) for (int i = _cmdShells.size() - 1; i >= 0; i--)
{ {
IRemoteCommandShell cmdShell = (IRemoteCommandShell) _cmdShells.get(i); IRemoteCommandShell cmdShell = (IRemoteCommandShell) _cmdShells.get(i);
@ -650,7 +647,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
Display.getDefault().asyncExec(new Refresh(this)); Display.getDefault().asyncExec(new Refresh(this));
} }
public class Refresh implements Runnable public class Refresh implements Runnable
{ {
private RemoteCmdSubSystem _ss; private RemoteCmdSubSystem _ss;
@ -659,7 +656,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
_ss = ss; _ss = ss;
} }
public void run() public void run()
{ {
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
registry.fireEvent(new SystemResourceChangeEvent(_ss, ISystemResourceChangeEvents.EVENT_REFRESH, _ss)); registry.fireEvent(new SystemResourceChangeEvent(_ss, ISystemResourceChangeEvents.EVENT_REFRESH, _ss));
@ -677,14 +674,14 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
_cmdShell = cmdShell; _cmdShell = cmdShell;
} }
public void run() public void run()
{ {
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
registry.fireEvent(new SystemResourceChangeEvent(_cmdShell, ISystemResourceChangeEvents.EVENT_COMMAND_SHELL_REMOVED, null)); registry.fireEvent(new SystemResourceChangeEvent(_cmdShell, ISystemResourceChangeEvents.EVENT_COMMAND_SHELL_REMOVED, null));
registry.fireEvent(new SystemResourceChangeEvent(_ss, ISystemResourceChangeEvents.EVENT_REFRESH, _ss)); registry.fireEvent(new SystemResourceChangeEvent(_ss, ISystemResourceChangeEvents.EVENT_REFRESH, _ss));
} }
} }
/** /**
* @see ICommunicationsListener#isPassiveCommunicationsListener() * @see ICommunicationsListener#isPassiveCommunicationsListener()
@ -754,7 +751,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
} }
return environmentVariables; return environmentVariables;
} }
public IPropertySet createPropertySet(String name) { public IPropertySet createPropertySet(String name) {
IPropertySet result = null; IPropertySet result = null;
if (name.equals(ENVIRONMENT_VARS)) { if (name.equals(ENVIRONMENT_VARS)) {
@ -768,13 +765,15 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/** /**
* overridden so that for universal we don't need to do in modal thread * overridden so that for universal we don't need to do in modal thread
* @deprecated *
* @deprecated use
* {@link #runCommand(String, Object, boolean, IProgressMonitor)}
*/ */
public Object[] runCommand(String command, Object context, boolean interpretOutput) throws Exception public Object[] runCommand(String command, Object context, boolean interpretOutput) throws Exception
{ {
return internalRunCommand(command, context, interpretOutput, null); return internalRunCommand(command, context, interpretOutput, null);
} }
/** /**
* overridden so that for universal we don't need to do in modal thread * overridden so that for universal we don't need to do in modal thread
*/ */
@ -785,8 +784,8 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/** /**
* overridden so that for universal we don't need to do in modal thread * overridden so that for universal we don't need to do in modal thread
* *
* @deprecated * @deprecated use {@link #runShell(Object, IProgressMonitor)}
*/ */
public IRemoteCommandShell runShell(Object context) throws Exception public IRemoteCommandShell runShell(Object context) throws Exception
{ {
@ -803,48 +802,49 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
Refresh refreshOnMain = new Refresh(this); Refresh refreshOnMain = new Refresh(this);
Display.getDefault().asyncExec(refreshOnMain); Display.getDefault().asyncExec(refreshOnMain);
return cmdShell; return cmdShell;
} }
/** /**
* overridden so that for universal we don't need to do in modal thread * overridden so that for universal we don't need to do in modal thread
*/ */
public IRemoteCommandShell runShell(Object context, IProgressMonitor monitor) throws Exception public IRemoteCommandShell runShell(Object context, IProgressMonitor monitor) throws Exception
{ {
IRemoteCommandShell cmdShell = internalRunShell(context, monitor); IRemoteCommandShell cmdShell = internalRunShell(context, monitor);
Refresh refreshOnMain = new Refresh(this); Refresh refreshOnMain = new Refresh(this);
Display.getDefault().asyncExec(refreshOnMain); Display.getDefault().asyncExec(refreshOnMain);
return cmdShell; return cmdShell;
} }
/** /**
* Execute a remote command. This is only applicable if the subsystem * Execute a remote command. This is only applicable if the subsystem
* factory reports true for supportsCommands(). * factory reports true for supportsCommands().
* *
* @param command Command to be executed remotely. * @param command Command to be executed remotely.
* @param context context of a command (i.e. working directory). <code>null</code> is * @param context context of a command (i.e. working directory).
* valid and means to use the default context. * <code>null</code> is valid and means to use the default
* context.
* @return Array of objects that are the result of running this command. * @return Array of objects that are the result of running this command.
* Typically, these are messages logged by the command. * Typically, these are messages logged by the command.
* *
* @deprecated * @deprecated use {@link #runCommand(String, Object, IProgressMonitor)}
*/ */
public Object[] runCommand(String command, Object context) throws Exception public Object[] runCommand(String command, Object context) throws Exception
{ {
return runCommand(command, context, true); return runCommand(command, context, true);
} }
/** /**
* Execute a remote command. This is only applicable if the subsystem * Execute a remote command. This is only applicable if the subsystem
* factory reports true for supportsCommands(). * factory reports true for supportsCommands().
* *
* @param command Command to be executed remotely. * @param command Command to be executed remotely.
* @param context context of a command (i.e. working directory). <code>null</code> is * @param context context of a command (i.e. working directory). <code>null</code> is
* valid and means to use the default context. * valid and means to use the default context.
@ -856,8 +856,8 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
return runCommand(command, context, true, monitor); return runCommand(command, context, true, monitor);
} }
/** /**
* Send a command as input to a running command shell. * Send a command as input to a running command shell.
* @param input the command to invoke in the shell. * @param input the command to invoke in the shell.
@ -872,7 +872,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
if (ok) if (ok)
{ {
internalSendCommandToShell(input, commandObject, monitor); internalSendCommandToShell(input, commandObject, monitor);
} }
else else
SystemBasePlugin.logDebugMessage(this.getClass().getName(), SystemBasePlugin.logDebugMessage(this.getClass().getName(),
"in SubSystemImpl.sendCommandToShell: isConnected() returning false!"); //$NON-NLS-1$ "in SubSystemImpl.sendCommandToShell: isConnected() returning false!"); //$NON-NLS-1$
@ -880,7 +880,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/** /**
* Cancel a shell or running command. * Cancel a shell or running command.
* *
* @param commandObject the shell or command to cancel. * @param commandObject the shell or command to cancel.
*/ */
public void cancelShell(Object commandObject) throws Exception public void cancelShell(Object commandObject) throws Exception
@ -914,7 +914,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
"in SubSystemImpl.cancelShell: isConnected() returning false!"); //$NON-NLS-1$ "in SubSystemImpl.cancelShell: isConnected() returning false!"); //$NON-NLS-1$
} }
} }
/** /**
* Cancel a shell or running command. * Cancel a shell or running command.
* @param commandObject the shell or command to cancel. * @param commandObject the shell or command to cancel.
@ -925,7 +925,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
boolean ok = true; boolean ok = true;
if (!isConnected()) if (!isConnected())
ok = promptForPassword(); ok = promptForPassword();
if (ok) if (ok)
{ {
internalCancelShell(commandObject, monitor); internalCancelShell(commandObject, monitor);
@ -940,7 +940,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/** /**
* Remove and Cancel a shell or running command. * Remove and Cancel a shell or running command.
* *
* @param commandObject the shell or command to cancel. * @param commandObject the shell or command to cancel.
*/ */
public void removeShell(Object commandObject) throws Exception public void removeShell(Object commandObject) throws Exception
@ -988,14 +988,11 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/** /**
* Creates a new RunCommandJob * Creates a new RunCommandJob
* *
* @param cmd * @param cmd The remote command to run
* The remote command to run * @param runContext The context in which to run the command
* @param runContext * @param runInterpret Whether or not to interpret results of the
* The context in which to run the command * command as RSE objects
* @param runInterpret
* Whether or not to interpret results of the command as RSE
* objects
*/ */
public RunCommandJob(String cmd, Object runContext, boolean runInterpret) public RunCommandJob(String cmd, Object runContext, boolean runInterpret)
{ {
@ -1032,9 +1029,8 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/** /**
* Creates a new RunShellJob * Creates a new RunShellJob
* *
* @param runContext * @param runContext the context within which the shell will be ran
* the context within which the shell will be ran
*/ */
public RunShellJob(Object runContext) public RunShellJob(Object runContext)
{ {
@ -1049,7 +1045,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
int totalWorkUnits = IProgressMonitor.UNKNOWN; int totalWorkUnits = IProgressMonitor.UNKNOWN;
if (!implicitConnect(false, mon, msg, totalWorkUnits)){ if (!implicitConnect(false, mon, msg, totalWorkUnits)){
String msgTxt = NLS.bind(ShellStrings.MSG_CONNECT_FAILED, getHostName()); String msgTxt = NLS.bind(ShellStrings.MSG_CONNECT_FAILED, getHostName());
throw new Exception(msgTxt); throw new Exception(msgTxt);
} }
@ -1069,9 +1065,8 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/** /**
* Constructs a new CancelShellJob * Constructs a new CancelShellJob
* *
* @param runContext * @param runContext The context for the cancelled shell
* The context for the cancelled shell
*/ */
public CancelShellJob(Object runContext) public CancelShellJob(Object runContext)
{ {
@ -1107,11 +1102,9 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/** /**
* Constructs a new SendCommandToShellJob * Constructs a new SendCommandToShellJob
* *
* @param cmd * @param cmd The command to send to the shell
* The command to send to the shell * @param runContext The context in which the command is to be run
* @param runContext
* The context in which the command is to be run
*/ */
public SendCommandToShellJob(String cmd, Object runContext) public SendCommandToShellJob(String cmd, Object runContext)
{ {
@ -1130,7 +1123,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
if (!implicitConnect(false, mon, msg, totalWorkUnits)){ if (!implicitConnect(false, mon, msg, totalWorkUnits)){
String msgTxt = NLS.bind(ShellStrings.MSG_CONNECT_FAILED, getHostName()); String msgTxt = NLS.bind(ShellStrings.MSG_CONNECT_FAILED, getHostName());
throw new Exception(msgTxt); throw new Exception(msgTxt);
} }
internalSendCommandToShell(_cmd, _runContext, mon); internalSendCommandToShell(_cmd, _runContext, mon);
@ -1147,9 +1140,8 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/** /**
* Constructs a new RemoveShellJob * Constructs a new RemoveShellJob
* *
* @param runContext * @param runContext the context for the removed shell
* the context for the removed shell
*/ */
public RemoveShellJob(Object runContext) public RemoveShellJob(Object runContext)
{ {

View file

@ -19,6 +19,7 @@
* David Dykstal (IBM) - [217556] remove service subsystem types * David Dykstal (IBM) - [217556] remove service subsystem types
* David McKnight (IBM) - [220524] internalSwitchServiceSubSystemConfiguration -> internalSwitchSubSystemConfiguration * David McKnight (IBM) - [220524] internalSwitchServiceSubSystemConfiguration -> internalSwitchSubSystemConfiguration
* Martin Oberhuber (Wind River) - [226301][api] IShellService should throw SystemMessageException on error * Martin Oberhuber (Wind River) - [226301][api] IShellService should throw SystemMessageException on error
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem; package org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem;
@ -240,6 +241,7 @@ public final class ShellServiceSubSystem extends RemoteCmdSubSystem implements I
public void initializeSubSystem(IProgressMonitor monitor) public void initializeSubSystem(IProgressMonitor monitor)
{ {
super.initializeSubSystem(monitor);
getShellService().initService(monitor); getShellService().initService(monitor);
} }
@ -247,6 +249,7 @@ public final class ShellServiceSubSystem extends RemoteCmdSubSystem implements I
{ {
cancelAllShells(); cancelAllShells();
getShellService().uninitService(monitor); getShellService().uninitService(monitor);
super.uninitializeSubSystem(monitor);
} }
} }

View file

@ -7,16 +7,17 @@
* *
* 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:
* Tobias Schwarz (Wind River) - [181394] Include Context in getAbsoluteName() for filter and pool references * Tobias Schwarz (Wind River) - [181394] Include Context in getAbsoluteName() for filter and pool references
* Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
@ -53,19 +54,19 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
* Adapter for displaying SystemFilterPool reference objects in tree views. * Adapter for displaying SystemFilterPool reference objects in tree views.
* These are children of SubSystem objects * These are children of SubSystem objects
*/ */
public class SystemViewFilterPoolReferenceAdapter public class SystemViewFilterPoolReferenceAdapter
extends AbstractSystemViewAdapter extends AbstractSystemViewAdapter
{ {
protected String translatedType; protected String translatedType;
//protected Object parent; //protected Object parent;
// for reset property support // for reset property support
//private String original_userId, original_port; //private String original_userId, original_port;
// ------------------- // -------------------
// property descriptors // property descriptors
// ------------------- // -------------------
private static PropertyDescriptor[] propertyDescriptorArray = null; private static PropertyDescriptor[] propertyDescriptorArray = null;
/** /**
* Returns any actions that should be contributed to the popup menu * Returns any actions that should be contributed to the popup menu
* for the given subsystem object. * for the given subsystem object.
@ -84,43 +85,48 @@ public class SystemViewFilterPoolReferenceAdapter
ISystemFilterPool pool = getFilterPool(element); ISystemFilterPool pool = getFilterPool(element);
ISubSystemConfiguration ssFactory = getSubSystemConfiguration(pool); ISubSystemConfiguration ssFactory = getSubSystemConfiguration(pool);
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class); ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
if (adapter != null) {
IAction[] actions = adapter.getFilterPoolActions(menu, selection, shell, menuGroup, ssFactory, pool); // Lazy Loading: By default, ISubSystemConfigurationAdapter will
if (actions != null) // only be available after its declaring bundle has been loaded,
{ // which usually happens on "connect" of a subsystem. Before that
for (int idx=0; idx<actions.length; idx++) // time, dynamically contributed actions will not be available.
{ // Implementations that want their dynamic actions to be avaialble
IAction action = actions[idx]; // earlier need to either declare them by static plugin.xml, or
menu.add(menuGroup, action); // provision for more eager loading of the bundle that declares
} // their adapter.
} IAction[] actions = adapter.getFilterPoolActions(menu, selection, shell, menuGroup, ssFactory, pool);
actions = adapter.getFilterPoolReferenceActions(menu, selection, shell, menuGroup, ssFactory, (ISystemFilterPoolReference)element); if (actions != null) {
if (actions != null) for (int idx = 0; idx < actions.length; idx++) {
{ IAction action = actions[idx];
//menu.addSeparator(); menu.add(menuGroup, action);
for (int idx=0; idx<actions.length; idx++) }
{ }
IAction action = actions[idx]; actions = adapter.getFilterPoolReferenceActions(menu, selection, shell, menuGroup, ssFactory, (ISystemFilterPoolReference) element);
menu.add(menuGroup, action); if (actions != null) {
} // menu.addSeparator();
} for (int idx = 0; idx < actions.length; idx++) {
IAction action = actions[idx];
menu.add(menuGroup, action);
}
}
}
} }
private ISubSystemConfiguration getSubSystemConfiguration(ISystemFilterPool pool) private ISubSystemConfiguration getSubSystemConfiguration(ISystemFilterPool pool)
{ {
return SubSystemHelpers.getParentSubSystemConfiguration(pool); return SubSystemHelpers.getParentSubSystemConfiguration(pool);
} }
/** /**
* <i>Overridden from parent.</i><br> * <i>Overridden from parent.</i><br>
* Returns the subsystem that contains this object. * Returns the subsystem that contains this object.
*/ */
public ISubSystem getSubSystem(Object element) public ISubSystem getSubSystem(Object element)
{ {
ISystemFilterPoolReference ref = (ISystemFilterPoolReference)element; ISystemFilterPoolReference ref = (ISystemFilterPoolReference)element;
return (ISubSystem)ref.getProvider(); return (ISubSystem)ref.getProvider();
} }
/** /**
* Returns an image descriptor for the image. More efficient than getting the image. * Returns an image descriptor for the image. More efficient than getting the image.
* @param element The element for which an image is desired * @param element The element for which an image is desired
@ -132,7 +138,17 @@ public class SystemViewFilterPoolReferenceAdapter
ISystemFilterPoolManagerProvider provider = pool.getProvider(); ISystemFilterPoolManagerProvider provider = pool.getProvider();
if (provider != null) { if (provider != null) {
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter) provider.getAdapter(ISubSystemConfigurationAdapter.class); ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter) provider.getAdapter(ISubSystemConfigurationAdapter.class);
poolImage = adapter.getSystemFilterPoolImage(pool); if (adapter != null) {
// Lazy Loading: Customized filter pool images will only be
// available once the bundle that declares the
// ISubSystemConfigurationAdapter has been activated. Until
// that time, a default image is shown. Clients who want
// their customized images be available earlier need to
// provision for more eager loading of their bundles at the
// right time (e.g. when expanding the SubSystem node,
// rather than when connecting).
poolImage = adapter.getSystemFilterPoolImage(pool);
}
} }
} }
if (poolImage == null) { if (poolImage == null) {
@ -140,7 +156,7 @@ public class SystemViewFilterPoolReferenceAdapter
} }
return poolImage; return poolImage;
} }
private ISystemFilterPool getFilterPool(Object element) private ISystemFilterPool getFilterPool(Object element)
{ {
ISystemFilterPoolReference ref = (ISystemFilterPoolReference)element; ISystemFilterPoolReference ref = (ISystemFilterPoolReference)element;
@ -161,7 +177,7 @@ public class SystemViewFilterPoolReferenceAdapter
} }
return result; return result;
} }
/** /**
* Return the name of this object, which may be different than the display text ({#link #getText(Object)}. * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
* <p> * <p>
@ -171,14 +187,14 @@ public class SystemViewFilterPoolReferenceAdapter
{ {
return getFilterPool(element).getName(); return getFilterPool(element).getName();
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object) * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
*/ */
public String getAbsoluteName(Object element) public String getAbsoluteName(Object element)
{ {
//TODO consider caching the absolute name in the FilterPoolReference to avoid unnecessary String operations - the name won't ever change //TODO consider caching the absolute name in the FilterPoolReference to avoid unnecessary String operations - the name won't ever change
ISystemFilterPoolReference filterPoolRef = (ISystemFilterPoolReference)element; ISystemFilterPoolReference filterPoolRef = (ISystemFilterPoolReference)element;
ISystemFilterPoolReferenceManagerProvider subSystem = filterPoolRef.getProvider(); ISystemFilterPoolReferenceManagerProvider subSystem = filterPoolRef.getProvider();
ISystemViewElementAdapter adapter = SystemAdapterHelpers.getViewAdapter(subSystem); ISystemViewElementAdapter adapter = SystemAdapterHelpers.getViewAdapter(subSystem);
@ -188,7 +204,7 @@ public class SystemViewFilterPoolReferenceAdapter
String absoluteName = parentAbsoluteName + "." + managerName + "." + referenceName; //$NON-NLS-1$ //$NON-NLS-2$ String absoluteName = parentAbsoluteName + "." + managerName + "." + referenceName; //$NON-NLS-1$ //$NON-NLS-2$
return absoluteName; return absoluteName;
} }
/** /**
* Return the type label for this object * Return the type label for this object
*/ */
@ -197,8 +213,8 @@ public class SystemViewFilterPoolReferenceAdapter
if (translatedType == null) if (translatedType == null)
translatedType = SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_TYPE_VALUE; translatedType = SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_TYPE_VALUE;
return translatedType; return translatedType;
} }
/** /**
* Return the parent of this object * Return the parent of this object
*/ */
@ -206,8 +222,8 @@ public class SystemViewFilterPoolReferenceAdapter
{ {
ISystemFilterPoolReference fpr = (ISystemFilterPoolReference)element; ISystemFilterPoolReference fpr = (ISystemFilterPoolReference)element;
return SubSystemHelpers.getParentSubSystem(fpr); return SubSystemHelpers.getParentSubSystem(fpr);
} }
/** /**
* Return the children of this object. * Return the children of this object.
* For filter pools, this is a list of filters. * For filter pools, this is a list of filters.
@ -218,7 +234,7 @@ public class SystemViewFilterPoolReferenceAdapter
ISubSystem ss = getSubSystem(element); ISubSystem ss = getSubSystem(element);
return fpRef.getSystemFilterReferences(ss); return fpRef.getSystemFilterReferences(ss);
} }
/** /**
* Return true if this object has children * Return true if this object has children
*/ */
@ -233,7 +249,7 @@ public class SystemViewFilterPoolReferenceAdapter
} }
return count > 0; return count > 0;
} }
// Property sheet descriptors defining all the properties we expose in the Property Sheet // Property sheet descriptors defining all the properties we expose in the Property Sheet
/** /**
* Return our unique property descriptors * Return our unique property descriptors
@ -253,7 +269,7 @@ public class SystemViewFilterPoolReferenceAdapter
// Related connection // Related connection
propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_RELATED_CONNECTION, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_RELATEDCONNECTION_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_RELATEDCONNECTION_TOOLTIP); propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_RELATED_CONNECTION, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_RELATEDCONNECTION_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_RELATEDCONNECTION_TOOLTIP);
} }
return propertyDescriptorArray; return propertyDescriptorArray;
} }
/** /**
@ -261,7 +277,7 @@ public class SystemViewFilterPoolReferenceAdapter
*/ */
protected Object internalGetPropertyValue(Object key) protected Object internalGetPropertyValue(Object key)
{ {
String name = (String)key; String name = (String)key;
//SystemFilterPoolReference ref = getFilterPoolReference(propertySourceInput); //SystemFilterPoolReference ref = getFilterPoolReference(propertySourceInput);
ISystemFilterPool pool = getFilterPool(propertySourceInput); ISystemFilterPool pool = getFilterPool(propertySourceInput);
if (name.equals(ISystemPropertyConstants.P_PARENT_FILTERPOOL)) if (name.equals(ISystemPropertyConstants.P_PARENT_FILTERPOOL))
@ -269,22 +285,22 @@ public class SystemViewFilterPoolReferenceAdapter
else if (name.equals(ISystemPropertyConstants.P_PROFILE)) else if (name.equals(ISystemPropertyConstants.P_PROFILE))
return pool.getSystemFilterPoolManager().getName(); return pool.getSystemFilterPoolManager().getName();
else if (name.equals(ISystemPropertyConstants.P_RELATED_CONNECTION)) else if (name.equals(ISystemPropertyConstants.P_RELATED_CONNECTION))
return (pool.getOwningParentName()==null) ? getTranslatedNotApplicable() : pool.getOwningParentName(); return (pool.getOwningParentName()==null) ? getTranslatedNotApplicable() : pool.getOwningParentName();
else else
return null; return null;
} }
// FOR COMMON DELETE ACTIONS // FOR COMMON DELETE ACTIONS
/** /**
* Return true if this object is deletable by the user. If so, when selected, * Return true if this object is deletable by the user. If so, when selected,
* the Edit->Delete menu item will be enabled. * the Edit->Delete menu item will be enabled.
*/ */
public boolean canDelete(Object element) public boolean canDelete(Object element)
{ {
ISystemFilterPool fp = getFilterPool(element); ISystemFilterPool fp = getFilterPool(element);
return fp.isDeletable(); return fp.isDeletable();
} }
/** /**
* Perform the delete action. * Perform the delete action.
* This physically deletes the filter pool and all references. * This physically deletes the filter pool and all references.
@ -294,24 +310,24 @@ public class SystemViewFilterPoolReferenceAdapter
ISystemFilterPool fp = getFilterPool(element); ISystemFilterPool fp = getFilterPool(element);
ISystemFilterPoolManager fpMgr = fp.getSystemFilterPoolManager(); ISystemFilterPoolManager fpMgr = fp.getSystemFilterPoolManager();
fpMgr.deleteSystemFilterPool(fp); fpMgr.deleteSystemFilterPool(fp);
//SubSystemConfiguration ssParentFactory = getSubSystemConfiguration(fp); //SubSystemConfiguration ssParentFactory = getSubSystemConfiguration(fp);
//ssParentFactory.deleteFilterPool(fp); //ssParentFactory.deleteFilterPool(fp);
return true; return true;
} }
// FOR COMMON RENAME ACTIONS // FOR COMMON RENAME ACTIONS
/** /**
* 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 menu item will be enabled. * the Rename menu item will be enabled.
*/ */
public boolean canRename(Object element) public boolean canRename(Object element)
{ {
if (!canDelete(element)) if (!canDelete(element))
return false; return false;
ISystemFilterPool fp = getFilterPool(element); ISystemFilterPool fp = getFilterPool(element);
return !fp.isNonRenamable(); return !fp.isNonRenamable();
} }
/** /**
* Perform the rename action. Assumes uniqueness checking was done already. * Perform the rename action. Assumes uniqueness checking was done already.
*/ */
@ -320,10 +336,10 @@ public class SystemViewFilterPoolReferenceAdapter
ISystemFilterPool fp = getFilterPool(element); ISystemFilterPool fp = getFilterPool(element);
ISystemFilterPoolManager fpMgr = fp.getSystemFilterPoolManager(); ISystemFilterPoolManager fpMgr = fp.getSystemFilterPoolManager();
fpMgr.renameSystemFilterPool(fp,name); fpMgr.renameSystemFilterPool(fp,name);
//SubSystemConfiguration ssParentFactory = getSubSystemConfiguration(fp); //SubSystemConfiguration ssParentFactory = getSubSystemConfiguration(fp);
//ssParentFactory.renameFilterPool(fp,name); //ssParentFactory.renameFilterPool(fp,name);
return true; return true;
} }
/** /**
* Return a validator for verifying the new name is correct. * Return a validator for verifying the new name is correct.
*/ */
@ -340,7 +356,7 @@ public class SystemViewFilterPoolReferenceAdapter
String[] names = mgr.getSystemFilterPoolNames(); String[] names = mgr.getSystemFilterPoolNames();
ISystemValidator nameValidator = new ValidatorFilterPoolName(names); ISystemValidator nameValidator = new ValidatorFilterPoolName(names);
return nameValidator; return nameValidator;
} }
/** /**
* Parent override. * Parent override.
* <p> * <p>
@ -390,7 +406,7 @@ public class SystemViewFilterPoolReferenceAdapter
/** /**
* This is a local RSE artifact so returning false * This is a local RSE artifact so returning false
* *
* @param element the object to check * @param element the object to check
* @return false since this is not remote * @return false since this is not remote
*/ */

View file

@ -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:
* David Dykstal (IBM) - moved SystemsPreferencesManager to a new package * David Dykstal (IBM) - moved SystemsPreferencesManager to a new package
* Tobias Schwarz (Wind River) - [181394] Include Context in getAbsoluteName() for filter and pool references * Tobias Schwarz (Wind River) - [181394] Include Context in getAbsoluteName() for filter and pool references
@ -19,12 +19,13 @@
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Tobias Schwarz (Wind River) - [173267] "empty list" should not be displayed * Tobias Schwarz (Wind River) - [173267] "empty list" should not be displayed
* Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
* Kevin Doyle (IBM) - [187707] Added separator between New Folder and New File in context menu * Kevin Doyle (IBM) - [187707] Added separator between New Folder and New File in context menu
* David McKnight (IBM) - [199566] Remove synchronzied from internalGetChildren * David McKnight (IBM) - [199566] Remove synchronzied from internalGetChildren
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
* David McKnight (IBM) - [210563] error messages need to be shown if incurred during filter expansion * David McKnight (IBM) - [210563] error messages need to be shown if incurred during filter expansion
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
@ -85,15 +86,15 @@ import org.eclipse.ui.views.properties.PropertyDescriptor;
* Adapter for displaying SystemFilterReference objects in tree views. * Adapter for displaying SystemFilterReference objects in tree views.
* These are children of SystemFilterPoolReference and SystemFilterReference objects * These are children of SystemFilterPoolReference and SystemFilterReference objects
*/ */
public class SystemViewFilterReferenceAdapter public class SystemViewFilterReferenceAdapter
extends AbstractSystemViewAdapter extends AbstractSystemViewAdapter
{ {
//private static String translatedFilterString = null; //private static String translatedFilterString = null;
// ------------------- // -------------------
// property descriptors // property descriptors
// ------------------- // -------------------
private static PropertyDescriptor[] propertyDescriptorArray = null; private static PropertyDescriptor[] propertyDescriptorArray = null;
//private SystemComboBoxPropertyDescriptor filterStringsDescriptor, filtersDescriptor; //private SystemComboBoxPropertyDescriptor filterStringsDescriptor, filtersDescriptor;
/** /**
* Returns any actions that should be contributed to the popup menu * Returns any actions that should be contributed to the popup menu
@ -113,26 +114,34 @@ public class SystemViewFilterReferenceAdapter
IHost currentConnection = currentSubSystem.getHost(); IHost currentConnection = currentSubSystem.getHost();
ssFactory.setConnection(currentConnection); ssFactory.setConnection(currentConnection);
ssFactory.setCurrentSelection(selection.toArray()); ssFactory.setCurrentSelection(selection.toArray());
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class); ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter) ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
if (adapter != null) {
IAction[] actions = adapter.getFilterActions(menu, selection, shell, menuGroup, ssFactory, filter); // Lazy Loading: Specialized actions on filters are available only
if (actions != null) // after the bundle that declares the ISubSystemConfigurationAdapter
{ // has been loaded, which typically is after connecting. We do not
for (int idx = 0; idx < actions.length; idx++) // load the bundle here because this code is executed as part of
// showing a context menu. Subsystems who want their actions to be
// available earlier need to provide them by static plugin.xml
// markup or provision for more eager loading of their bundle, e.g.
// through Platform.getAdapterManager().loadAdapter() at the right
// time.
IAction[] actions = adapter.getFilterActions(menu, selection, shell, menuGroup, ssFactory, filter);
if (actions != null)
{ {
IAction action = actions[idx]; for (int idx = 0; idx < actions.length; idx++) {
if (action instanceof SystemNewFilterAction) IAction action = actions[idx];
menu.appendToGroup(ISystemContextMenuConstants.GROUP_NEW, new Separator()); if (action instanceof SystemNewFilterAction)
menu.add(menuGroup, action); menu.appendToGroup(ISystemContextMenuConstants.GROUP_NEW, new Separator());
menu.add(menuGroup, action);
}
} }
} actions = adapter.getFilterReferenceActions(menu, selection, shell, menuGroup, ssFactory, getFilterReference(selection.getFirstElement()));
actions = adapter.getFilterReferenceActions(menu, selection, shell, menuGroup, ssFactory, getFilterReference(selection.getFirstElement())); if (actions != null)
if (actions != null)
{
for (int idx = 0; idx < actions.length; idx++)
{ {
IAction action = actions[idx]; for (int idx = 0; idx < actions.length; idx++) {
menu.add(menuGroup, action); IAction action = actions[idx];
menu.add(menuGroup, action);
}
} }
} }
} }
@ -141,7 +150,7 @@ public class SystemViewFilterReferenceAdapter
{ {
return SubSystemHelpers.getParentSubSystemConfiguration(filter); return SubSystemHelpers.getParentSubSystemConfiguration(filter);
} }
/** /**
* <i>Overridden from parent.</i><br> * <i>Overridden from parent.</i><br>
* Returns the subsystem that contains this object. * Returns the subsystem that contains this object.
@ -153,7 +162,7 @@ public class SystemViewFilterReferenceAdapter
else else
return null; return null;
} }
/** /**
* Returns an image descriptor for the image. More efficient than getting the image. * Returns an image descriptor for the image. More efficient than getting the image.
* @param element The element for which an image is desired * @param element The element for which an image is desired
@ -165,9 +174,17 @@ public class SystemViewFilterReferenceAdapter
ISystemFilter filter = getFilter(element); ISystemFilter filter = getFilter(element);
if (filter.getProvider() != null) // getProvider() returns the subsystem factory if (filter.getProvider() != null) // getProvider() returns the subsystem factory
{ {
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)filter.getProvider().getAdapter(ISubSystemConfigurationAdapter.class); ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)filter.getProvider().getAdapter(ISubSystemConfigurationAdapter.class);
filterImage = adapter.getSystemFilterImage(filter); if (adapter != null) {
// Lazy Loading: Customized Filter Images will be available only
// after the bundle that declares the
// ISubSystemConfigurationAdapter has been loaded. Until that
// time, a default filter image is used. Extenders who want to
// see their filter images right away need to provision for
// eager loading of their bundles at the right time (i.e. when
// expanding the Subsystem node).
filterImage = adapter.getSystemFilterImage(filter);
}
} }
if (filterImage == null) if (filterImage == null)
filterImage = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTER_ID); filterImage = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTER_ID);
@ -178,7 +195,7 @@ public class SystemViewFilterReferenceAdapter
{ {
return (ISystemFilterReference) element; // get referenced object return (ISystemFilterReference) element; // get referenced object
} }
private ISystemFilter getFilter(Object element) private ISystemFilter getFilter(Object element)
{ {
return getFilterReference(element).getReferencedFilter(); // get master object return getFilterReference(element).getReferencedFilter(); // get master object
@ -191,7 +208,7 @@ public class SystemViewFilterReferenceAdapter
{ {
return getFilter(element).getName(); return getFilter(element).getName();
} }
/** /**
* Return the name of this object, which may be different than the display text ({#link #getText(Object)}. * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
* <p> * <p>
@ -201,14 +218,14 @@ public class SystemViewFilterReferenceAdapter
{ {
return getFilter(element).getName(); return getFilter(element).getName();
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object) * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
*/ */
public String getAbsoluteName(Object element) public String getAbsoluteName(Object element)
{ {
//TODO consider caching the absolute name in the FilterReference to avoid unnecessary String operations - the name won't ever change //TODO consider caching the absolute name in the FilterReference to avoid unnecessary String operations - the name won't ever change
ISystemFilterPoolReference filterPoolReference = getFilterReference(element).getParentSystemFilterReferencePool(); ISystemFilterPoolReference filterPoolReference = getFilterReference(element).getParentSystemFilterReferencePool();
ISystemViewElementAdapter adapter = SystemAdapterHelpers.getViewAdapter(filterPoolReference); ISystemViewElementAdapter adapter = SystemAdapterHelpers.getViewAdapter(filterPoolReference);
String parentAbsoluteName = (adapter != null) ? adapter.getAbsoluteName(filterPoolReference) : ""; //$NON-NLS-1$ String parentAbsoluteName = (adapter != null) ? adapter.getAbsoluteName(filterPoolReference) : ""; //$NON-NLS-1$
@ -268,17 +285,17 @@ public class SystemViewFilterReferenceAdapter
ISubSystem subsystem = element.getSubSystem(); ISubSystem subsystem = element.getSubSystem();
ISubSystemConfiguration configuration = subsystem.getSubSystemConfiguration(); ISubSystemConfiguration configuration = subsystem.getSubSystemConfiguration();
Object adapter = Platform.getAdapterManager().getAdapter(configuration, ISubSystemConfigurationAdapter.class); Object adapter = Platform.getAdapterManager().getAdapter(configuration, ISubSystemConfigurationAdapter.class);
if (adapter instanceof ISubSystemConfigurationAdapter) if (adapter instanceof ISubSystemConfigurationAdapter)
{ {
children = ((ISubSystemConfigurationAdapter)adapter).applyViewFilters(element, children); children = ((ISubSystemConfigurationAdapter)adapter).applyViewFilters(element, children);
} }
return children; return children;
} }
/* /*
* Returns the children of the specified element. If a monitor is passed in then * Returns the children of the specified element. If a monitor is passed in then
* the context is assumed to be modal and, as such, the modal version of ss.resolveFilterStrings * the context is assumed to be modal and, as such, the modal version of ss.resolveFilterStrings
* is called rather than the main thread version. * is called rather than the main thread version.
*/ */
@ -299,7 +316,7 @@ public class SystemViewFilterReferenceAdapter
try try
{ {
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssf.getAdapter(ISubSystemConfigurationAdapter.class); ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssf.getAdapter(ISubSystemConfigurationAdapter.class);
ISystemFilter newFilter = adapter.createFilterByPrompting(ssf, fRef, getShell()); ISystemFilter newFilter = adapter.createFilterByPrompting(ssf, fRef, getShell());
if (newFilter == null) if (newFilter == null)
{ {
@ -341,14 +358,14 @@ public class SystemViewFilterReferenceAdapter
else else
{ {
/* /*
// show filter strings // show filter strings
if (ssf.showFilterStrings()) if (ssf.showFilterStrings())
{ {
SystemFilterStringReference[] refFilterStrings = fRef.getSystemFilterStringReferences(); SystemFilterStringReference[] refFilterStrings = fRef.getSystemFilterStringReferences();
if ((nestedFilterReferences == null) || (nestedFilterReferences.length == 0)) if ((nestedFilterReferences == null) || (nestedFilterReferences.length == 0))
return refFilterStrings; return refFilterStrings;
if ((refFilterStrings == null) || (refFilterStrings.length == 0)) if ((refFilterStrings == null) || (refFilterStrings.length == 0))
return nestedFilterReferences; return nestedFilterReferences;
int nbrChildren = nestedFilterReferences.length + refFilterStrings.length; int nbrChildren = nestedFilterReferences.length + refFilterStrings.length;
children = new Object[nbrChildren]; children = new Object[nbrChildren];
int idx=0; int idx=0;
@ -365,10 +382,10 @@ public class SystemViewFilterReferenceAdapter
try try
{ {
// hack to propogate type filters down from connection in select dialogs... // hack to propogate type filters down from connection in select dialogs...
ISystemViewInputProvider inputProvider = getInput(); ISystemViewInputProvider inputProvider = getInput();
if ((inputProvider != null) && (inputProvider instanceof SystemSelectRemoteObjectAPIProviderImpl) && if ((inputProvider != null) && (inputProvider instanceof SystemSelectRemoteObjectAPIProviderImpl) &&
(filterStrings != null) && (filterStrings.length > 0)) (filterStrings != null) && (filterStrings.length > 0))
{ {
SystemSelectRemoteObjectAPIProviderImpl ip = (SystemSelectRemoteObjectAPIProviderImpl) inputProvider; SystemSelectRemoteObjectAPIProviderImpl ip = (SystemSelectRemoteObjectAPIProviderImpl) inputProvider;
@ -380,11 +397,11 @@ public class SystemViewFilterReferenceAdapter
filterStrings = adorned; filterStrings = adorned;
} }
} }
boolean doQuery = true; boolean doQuery = true;
if (!referencedFilter.isTransient() && if (!referencedFilter.isTransient() &&
ssf.supportsFilterCaching() && ssf.supportsFilterCaching() &&
!fRef.isStale() && !fRef.isStale() &&
fRef.hasContents(SystemChildrenContentsType.getInstance())) fRef.hasContents(SystemChildrenContentsType.getInstance()))
{ {
doQuery = false; doQuery = false;
@ -409,7 +426,7 @@ public class SystemViewFilterReferenceAdapter
if (doQuery) if (doQuery)
{ {
Object[] allChildren = null; Object[] allChildren = null;
if (monitor == null) if (monitor == null)
{ {
allChildren = ss.resolveFilterStrings(filterStrings, new NullProgressMonitor()); allChildren = ss.resolveFilterStrings(filterStrings, new NullProgressMonitor());
@ -418,7 +435,7 @@ public class SystemViewFilterReferenceAdapter
{ {
allChildren = ss.resolveFilterStrings(filterStrings, monitor); allChildren = ss.resolveFilterStrings(filterStrings, monitor);
} }
if (allChildren == null) if (allChildren == null)
{ {
// System.out.println("filter children == null!"); //$NON-NLS-1$ // System.out.println("filter children == null!"); //$NON-NLS-1$
@ -430,7 +447,7 @@ public class SystemViewFilterReferenceAdapter
// error to display // error to display
return allChildren; // nothing to sort or cache - just show the error return allChildren; // nothing to sort or cache - just show the error
} }
if (nestedFilterReferences != null) if (nestedFilterReferences != null)
{ {
int nbrNestedFilters = nestedFilterReferences.length; int nbrNestedFilters = nestedFilterReferences.length;
@ -440,8 +457,8 @@ public class SystemViewFilterReferenceAdapter
children[idx] = nestedFilterReferences[idx]; children[idx] = nestedFilterReferences[idx];
for (int jdx = 0; jdx < allChildren.length; jdx++) for (int jdx = 0; jdx < allChildren.length; jdx++)
children[idx++] = allChildren[jdx]; children[idx++] = allChildren[jdx];
if (!referencedFilter.isTransient() && ssf.supportsFilterCaching()) if (!referencedFilter.isTransient() && ssf.supportsFilterCaching())
{ {
fRef.setContents(SystemChildrenContentsType.getInstance(), children); fRef.setContents(SystemChildrenContentsType.getInstance(), children);
@ -449,7 +466,7 @@ public class SystemViewFilterReferenceAdapter
} }
} }
} }
} }
catch (InterruptedException exc) catch (InterruptedException exc)
{ {
@ -474,13 +491,13 @@ public class SystemViewFilterReferenceAdapter
* That is, if the referenced filter has nested filters or filter strings. * That is, if the referenced filter has nested filters or filter strings.
*/ */
public boolean hasChildren(IAdaptable element) public boolean hasChildren(IAdaptable element)
{ {
ISystemFilterReference fRef = getFilterReference(element); ISystemFilterReference fRef = getFilterReference(element);
ISystemFilter referencedFilter = fRef.getReferencedFilter(); ISystemFilter referencedFilter = fRef.getReferencedFilter();
ISubSystemConfiguration factory = getSubSystemConfiguration(referencedFilter); ISubSystemConfiguration factory = getSubSystemConfiguration(referencedFilter);
if (factory.supportsFilterChildren()) if (factory.supportsFilterChildren())
{ {
int nbrNestedFilters = referencedFilter.getSystemFilterCount(); int nbrNestedFilters = referencedFilter.getSystemFilterCount();
int nbrFilterStrings = referencedFilter.getFilterStringCount(); int nbrFilterStrings = referencedFilter.getFilterStringCount();
return (nbrNestedFilters > 0) || (nbrFilterStrings > 0); return (nbrNestedFilters > 0) || (nbrFilterStrings > 0);
@ -521,7 +538,7 @@ public class SystemViewFilterReferenceAdapter
* <li>name="filterType". The value is tested against the non-translated filter type. Note all subsystems * <li>name="filterType". The value is tested against the non-translated filter type. Note all subsystems
* support different types of filters. * support different types of filters.
* <li>name="showChangeFilterStringsPropertyPage". The value is tested against the call to the subsystem factory method showChangeFilterStringsPropertyPage(SystemFilter). * <li>name="showChangeFilterStringsPropertyPage". The value is tested against the call to the subsystem factory method showChangeFilterStringsPropertyPage(SystemFilter).
* Compares against "true" (default) or "false". * Compares against "true" (default) or "false".
* </ol> * </ol>
*/ */
public boolean testAttribute(Object target, String name, String value) public boolean testAttribute(Object target, String name, String value)
@ -542,7 +559,7 @@ public class SystemViewFilterReferenceAdapter
if (value.equals("true")) //$NON-NLS-1$ if (value.equals("true")) //$NON-NLS-1$
return ssf.showChangeFilterStringsPropertyPage(ref.getReferencedFilter()); return ssf.showChangeFilterStringsPropertyPage(ref.getReferencedFilter());
else else
return !ssf.showChangeFilterStringsPropertyPage(ref.getReferencedFilter()); return !ssf.showChangeFilterStringsPropertyPage(ref.getReferencedFilter());
} }
else else
return super.testAttribute(target, name, value); return super.testAttribute(target, name, value);
@ -566,7 +583,7 @@ public class SystemViewFilterReferenceAdapter
// number filter strings // number filter strings
propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILTERSTRINGS_COUNT, SystemViewResources.RESID_PROPERTY_FILTERSTRINGS_COUNT_LABEL, SystemViewResources.RESID_PROPERTY_FILTERSTRINGS_COUNT_TOOLTIP); propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILTERSTRINGS_COUNT, SystemViewResources.RESID_PROPERTY_FILTERSTRINGS_COUNT_LABEL, SystemViewResources.RESID_PROPERTY_FILTERSTRINGS_COUNT_TOOLTIP);
// Related connection // Related connection
propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_IS_CONNECTION_PRIVATE, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_IS_CONNECTIONPRIVATE_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_IS_CONNECTIONPRIVATE_TOOLTIP); propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_IS_CONNECTION_PRIVATE, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_IS_CONNECTIONPRIVATE_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_IS_CONNECTIONPRIVATE_TOOLTIP);
} }
return propertyDescriptorArray; return propertyDescriptorArray;
} }
@ -713,13 +730,13 @@ public class SystemViewFilterReferenceAdapter
ISystemFilter filter = getFilter(element); ISystemFilter filter = getFilter(element);
return !filter.isPromptable(); return !filter.isPromptable();
} }
/** /**
* Don't show generic "Show in Table" if the factory asks not to * Don't show generic "Show in Table" if the factory asks not to
*/ */
public boolean showGenericShowInTableAction(Object element) public boolean showGenericShowInTableAction(Object element)
{ {
ISystemFilter filter = getFilter(element); ISystemFilter filter = getFilter(element);
ISubSystemConfiguration ssParentFactory = getSubSystemConfiguration(filter); ISubSystemConfiguration ssParentFactory = getSubSystemConfiguration(filter);
return ssParentFactory.showGenericShowInTableOnFilter(); return ssParentFactory.showGenericShowInTableOnFilter();
@ -827,7 +844,7 @@ public class SystemViewFilterReferenceAdapter
// ------------------------------------------ // ------------------------------------------
// METHODS TO SUPPORT COMMON DRAG AND DROP FUNCTION... // METHODS TO SUPPORT COMMON DRAG AND DROP FUNCTION...
// ------------------------------------------ // ------------------------------------------
/** /**
* drag support is handled directly for filter references, rather than delegated here. * drag support is handled directly for filter references, rather than delegated here.
*/ */
@ -837,7 +854,7 @@ public class SystemViewFilterReferenceAdapter
if (fRef != null) if (fRef != null)
{ {
if (getSubSystemConfiguration(fRef.getReferencedFilter()).supportsFilterStringExport()) if (getSubSystemConfiguration(fRef.getReferencedFilter()).supportsFilterStringExport())
{ {
return true; return true;
} }
} }
@ -860,11 +877,11 @@ public class SystemViewFilterReferenceAdapter
{ {
return true; return true;
} }
if (!fRef.getReferencedFilter().isNonChangable()) if (!fRef.getReferencedFilter().isNonChangable())
{ {
if (factory.supportsMultiStringFilters()) if (factory.supportsMultiStringFilters())
{ {
return true; return true;
} }
} }
@ -872,7 +889,7 @@ public class SystemViewFilterReferenceAdapter
} }
return false; return false;
} }
public ISystemResourceSet doDrag(SystemRemoteResourceSet set, IProgressMonitor monitor) public ISystemResourceSet doDrag(SystemRemoteResourceSet set, IProgressMonitor monitor)
{ {
return set; return set;
@ -909,13 +926,13 @@ public class SystemViewFilterReferenceAdapter
else if (from instanceof IAdaptable) else if (from instanceof IAdaptable)
{ {
ISystemRemoteElementAdapter radapter = (ISystemRemoteElementAdapter) ((IAdaptable) from).getAdapter(ISystemRemoteElementAdapter.class); ISystemRemoteElementAdapter radapter = (ISystemRemoteElementAdapter) ((IAdaptable) from).getAdapter(ISystemRemoteElementAdapter.class);
{ {
String newFilterStr = radapter.getFilterStringFor(from); String newFilterStr = radapter.getFilterStringFor(from);
if (newFilterStr != null) if (newFilterStr != null)
{ {
filter.addFilterString(newFilterStr); filter.addFilterString(newFilterStr);
return fRef; return fRef;
} }
} }
@ -929,10 +946,10 @@ public class SystemViewFilterReferenceAdapter
* compatable. * compatable.
*/ */
public boolean validateDrop(Object src, Object target, boolean sameSystem) public boolean validateDrop(Object src, Object target, boolean sameSystem)
{ {
if (!sameSystem) if (!sameSystem)
{ {
if (src instanceof IResource) if (src instanceof IResource)
{ {
return true; return true;
} }
@ -964,7 +981,7 @@ public class SystemViewFilterReferenceAdapter
return true; return true;
} }
} }
// check if src has a filter string // check if src has a filter string
else if (src instanceof IAdaptable) else if (src instanceof IAdaptable)
{ {
ISystemRemoteElementAdapter adapter = (ISystemRemoteElementAdapter) ((IAdaptable) src).getAdapter(ISystemRemoteElementAdapter.class); ISystemRemoteElementAdapter adapter = (ISystemRemoteElementAdapter) ((IAdaptable) src).getAdapter(ISystemRemoteElementAdapter.class);
@ -980,20 +997,20 @@ public class SystemViewFilterReferenceAdapter
} }
return false; return false;
} }
/* /*
* Return whether deferred queries are supported. * Return whether deferred queries are supported.
* Defer to the subsystem configuration. * Defer to the subsystem configuration.
*/ */
public boolean supportsDeferredQueries(ISubSystem subSys) public boolean supportsDeferredQueries(ISubSystem subSys)
{ {
return subSys.getSubSystemConfiguration().supportsDeferredQueries(); return subSys.getSubSystemConfiguration().supportsDeferredQueries();
} }
/** /**
* This is a local RSE artifact so returning false * This is a local RSE artifact so returning false
* *
* @param element the object to check * @param element the object to check
* @return false since this is not remote * @return false since this is not remote
*/ */

View file

@ -1,15 +1,15 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved. * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
* *
* 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:
* David Dykstal (IBM) - 180562: remove implementation of IRSEUserIdConstants * David Dykstal (IBM) - 180562: remove implementation of IRSEUserIdConstants
* Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
@ -20,11 +20,13 @@
* David Dykstal (IBM) - [217556] remove service subsystem types * David Dykstal (IBM) - [217556] remove service subsystem types
* Martin Oberhuber (Wind River) - [195399] Improve String display for default port 0 * Martin Oberhuber (Wind River) - [195399] Improve String display for default port 0
* David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.action.GroupMarker; import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IAction;
import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageDescriptor;
@ -34,7 +36,9 @@ import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.subsystems.IConnectorService; import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
import org.eclipse.rse.internal.ui.SystemResources; import org.eclipse.rse.internal.ui.SystemResources;
import org.eclipse.rse.internal.ui.subsystems.SubSystemConfigurationProxyAdapter;
import org.eclipse.rse.ui.ISystemContextMenuConstants; import org.eclipse.rse.ui.ISystemContextMenuConstants;
import org.eclipse.rse.ui.SystemBasePlugin; import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.rse.ui.SystemMenuManager; import org.eclipse.rse.ui.SystemMenuManager;
@ -55,25 +59,25 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor;
* Adapter for displaying SubSystem objects in tree views. * Adapter for displaying SubSystem objects in tree views.
* These are children of SystemConnection objects * These are children of SystemConnection objects
*/ */
public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
{ {
protected String translatedType; protected String translatedType;
// for reset property support // for reset property support
private String original_portData; private String original_portData;
private SystemInheritablePropertyData original_userIdData = new SystemInheritablePropertyData(); private SystemInheritablePropertyData original_userIdData = new SystemInheritablePropertyData();
//private SystemInheritablePropertyData original_portData = new SystemInheritablePropertyData(); //private SystemInheritablePropertyData original_portData = new SystemInheritablePropertyData();
private TextPropertyDescriptor propertyPortDescriptor; private TextPropertyDescriptor propertyPortDescriptor;
private boolean changed_userId, changed_port; private boolean changed_userId, changed_port;
private boolean port_editable = true; private boolean port_editable = true;
// ------------------- // -------------------
// property descriptors // property descriptors
// ------------------- // -------------------
private PropertyDescriptor[] propertyDescriptorArray = null; private PropertyDescriptor[] propertyDescriptorArray = null;
//private SystemInheritablePropertyData portData = new SystemInheritablePropertyData(); //private SystemInheritablePropertyData portData = new SystemInheritablePropertyData();
//private SystemInheritableTextPropertyDescriptor portDescriptor; //private SystemInheritableTextPropertyDescriptor portDescriptor;
private SystemInheritablePropertyData userIdData = new SystemInheritablePropertyData(); private SystemInheritablePropertyData userIdData = new SystemInheritablePropertyData();
private SystemInheritableTextPropertyDescriptor userIdDescriptor = null; private SystemInheritableTextPropertyDescriptor userIdDescriptor = null;
/** /**
* Returns any actions that should be contributed to the popup menu * Returns any actions that should be contributed to the popup menu
* for the given subsystem object. * for the given subsystem object.
@ -88,49 +92,92 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
{ {
// does not make sense adding unique actions per multi-selection // does not make sense adding unique actions per multi-selection
if (selection.size() == 1) { if (selection.size() == 1) {
Object element = selection.getFirstElement(); Object element = selection.getFirstElement();
ISubSystem ss = (ISubSystem)element; ISubSystem ss = (ISubSystem)element;
ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration(); ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class); ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
if (adapter == null) {
IAction[] actions = adapter.getSubSystemActions(menu, selection, shell, menuGroup, ssFactory, ss); // FIXME Fallback to default SubSystemConfigurationAdapter, such
if (actions != null) // that we get at least the "connect" and other common actions
{ // for subsystems before their adapter is loaded. Note that this
for (int idx=0; idx<actions.length; idx++) // means that the popular "launch Shell" action will not be
// available before the rse.shells.ui plugin is loaded; but that
// should be fixed by contributing that action via plugin.xml,
// rather than forcing full bundle activation here from the
// menu. See
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=226550
// //adapter = new SubSystemConfigurationAdapter();
Platform.getAdapterManager().loadAdapter(ssFactory, ISubSystemConfigurationAdapter.class.getName());
adapter = (ISubSystemConfigurationAdapter) ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
// if (adapter == null) {
// //TODO is this right? It deprives clients from the ability
// //to get rid of the standard actions contributed by the
// //default adapter. We shouldn't do that.
// adapter = new SubSystemConfigurationAdapter();
// }
}
if (adapter != null) {
// Lazy Loading: Dynamic contributed subsystem actions will be
// provided only once the corresponding plugin is activated
// (adapter factory loaded). This means, that by default,
// dynamic actions are only shown after connecting a subsystem.
// If a subsystem needs to show these earlier, it needs to
// provision for eager bundle activation to ensure that its
// ISubSystemConfigurationAdapter is loaded -- or, provide these
// actions by static plugin.xml markup.
IAction[] actions = adapter.getSubSystemActions(menu, selection, shell, menuGroup, ssFactory, ss);
if (actions != null)
{ {
IAction action = actions[idx]; for (int idx = 0; idx < actions.length; idx++) {
menu.add(menuGroup, action); IAction action = actions[idx];
menu.add(menuGroup, action);
}
} }
} }
} }
menu.appendToGroup(ISystemContextMenuConstants.GROUP_NEW, new GroupMarker(ISystemContextMenuConstants.GROUP_NEW_NONCASCADING));// user or BP/ISV additions menu.appendToGroup(ISystemContextMenuConstants.GROUP_NEW, new GroupMarker(ISystemContextMenuConstants.GROUP_NEW_NONCASCADING));// user or BP/ISV additions
} }
/** /**
* Returns an image descriptor for the image. More efficient than getting the image. * Returns an image descriptor for the image. More efficient than getting the image.
* @param element The element for which an image is desired * @param element The element for which an image is desired
*/ */
public ImageDescriptor getImageDescriptor(Object element) public ImageDescriptor getImageDescriptor(Object element)
{ {
//System.out.println("INSIDE GETIMAGEDESCRIPTOR FOR SUBSYSTEM VIEW ADAPTER: "+element); //System.out.println("INSIDE GETIMAGEDESCRIPTOR FOR SUBSYSTEM VIEW ADAPTER: "+element);
ISubSystem ss = (ISubSystem)element; ISubSystem ss = (ISubSystem)element;
ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration(); ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
if (ssFactory != null) if (ssFactory != null)
{ {
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class); ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
if (ss.isConnected()) if (adapter != null) {
return adapter.getLiveImage(ssFactory); if (ss.isConnected())
else return adapter.getLiveImage(ssFactory);
return adapter.getImage(ssFactory); else
return adapter.getImage(ssFactory);
} else {
// get image from proxy
ISubSystemConfigurationProxy proxy = ssFactory.getSubSystemConfigurationProxy();
SubSystemConfigurationProxyAdapter proxyAdapter = (SubSystemConfigurationProxyAdapter) Platform.getAdapterManager().getAdapter(proxy,
SubSystemConfigurationProxyAdapter.class);
if (proxyAdapter != null) {
if (ss.isConnected())
return proxyAdapter.getLiveImageDescriptor();
else
return proxyAdapter.getImageDescriptor();
} else {
SystemBasePlugin.logWarning("Unexpected error: SubSystemConfiguration has no adapter and no proxyAdapter: " + ss.getName()); //$NON-NLS-1$
return null;
}
}
} }
else else
{ {
SystemBasePlugin.logWarning("Unexpected error: ssFactory is null for ss " + ss.getName()); //$NON-NLS-1$ SystemBasePlugin.logWarning("Unexpected error: SubSystemConfiguration is null for ss " + ss.getName()); //$NON-NLS-1$
return null; return null;
} }
} }
/** /**
* Return the label for this object. Uses getName() on the subsystem object. * Return the label for this object. Uses getName() on the subsystem object.
*/ */
@ -147,7 +194,7 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
{ {
return ((ISubSystem)element).getName(); return ((ISubSystem)element).getName();
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object) * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
@ -161,7 +208,7 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
suffix = serviceType.toString(); suffix = serviceType.toString();
} }
return ss.getSystemProfileName() + "." + ss.getHostAliasName() + "." + suffix; //$NON-NLS-1$ //$NON-NLS-2$ return ss.getSystemProfileName() + "." + ss.getHostAliasName() + "." + suffix; //$NON-NLS-1$ //$NON-NLS-2$
} }
/** /**
* Return the type label for this object * Return the type label for this object
*/ */
@ -170,36 +217,36 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
if (translatedType == null) if (translatedType == null)
translatedType = SystemViewResources.RESID_PROPERTY_SUBSYSTEM_TYPE_VALUE; translatedType = SystemViewResources.RESID_PROPERTY_SUBSYSTEM_TYPE_VALUE;
return translatedType; return translatedType;
} }
/** /**
* Return the parent of this object. This is a connection object. * Return the parent of this object. This is a connection object.
*/ */
public Object getParent(Object element) public Object getParent(Object element)
{ {
//System.out.println("INSIDE GETPARENT FOR SUBSYSTEM VIEW ADAPTER: "+element); //System.out.println("INSIDE GETPARENT FOR SUBSYSTEM VIEW ADAPTER: "+element);
ISubSystem ss = (ISubSystem)element; ISubSystem ss = (ISubSystem)element;
return RSECorePlugin.getTheSystemRegistry().getHost(ss.getSystemProfile(),ss.getHostAliasName()); return RSECorePlugin.getTheSystemRegistry().getHost(ss.getSystemProfile(),ss.getHostAliasName());
} }
/** /**
* Return the children of this object * Return the children of this object
*/ */
public Object[] getChildren(IAdaptable element, IProgressMonitor monitor) public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
{ {
//System.out.println("INSIDE GETCHILDREN FOR SUBSYSTEM VIEW ADAPTER: "+element); //System.out.println("INSIDE GETCHILDREN FOR SUBSYSTEM VIEW ADAPTER: "+element);
ISubSystem ss = (ISubSystem)element; ISubSystem ss = (ISubSystem)element;
Object[] children = ss.getChildren(); Object[] children = ss.getChildren();
return children; return children;
} }
/** /**
* Return true if this object has children * Return true if this object has children
*/ */
public boolean hasChildren(IAdaptable element) public boolean hasChildren(IAdaptable element)
{ {
//System.out.println("INSIDE HASCHILDREN FOR SUBSYSTEM VIEW ADAPTER: "+element); //System.out.println("INSIDE HASCHILDREN FOR SUBSYSTEM VIEW ADAPTER: "+element);
ISubSystem ss = (ISubSystem)element; ISubSystem ss = (ISubSystem)element;
return ss.hasChildren(); return ss.hasChildren();
} }
@ -207,12 +254,12 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
// ---------------------------------- // ----------------------------------
// Property sheet supplier methods... // Property sheet supplier methods...
// ---------------------------------- // ----------------------------------
/** /**
* Returns the current collection of property descriptors for connection objects. * Returns the current collection of property descriptors for connection objects.
* @return an array containing all descriptors. * @return an array containing all descriptors.
*/ */
public IPropertyDescriptor[] getPropertyDescriptors() public IPropertyDescriptor[] getPropertyDescriptors()
{ {
if (propertyDescriptorArray == null) if (propertyDescriptorArray == null)
{ {
@ -221,46 +268,46 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
int idx = 0; int idx = 0;
for (idx = 0; idx < defaultProperties.length; idx++) for (idx = 0; idx < defaultProperties.length; idx++)
propertyDescriptorArray[idx] = defaultProperties[idx]; propertyDescriptorArray[idx] = defaultProperties[idx];
// add our unique property descriptors... // add our unique property descriptors...
//idx = defaultProperties.length; assertion //idx = defaultProperties.length; assertion
// user id // user id
//propertyDescriptorArray[idx] = new TextPropertyDescriptor(ISystemPropertyConstants.P_USERID, //propertyDescriptorArray[idx] = new TextPropertyDescriptor(ISystemPropertyConstants.P_USERID,
// SystemViewResources.RESID_PROPERTY_USERID_LABEL)); // SystemViewResources.RESID_PROPERTY_USERID_LABEL));
userIdDescriptor = userIdDescriptor =
new SystemInheritableTextPropertyDescriptor(ISystemPropertyConstants.P_USERID, new SystemInheritableTextPropertyDescriptor(ISystemPropertyConstants.P_USERID,
SystemViewResources.RESID_PROPERTY_USERID_LABEL); SystemViewResources.RESID_PROPERTY_USERID_LABEL);
userIdDescriptor.setToggleButtonToolTipText(SystemResources.RESID_SUBSYSTEM_USERID_INHERITBUTTON_TIP); userIdDescriptor.setToggleButtonToolTipText(SystemResources.RESID_SUBSYSTEM_USERID_INHERITBUTTON_TIP);
userIdDescriptor.setEntryFieldToolTipText(SystemResources.RESID_SUBSYSTEM_USERID_TIP); userIdDescriptor.setEntryFieldToolTipText(SystemResources.RESID_SUBSYSTEM_USERID_TIP);
propertyDescriptorArray[idx] = userIdDescriptor; propertyDescriptorArray[idx] = userIdDescriptor;
propertyDescriptorArray[idx].setDescription(SystemViewResources.RESID_PROPERTY_USERID_TOOLTIP); propertyDescriptorArray[idx].setDescription(SystemViewResources.RESID_PROPERTY_USERID_TOOLTIP);
// port // port
propertyPortDescriptor = new TextPropertyDescriptor(ISystemPropertyConstants.P_PORT, propertyPortDescriptor = new TextPropertyDescriptor(ISystemPropertyConstants.P_PORT,
SystemViewResources.RESID_PROPERTY_PORT_LABEL); SystemViewResources.RESID_PROPERTY_PORT_LABEL);
propertyPortDescriptor.setDescription(SystemViewResources.RESID_PROPERTY_PORT_TOOLTIP); propertyPortDescriptor.setDescription(SystemViewResources.RESID_PROPERTY_PORT_TOOLTIP);
propertyPortDescriptor.setValidator(new ValidatorPortInput()); propertyPortDescriptor.setValidator(new ValidatorPortInput());
propertyDescriptorArray[++idx] = propertyPortDescriptor; propertyDescriptorArray[++idx] = propertyPortDescriptor;
//propertyDescriptorArray[++idx] = getPortDescriptor(); //propertyDescriptorArray[++idx] = getPortDescriptor();
// connected // connected
propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_IS_CONNECTED, SystemViewResources.RESID_PROPERTY_CONNECTED_LABEL, SystemViewResources.RESID_PROPERTY_CONNECTED_TOOLTIP); propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_IS_CONNECTED, SystemViewResources.RESID_PROPERTY_CONNECTED_LABEL, SystemViewResources.RESID_PROPERTY_CONNECTED_TOOLTIP);
// vrm // vrm
propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_VRM, SystemViewResources.RESID_PROPERTY_VRM_LABEL, SystemViewResources.RESID_PROPERTY_VRM_TOOLTIP); propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_VRM, SystemViewResources.RESID_PROPERTY_VRM_LABEL, SystemViewResources.RESID_PROPERTY_VRM_TOOLTIP);
} }
return propertyDescriptorArray; return propertyDescriptorArray;
} }
/** /**
* Return our unique property descriptors * Return our unique property descriptors
*/ */
protected org.eclipse.ui.views.properties.IPropertyDescriptor[] internalGetPropertyDescriptors() protected org.eclipse.ui.views.properties.IPropertyDescriptor[] internalGetPropertyDescriptors()
{ {
return null; return null;
} }
/** /**
* Create (first time), configure and return the property descriptor for the port number * Create (first time), configure and return the property descriptor for the port number
* *
@ -269,20 +316,20 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
if (portDescriptor == null) if (portDescriptor == null)
{ {
SystemViewPlugin plugin = SystemViewPlugin.getDefault(); SystemViewPlugin plugin = SystemViewPlugin.getDefault();
RSEUIPlugin sp = RSEUIPlugin.getDefault(); RSEUIPlugin sp = RSEUIPlugin.getDefault();
portDescriptor = portDescriptor =
new SystemInheritableTextPropertyDescriptor(ISystemPropertyConstants.P_PORT, new SystemInheritableTextPropertyDescriptor(ISystemPropertyConstants.P_PORT,
SystemViewResources.RESID_PROPERTY_PORT_LABEL)); SystemViewResources.RESID_PROPERTY_PORT_LABEL));
portDescriptor.setToggleButtonToolTipText(SystemResources.RESID_SUBSYSTEM_PORT_INHERITBUTTON_TIP)); portDescriptor.setToggleButtonToolTipText(SystemResources.RESID_SUBSYSTEM_PORT_INHERITBUTTON_TIP));
portDescriptor.setEntryFieldToolTipText(SystemResources.RESID_SUBSYSTEM_PORT_TIP)); portDescriptor.setEntryFieldToolTipText(SystemResources.RESID_SUBSYSTEM_PORT_TIP));
portDescriptor.setDescription(SystemViewResources.RESID_PROPERTY_PORT_DESCRIPTION)); portDescriptor.setDescription(SystemViewResources.RESID_PROPERTY_PORT_DESCRIPTION));
} }
return portDescriptor; return portDescriptor;
}*/ }*/
/** /**
* Set the values in the userIdPropertyData object that drives the userId property sheet widget * Set the values in the userIdPropertyData object that drives the userId property sheet widget
*/ */
private SystemInheritablePropertyData setUserIdPropertyData(SystemInheritablePropertyData data, ISubSystem subsys) private SystemInheritablePropertyData setUserIdPropertyData(SystemInheritablePropertyData data, ISubSystem subsys)
{ {
String localUserId = subsys.getLocalUserId(); String localUserId = subsys.getLocalUserId();
@ -291,24 +338,24 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
data.setInheritedValue(parentUserId); data.setInheritedValue(parentUserId);
data.setIsLocal((localUserId!=null)&&(localUserId.length()>0)); data.setIsLocal((localUserId!=null)&&(localUserId.length()>0));
// DY: Defect 42735, check if user has temporarilly overrode the userid // DY: Defect 42735, check if user has temporarilly overrode the userid
// for this connection via the signon dialog // for this connection via the signon dialog
if (subsys.isConnected()) if (subsys.isConnected())
{ {
String connectedId = subsys.getConnectorService().getUserId(); String connectedId = subsys.getConnectorService().getUserId();
//On Local subsystems, connectedId==null. Phil. //On Local subsystems, connectedId==null. Phil.
if (data.getIsLocal() && connectedId!=null && !connectedId.equals(localUserId)) if (data.getIsLocal() && connectedId!=null && !connectedId.equals(localUserId))
{ {
data.setLocalValue(connectedId); data.setLocalValue(connectedId);
data.setIsLocal(true); data.setIsLocal(true);
} }
else if (connectedId!=null && !connectedId.equals(parentUserId)) else if (connectedId!=null && !connectedId.equals(parentUserId))
{ {
data.setLocalValue(connectedId); data.setLocalValue(connectedId);
data.setIsLocal(true); data.setIsLocal(true);
} }
} }
return data; return data;
} }
@ -329,12 +376,12 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
boolean notApplicable = (!ssFactory.isPortEditable() && (iPort <= 0)); boolean notApplicable = (!ssFactory.isPortEditable() && (iPort <= 0));
if (!notApplicable) if (!notApplicable)
{ {
data.setInheritedValue("0"); data.setInheritedValue("0");
data.setInheritedDisplayString(NLS.bind(SystemPropertyResources.RESID_PORT_DYNAMICSELECT, "0")); //$NON-NLS-1$ data.setInheritedDisplayString(NLS.bind(SystemPropertyResources.RESID_PORT_DYNAMICSELECT, "0")); //$NON-NLS-1$
data.setIsLocal(iPort != 0); data.setIsLocal(iPort != 0);
} }
data.setNotApplicable(notApplicable); data.setNotApplicable(notApplicable);
getPortDescriptor().setEditable(!notApplicable); getPortDescriptor().setEditable(!notApplicable);
//data.printDetails(); //data.printDetails();
return data; return data;
} }
@ -342,10 +389,10 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
private String getPortString(ISubSystem ss) private String getPortString(ISubSystem ss)
{ {
//return getPortPropertyData(portData, ss); //return getPortPropertyData(portData, ss);
int iPort = ss.getConnectorService().getPort(); int iPort = ss.getConnectorService().getPort();
ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration(); ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
boolean notApplicable = (!ssFactory.isPortEditable() && (iPort <= 0)); boolean notApplicable = (!ssFactory.isPortEditable() && (iPort <= 0));
if (notApplicable) if (notApplicable)
return getTranslatedNotApplicable(); return getTranslatedNotApplicable();
else else
@ -353,17 +400,17 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
return Integer.toString(iPort); return Integer.toString(iPort);
} }
} }
/** /**
* Returns the current value for the named property. * Returns the current value for the named property.
* The parent handles P_TEXT and P_TYPE only, and we augment that here. * The parent handles P_TEXT and P_TYPE only, and we augment that here.
* @param property the name of the property as named by its property descriptor * @param property the name of the property as named by its property descriptor
* @return the current value of the property * @return the current value of the property
*/ */
public Object getPropertyValue(Object property) public Object getPropertyValue(Object property)
{ {
String name = (String)property; String name = (String)property;
ISubSystem ss = (ISubSystem)propertySourceInput; ISubSystem ss = (ISubSystem)propertySourceInput;
if (name.equals(ISystemPropertyConstants.P_USERID)) if (name.equals(ISystemPropertyConstants.P_USERID))
return setUserIdPropertyData(userIdData, ss); return setUserIdPropertyData(userIdData, ss);
else if (name.equals(ISystemPropertyConstants.P_PORT)) else if (name.equals(ISystemPropertyConstants.P_PORT))
@ -390,7 +437,7 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
// connection is offline // connection is offline
return SystemResources.RESID_OFFLINE_LABEL; return SystemResources.RESID_OFFLINE_LABEL;
} }
IConnectorService system = ss.getConnectorService(); IConnectorService system = ss.getConnectorService();
boolean connected = false; boolean connected = false;
if (system == null) if (system == null)
@ -398,14 +445,14 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
System.out.println("SystemViewSubSystemAdapter: Error! system is null for subsystem "+ss.getClass().getName()); //$NON-NLS-1$ System.out.println("SystemViewSubSystemAdapter: Error! system is null for subsystem "+ss.getClass().getName()); //$NON-NLS-1$
SystemBasePlugin.logError("SystemViewSubSystemAdapter: Error! system is null for subsystem "+ss.getClass().getName(), null); //$NON-NLS-1$ SystemBasePlugin.logError("SystemViewSubSystemAdapter: Error! system is null for subsystem "+ss.getClass().getName(), null); //$NON-NLS-1$
} }
else else
connected = system.isConnected(); connected = system.isConnected();
return connected ? getTranslatedYes() : getTranslatedNo(); return connected ? getTranslatedYes() : getTranslatedNo();
} }
else else
return super.getPropertyValue(name); return super.getPropertyValue(name);
} }
/** /**
* Returns itself * Returns itself
*/ */
@ -414,17 +461,17 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
if (element instanceof ISubSystem) if (element instanceof ISubSystem)
return (ISubSystem)element; return (ISubSystem)element;
else else
return null; return null;
} }
/** /**
* Return our unique property values * Return our unique property values
*/ */
public Object internalGetPropertyValue(Object key) public Object internalGetPropertyValue(Object key)
{ {
return null; return null;
} }
// because this node has some editable properties, these overrides of our // because this node has some editable properties, these overrides of our
// parent class are needed as callbacks from the PropertySheet window. // parent class are needed as callbacks from the PropertySheet window.
/** /**
@ -436,29 +483,35 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
if (this.propertySourceInput == propertySourceInput) if (this.propertySourceInput == propertySourceInput)
return; return;
super.setPropertySourceInput(propertySourceInput); super.setPropertySourceInput(propertySourceInput);
ISubSystem ss = (ISubSystem)propertySourceInput; ISubSystem ss = (ISubSystem)propertySourceInput;
ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration(); ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
original_userIdData = setUserIdPropertyData(original_userIdData,ss); original_userIdData = setUserIdPropertyData(original_userIdData,ss);
//original_portData = setPortPropertyData(original_portData,ss); //original_portData = setPortPropertyData(original_portData,ss);
original_portData = getPortString(ss); original_portData = getPortString(ss);
changed_userId = changed_port = false; changed_userId = changed_port = false;
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class); ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
if (userIdDescriptor != null) if (adapter != null) {
{ // Lazy Loading: Since this is called from opening a context
// menu, Dynamic Validator will only be available once the
userIdDescriptor.setValidator(adapter.getUserIdValidator(ssFactory)); // ISubSystemConfigurationAdapter is loaded, i.e. after
// connecting.
// If a subsystem wants to provision for having the validator
// available earlier, it needs to eagerly load the bundle that
// declares its ISubSystemConfigurationAdapter.
if (userIdDescriptor != null) {
userIdDescriptor.setValidator(adapter.getUserIdValidator(ssFactory));
}
// getPortDescriptor().setValidator((ICellEditorValidator)ssFactory.getPortValidator());
if (propertyPortDescriptor != null) {
propertyPortDescriptor.setValidator(adapter.getPortValidator(ssFactory));
}
} }
//getPortDescriptor().setValidator((ICellEditorValidator)ssFactory.getPortValidator());
if (propertyPortDescriptor != null)
{
propertyPortDescriptor.setValidator(adapter.getPortValidator(ssFactory));
}
ss.getConnectorService().getPort(); ss.getConnectorService().getPort();
port_editable = ssFactory.isPortEditable(); port_editable = ssFactory.isPortEditable();
} }
/** /**
* Returns whether the property value has changed from the default. * Returns whether the property value has changed from the default.
* Only applicable for editable properties. * Only applicable for editable properties.
@ -466,16 +519,16 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
* @return <code>true</code> if the value of the specified property has changed * @return <code>true</code> if the value of the specified property has changed
* from its original default value; <code>false</code> otherwise. * from its original default value; <code>false</code> otherwise.
*/ */
public boolean isPropertySet(Object propertyObject) public boolean isPropertySet(Object propertyObject)
{ {
String property = (String)propertyObject; String property = (String)propertyObject;
boolean changed = false; boolean changed = false;
if (property.equals(ISystemPropertyConstants.P_USERID)) if (property.equals(ISystemPropertyConstants.P_USERID))
changed = changed_userId; changed = changed_userId;
else if (property.equals(ISystemPropertyConstants.P_PORT)) else if (property.equals(ISystemPropertyConstants.P_PORT))
changed = changed_port && port_editable; changed = changed_port && port_editable;
return changed; return changed;
} }
/** /**
* Change the subsystem user Id value * Change the subsystem user Id value
@ -484,13 +537,13 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
{ {
//int whereToUpdate = USERID_LOCATION_SUBSYSTEM; //int whereToUpdate = USERID_LOCATION_SUBSYSTEM;
String userId = data.getLocalValue(); // will be "" if !data.getIsLocal(), which results in wiping out local override String userId = data.getLocalValue(); // will be "" if !data.getIsLocal(), which results in wiping out local override
ISubSystemConfiguration ssFactory = subsys.getSubSystemConfiguration(); ISubSystemConfiguration ssFactory = subsys.getSubSystemConfiguration();
// unlike with connection objects, we don't ever allow the user to change the parent's // unlike with connection objects, we don't ever allow the user to change the parent's
// userId value, even if it is empty, when working with subsystems. There is too much // userId value, even if it is empty, when working with subsystems. There is too much
// ambiquity as the parent could be the connnection or the user preferences setting for this // ambiquity as the parent could be the connnection or the user preferences setting for this
// system type. Because of this decision, we don't need to tell updateSubSystem(...) where // system type. Because of this decision, we don't need to tell updateSubSystem(...) where
// to update, as it always the local subsystem. // to update, as it always the local subsystem.
ssFactory.updateSubSystem(subsys, true, userId, false, subsys.getConnectorService().getPort()); ssFactory.updateSubSystem(subsys, true, userId, false, subsys.getConnectorService().getPort());
} }
/** /**
* Change the subsystem port value * Change the subsystem port value
@ -500,11 +553,11 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
String port = data.getLocalValue(); // will be "" if !data.getIsLocal(), which results in wiping out local override String port = data.getLocalValue(); // will be "" if !data.getIsLocal(), which results in wiping out local override
Integer portInteger = null; Integer portInteger = null;
if (data.getIsLocal() && (port.length()>0)) if (data.getIsLocal() && (port.length()>0))
portInteger = new Integer(port); portInteger = new Integer(port);
else else
portInteger = new Integer(0); portInteger = new Integer(0);
SubSystemConfiguration ssFactory = subsys.getParentSubSystemConfiguration(); SubSystemConfiguration ssFactory = subsys.getParentSubSystemConfiguration();
ssFactory.updateSubSystem((Shell)null, subsys, false, subsys.getLocalUserId(), true, portInteger); ssFactory.updateSubSystem((Shell)null, subsys, false, subsys.getLocalUserId(), true, portInteger);
} }
*/ */
/** /**
@ -518,11 +571,11 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
Integer portInteger = null; Integer portInteger = null;
if (port.length()>0) if (port.length()>0)
{ {
try try
{ {
portInteger = new Integer(port); portInteger = new Integer(port);
} }
catch (Exception exc) catch (Exception exc)
{ {
return; return;
} }
@ -532,12 +585,12 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
portInteger = new Integer(0); portInteger = new Integer(0);
} }
int portInt = portInteger.intValue(); int portInt = portInteger.intValue();
ISubSystemConfiguration ssFactory = subsys.getSubSystemConfiguration(); ISubSystemConfiguration ssFactory = subsys.getSubSystemConfiguration();
ssFactory.updateSubSystem(subsys, false, subsys.getLocalUserId(), true, portInt); ssFactory.updateSubSystem(subsys, false, subsys.getLocalUserId(), true, portInt);
subsys.commit(); subsys.commit();
} }
/** /**
* Called when user selects the reset button in property sheet. * Called when user selects the reset button in property sheet.
*/ */
@ -545,10 +598,10 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
{ {
String property = (String)propertyObject; String property = (String)propertyObject;
ISubSystem ss = (ISubSystem)propertySourceInput; ISubSystem ss = (ISubSystem)propertySourceInput;
ss.getSubSystemConfiguration(); ss.getSubSystemConfiguration();
if (property.equals(ISystemPropertyConstants.P_USERID)) if (property.equals(ISystemPropertyConstants.P_USERID))
{ {
updateUserId(ss, original_userIdData); updateUserId(ss, original_userIdData);
changed_userId = false; changed_userId = false;
} }
else if (property.equals(ISystemPropertyConstants.P_PORT)) else if (property.equals(ISystemPropertyConstants.P_PORT))
@ -557,29 +610,29 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
updatePort(ss, original_portData); updatePort(ss, original_portData);
changed_port = false; changed_port = false;
} }
} }
/** /**
* Called when user changes property via property sheet. * Called when user changes property via property sheet.
*/ */
public void setPropertyValue(Object property, Object value) public void setPropertyValue(Object property, Object value)
{ {
String name = (String)property; String name = (String)property;
ISubSystem ss = (ISubSystem)propertySourceInput; ISubSystem ss = (ISubSystem)propertySourceInput;
ss.getSubSystemConfiguration(); ss.getSubSystemConfiguration();
//System.out.println("inside setPropVal: " + property + ", value: " + value); //System.out.println("inside setPropVal: " + property + ", value: " + value);
if (name.equals(ISystemPropertyConstants.P_USERID)) if (name.equals(ISystemPropertyConstants.P_USERID))
{ {
updateUserId(ss, (SystemInheritablePropertyData)value); updateUserId(ss, (SystemInheritablePropertyData)value);
changed_userId = true; changed_userId = true;
} }
else if (name.equals(ISystemPropertyConstants.P_PORT)) else if (name.equals(ISystemPropertyConstants.P_PORT))
{ {
//System.out.println("inside setPropVal: " + property + ", value: " + value); //System.out.println("inside setPropVal: " + property + ", value: " + value);
//updatePort(ss, (SystemInheritablePropertyData)value); //updatePort(ss, (SystemInheritablePropertyData)value);
updatePort(ss, (String)value); updatePort(ss, (String)value);
changed_port = true; changed_port = true;
} }
} }
/** /**
* Override of {@link AbstractSystemViewAdapter#testAttribute(Object, String, String)}. We add * Override of {@link AbstractSystemViewAdapter#testAttribute(Object, String, String)}. We add
@ -588,9 +641,9 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
* <li>name="serverLaunchPP". Returns "true" if the given subsystem supports the Server Launch Settings * <li>name="serverLaunchPP". Returns "true" if the given subsystem supports the Server Launch Settings
* property page, which is determined by calling it's factory's {@link ISubSystemConfiguration#supportsServerLaunchProperties(org.eclipse.rse.core.model.IHost)} method. * property page, which is determined by calling it's factory's {@link ISubSystemConfiguration#supportsServerLaunchProperties(org.eclipse.rse.core.model.IHost)} method.
* </ol> * </ol>
* *
* This property is used to filter the existence of the Server Launch Settings property page. * This property is used to filter the existence of the Server Launch Settings property page.
* *
* @see org.eclipse.ui.IActionFilter#testAttribute(Object, String, String) * @see org.eclipse.ui.IActionFilter#testAttribute(Object, String, String)
*/ */
public boolean testAttribute(Object target, String name, String value) public boolean testAttribute(Object target, String name, String value)
@ -624,7 +677,7 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
} }
return super.testAttribute(target, name, value); return super.testAttribute(target, name, value);
} }
// FOR COMMON DELETE ACTIONS // FOR COMMON DELETE ACTIONS
/** /**
* Return true if we should show the delete action in the popup for the given element. * Return true if we should show the delete action in the popup for the given element.
@ -633,32 +686,32 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
public boolean showDelete(Object element) public boolean showDelete(Object element)
{ {
return canDelete(element); return canDelete(element);
} }
/** /**
* Return true if this object is deletable by the user. If so, when selected, * Return true if this object is deletable by the user. If so, when selected,
* the Edit->Delete menu item will be enabled. * the Edit->Delete menu item will be enabled.
*/ */
public boolean canDelete(Object element) public boolean canDelete(Object element)
{ {
//System.out.println("INSIDE ISDELETABLE FOR SUBSYSTEM VIEW ADAPTER: "+element); //System.out.println("INSIDE ISDELETABLE FOR SUBSYSTEM VIEW ADAPTER: "+element);
ISubSystem ss = (ISubSystem)element; ISubSystem ss = (ISubSystem)element;
ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration(); ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
return ssFactory.isSubSystemsDeletable(); return ssFactory.isSubSystemsDeletable();
} }
/** /**
* Perform the delete action. * Perform the delete action.
*/ */
public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor)
{ {
//System.out.println("INSIDE DODELETE FOR SUBSYSTEM VIEW ADAPTER: "+element); //System.out.println("INSIDE DODELETE FOR SUBSYSTEM VIEW ADAPTER: "+element);
ISubSystem ss = (ISubSystem)element; ISubSystem ss = (ISubSystem)element;
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
sr.deleteSubSystem(ss); sr.deleteSubSystem(ss);
return true; return true;
} }
// FOR COMMON RENAME ACTIONS // FOR COMMON RENAME ACTIONS
/** /**
* Return true if we should show the rename action in the popup for the given element. * Return true if we should show the rename action in the popup for the given element.
@ -667,16 +720,16 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
public boolean showRename(Object element) public boolean showRename(Object element)
{ {
return canRename(element); return canRename(element);
} }
/** /**
* 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 menu item will be enabled. * the Rename menu item will be enabled.
*/ */
public boolean canRename(Object element) public boolean canRename(Object element)
{ {
return canDelete(element); // same rules for both delete and rename return canDelete(element); // same rules for both delete and rename
} }
/** /**
* Perform the rename action. Assumes uniqueness checking was done already. * Perform the rename action. Assumes uniqueness checking was done already.
*/ */
@ -686,8 +739,8 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
ISubSystemConfiguration parentSSFactory = ss.getSubSystemConfiguration(); ISubSystemConfiguration parentSSFactory = ss.getSubSystemConfiguration();
parentSSFactory.renameSubSystem(ss,name); // renames, and saves to disk parentSSFactory.renameSubSystem(ss,name); // renames, and saves to disk
return true; return true;
} }
/** /**
* Return a validator for verifying the new name is correct on a rename action. * Return a validator for verifying the new name is correct on a rename action.
* The default implementation is not to support rename hence this method returns * The default implementation is not to support rename hence this method returns
@ -697,28 +750,28 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
{ {
return null; return null;
} }
// FOR COMMON DRAG AND DROP ACTIONS // FOR COMMON DRAG AND DROP ACTIONS
/** /**
* Indicates whether the subsystem can be dragged. * Indicates whether the subsystem can be dragged.
* Can't be used for physical copies but rather * Can't be used for physical copies but rather
* for views (like the Scratchpad) * for views (like the Scratchpad)
*/ */
public boolean canDrag(Object element) public boolean canDrag(Object element)
{ {
return true; return true;
} }
/** /**
* Returns the subsystem (no phyiscal operation required to drag and subsystem (because it's local) * Returns the subsystem (no phyiscal operation required to drag and subsystem (because it's local)
*/ */
public Object doDrag(Object element, boolean sameSystemType, IProgressMonitor monitor) public Object doDrag(Object element, boolean sameSystemType, IProgressMonitor monitor)
{ {
return element; return element;
} }
// ------------------------------------------------------------ // ------------------------------------------------------------
// METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER... // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
@ -752,10 +805,10 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
{ {
return ISystemMementoConstants.MEMENTO_KEY_SUBSYSTEM; return ISystemMementoConstants.MEMENTO_KEY_SUBSYSTEM;
} }
/** /**
* This is a local RSE artifact so returning false * This is a local RSE artifact so returning false
* *
* @param element the object to check * @param element the object to check
* @return false since this is not remote * @return false since this is not remote
*/ */

View file

@ -1,18 +1,19 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
* *
* 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) - [184095] Replace systemTypeName by IRSESystemType * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
* Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.view.team; package org.eclipse.rse.internal.ui.view.team;
@ -23,13 +24,16 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.model.ISystemProfile; import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
import org.eclipse.rse.internal.ui.SystemResources; import org.eclipse.rse.internal.ui.SystemResources;
import org.eclipse.rse.internal.ui.subsystems.SubSystemConfigurationProxyAdapter;
import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter; import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
/** /**
* This class represents a child node under category nodes, in the Team view. * This class represents a child node under category nodes, in the Team view.
* It represents expandable subsystem factories such as "Files" or "iSeries Objects". * It represents expandable subsystem factories such as "Files" or "iSeries Objects".
*/ */
public class SystemTeamViewSubSystemConfigurationNode implements IAdaptable public class SystemTeamViewSubSystemConfigurationNode implements IAdaptable
{ {
@ -38,7 +42,7 @@ public class SystemTeamViewSubSystemConfigurationNode implements IAdaptable
private ISubSystemConfiguration ssf; private ISubSystemConfiguration ssf;
private SystemTeamViewCategoryNode parentCategory; private SystemTeamViewCategoryNode parentCategory;
private String name = null; private String name = null;
/** /**
* Constructor * Constructor
*/ */
@ -57,11 +61,11 @@ public class SystemTeamViewSubSystemConfigurationNode implements IAdaptable
*/ */
public Object getAdapter(Class adapterType) public Object getAdapter(Class adapterType)
{ {
return Platform.getAdapterManager().getAdapter(this, adapterType); return Platform.getAdapterManager().getAdapter(this, adapterType);
} }
/** /**
* Compare this node to another. * Compare this node to another.
*/ */
public boolean equals(Object o) public boolean equals(Object o)
{ {
@ -78,7 +82,7 @@ public class SystemTeamViewSubSystemConfigurationNode implements IAdaptable
else else
return super.equals(o); return super.equals(o);
} }
/** /**
* Return this node's image * Return this node's image
* @return the image to show in the tree, for this node * @return the image to show in the tree, for this node
@ -86,7 +90,21 @@ public class SystemTeamViewSubSystemConfigurationNode implements IAdaptable
public ImageDescriptor getImageDescriptor() public ImageDescriptor getImageDescriptor()
{ {
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssf.getAdapter(ISubSystemConfigurationAdapter.class); ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssf.getAdapter(ISubSystemConfigurationAdapter.class);
return adapter.getImage(ssf); if (adapter != null) {
return adapter.getImage(ssf);
} else {
// Fall back to using the Proxy -- see also
// SystemViewSubSystemAdapter.getImageDescriptor()
ISubSystemConfigurationProxy proxy = ssf.getSubSystemConfigurationProxy();
SubSystemConfigurationProxyAdapter proxyAdapter = (SubSystemConfigurationProxyAdapter) Platform.getAdapterManager().getAdapter(proxy,
SubSystemConfigurationProxyAdapter.class);
if (proxyAdapter != null) {
return proxyAdapter.getImageDescriptor();
} else {
SystemBasePlugin.logWarning("Unexpected error: SubSystemConfiguration has no adapter and no proxyAdapter: " + ssf.getId()); //$NON-NLS-1$
return null;
}
}
} }
/** /**
@ -116,9 +134,9 @@ public class SystemTeamViewSubSystemConfigurationNode implements IAdaptable
buf.append(")"); //$NON-NLS-1$ buf.append(")"); //$NON-NLS-1$
name = buf.toString(); name = buf.toString();
} }
return name; return name;
} }
/** /**
* Convert to string. We call getLabel() * Convert to string. We call getLabel()
*/ */

View file

@ -1,26 +1,28 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
* *
* 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) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.propertypages; package org.eclipse.rse.ui.propertypages;
import org.eclipse.core.runtime.Platform;
import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider; import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
import org.eclipse.rse.core.filters.ISystemFilterReference; import org.eclipse.rse.core.filters.ISystemFilterReference;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
import org.eclipse.rse.core.subsystems.SubSystemHelpers; import org.eclipse.rse.core.subsystems.SubSystemHelpers;
import org.eclipse.rse.internal.ui.SystemPropertyResources; import org.eclipse.rse.internal.ui.SystemPropertyResources;
import org.eclipse.rse.services.clientserver.messages.SystemMessage; import org.eclipse.rse.services.clientserver.messages.SystemMessage;
@ -32,30 +34,33 @@ import org.eclipse.rse.ui.filters.SystemChangeFilterPane;
import org.eclipse.rse.ui.filters.SystemFilterStringEditPane; import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter; import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
import org.eclipse.rse.ui.validators.ISystemValidator; import org.eclipse.rse.ui.validators.ISystemValidator;
import org.eclipse.rse.ui.view.SubSystemConfigurationAdapter;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
/** /**
* This is the property page for changing filters. This page used to be the Change dialog. * This is the property page for changing filters. This page used to be the
* The plugin.xml file registers this for objects of class org.eclipse.rse.internal.filters.SystemFilter or * Change dialog. The plugin.xml file registers this for objects of class
* org.eclipse.rse.filters.SystemFilterReference. * org.eclipse.rse.internal.filters.SystemFilter or
* org.eclipse.rse.filters.SystemFilterReference.
* <p> * <p>
* If you have your own change filter dialog (versus configuring ours) you must configure this * If you have your own change filter dialog (versus configuring ours) you must
* pane yourself by overriding {@link SubSystemConfiguration#customizeChangeFilterPropertyPage(SystemChangeFilterPropertyPage, ISystemFilter, Shell)} * configure this pane yourself by overriding
* and configuring the pane as described in that method's javadoc. * {@link SubSystemConfigurationAdapter#customizeChangeFilterPropertyPage(ISubSystemConfiguration, SystemChangeFilterPropertyPage, ISystemFilter, Shell)}
* and configuring the pane as described in that method's javadoc.
*/ */
public class SystemChangeFilterPropertyPage extends SystemBasePropertyPage public class SystemChangeFilterPropertyPage extends SystemBasePropertyPage
implements ISystemPageCompleteListener, ISystemChangeFilterPaneEditPaneSupplier implements ISystemPageCompleteListener, ISystemChangeFilterPaneEditPaneSupplier
{ {
protected String errorMessage; protected String errorMessage;
protected boolean initDone = false; protected boolean initDone = false;
protected SystemChangeFilterPane changeFilterPane; protected SystemChangeFilterPane changeFilterPane;
protected SystemFilterStringEditPane editPane; protected SystemFilterStringEditPane editPane;
/** /**
* Constructor for SystemFilterPropertyPage * Constructor for SystemFilterPropertyPage
*/ */
@ -83,12 +88,12 @@ public class SystemChangeFilterPropertyPage extends SystemBasePropertyPage
* provider itself (eg subsystem) * provider itself (eg subsystem)
* <p> * <p>
* This is passed into the filter and filter string wizards and dialogs in case it is needed * This is passed into the filter and filter string wizards and dialogs in case it is needed
* for context. * for context.
*/ */
public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider) public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider)
{ {
changeFilterPane.setSystemFilterPoolReferenceManagerProvider(provider); changeFilterPane.setSystemFilterPoolReferenceManagerProvider(provider);
} }
/** /**
* <i>Configuration method</i><br> * <i>Configuration method</i><br>
* Set the contextual system filter pool manager provider. Will be non-null if the * Set the contextual system filter pool manager provider. Will be non-null if the
@ -96,13 +101,13 @@ public class SystemChangeFilterPropertyPage extends SystemBasePropertyPage
* provider itself (eg subsystemconfiguration) * provider itself (eg subsystemconfiguration)
* <p> * <p>
* This is passed into the filter and filter string wizards and dialogs in case it is needed * This is passed into the filter and filter string wizards and dialogs in case it is needed
* for context. * for context.
*/ */
public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider provider) public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider provider)
{ {
changeFilterPane.setSystemFilterPoolManagerProvider(provider); changeFilterPane.setSystemFilterPoolManagerProvider(provider);
} }
/** /**
* <i>Configuration method</i><br> * <i>Configuration method</i><br>
* Set the Parent Filter Pool prompt label and tooltip text. * Set the Parent Filter Pool prompt label and tooltip text.
@ -129,7 +134,7 @@ public class SystemChangeFilterPropertyPage extends SystemBasePropertyPage
changeFilterPane.setListLabel(label, tip); changeFilterPane.setListLabel(label, tip);
} }
/** /**
* Set the string to show as the first item in the list. * Set the string to show as the first item in the list.
* The default is "New filter string" * The default is "New filter string"
*/ */
public void setNewListItemText(String label) public void setNewListItemText(String label)
@ -152,7 +157,7 @@ public class SystemChangeFilterPropertyPage extends SystemBasePropertyPage
} }
/** /**
* <i>Configuration method</i><br> * <i>Configuration method</i><br>
* Set the error message to use when the user is editing or creating a filter string, and the * Set the error message to use when the user is editing or creating a filter string, and the
* Apply processing detects a duplicate filter string in the list. * Apply processing detects a duplicate filter string in the list.
*/ */
public void setDuplicateFilterStringErrorMessage(SystemMessage msg) public void setDuplicateFilterStringErrorMessage(SystemMessage msg)
@ -183,9 +188,9 @@ public class SystemChangeFilterPropertyPage extends SystemBasePropertyPage
{ {
changeFilterPane.setSupportsMultipleStrings(multi); changeFilterPane.setSupportsMultipleStrings(multi);
} }
// OVERRIDABLE METHODS... // OVERRIDABLE METHODS...
/** /**
* Create the page's GUI contents. * Create the page's GUI contents.
* @see org.eclipse.jface.preference.PreferencePage#createContents(Composite) * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
@ -196,46 +201,51 @@ public class SystemChangeFilterPropertyPage extends SystemBasePropertyPage
if (shell == null) if (shell == null)
{ {
System.out.println("Damn, shell is still null!"); //$NON-NLS-1$ System.out.println("Damn, shell is still null!"); //$NON-NLS-1$
} }
changeFilterPane.setShell(shell); changeFilterPane.setShell(shell);
ISystemFilter selectedFilter = getFilter(); ISystemFilter selectedFilter = getFilter();
if (selectedFilter.isPromptable()) if (selectedFilter.isPromptable())
{ {
int nbrColumns = 1; int nbrColumns = 1;
Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns); Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
/*Label test =*/ SystemWidgetHelpers.createLabel(composite_prompts, SystemPropertyResources.RESID_TERM_NOTAPPLICABLE, nbrColumns, false); /*Label test =*/ SystemWidgetHelpers.createLabel(composite_prompts, SystemPropertyResources.RESID_TERM_NOTAPPLICABLE, nbrColumns, false);
return composite_prompts; return composite_prompts;
} }
if (getElement() instanceof ISystemFilterReference) if (getElement() instanceof ISystemFilterReference)
{ {
ISystemFilterReference filterRef = (ISystemFilterReference)getElement(); ISystemFilterReference filterRef = (ISystemFilterReference)getElement();
changeFilterPane.setSystemFilterPoolReferenceManagerProvider(filterRef.getProvider()); changeFilterPane.setSystemFilterPoolReferenceManagerProvider(filterRef.getProvider());
} }
changeFilterPane.setSystemFilterPoolManagerProvider(selectedFilter.getProvider()); changeFilterPane.setSystemFilterPoolManagerProvider(selectedFilter.getProvider());
ISubSystemConfiguration ssf = SubSystemHelpers.getParentSubSystemConfiguration(selectedFilter); ISubSystemConfiguration ssf = SubSystemHelpers.getParentSubSystemConfiguration(selectedFilter);
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssf.getAdapter(ISubSystemConfigurationAdapter.class); ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssf.getAdapter(ISubSystemConfigurationAdapter.class);
if (adapter == null) {
// lazy loading: load adapter if necessary
Platform.getAdapterManager().loadAdapter(ssf, ISubSystemConfigurationAdapter.class.getName());
adapter = (ISubSystemConfigurationAdapter) ssf.getAdapter(ISubSystemConfigurationAdapter.class);
}
adapter.customizeChangeFilterPropertyPage(ssf, this, selectedFilter, shell); adapter.customizeChangeFilterPropertyPage(ssf, this, selectedFilter, shell);
changeFilterPane.setInputObject(getElement()); changeFilterPane.setInputObject(getElement());
/* /*
// ensure the page has no special buttons // ensure the page has no special buttons
noDefaultAndApplyButton(); noDefaultAndApplyButton();
// Inner composite // Inner composite
int nbrColumns = 2; int nbrColumns = 2;
Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns); Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
Label test = SystemWidgetHelpers.createLabel(composite_prompts, "Testing", nbrColumns); Label test = SystemWidgetHelpers.createLabel(composite_prompts, "Testing", nbrColumns);
if (!initDone) if (!initDone)
doInitializeFields(); doInitializeFields();
return composite_prompts; return composite_prompts;
*/ */
return changeFilterPane.createContents(parent); return changeFilterPane.createContents(parent);
@ -243,9 +253,9 @@ public class SystemChangeFilterPropertyPage extends SystemBasePropertyPage
/** /**
* Intercept of parent so we can reset the default button * Intercept of parent so we can reset the default button
*/ */
protected void contributeButtons(Composite parent) protected void contributeButtons(Composite parent)
{ {
super.contributeButtons(parent); super.contributeButtons(parent);
getShell().setDefaultButton(changeFilterPane.getApplyButton()); // defect 46129 getShell().setDefaultButton(changeFilterPane.getApplyButton()); // defect 46129
} }
@ -255,7 +265,7 @@ public class SystemChangeFilterPropertyPage extends SystemBasePropertyPage
* Return true if ok, false if there is an error. * Return true if ok, false if there is an error.
*/ */
protected boolean verifyPageContents() protected boolean verifyPageContents()
{ {
return true; return true;
} }
@ -270,7 +280,7 @@ public class SystemChangeFilterPropertyPage extends SystemBasePropertyPage
else else
return ((ISystemFilterReference)element).getReferencedFilter(); return ((ISystemFilterReference)element).getReferencedFilter();
} }
/** /**
* Called by parent when user presses OK * Called by parent when user presses OK
*/ */
@ -298,16 +308,16 @@ public class SystemChangeFilterPropertyPage extends SystemBasePropertyPage
//super.setPageComplete(complete); //super.setPageComplete(complete);
super.setValid(complete); // we'll see if this is the right thing to do super.setValid(complete); // we'll see if this is the right thing to do
} }
/** /**
* Return our edit pane. Overriding this is an alternative to calling setEditPane. * Return our edit pane. Overriding this is an alternative to calling setEditPane.
* Method is declared in {@link ISystemChangeFilterPaneEditPaneSupplier}. * Method is declared in {@link ISystemChangeFilterPaneEditPaneSupplier}.
*/ */
public SystemFilterStringEditPane getFilterStringEditPane(Shell shell) public SystemFilterStringEditPane getFilterStringEditPane(Shell shell)
{ {
// this method is called from SystemChangeFilterPane via callback // this method is called from SystemChangeFilterPane via callback
if (editPane == null) if (editPane == null)
editPane = new SystemFilterStringEditPane(shell); editPane = new SystemFilterStringEditPane(shell);
return editPane; return editPane;
} }
} }

View file

@ -1,15 +1,15 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved. * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
* *
* 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:
* Kevin Doyle (IBM) - [187736] Marked _objectInput stale when new resource created * Kevin Doyle (IBM) - [187736] Marked _objectInput stale when new resource created
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
@ -19,6 +19,7 @@
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
* David McKnight (IBM) - [224313] [api] Create RSE Events for MOVE and COPY holding both source and destination fields * David McKnight (IBM) - [224313] [api] Create RSE Events for MOVE and COPY holding both source and destination fields
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.view; package org.eclipse.rse.ui.view;
@ -134,14 +135,14 @@ import org.eclipse.ui.views.properties.IPropertyDescriptor;
*/ */
public class SystemTableView public class SystemTableView
extends TableViewer extends TableViewer
implements IMenuListener, implements IMenuListener,
ISystemDeleteTarget, ISystemRenameTarget, ISystemSelectAllTarget, ISystemDeleteTarget, ISystemRenameTarget, ISystemSelectAllTarget,
ISystemResourceChangeListener, ISystemRemoteChangeListener, ISystemResourceChangeListener, ISystemRemoteChangeListener,
ISystemShellProvider, ISelectionChangedListener, ISelectionProvider ISystemShellProvider, ISelectionChangedListener, ISelectionProvider
{ {
// inner class to support cell editing // inner class to support cell editing
private ICellModifier cellModifier = new ICellModifier() private ICellModifier cellModifier = new ICellModifier()
{ {
public Object getValue(Object element, String property) public Object getValue(Object element, String property)
@ -183,14 +184,14 @@ public class SystemTableView
private class HeaderSelectionListener extends SelectionAdapter private class HeaderSelectionListener extends SelectionAdapter
{ {
public HeaderSelectionListener() public HeaderSelectionListener()
{ {
_upI = RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_MOVEUP_ID); _upI = RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_MOVEUP_ID);
_downI = RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_MOVEDOWN_ID); _downI = RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_MOVEDOWN_ID);
} }
/** /**
* Handles the case of user selecting the * Handles the case of user selecting the
* header area. * header area.
@ -220,13 +221,13 @@ public class SystemTableView
{ {
tcolumn.setImage(_upI); tcolumn.setImage(_upI);
} }
} }
else else
{ {
setSorter(new SystemTableViewSorter(column, SystemTableView.this, _columnManager)); setSorter(new SystemTableViewSorter(column, SystemTableView.this, _columnManager));
tcolumn.setImage(_downI); tcolumn.setImage(_downI);
} }
// unset image of other columns // unset image of other columns
TableColumn[] allColumns = table.getColumns(); TableColumn[] allColumns = table.getColumns();
for (int i = 0; i < allColumns.length; i++) for (int i = 0; i < allColumns.length; i++)
@ -264,9 +265,9 @@ public class SystemTableView
// Note the Edit menu actions are set in SystemViewPart. Here we use these // Note the Edit menu actions are set in SystemViewPart. Here we use these
// actions from our own popup menu actions. // actions from our own popup menu actions.
private SystemCommonDeleteAction _deleteAction; private SystemCommonDeleteAction _deleteAction;
// for global delete menu item // for global delete menu item
private SystemCommonRenameAction _renameAction; private SystemCommonRenameAction _renameAction;
// for common rename menu item // for common rename menu item
private SystemCommonSelectAllAction _selectAllAction; private SystemCommonSelectAllAction _selectAllAction;
// for common Ctrl+A select-all // for common Ctrl+A select-all
@ -278,7 +279,7 @@ public class SystemTableView
protected boolean _selectionEnableDeleteAction; protected boolean _selectionEnableDeleteAction;
protected boolean _selectionEnableRenameAction; protected boolean _selectionEnableRenameAction;
protected boolean _selectionIsRemoteObject = true; protected boolean _selectionIsRemoteObject = true;
protected boolean _selectionFlagsUpdated = false; protected boolean _selectionFlagsUpdated = false;
@ -286,38 +287,38 @@ public class SystemTableView
private int[] _lastWidths = null; private int[] _lastWidths = null;
private int _charWidth = 3; private int _charWidth = 3;
private boolean _showColumns = true; private boolean _showColumns = true;
private Image _upI; private Image _upI;
private Image _downI; private Image _downI;
protected boolean menuListenerAdded = false; protected boolean menuListenerAdded = false;
private static final int LEFT_BUTTON = 1; private static final int LEFT_BUTTON = 1;
private int mouseButtonPressed = LEFT_BUTTON; private int mouseButtonPressed = LEFT_BUTTON;
/** /**
* Constructor for the table view * Constructor for the table view
* *
*/ */
public SystemTableView(Table table, ISystemMessageLine msgLine) public SystemTableView(Table table, ISystemMessageLine msgLine)
{ {
super(table); super(table);
_layout = new TableLayout(); _layout = new TableLayout();
_messageLine = msgLine; _messageLine = msgLine;
_columnManager = new SystemTableViewColumnManager(this); _columnManager = new SystemTableViewColumnManager(this);
_provider = getProvider(); _provider = getProvider();
_columnSelectionListener = new HeaderSelectionListener(); _columnSelectionListener = new HeaderSelectionListener();
setContentProvider(_provider); setContentProvider(_provider);
setLabelProvider(new SystemDecoratingLabelProvider(_provider, PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator())); setLabelProvider(new SystemDecoratingLabelProvider(_provider, PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
//setLabelProvider(_provider); //setLabelProvider(_provider);
_filter = new SystemTableViewFilter(); _filter = new SystemTableViewFilter();
addFilter(_filter); addFilter(_filter);
_charWidth = table.getFont().getFontData()[0].getHeight() / 2; _charWidth = table.getFont().getFontData()[0].getHeight() / 2;
computeLayout(); computeLayout();
@ -334,9 +335,9 @@ public class SystemTableView
sr.addSystemRemoteChangeListener(this); sr.addSystemRemoteChangeListener(this);
initDragAndDrop(); initDragAndDrop();
table.setVisible(false); table.setVisible(false);
// key listening for delete press // key listening for delete press
getControl().addKeyListener(new KeyAdapter() getControl().addKeyListener(new KeyAdapter()
{ {
@ -345,19 +346,19 @@ public class SystemTableView
handleKeyPressed(e); handleKeyPressed(e);
} }
}); });
getControl().addMouseListener(new MouseAdapter() getControl().addMouseListener(new MouseAdapter()
{ {
public void mouseDown(MouseEvent e) public void mouseDown(MouseEvent e)
{ {
mouseButtonPressed = e.button; //d40615 mouseButtonPressed = e.button; //d40615
} }
}); });
_upI = RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_ARROW_UP_ID); _upI = RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_ARROW_UP_ID);
_downI = RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_ARROW_DOWN_ID); _downI = RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_ARROW_DOWN_ID);
} }
protected SystemTableViewProvider getProvider() protected SystemTableViewProvider getProvider()
{ {
if (_provider == null) if (_provider == null)
@ -366,12 +367,12 @@ public class SystemTableView
} }
return _provider; return _provider;
} }
public void showColumns(boolean flag) public void showColumns(boolean flag)
{ {
_showColumns = flag; _showColumns = flag;
} }
public Layout getLayout() public Layout getLayout()
{ {
@ -441,7 +442,7 @@ public class SystemTableView
} }
/** /**
* Convenience method for retrieving the view adapter for an object * Convenience method for retrieving the view adapter for an object
*/ */
protected ISystemViewElementAdapter getViewAdapter(Object obj) protected ISystemViewElementAdapter getViewAdapter(Object obj)
{ {
@ -452,7 +453,7 @@ public class SystemTableView
} }
/** /**
* Convenience method for retrieving the view adapter for an object's children * Convenience method for retrieving the view adapter for an object's children
*/ */
public ISystemViewElementAdapter getAdapterForContents() public ISystemViewElementAdapter getAdapterForContents()
{ {
@ -475,9 +476,9 @@ public class SystemTableView
Object[] children = provider.getChildren(object); Object[] children = provider.getChildren(object);
return getVisibleDescriptors(children); return getVisibleDescriptors(children);
} }
private IPropertyDescriptor[] getVisibleDescriptors(Object[] children) private IPropertyDescriptor[] getVisibleDescriptors(Object[] children)
{ {
if (children != null && children.length > 0) if (children != null && children.length > 0)
{ {
IAdaptable child = (IAdaptable) children[0]; IAdaptable child = (IAdaptable) children[0];
@ -491,14 +492,14 @@ public class SystemTableView
{ {
return _columnManager; return _columnManager;
} }
public IPropertyDescriptor getNameDescriptor(Object object) public IPropertyDescriptor getNameDescriptor(Object object)
{ {
SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider(); SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
Object[] children = provider.getChildren(object); Object[] children = provider.getChildren(object);
return getNameDescriptor(children); return getNameDescriptor(children);
} }
private IPropertyDescriptor getNameDescriptor(Object[] children) private IPropertyDescriptor getNameDescriptor(Object[] children)
{ {
if (children != null && children.length > 0) if (children != null && children.length > 0)
@ -519,7 +520,7 @@ public class SystemTableView
Object[] children = provider.getChildren(_objectInput); Object[] children = provider.getChildren(_objectInput);
return getFormatsIn(children); return getFormatsIn(children);
} }
private IPropertyDescriptor[] getCustomDescriptors(ISystemViewElementAdapter adapter) private IPropertyDescriptor[] getCustomDescriptors(ISystemViewElementAdapter adapter)
{ {
return _columnManager.getVisibleDescriptors(adapter); return _columnManager.getVisibleDescriptors(adapter);
@ -538,7 +539,7 @@ public class SystemTableView
{ {
ISystemViewElementAdapter ad = (ISystemViewElementAdapter) adapter; ISystemViewElementAdapter ad = (ISystemViewElementAdapter) adapter;
ad.setPropertySourceInput(child); ad.setPropertySourceInput(child);
IPropertyDescriptor[] descriptors = getCustomDescriptors(ad); IPropertyDescriptor[] descriptors = getCustomDescriptors(ad);
for (int i = 0; i < descriptors.length; i++) for (int i = 0; i < descriptors.length; i++)
{ {
@ -547,9 +548,17 @@ public class SystemTableView
try try
{ {
Object key = descriptor.getId(); Object key = descriptor.getId();
Object propertyValue = ad.getPropertyValue(key, false); Object propertyValue = ad.getPropertyValue(key, false);
results.add(propertyValue.getClass()); if (propertyValue != null) {
// FIXME Since we're only checking the FIRST element
// in the list of elements for its descriptor, we
// might get null here if the first element is
// invalid - although other elements might be valid.
// This issue is tracked in
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=193329#c5
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=187571
results.add(propertyValue.getClass());
}
} }
catch (Exception e) catch (Exception e)
{ {
@ -561,7 +570,7 @@ public class SystemTableView
} }
return results; return results;
} }
public void computeLayout() public void computeLayout()
{ {
@ -578,7 +587,7 @@ public class SystemTableView
return editor; return editor;
} }
private boolean sameDescriptors(IPropertyDescriptor[] descriptors1, IPropertyDescriptor[] descriptors2) private boolean sameDescriptors(IPropertyDescriptor[] descriptors1, IPropertyDescriptor[] descriptors2)
{ {
if (descriptors1 == null || descriptors2 == null) if (descriptors1 == null || descriptors2 == null)
@ -603,7 +612,7 @@ public class SystemTableView
/** /**
* Determines what columns should be shown in this view. The columns may change * Determines what columns should be shown in this view. The columns may change
* anytime the view input changes. The columns in the control are modified and * anytime the view input changes. The columns in the control are modified and
* columns may be added or deleted as necessary to make it conform to the * columns may be added or deleted as necessary to make it conform to the
* new data. * new data.
*/ */
public void computeLayout(boolean force) public void computeLayout(boolean force)
@ -612,7 +621,7 @@ public class SystemTableView
return; return;
if (_objectInput == null) if (_objectInput == null)
return; return;
SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider(); SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
Object[] children = provider.getChildren(_objectInput); Object[] children = provider.getChildren(_objectInput);
@ -621,17 +630,17 @@ public class SystemTableView
{ {
return; return;
} }
IPropertyDescriptor[] descriptors = getVisibleDescriptors(children); IPropertyDescriptor[] descriptors = getVisibleDescriptors(children);
IPropertyDescriptor nameDescriptor = getNameDescriptor(children); IPropertyDescriptor nameDescriptor = getNameDescriptor(children);
int n = descriptors.length; // number of columns we need (name column + other columns) int n = descriptors.length; // number of columns we need (name column + other columns)
if (nameDescriptor != null) if (nameDescriptor != null)
n += 1; n += 1;
if (n == 0) if (n == 0)
return; // there is nothing to lay out! return; // there is nothing to lay out!
if (sameDescriptors(descriptors,_uniqueDescriptors) && !force) if (sameDescriptors(descriptors,_uniqueDescriptors) && !force)
{ {
setLastColumnWidths(getCurrentColumnWidths()); setLastColumnWidths(getCurrentColumnWidths());
@ -660,7 +669,7 @@ public class SystemTableView
int alignment = SWT.LEFT; int alignment = SWT.LEFT;
int weight = 100; int weight = 100;
if (i == 0) if (i == 0)
{ {
// this is the first column -- treat it special // this is the first column -- treat it special
//name = SystemPropertyResources.RESID_PROPERTY_NAME_LABEL; //name = SystemPropertyResources.RESID_PROPERTY_NAME_LABEL;
name = SystemResources.RESID_RENAME_COLHDG_OLDNAME; name = SystemResources.RESID_RENAME_COLHDG_OLDNAME;
@ -725,15 +734,15 @@ public class SystemTableView
// find a default // find a default
totalWidth = 500; totalWidth = 500;
} }
int[] lastWidths = getLastColumnWidths(); int[] lastWidths = getLastColumnWidths();
if (numColumns > 1) if (numColumns > 1)
{ {
// check if previous widths can be used // check if previous widths can be used
if (lastWidths != null && lastWidths.length == numColumns) if (lastWidths != null && lastWidths.length == numColumns)
{ {
// use previously established widths // use previously established widths
setCurrentColumnWidths(lastWidths); setCurrentColumnWidths(lastWidths);
} }
@ -749,7 +758,7 @@ public class SystemTableView
columns[0].setWidth(firstWidth); columns[0].setWidth(firstWidth);
for (int i = 1; i < numColumns; i++) for (int i = 1; i < numColumns; i++)
{ {
columns[i].setWidth(averageWidth); columns[i].setWidth(averageWidth);
} }
setLastColumnWidths(getCurrentColumnWidths()); setLastColumnWidths(getCurrentColumnWidths());
@ -758,23 +767,23 @@ public class SystemTableView
table.setHeaderVisible(true); table.setHeaderVisible(true);
} }
else else
{ {
if (numColumns == 1) if (numColumns == 1)
{ {
int width = totalWidth; int width = totalWidth;
if (lastWidths != null && lastWidths.length == 1) if (lastWidths != null && lastWidths.length == 1)
{ {
width = (totalWidth > lastWidths[0]) ? totalWidth : lastWidths[0]; width = (totalWidth > lastWidths[0]) ? totalWidth : lastWidths[0];
} }
int maxWidth = provider.getMaxCharsInColumnZero() * _charWidth; int maxWidth = provider.getMaxCharsInColumnZero() * _charWidth;
if (maxWidth > width) if (maxWidth > width)
{ {
width = maxWidth; width = maxWidth;
} }
if (width > 0) if (width > 0)
{ {
columns[0].setWidth(width); columns[0].setWidth(width);
@ -826,27 +835,27 @@ public class SystemTableView
/** /**
* Initialize drag and drop support for this view. * Initialize drag and drop support for this view.
* *
*/ */
protected void initDragAndDrop() protected void initDragAndDrop()
{ {
int ops = DND.DROP_COPY | DND.DROP_MOVE; int ops = DND.DROP_COPY | DND.DROP_MOVE;
Transfer[] dragtransfers = new Transfer[] Transfer[] dragtransfers = new Transfer[]
{ PluginTransfer.getInstance(), { PluginTransfer.getInstance(),
EditorInputTransfer.getInstance() EditorInputTransfer.getInstance()
}; };
Transfer[] droptransfers = new Transfer[] Transfer[] droptransfers = new Transfer[]
{ PluginTransfer.getInstance(), { PluginTransfer.getInstance(),
FileTransfer.getInstance(), FileTransfer.getInstance(),
EditorInputTransfer.getInstance() EditorInputTransfer.getInstance()
}; };
addDragSupport(ops | DND.DROP_DEFAULT, dragtransfers, new SystemViewDataDragAdapter(this)); addDragSupport(ops | DND.DROP_DEFAULT, dragtransfers, new SystemViewDataDragAdapter(this));
addDropSupport(ops | DND.DROP_DEFAULT, droptransfers, new SystemViewDataDropAdapter(this)); addDropSupport(ops | DND.DROP_DEFAULT, droptransfers, new SystemViewDataDropAdapter(this));
} }
/** /**
* Used to asynchronously update the view whenever properties change. * Used to asynchronously update the view whenever properties change.
* @see org.eclipse.rse.core.events.ISystemResourceChangeListener#systemResourceChanged(org.eclipse.rse.core.events.ISystemResourceChangeEvent) * @see org.eclipse.rse.core.events.ISystemResourceChangeListener#systemResourceChanged(org.eclipse.rse.core.events.ISystemResourceChangeEvent)
*/ */
@ -868,7 +877,7 @@ public class SystemTableView
if (child == ((ISystemFilterReference)_objectInput).getReferencedFilter()) if (child == ((ISystemFilterReference)_objectInput).getReferencedFilter())
{ {
SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider(); SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
if (provider != null) if (provider != null)
{ {
if (!madeChange) if (!madeChange)
@ -876,7 +885,7 @@ public class SystemTableView
provider.flushCache(); provider.flushCache();
madeChange = true; madeChange = true;
} }
computeLayout(); computeLayout();
try try
{ {
@ -889,7 +898,7 @@ public class SystemTableView
} }
} }
} }
} }
break; break;
case ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE : case ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE :
@ -900,19 +909,19 @@ public class SystemTableView
{ {
Widget w = findItem(child); Widget w = findItem(child);
if (w != null) if (w != null)
{ {
updateItem(w, child); updateItem(w, child);
} }
} }
catch (Exception e) catch (Exception e)
{ {
} }
} }
return; return;
//break; //break;
case ISystemResourceChangeEvents.EVENT_DELETE: case ISystemResourceChangeEvents.EVENT_DELETE:
case ISystemResourceChangeEvents.EVENT_DELETE_MANY: case ISystemResourceChangeEvents.EVENT_DELETE_MANY:
{ {
if (child instanceof ISystemFilterReference) if (child instanceof ISystemFilterReference)
@ -921,11 +930,11 @@ public class SystemTableView
if (w != null) if (w != null)
{ {
remove(child); remove(child);
} }
} }
} }
break; break;
case ISystemResourceChangeEvents.EVENT_ADD : case ISystemResourceChangeEvents.EVENT_ADD :
case ISystemResourceChangeEvents.EVENT_ADD_RELATIVE : case ISystemResourceChangeEvents.EVENT_ADD_RELATIVE :
{ {
@ -948,7 +957,7 @@ public class SystemTableView
} }
} }
break; break;
case ISystemResourceChangeEvents.EVENT_REFRESH: case ISystemResourceChangeEvents.EVENT_REFRESH:
case ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE: case ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE:
{ {
@ -962,9 +971,9 @@ public class SystemTableView
{ {
Widget w = findItem(child); Widget w = findItem(child);
if (w != null && w.getData() != _objectInput) if (w != null && w.getData() != _objectInput)
{ {
//child is the children of this table input. //child is the children of this table input.
//Need to refresh the whole view to handler //Need to refresh the whole view to handler
//And we need to make _objectInput to stale, otherwise deleted object //And we need to make _objectInput to stale, otherwise deleted object
//could not be removed from the table. //could not be removed from the table.
if (_objectInput instanceof ISystemContainer) if (_objectInput instanceof ISystemContainer)
@ -978,7 +987,7 @@ public class SystemTableView
{ {
SystemBasePlugin.logError(e.getMessage()); SystemBasePlugin.logError(e.getMessage());
} }
} }
break; break;
default : default :
@ -993,8 +1002,8 @@ public class SystemTableView
if (provider != null) if (provider != null)
{ {
if (!madeChange) if (!madeChange)
{ {
provider.flushCache(); provider.flushCache();
madeChange = true; madeChange = true;
} }
@ -1023,7 +1032,7 @@ public class SystemTableView
Object remoteResourceParent = event.getResourceParent(); Object remoteResourceParent = event.getResourceParent();
Object remoteResource = event.getResource(); Object remoteResource = event.getResource();
List remoteResourceNames = null; List remoteResourceNames = null;
if (remoteResource instanceof List) { if (remoteResource instanceof List) {
remoteResourceNames = (List) remoteResource; remoteResourceNames = (List) remoteResource;
remoteResource = remoteResourceNames.get(0); remoteResource = remoteResourceNames.get(0);
} }
@ -1040,7 +1049,7 @@ public class SystemTableView
refresh(); refresh();
return; return;
} }
switch (eventType) switch (eventType)
{ {
// -------------------------- // --------------------------
@ -1123,7 +1132,7 @@ public class SystemTableView
{ {
((ISystemContainer)_objectInput).markStale(true); ((ISystemContainer)_objectInput).markStale(true);
} }
provider.flushCache(); provider.flushCache();
madeChange = true; madeChange = true;
@ -1200,10 +1209,10 @@ public class SystemTableView
{ {
provider.flushCache(); provider.flushCache();
} }
refresh(); refresh();
} }
} }
break; break;
*/ */
@ -1232,19 +1241,19 @@ public class SystemTableView
public void selectionChanged(SelectionChangedEvent event) public void selectionChanged(SelectionChangedEvent event)
{ {
IStructuredSelection sel = (IStructuredSelection)event.getSelection(); IStructuredSelection sel = (IStructuredSelection)event.getSelection();
Object firstSelection = sel.getFirstElement(); Object firstSelection = sel.getFirstElement();
if (firstSelection == null) if (firstSelection == null)
return; return;
_selectionFlagsUpdated = false; _selectionFlagsUpdated = false;
ISystemViewElementAdapter adapter = getViewAdapter(firstSelection); ISystemViewElementAdapter adapter = getViewAdapter(firstSelection);
if (adapter != null) if (adapter != null)
{ {
displayMessage(adapter.getStatusLineText(firstSelection)); displayMessage(adapter.getStatusLineText(firstSelection));
if ((mouseButtonPressed == LEFT_BUTTON)) if ((mouseButtonPressed == LEFT_BUTTON))
adapter.selectionChanged(firstSelection); adapter.selectionChanged(firstSelection);
} }
else else
clearMessage(); clearMessage();
} }
@ -1282,7 +1291,7 @@ public class SystemTableView
* Everything below is basically stuff copied and pasted from SystemsView * Everything below is basically stuff copied and pasted from SystemsView
* -There needs to be cleaning up of the below code as some of this stuff * -There needs to be cleaning up of the below code as some of this stuff
* is broken for the table view * is broken for the table view
* *
* *
public void createStandardGroups(IMenuManager menu) public void createStandardGroups(IMenuManager menu)
{ {
@ -1315,7 +1324,7 @@ public class SystemTableView
menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORGANIZE)); menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORGANIZE));
// rename,move,copy,delete,bookmark,refactoring // rename,move,copy,delete,bookmark,refactoring
menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORDER)); menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORDER));
// move up, move down // move up, move down
menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GENERATE)); menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GENERATE));
// getters/setters, etc. Typically in editor // getters/setters, etc. Typically in editor
menu.add(new Separator(ISystemContextMenuConstants.GROUP_SEARCH)); menu.add(new Separator(ISystemContextMenuConstants.GROUP_SEARCH));
@ -1346,7 +1355,7 @@ public class SystemTableView
if (_propertyDialogAction == null) if (_propertyDialogAction == null)
{ {
_propertyDialogAction = new PropertyDialogAction(new SameShellProvider(getShell()), this); _propertyDialogAction = new PropertyDialogAction(new SameShellProvider(getShell()), this);
//propertyDialogAction.setToolTipText(" "); //propertyDialogAction.setToolTipText(" ");
} }
_propertyDialogAction.selectionChanged(getSelection()); _propertyDialogAction.selectionChanged(getSelection());
return _propertyDialogAction; return _propertyDialogAction;
@ -1447,7 +1456,7 @@ public class SystemTableView
} }
/** /**
* Required method from ISystemDeleteTarget * Required method from ISystemDeleteTarget
* Decides whether to enable the delete menu item. * Decides whether to enable the delete menu item.
* Assumes scanSelections() has already been called * Assumes scanSelections() has already been called
*/ */
public boolean canDelete() public boolean canDelete()
@ -1515,7 +1524,7 @@ public class SystemTableView
return ok; return ok;
} }
/** /**
* Decides whether to even show the properties menu item. * Decides whether to even show the properties menu item.
* Assumes scanSelections() has already been called * Assumes scanSelections() has already been called
@ -1523,7 +1532,7 @@ public class SystemTableView
protected boolean showProperties() { protected boolean showProperties() {
return _selectionShowPropertiesAction; return _selectionShowPropertiesAction;
} }
// --------------------------- // ---------------------------
// ISYSTEMRENAMETARGET METHODS // ISYSTEMRENAMETARGET METHODS
// --------------------------- // ---------------------------
@ -1551,7 +1560,7 @@ public class SystemTableView
setUser(true); setUser(true);
} }
public IStatus runInWorkspace(IProgressMonitor monitor) public IStatus runInWorkspace(IProgressMonitor monitor)
{ {
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
Object element = null; Object element = null;
@ -1561,7 +1570,7 @@ public class SystemTableView
String oldName = null; String oldName = null;
Vector fileNamesRenamed = new Vector(); Vector fileNamesRenamed = new Vector();
boolean ok = true; boolean ok = true;
try { try {
int steps = elements.length; int steps = elements.length;
monitor.beginTask(renameMessage, steps); monitor.beginTask(renameMessage, steps);
@ -1571,21 +1580,21 @@ public class SystemTableView
adapter = (ISystemViewElementAdapter)elementAdapters[i]; adapter = (ISystemViewElementAdapter)elementAdapters[i];
remoteAdapter = getRemoteAdapter(element); remoteAdapter = getRemoteAdapter(element);
Object parentElement = getParentForContent(element); Object parentElement = getParentForContent(element);
if (remoteAdapter != null) if (remoteAdapter != null)
{ {
oldName = remoteAdapter.getName(element); oldName = remoteAdapter.getName(element);
oldFullName = remoteAdapter.getAbsoluteName(element); // pre-rename oldFullName = remoteAdapter.getAbsoluteName(element); // pre-rename
monitor.subTask(getRenamingMessage(oldName).getLevelOneText()); monitor.subTask(getRenamingMessage(oldName).getLevelOneText());
} }
ok = adapter.doRename(null, element, newNames[i], monitor); ok = adapter.doRename(null, element, newNames[i], monitor);
if (ok) if (ok)
{ {
fileNamesRenamed.add(oldName); fileNamesRenamed.add(oldName);
if (remoteAdapter != null) if (remoteAdapter != null)
{ {
// Don't think we need to do findItem and updateItem here. // Don't think we need to do findItem and updateItem here.
sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED, element, parentElement, adapter.getSubSystem(element), new String[]{oldFullName}, this); sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED, element, parentElement, adapter.getSubSystem(element), new String[]{oldFullName}, this);
} }
else else
@ -1593,7 +1602,7 @@ public class SystemTableView
} }
monitor.worked(1); monitor.worked(1);
} }
} }
catch (SystemMessageException exc) { catch (SystemMessageException exc) {
ok = false; ok = false;
//If this operation is canceled, need to display a proper message to the user. //If this operation is canceled, need to display a proper message to the user.
@ -1620,7 +1629,7 @@ public class SystemTableView
exc); exc);
ok = false; ok = false;
} }
return Status.OK_STATUS; return Status.OK_STATUS;
} }
} }
@ -1637,7 +1646,7 @@ public class SystemTableView
} }
/** /**
* Required method from ISystemRenameTarget * Required method from ISystemRenameTarget
* Decides whether to enable the rename menu item. * Decides whether to enable the rename menu item.
* Assumes scanSelections() has already been called * Assumes scanSelections() has already been called
*/ */
public boolean canRename() public boolean canRename()
@ -1648,32 +1657,32 @@ public class SystemTableView
} }
// default implementation // default implementation
// in default table, parent is input // in default table, parent is input
protected Object getParentForContent(Object element) protected Object getParentForContent(Object element)
{ {
return _objectInput; return _objectInput;
} }
/** /**
* Get the specific "Renaming %1..." * Get the specific "Renaming %1..."
*/ */
protected SystemMessage getRenamingMessage(String oldName) protected SystemMessage getRenamingMessage(String oldName)
{ {
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_RENAMEGENERIC_PROGRESS); SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_RENAMEGENERIC_PROGRESS);
msg.makeSubstitution(oldName); msg.makeSubstitution(oldName);
return msg; return msg;
} }
/** /**
* Required method from ISystemRenameTarget * Required method from ISystemRenameTarget
*/ */
public boolean doRename(String[] newNames) public boolean doRename(String[] newNames)
{ {
IStructuredSelection selection = (IStructuredSelection) getSelection(); IStructuredSelection selection = (IStructuredSelection) getSelection();
Iterator elements = selection.iterator(); Iterator elements = selection.iterator();
Object[] renameElements = new Object[newNames.length]; Object[] renameElements = new Object[newNames.length];
Object[] elementAdapters = new Object[newNames.length]; Object[] elementAdapters = new Object[newNames.length];
int i = 0; int i = 0;
@ -1689,7 +1698,7 @@ public class SystemTableView
RenameJob renameJob = new RenameJob(newNames, renameElements, elementAdapters, renameMessageText); RenameJob renameJob = new RenameJob(newNames, renameElements, elementAdapters, renameMessageText);
renameJob.schedule(); renameJob.schedule();
return true; return true;
} }
/** /**
@ -1707,7 +1716,7 @@ public class SystemTableView
((ISystemViewElementAdapter) adapter).setViewer(this); ((ISystemViewElementAdapter) adapter).setViewer(this);
return adapter; return adapter;
} }
/** /**
* Return true if select all should be enabled for the given object. * Return true if select all should be enabled for the given object.
@ -1720,9 +1729,9 @@ public class SystemTableView
} }
/** /**
* When this action is run via Edit->Select All or via Ctrl+A, perform the * When this action is run via Edit->Select All or via Ctrl+A, perform the
* select all action. For a tree view, this should select all the children * select all action. For a tree view, this should select all the children
* of the given selected object. You can use the passed in selected object * of the given selected object. You can use the passed in selected object
* or ignore it and query the selected object yourself. * or ignore it and query the selected object yourself.
*/ */
public void doSelectAll(IStructuredSelection selection) public void doSelectAll(IStructuredSelection selection)
{ {
@ -1739,9 +1748,9 @@ public class SystemTableView
public void menuAboutToShow(IMenuManager manager) public void menuAboutToShow(IMenuManager manager)
{ {
SystemView.createStandardGroups(manager); SystemView.createStandardGroups(manager);
fillContextMenu(manager); fillContextMenu(manager);
if (!menuListenerAdded) if (!menuListenerAdded)
{ {
if (manager instanceof MenuManager) if (manager instanceof MenuManager)
@ -1794,7 +1803,7 @@ public class SystemTableView
menu.appendToGroup(ISystemContextMenuConstants.GROUP_REORGANIZE, getRenameAction()); menu.appendToGroup(ISystemContextMenuConstants.GROUP_REORGANIZE, getRenameAction());
} }
// ADAPTER SPECIFIC ACTIONS // ADAPTER SPECIFIC ACTIONS
SystemMenuManager ourMenu = new SystemMenuManager(menu); SystemMenuManager ourMenu = new SystemMenuManager(menu);
Iterator elements = selection.iterator(); Iterator elements = selection.iterator();
@ -1817,7 +1826,7 @@ public class SystemTableView
AbstractSystemViewAdapter aVA = (AbstractSystemViewAdapter)nextAdapter; AbstractSystemViewAdapter aVA = (AbstractSystemViewAdapter)nextAdapter;
// add remote actions // add remote actions
aVA.addCommonRemoteActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADAPTERS); aVA.addCommonRemoteActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADAPTERS);
// add dynamic menu popups // add dynamic menu popups
aVA.addDynamicPopupMenuActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADDITIONS); aVA.addDynamicPopupMenuActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADDITIONS);
} }
@ -1830,7 +1839,7 @@ public class SystemTableView
if ((items[idx] instanceof ActionContributionItem) && (((ActionContributionItem) items[idx]).getAction() instanceof ISystemAction)) if ((items[idx] instanceof ActionContributionItem) && (((ActionContributionItem) items[idx]).getAction() instanceof ISystemAction))
{ {
ISystemAction item = (ISystemAction) (((ActionContributionItem) items[idx]).getAction()); ISystemAction item = (ISystemAction) (((ActionContributionItem) items[idx]).getAction());
//item.setShell(getShell()); //item.setShell(getShell());
//item.setSelection(selection); //item.setSelection(selection);
//item.setViewer(this); //item.setViewer(this);
item.setInputs(getShell(), this, selection); item.setInputs(getShell(), this, selection);
@ -1839,8 +1848,8 @@ public class SystemTableView
{ {
SystemSubMenuManager item = (SystemSubMenuManager) items[idx]; SystemSubMenuManager item = (SystemSubMenuManager) items[idx];
//item.setShell(getShell()); //item.setShell(getShell());
//item.setSelection(selection); //item.setSelection(selection);
//item.setViewer(this); //item.setViewer(this);
item.setInputs(getShell(), this, selection); item.setInputs(getShell(), this, selection);
} }
} }
@ -1857,7 +1866,7 @@ public class SystemTableView
// PROPERTIES ACTION... // PROPERTIES ACTION...
// This is supplied by the system, so we pretty much get it for free. It finds the // This is supplied by the system, so we pretty much get it for free. It finds the
// registered propertyPages extension points registered for the selected object's class type. // registered propertyPages extension points registered for the selected object's class type.
//propertyDialogAction.selectionChanged(selection); //propertyDialogAction.selectionChanged(selection);
if (showProperties()) if (showProperties())
{ {
@ -1867,7 +1876,7 @@ public class SystemTableView
menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction); menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction);
} }
} }
// OPEN IN NEW PERSPECTIVE ACTION... if (fromSystemViewPart && showOpenViewActions()) // OPEN IN NEW PERSPECTIVE ACTION... if (fromSystemViewPart && showOpenViewActions())
if (!_selectionIsRemoteObject) if (!_selectionIsRemoteObject)
{ {
@ -1927,7 +1936,7 @@ public class SystemTableView
if (_selectionShowRenameAction) if (_selectionShowRenameAction)
_selectionShowRenameAction = adapter.showRename(element); _selectionShowRenameAction = adapter.showRename(element);
if (_selectionShowPropertiesAction) if (_selectionShowPropertiesAction)
_selectionShowPropertiesAction = adapter.showProperties(element); _selectionShowPropertiesAction = adapter.showProperties(element);
@ -2004,7 +2013,7 @@ public class SystemTableView
*/ */
} }
} }
/** /**
* Display a message/status on the message/status line * Display a message/status on the message/status line
*/ */
@ -2022,5 +2031,5 @@ public class SystemTableView
_messageLine.clearMessage(); _messageLine.clearMessage();
} }
} }

View file

@ -1,26 +1,27 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved. * Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
* *
* 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:
* Uwe Stieber (Wind River) - Reworked new connection wizard extension point. * Uwe Stieber (Wind River) - Reworked new connection wizard extension point.
* 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) - [184095] Replace systemTypeName by IRSESystemType * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
* Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
* Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
* Uwe Stieber (Wind River) - [192202] Default RSE new connection wizard does not allow to query created host instance anymore * Uwe Stieber (Wind River) - [192202] Default RSE new connection wizard does not allow to query created host instance anymore
* Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code * Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code
* David Dykstal (IBM) - [168976][api] move ISystemNewConnectionWizardPage from core to UI * David Dykstal (IBM) - [168976][api] move ISystemNewConnectionWizardPage from core to UI
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.wizards.newconnection; package org.eclipse.rse.ui.wizards.newconnection;
@ -33,6 +34,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Vector; import java.util.Vector;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage; import org.eclipse.jface.wizard.WizardPage;
@ -70,7 +72,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
private ISystemProfile privateProfile = null; private ISystemProfile privateProfile = null;
private IHost selectedContext = null; private IHost selectedContext = null;
private static String lastProfile = null; private static String lastProfile = null;
private IHost createdHost = null; private IHost createdHost = null;
/** /**
* Constructor. * Constructor.
@ -90,7 +92,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
*/ */
public void dispose() { public void dispose() {
super.dispose(); super.dispose();
mainPage = null; mainPage = null;
subsystemConfigurationSuppliedWizardPages = null; subsystemConfigurationSuppliedWizardPages = null;
ssfWizardPagesPerSystemType.clear(); ssfWizardPagesPerSystemType.clear();
@ -115,7 +117,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
subsystemConfigurationSuppliedWizardPages = getAdditionalWizardPages(systemType); subsystemConfigurationSuppliedWizardPages = getAdditionalWizardPages(systemType);
} }
} }
/** /**
* Creates the wizard pages. This method is an override from the parent Wizard class. * Creates the wizard pages. This method is an override from the parent Wizard class.
*/ */
@ -123,9 +125,9 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
try { try {
// reset the remembered created host instance // reset the remembered created host instance
createdHost = null; createdHost = null;
mainPage = createMainPage(getSystemType()); mainPage = createMainPage(getSystemType());
SystemConnectionForm form = mainPage.getSystemConnectionForm(); SystemConnectionForm form = mainPage.getSystemConnectionForm();
if (form != null) { if (form != null) {
form.setCurrentlySelectedConnection(selectedContext); form.setCurrentlySelectedConnection(selectedContext);
@ -137,10 +139,10 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
// there had been a default connection name explicitly set from outside. // there had been a default connection name explicitly set from outside.
if (defaultConnectionName != null) form.setConnectionName(defaultConnectionName); if (defaultConnectionName != null) form.setConnectionName(defaultConnectionName);
else form.setConnectionName(""); //$NON-NLS-1$ else form.setConnectionName(""); //$NON-NLS-1$
if (defaultHostName != null) form.setHostName(defaultHostName); if (defaultHostName != null) form.setHostName(defaultHostName);
} }
if (mainPage != null && getSystemType() != null) mainPage.setSystemType(getSystemType()); if (mainPage != null && getSystemType() != null) mainPage.setSystemType(getSystemType());
updateDefaultSelectedProfile(); updateDefaultSelectedProfile();
@ -188,12 +190,12 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
/** /**
* Calculates the default profile name to propose on the default new * Calculates the default profile name to propose on the default new
* connection wizard main page. * connection wizard main page.
* *
* <pre> * <pre>
* Expected order of default profile selection: * Expected order of default profile selection:
* 1. If a connection is selected, the default profile is the one from the connection. * 1. If a connection is selected, the default profile is the one from the connection.
* 2. If the wizard remembered the last profile and this last remembered profile is still * 2. If the wizard remembered the last profile and this last remembered profile is still
* available and active, the remembered last profile is the default profile. * available and active, the remembered last profile is the default profile.
* 3. If the default private system profile is availabe and active, the default private system profile * 3. If the default private system profile is availabe and active, the default private system profile
* is the default profile. * is the default profile.
* 4. The first non-empty profile from the list of active profiles is the default profile. * 4. The first non-empty profile from the list of active profiles is the default profile.
@ -207,7 +209,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
List profileNames = activeProfileNames != null ? Arrays.asList(activeProfileNames) : new ArrayList(); List profileNames = activeProfileNames != null ? Arrays.asList(activeProfileNames) : new ArrayList();
mainPage.getSystemConnectionForm().setProfileNames(activeProfileNames); mainPage.getSystemConnectionForm().setProfileNames(activeProfileNames);
// 1. If a connection is selected, the default profile is the one from the connection. // 1. If a connection is selected, the default profile is the one from the connection.
String defaultProfileName = selectedContext != null ? selectedContext.getSystemProfileName() : null; String defaultProfileName = selectedContext != null ? selectedContext.getSystemProfileName() : null;
if (defaultProfileName == null || !profileNames.contains(defaultProfileName)) { if (defaultProfileName == null || !profileNames.contains(defaultProfileName)) {
@ -222,7 +224,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
if (defaultPrivateProfile != null) defaultProfileName = defaultPrivateProfile.getName(); if (defaultPrivateProfile != null) defaultProfileName = defaultPrivateProfile.getName();
if (defaultProfileName == null || !profileNames.contains(defaultProfileName)) { if (defaultProfileName == null || !profileNames.contains(defaultProfileName)) {
// 4. The first non-empty profile from the list of active profiles is the default profile. // 4. The first non-empty profile from the list of active profiles is the default profile.
// Note: The profile names get normalized within the constructor. // Note: The profile names get normalized within the constructor.
if (profileNames.size() > 0) defaultProfileName = (String)profileNames.get(0); if (profileNames.size() > 0) defaultProfileName = (String)profileNames.get(0);
} }
} }
@ -236,9 +238,9 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
if (selectedContext == null || !defaultProfileName.equals(selectedContext.getSystemProfileName())) if (selectedContext == null || !defaultProfileName.equals(selectedContext.getSystemProfileName()))
lastProfile = defaultProfileName; lastProfile = defaultProfileName;
} }
} }
/** /**
* Set the currently selected context. Used to better default entry fields. * Set the currently selected context. Used to better default entry fields.
*/ */
@ -376,17 +378,17 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
/** /**
* Returns the create host instance once the user pressed finished. The created * Returns the create host instance once the user pressed finished. The created
* host instance will be reset to <code>null</code> once the wizard got disposed. * host instance will be reset to <code>null</code> once the wizard got disposed.
* *
* @return The created host instance or <code>null</code>. * @return The created host instance or <code>null</code>.
*/ */
public IHost getCreatedHost() { public IHost getCreatedHost() {
return createdHost; return createdHost;
} }
/** /**
* Private method to get all the wizard pages from all the subsystem factories, given a * Private method to get all the wizard pages from all the subsystem factories, given a
* system type. * system type.
* *
* @param systemType The system type to query the additional subsystem service pages for. Must be not <code>null</code>. * @param systemType The system type to query the additional subsystem service pages for. Must be not <code>null</code>.
*/ */
private ISystemNewConnectionWizardPage[] getAdditionalWizardPages(IRSESystemType systemType) { private ISystemNewConnectionWizardPage[] getAdditionalWizardPages(IRSESystemType systemType) {
@ -400,6 +402,14 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
ISubSystemConfiguration[] factories = sr.getSubSystemConfigurationsBySystemType(systemType, true); ISubSystemConfiguration[] factories = sr.getSubSystemConfigurationsBySystemType(systemType, true);
for (int idx = 0; idx < factories.length; idx++) { for (int idx = 0; idx < factories.length; idx++) {
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)factories[idx].getAdapter(ISubSystemConfigurationAdapter.class); ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)factories[idx].getAdapter(ISubSystemConfigurationAdapter.class);
if (adapter == null) {
// try to activate bundle - FIXME should perhaps be done
// earlier in the action that shows the wizard dialog?
// And, is it really necessary to get the wizard pages that
// early already?
Platform.getAdapterManager().loadAdapter(factories[idx], ISubSystemConfigurationAdapter.class.getName());
adapter = (ISubSystemConfigurationAdapter) factories[idx].getAdapter(ISubSystemConfigurationAdapter.class);
}
ISystemNewConnectionWizardPage[] pages = adapter.getNewConnectionWizardPages(factories[idx], this); ISystemNewConnectionWizardPage[] pages = adapter.getNewConnectionWizardPages(factories[idx], this);
if (pages != null) { if (pages != null) {
@ -418,7 +428,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
} }
/** /**
* Return true if there are additional pages. This decides whether to enable the Next button * Return true if there are additional pages. This decides whether to enable the Next button
* on the main page * on the main page
*/ */
protected boolean hasAdditionalPages() { protected boolean hasAdditionalPages() {

View file

@ -3,13 +3,13 @@
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
* *
* 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) - 141803: Fix cpu usage 100% while connecting * Martin Oberhuber (Wind River) - 141803: Fix cpu usage 100% while connecting
* David Dykstal (IBM) - 168870: moved SystemPreferencesManager to a new package * David Dykstal (IBM) - 168870: moved SystemPreferencesManager to a new package
@ -35,6 +35,7 @@
* David McKnight (IBM) - [220309] [nls] Some GenericMessages and SubSystemResources should move from UI to Core * David McKnight (IBM) - [220309] [nls] Some GenericMessages and SubSystemResources should move from UI to Core
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
* David Dykstal (IBM) - [225089][ssh][shells][api] Canceling connection leads to exception * David Dykstal (IBM) - [225089][ssh][shells][api] Canceling connection leads to exception
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.core.subsystems; package org.eclipse.rse.core.subsystems;
@ -137,14 +138,12 @@ import org.eclipse.ui.progress.WorkbenchJob;
* <li>{@link #internalGetProperties(Object subject, String[] keys, IProgressMonitor monitor)} * <li>{@link #internalGetProperties(Object subject, String[] keys, IProgressMonitor monitor)}
* <li>{@link #internalSetProperties(Object subject, String[] keys, String[] values, IProgressMonitor monitor)} * <li>{@link #internalSetProperties(Object subject, String[] keys, String[] values, IProgressMonitor monitor)}
* </ul> * </ul>
* *
*/ */
public abstract class SubSystem extends RSEModelObject public abstract class SubSystem extends RSEModelObject
implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
{ {
protected static final String SUBSYSTEM_FILE_NAME = "subsystem"; //$NON-NLS-1$ protected static final String SUBSYSTEM_FILE_NAME = "subsystem"; //$NON-NLS-1$
//protected transient SubSystemConfiguration parentFactory = null; //protected transient SubSystemConfiguration parentFactory = null;
@ -182,11 +181,12 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
protected IHost _host; protected IHost _host;
protected String _name = null; protected String _name = null;
protected String _subsystemConfigurationId = null; protected String _subsystemConfigurationId = null;
protected boolean _hidden = false; protected boolean _hidden = false;
private boolean _isInitialized = false;
/** /**
* @generated This field/method will be replaced during code generation. * @generated This field/method will be replaced during code generation.
@ -495,7 +495,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.eclipse.rse.core.subsystems.ISubSystem#checkIsConnected(org.eclipse.core.runtime.IProgressMonitor) * @see org.eclipse.rse.core.subsystems.ISubSystem#checkIsConnected(org.eclipse.core.runtime.IProgressMonitor)
*/ */
public void checkIsConnected(IProgressMonitor monitor) throws SystemMessageException public void checkIsConnected(IProgressMonitor monitor) throws SystemMessageException
@ -806,7 +806,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
* when they do not find a reference for the key themselves. * when they do not find a reference for the key themselves.
* </p> * </p>
* @see org.eclipse.rse.core.subsystems.IRemoteObjectResolver#getObjectWithAbsoluteName(String, IProgressMonitor) * @see org.eclipse.rse.core.subsystems.IRemoteObjectResolver#getObjectWithAbsoluteName(String, IProgressMonitor)
* *
* @param key the unique id of the remote object. * @param key the unique id of the remote object.
* Must not be <code>null</code>. * Must not be <code>null</code>.
* @param monitor the progress monitor * @param monitor the progress monitor
@ -2007,13 +2007,23 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
return false; return false;
} }
/** /**
* Return the children of this subsystem, to populate the GUI subtree of this subsystem. * Return the children of this subsystem, to populate the GUI subtree of
* By default, this method: * this subsystem. By default, this method:
* <ul> * <ul>
* <li>Returns the filter pool references of this subsystem, if supportsFilters() is true for our factory. * <li>Returns the filter pool references of this subsystem, if
* <li>If supportsFilters() is false from our factory, returns null * supportsFilters() is true for our factory.
* <li>If supportsFilters() is false from our factory, returns null
* </ul> * </ul>
* So, be sure to override this method IF you do not support filters. * So, be sure to override this method IF you do not support filters.
*
* Lazy Loading: Note that if your subsystem does not support connecting,
* and you do not support filters, here is a good point to ensure that the
* bundles which declare your UI adapters get loaded, since the default code
* which overriders usually place in
* {@link #initializeSubSystem(IProgressMonitor)} is not called in that
* case. Similarly, if your subsystem declares custom images for filters or
* filter pools, overriding the getChildren() call here to first load your
* filter adapters and THEN super.getChildren() is a good idea.
*/ */
public Object[] getChildren() public Object[] getChildren()
{ {
@ -2073,7 +2083,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
/** /**
* Resolve an <i>absolute</i> filter string. * Resolve an <i>absolute</i> filter string.
* *
* This is only applicable if the subsystem * This is only applicable if the subsystem
* factory reports true for {@link org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsFilters()}, * factory reports true for {@link org.eclipse.rse.core.subsystems.SubSystemConfiguration#supportsFilters()},
* which is the default. Otherwise, {@link org.eclipse.rse.core.subsystems.SubSystem#getChildren()} * which is the default. Otherwise, {@link org.eclipse.rse.core.subsystems.SubSystem#getChildren()}
@ -2112,6 +2122,10 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
if (isConnected()) if (isConnected())
{ {
if (!supportsConnecting && !_isInitialized) {
// Lazy Loading: Load adapters (e.g. Local Subsystem)
initializeSubSystem(monitor);
}
Object[] results = internalResolveFilterString(filterString, monitor); Object[] results = internalResolveFilterString(filterString, monitor);
if (sortResults && (results!=null)) if (sortResults && (results!=null))
results = sortResolvedFilterStringObjects(results); results = sortResolvedFilterStringObjects(results);
@ -2149,6 +2163,10 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
} }
if (isConnected()) if (isConnected())
{ {
if (!supportsConnecting && !_isInitialized) {
// Lazy Loading: Load adapters (e.g. Local Subsystem)
initializeSubSystem(monitor);
}
Object[] results = internalResolveFilterStrings(filterStrings, monitor); Object[] results = internalResolveFilterStrings(filterStrings, monitor);
if (sortResults && (results!=null)) if (sortResults && (results!=null))
results = sortResolvedFilterStringObjects(results); results = sortResolvedFilterStringObjects(results);
@ -2197,6 +2215,10 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
{ {
if (isConnected()) if (isConnected())
{ {
if (!supportsConnecting && !_isInitialized) {
// Lazy Loading: Load adapters (e.g. Local Subsystem)
initializeSubSystem(monitor);
}
Object[] results= internalResolveFilterString(parent, filterString, monitor); Object[] results= internalResolveFilterString(parent, filterString, monitor);
if (sortResults && (results!=null)) if (sortResults && (results!=null))
results = sortResolvedFilterStringObjects(results); results = sortResolvedFilterStringObjects(results);
@ -2226,7 +2248,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
* @param key Identifies property to set * @param key Identifies property to set
* @param value Value to set property to * @param value Value to set property to
* @return Object interpretable by subsystem. Might be a Boolean, or the might be new value for confirmation. * @return Object interpretable by subsystem. Might be a Boolean, or the might be new value for confirmation.
* *
* @deprecated this shouldn't be used * @deprecated this shouldn't be used
*/ */
public Object setProperty(Object subject, String key, String value) public Object setProperty(Object subject, String key, String value)
@ -2242,7 +2264,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
* @param subject Identifies which object to get the properties of * @param subject Identifies which object to get the properties of
* @param key Identifies property to get value of * @param key Identifies property to get value of
* @return String The value of the requested key. * @return String The value of the requested key.
* *
* @deprecated this shouldn't be used * @deprecated this shouldn't be used
*/ */
public String getProperty(Object subject, String key) public String getProperty(Object subject, String key)
@ -2259,7 +2281,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
* @param keys the array of propertie keys to set. * @param keys the array of propertie keys to set.
* @param values the array of values to set. The value at a certain index corresponds to the property key at the same index. * @param values the array of values to set. The value at a certain index corresponds to the property key at the same index.
* @return Object interpretable by subsystem. Might be a Boolean, or the might be new values for confirmation. * @return Object interpretable by subsystem. Might be a Boolean, or the might be new values for confirmation.
* *
* @deprecated this shouldn't be used * @deprecated this shouldn't be used
*/ */
public Object setProperties(Object subject, String[] keys, String[] values) public Object setProperties(Object subject, String[] keys, String[] values)
@ -2269,26 +2291,37 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
} }
/** /**
* Initialize this subsystem instance after the corresponding {@link IConnectorService} connect method finishes. * Initialize this subsystem instance after the corresponding
* This method should be overridden if any initialization for the subsystem needs * {@link IConnectorService} connect method finishes. This method should be
* to occur at this time * overridden if any initialization for the subsystem needs to occur at this
* <p> The default implementation currently does nothing, but overriding methods should call super. * time.
* @param monitor a monitor that can be used to show progress or provide cancellation. * <p>
* The default implementation currently does nothing, but overriding methods
* should call super before doing any other work.
*
* @param monitor a progress monitor that can be used to show progress
* during long-running operation. Cancellation is typically not
* supported since it might leave the system in an inconsistent
* state.
*/ */
public void initializeSubSystem(IProgressMonitor monitor) { public void initializeSubSystem(IProgressMonitor monitor) {
_isInitialized = true;
} }
/** /**
* Uninitialize this subsystem just after disconnect. * Uninitialize this subsystem just after disconnect. The default
* The default implementation currently does nothing. * implementation currently does nothing. Overriding methods should call
* Overriding methods should call super. * super after doing their own work.
* @param monitor a progress monitor that can be used to show uninitialization progress can provide cancellation. *
* @param monitor a progress monitor that can be used to show progress
* during long-running operation. Cancellation is typically not
* supported since it might leave the system in an inconsistent
* state.
*/ */
public void uninitializeSubSystem(IProgressMonitor monitor) { public void uninitializeSubSystem(IProgressMonitor monitor) {
_isInitialized = false;
} }
/* /*
* Connect to a remote system with a monitor. * Connect to a remote system with a monitor.
* Required for Bug 176603 * Required for Bug 176603
@ -2441,7 +2474,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
* displaying for you. * displaying for you.
* <p> * <p>
* Override internalDisconnect if you want, but by default it calls getSystem().disconnect(IProgressMonitor). * Override internalDisconnect if you want, but by default it calls getSystem().disconnect(IProgressMonitor).
* *
*/ */
public void disconnect() throws Exception public void disconnect() throws Exception
{ {
@ -2454,7 +2487,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
* displaying for you. * displaying for you.
* <p> * <p>
* Override internalDisconnect if you want, but by default it calls getSystem().disconnect(IProgressMonitor). * Override internalDisconnect if you want, but by default it calls getSystem().disconnect(IProgressMonitor).
* *
* @param collapseTree collapse the tree in the system view * @param collapseTree collapse the tree in the system view
*/ */
public void disconnect(boolean collapseTree) throws Exception public void disconnect(boolean collapseTree) throws Exception
@ -2497,7 +2530,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
* @param subject Identifies which object to get the properties of * @param subject Identifies which object to get the properties of
* @param keys the array of property keys. * @param keys the array of property keys.
* @return the values for the given property keys. * @return the values for the given property keys.
* *
* @deprecated this shouldn't be used * @deprecated this shouldn't be used
*/ */
public String[] getProperties(Object subject, String[] keys) public String[] getProperties(Object subject, String[] keys)
@ -2511,7 +2544,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
* Return the {@link org.eclipse.rse.core.subsystems.IConnectorService IConnectorService} object that represents the live connection for this system. * Return the {@link org.eclipse.rse.core.subsystems.IConnectorService IConnectorService} object that represents the live connection for this system.
* This must return an object that implements {@link IConnectorService}. A good starting point for that * This must return an object that implements {@link IConnectorService}. A good starting point for that
* is the base class {@link AbstractConnectorService}. * is the base class {@link AbstractConnectorService}.
* *
* The connector service gets passed in to the constructor for the subsystem so there's normally no reason * The connector service gets passed in to the constructor for the subsystem so there's normally no reason
* to override this method. * to override this method.
* *
@ -2523,7 +2556,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
/** /**
* Sets the {@link org.eclipse.rse.core.subsystems.IConnectorService IConnectorService} object that represents the live connection for this system. * Sets the {@link org.eclipse.rse.core.subsystems.IConnectorService IConnectorService} object that represents the live connection for this system.
* *
* @param connectorService the connector service * @param connectorService the connector service
*/ */
public void setConnectorService(IConnectorService connectorService) public void setConnectorService(IConnectorService connectorService)
@ -2558,7 +2591,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
/** /**
* Return the CacheManager for this subsystem. This is the default implementation * Return the CacheManager for this subsystem. This is the default implementation
* which just returns null. * which just returns null.
* *
* @see #supportsCaching() * @see #supportsCaching()
*/ */
public ICacheManager getCacheManager() public ICacheManager getCacheManager()
@ -2577,7 +2610,7 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
* - well, actually you can throw anything and we'll wrap it here in an InvocationTargetException * - well, actually you can throw anything and we'll wrap it here in an InvocationTargetException
* <li>do not worry about calling monitor.done() ... caller will do that. * <li>do not worry about calling monitor.done() ... caller will do that.
* </ul> * </ul>
* *
*/ */
private void internalConnect(IProgressMonitor monitor) private void internalConnect(IProgressMonitor monitor)
throws InvocationTargetException, OperationCanceledException throws InvocationTargetException, OperationCanceledException

View file

@ -1,14 +1,15 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. * Copyright (c) 2006, 2008 Wind River Systems, Inc. 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
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Tobias Schwarz (Wind River) - initial API and implementation * Tobias Schwarz (Wind River) - initial API and implementation
* Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
* Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes * Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.tests.internal.testsubsystem; package org.eclipse.rse.tests.internal.testsubsystem;
@ -26,8 +27,8 @@ import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemNode;
import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemNodeContainer; import org.eclipse.rse.tests.testsubsystem.interfaces.ITestSubSystemNodeContainer;
/** /**
* Simple test subsystem with branches and leafes. * Simple test subsystem with branches and leaves. Further children can be added
* Further childs can be added or removed via context menu actions. * or removed via context menu actions.
*/ */
public class TestSubSystem extends SubSystem implements ITestSubSystem { public class TestSubSystem extends SubSystem implements ITestSubSystem {
@ -35,8 +36,9 @@ public class TestSubSystem extends SubSystem implements ITestSubSystem {
/** /**
* Constructor. * Constructor.
* @param host *
* @param connectorService * @param host the host to connect
* @param connectorService connector service to use
*/ */
public TestSubSystem(IHost host, IConnectorService connectorService) { public TestSubSystem(IHost host, IConnectorService connectorService) {
super(host, connectorService); super(host, connectorService);
@ -45,7 +47,8 @@ public class TestSubSystem extends SubSystem implements ITestSubSystem {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.SubSystem#initializeSubSystem(org.eclipse.core.runtime.IProgressMonitor) * @see org.eclipse.rse.core.subsystems.SubSystem#initializeSubSystem(org.eclipse.core.runtime.IProgressMonitor)
*/ */
public void initializeSubSystem(IProgressMonitor monitor) { public void initializeSubSystem(IProgressMonitor monitor) {
super.initializeSubSystem(monitor);
TestSubSystemContainerNode parent0 = new TestSubSystemContainerNode("0"); //$NON-NLS-1$ TestSubSystemContainerNode parent0 = new TestSubSystemContainerNode("0"); //$NON-NLS-1$
TestSubSystemContainerNode child0 = new TestSubSystemContainerNode("0:0"); //$NON-NLS-1$ TestSubSystemContainerNode child0 = new TestSubSystemContainerNode("0:0"); //$NON-NLS-1$
parent0.addChildNode(child0); parent0.addChildNode(child0);
@ -63,19 +66,20 @@ public class TestSubSystem extends SubSystem implements ITestSubSystem {
*/ */
public void uninitializeSubSystem(IProgressMonitor monitor) { public void uninitializeSubSystem(IProgressMonitor monitor) {
fChildren.clear(); fChildren.clear();
super.uninitializeSubSystem(monitor);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.SubSystem#getObjectWithAbsoluteName(java.lang.String) * @see org.eclipse.rse.core.subsystems.SubSystem#getObjectWithAbsoluteName(java.lang.String)
*/ */
public Object getObjectWithAbsoluteName(String key) throws Exception { public Object getObjectWithAbsoluteName(String key, IProgressMonitor monitor) throws Exception {
ITestSubSystemNode[] childs = getChildNodes(); ITestSubSystemNode[] childs = getChildNodes();
for (int i = 0; i < childs.length; i++) { for (int i = 0; i < childs.length; i++) {
if (childs[i].getName().equalsIgnoreCase(key)) { if (childs[i].getName().equalsIgnoreCase(key)) {
return childs[i]; return childs[i];
} }
} }
return super.getObjectWithAbsoluteName(key); return super.getObjectWithAbsoluteName(key, monitor);
} }
/* (non-Javadoc) /* (non-Javadoc)