1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-29 20:05:35 +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

@ -10,6 +10,7 @@
* 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) - [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;
@ -52,7 +53,8 @@ public class DaytimeSubSystem extends SubSystem {
public void initializeSubSystem(IProgressMonitor monitor) {
//This is called after connect - expand the daytime node.
//May be called in worker thread.
// Always called in worker thread.
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 SystemResourceChangeEvent event = new SystemResourceChangeEvent(this, ISystemResourceChangeEvents.EVENT_SELECT_EXPAND, null);
@ -90,7 +92,7 @@ public class DaytimeSubSystem extends SubSystem {
}
public void uninitializeSubSystem(IProgressMonitor monitor) {
//nothing to do
super.uninitializeSubSystem(monitor);
}
public Class getServiceType() {

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
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -12,6 +12,7 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
********************************************************************************/
package samples.subsystems;
@ -45,23 +46,28 @@ public class DeveloperSubSystem extends SubSystem
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) {
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.ISubSystem#uninitializeSubSystem(org.eclipse.core.runtime.IProgressMonitor)
*/
public void uninitializeSubSystem(IProgressMonitor monitor) {
super.initializeSubSystem(monitor);
}
/*
* (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
if (key.startsWith("Team_")) //$NON-NLS-1$
@ -81,7 +87,7 @@ public class DeveloperSubSystem extends SubSystem
return devrs[idx];
}
// Not a remote object: fall back to return filter reference
return super.getObjectWithAbsoluteName(key);
return super.getObjectWithAbsoluteName(key, monitor);
}
/**

View file

@ -19,6 +19,7 @@
* David Dykstal (IBM) - [217556] remove service subsystem types
* Martin Oberhuber (Wind River) - [cleanup] Add API "since" Javadoc tags
* 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;
@ -90,14 +91,25 @@ public interface ISubSystem extends ISystemFilterPoolReferenceManagerProvider, I
public IHost getHost();
/**
* Called on each subsystem associated with a particular {@link IConnectorService} after it connects.
* @param monitor A progress monitor supporting progress reporting and cancellation.
* Called on each subsystem associated with a particular
* {@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);
/**
* Called on each subsystem associated with a particular {@link IConnectorService} after it disconnects
* @param monitor A progress monitor supporting progress reporting and cancellation.
* Called on each subsystem associated with a particular
* {@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);

View file

@ -15,13 +15,12 @@
* Martin Oberhuber (Wind River) - [180519][api] declaratively register adapter factories
* 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
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
*******************************************************************************/
package org.eclipse.rse.internal.subsystems.files.core;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileEmpty;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@ -47,20 +46,6 @@ public class Activator extends AbstractUIPlugin {
*/
public void start(BundleContext context) throws Exception {
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

@ -34,6 +34,7 @@
* 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
* 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;
@ -991,9 +992,9 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
public void uninitializeSubSystem(IProgressMonitor monitor)
{
super.uninitializeSubSystem(monitor);
getFileService().uninitService(monitor);
_userHome = null;
super.uninitializeSubSystem(monitor);
}
/**

View file

@ -25,6 +25,7 @@
* 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) - [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;
@ -49,6 +50,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterReference;
@ -1031,26 +1033,13 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
/**
* Return the object within the subsystem that corresponds to
* the specified unique ID.
* Return the object within the subsystem that corresponds to the specified
* unique ID.
*
* For remote files, assuming the key is the absolute path of
* a file, this is simply a wrapper to getRemoteFileObject().
* For remote files, assuming the key is the absolute path of a file, this
* is simply a wrapper to getRemoteFileObject().
*
* @see SubSystem#getObjectWithAbsoluteName(String)
* @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.
* @see SubSystem#getObjectWithAbsoluteName(String, IProgressMonitor)
*/
public Object getObjectWithAbsoluteName(String key, IProgressMonitor monitor) throws Exception
{
@ -1240,12 +1229,16 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
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);
}
public void uninitializeSubSystem(IProgressMonitor monitor)
{
getConnectorService().removeCommunicationsListener(this);
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
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -13,13 +13,12 @@
* Contributors:
* 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) - [218304] Improve deferred adapter loading
********************************************************************************/
package org.eclipse.rse.internal.subsystems.processes.core;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.rse.subsystems.processes.core.subsystem.impl.RemoteProcessImpl;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@ -41,18 +40,6 @@ public class Activator extends AbstractUIPlugin {
public void start(BundleContext context) throws Exception
{
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,5 +1,5 @@
/********************************************************************************
* 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
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -13,6 +13,7 @@
* Contributors:
* 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) - [218304] Improve deferred adapter loading
********************************************************************************/
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 org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.CommunicationsEvent;
import org.eclipse.rse.core.subsystems.ICommunicationsListener;
@ -93,6 +95,9 @@ public abstract class RemoteProcessSubSystemImpl extends SubSystem implements
*/
public void initializeSubSystem(IProgressMonitor monitor)
{
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);
}
@ -102,6 +107,7 @@ public abstract class RemoteProcessSubSystemImpl extends SubSystem implements
public void uninitializeSubSystem(IProgressMonitor monitor)
{
getConnectorService().removeCommunicationsListener(this);
super.uninitializeSubSystem(monitor);
}
/* (non-Javadoc)
@ -162,10 +168,11 @@ public abstract class RemoteProcessSubSystemImpl extends SubSystem implements
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
{
@ -174,7 +181,7 @@ public abstract class RemoteProcessSubSystemImpl extends SubSystem implements
}
catch (NumberFormatException e)
{
return super.getObjectWithAbsoluteName(key);
return super.getObjectWithAbsoluteName(key, monitor);
}
}
}

View file

@ -16,6 +16,7 @@
* David Dykstal (IBM) - [197036] refactored switch configuration
* David Dykstal (IBM) - [217556] remove service subsystem types
* David McKnight (IBM) - [220524] internalSwitchServiceSubSystemConfiguration -> internalSwitchSubSystemConfiguration
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
********************************************************************************/
package org.eclipse.rse.subsystems.processes.servicesubsystem;
@ -187,8 +188,8 @@ public class ProcessServiceSubSystem extends RemoteProcessSubSystemImpl implemen
*/
public void uninitializeSubSystem(IProgressMonitor monitor)
{
super.uninitializeSubSystem(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
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -13,13 +13,12 @@
* Contributors:
* 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) - [218304] Improve deferred adapter loading
********************************************************************************/
package org.eclipse.rse.internal.subsystems.shells.core;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.rse.subsystems.shells.core.model.RemoteOutput;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@ -43,18 +42,6 @@ public class Activator extends AbstractUIPlugin {
*/
public void start(BundleContext context) throws Exception {
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

@ -18,6 +18,7 @@
* Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
* 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
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
*******************************************************************************/
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.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.core.RSECorePlugin;
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.IConnectorService;
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.internal.subsystems.shells.core.ShellStrings;
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.subsystems.IRemoteFile;
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.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
@ -76,6 +80,12 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
_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
*/
@ -304,8 +314,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/**
* Lists the possible commands for the given context
*
* @param context
* the context for a command
* @param context the context for a command
* @return the list of possible commands
*/
public ICandidateCommand[] getCandidateCommands(Object context)
@ -466,25 +475,13 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
}
/**
* Return the object within the subsystem that corresponds to the
* specified unique ID.
* For remote command, the key is determined by the command ID
* and the ouput ID.
* Return the object within the subsystem that corresponds to the specified
* unique ID. For remote command, the key is determined by the command ID
* and the output ID.
*
* @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.
* @see ISubSystem#getObjectWithAbsoluteName(String, IProgressMonitor)
*/
public Object getObjectWithAbsoluteName(String key) throws Exception
public Object getObjectWithAbsoluteName(String key, IProgressMonitor monitor) throws Exception
{
String cmdKey = key;
String outKey = null;
@ -515,7 +512,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
return theCmd;
}
//fallback to return filter reference or similar
return super.getObjectWithAbsoluteName(key);
return super.getObjectWithAbsoluteName(key, monitor);
}
// called by subsystem on disconnect
@ -768,7 +765,9 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/**
* 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
{
@ -786,7 +785,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/**
* 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
{
@ -829,12 +828,13 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
* factory reports true for supportsCommands().
*
* @param command Command to be executed remotely.
* @param context context of a command (i.e. working directory). <code>null</code> is
* valid and means to use the default context.
* @param context context of a command (i.e. working directory).
* <code>null</code> is valid and means to use the default
* context.
* @return Array of objects that are the result of running this 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
{
@ -989,13 +989,10 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/**
* Creates a new RunCommandJob
*
* @param cmd
* The remote command to run
* @param runContext
* The context in which to run the command
* @param runInterpret
* Whether or not to interpret results of the command as RSE
* objects
* @param cmd The remote command to run
* @param runContext The context in which to run the command
* @param runInterpret Whether or not to interpret results of the
* command as RSE objects
*/
public RunCommandJob(String cmd, Object runContext, boolean runInterpret)
{
@ -1033,8 +1030,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/**
* Creates a new RunShellJob
*
* @param runContext
* the context within which the shell will be ran
* @param runContext the context within which the shell will be ran
*/
public RunShellJob(Object runContext)
{
@ -1070,8 +1066,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/**
* Constructs a new CancelShellJob
*
* @param runContext
* The context for the cancelled shell
* @param runContext The context for the cancelled shell
*/
public CancelShellJob(Object runContext)
{
@ -1108,10 +1103,8 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/**
* Constructs a new SendCommandToShellJob
*
* @param cmd
* The command to send to the shell
* @param runContext
* The context in which the command is to be run
* @param cmd The command to send to the shell
* @param runContext The context in which the command is to be run
*/
public SendCommandToShellJob(String cmd, Object runContext)
{
@ -1148,8 +1141,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
/**
* Constructs a new RemoveShellJob
*
* @param runContext
* the context for the removed shell
* @param runContext the context for the removed shell
*/
public RemoveShellJob(Object runContext)
{

View file

@ -19,6 +19,7 @@
* David Dykstal (IBM) - [217556] remove service subsystem types
* David McKnight (IBM) - [220524] internalSwitchServiceSubSystemConfiguration -> internalSwitchSubSystemConfiguration
* 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;
@ -240,6 +241,7 @@ public final class ShellServiceSubSystem extends RemoteCmdSubSystem implements I
public void initializeSubSystem(IProgressMonitor monitor)
{
super.initializeSubSystem(monitor);
getShellService().initService(monitor);
}
@ -247,6 +249,7 @@ public final class ShellServiceSubSystem extends RemoteCmdSubSystem implements I
{
cancelAllShells();
getShellService().uninitService(monitor);
super.uninitializeSubSystem(monitor);
}
}

View file

@ -17,6 +17,7 @@
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* 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
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
*******************************************************************************/
package org.eclipse.rse.internal.ui.view;
@ -84,27 +85,32 @@ public class SystemViewFilterPoolReferenceAdapter
ISystemFilterPool pool = getFilterPool(element);
ISubSystemConfiguration ssFactory = getSubSystemConfiguration(pool);
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
if (adapter != null) {
// Lazy Loading: By default, ISubSystemConfigurationAdapter will
// only be available after its declaring bundle has been loaded,
// which usually happens on "connect" of a subsystem. Before that
// time, dynamically contributed actions will not be available.
// Implementations that want their dynamic actions to be avaialble
// earlier need to either declare them by static plugin.xml, or
// provision for more eager loading of the bundle that declares
// their adapter.
IAction[] actions = adapter.getFilterPoolActions(menu, selection, shell, menuGroup, ssFactory, pool);
if (actions != null)
{
for (int idx=0; idx<actions.length; idx++)
{
if (actions != null) {
for (int idx = 0; idx < actions.length; idx++) {
IAction action = actions[idx];
menu.add(menuGroup, action);
}
}
actions = adapter.getFilterPoolReferenceActions(menu, selection, shell, menuGroup, ssFactory, (ISystemFilterPoolReference)element);
if (actions != null)
{
//menu.addSeparator();
for (int idx=0; idx<actions.length; idx++)
{
actions = adapter.getFilterPoolReferenceActions(menu, selection, shell, menuGroup, ssFactory, (ISystemFilterPoolReference) element);
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)
{
@ -132,9 +138,19 @@ public class SystemViewFilterPoolReferenceAdapter
ISystemFilterPoolManagerProvider provider = pool.getProvider();
if (provider != null) {
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter) provider.getAdapter(ISubSystemConfigurationAdapter.class);
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) {
poolImage = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTERPOOL_ID);
}

View file

@ -25,6 +25,7 @@
* David McKnight (IBM) - [199566] Remove synchronzied from internalGetChildren
* 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
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
*******************************************************************************/
package org.eclipse.rse.internal.ui.view;
@ -113,13 +114,21 @@ public class SystemViewFilterReferenceAdapter
IHost currentConnection = currentSubSystem.getHost();
ssFactory.setConnection(currentConnection);
ssFactory.setCurrentSelection(selection.toArray());
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter) ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
if (adapter != null) {
// Lazy Loading: Specialized actions on filters are available only
// after the bundle that declares the ISubSystemConfigurationAdapter
// has been loaded, which typically is after connecting. We do not
// 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)
{
for (int idx = 0; idx < actions.length; idx++)
{
for (int idx = 0; idx < actions.length; idx++) {
IAction action = actions[idx];
if (action instanceof SystemNewFilterAction)
menu.appendToGroup(ISystemContextMenuConstants.GROUP_NEW, new Separator());
@ -129,13 +138,13 @@ public class SystemViewFilterReferenceAdapter
actions = adapter.getFilterReferenceActions(menu, selection, shell, menuGroup, ssFactory, getFilterReference(selection.getFirstElement()));
if (actions != null)
{
for (int idx = 0; idx < actions.length; idx++)
{
for (int idx = 0; idx < actions.length; idx++) {
IAction action = actions[idx];
menu.add(menuGroup, action);
}
}
}
}
private ISubSystemConfiguration getSubSystemConfiguration(ISystemFilter filter)
{
@ -165,10 +174,18 @@ public class SystemViewFilterReferenceAdapter
ISystemFilter filter = getFilter(element);
if (filter.getProvider() != null) // getProvider() returns the subsystem factory
{
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)filter.getProvider().getAdapter(ISubSystemConfigurationAdapter.class);
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)
filterImage = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTER_ID);
return filterImage;

View file

@ -20,11 +20,13 @@
* David Dykstal (IBM) - [217556] remove service subsystem types
* Martin Oberhuber (Wind River) - [195399] Improve String display for default port 0
* 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;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IAction;
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.ISubSystem;
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.subsystems.SubSystemConfigurationProxyAdapter;
import org.eclipse.rse.ui.ISystemContextMenuConstants;
import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.rse.ui.SystemMenuManager;
@ -92,18 +96,45 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
ISubSystem ss = (ISubSystem)element;
ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
if (adapter == null) {
// FIXME Fallback to default SubSystemConfigurationAdapter, such
// that we get at least the "connect" and other common actions
// for subsystems before their adapter is loaded. Note that this
// 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)
{
for (int idx=0; idx<actions.length; idx++)
{
for (int idx = 0; idx < actions.length; idx++) {
IAction action = actions[idx];
menu.add(menuGroup, action);
}
}
}
}
menu.appendToGroup(ISystemContextMenuConstants.GROUP_NEW, new GroupMarker(ISystemContextMenuConstants.GROUP_NEW_NONCASCADING));// user or BP/ISV additions
}
@ -119,14 +150,30 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
if (ssFactory != null)
{
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
if (adapter != null) {
if (ss.isConnected())
return adapter.getLiveImage(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
{
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;
}
}
@ -444,17 +491,23 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
changed_userId = changed_port = false;
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
// 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)
{
// getPortDescriptor().setValidator((ICellEditorValidator)ssFactory.getPortValidator());
if (propertyPortDescriptor != null) {
propertyPortDescriptor.setValidator(adapter.getPortValidator(ssFactory));
}
}
ss.getConnectorService().getPort();
port_editable = ssFactory.isPortEditable();
}

View file

@ -1,5 +1,5 @@
/********************************************************************************
* 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
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -13,6 +13,7 @@
* Contributors:
* 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) - [218304] Improve deferred adapter loading
********************************************************************************/
package org.eclipse.rse.internal.ui.view.team;
@ -23,7 +24,10 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.model.ISystemProfile;
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.subsystems.SubSystemConfigurationProxyAdapter;
import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
@ -86,7 +90,21 @@ public class SystemTeamViewSubSystemConfigurationNode implements IAdaptable
public ImageDescriptor getImageDescriptor()
{
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssf.getAdapter(ISubSystemConfigurationAdapter.class);
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;
}
}
}
/**

View file

@ -1,5 +1,5 @@
/********************************************************************************
* 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
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -12,15 +12,17 @@
*
* Contributors:
* 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;
import org.eclipse.core.runtime.Platform;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
import org.eclipse.rse.core.filters.ISystemFilterReference;
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.internal.ui.SystemPropertyResources;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
@ -32,18 +34,21 @@ import org.eclipse.rse.ui.filters.SystemChangeFilterPane;
import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
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.Control;
import org.eclipse.swt.widgets.Shell;
/**
* This is the property page for changing filters. This page used to be the Change dialog.
* The plugin.xml file registers this for objects of class org.eclipse.rse.internal.filters.SystemFilter or
* This is the property page for changing filters. This page used to be the
* Change dialog. The plugin.xml file registers this for objects of class
* org.eclipse.rse.internal.filters.SystemFilter or
* org.eclipse.rse.filters.SystemFilterReference.
* <p>
* If you have your own change filter dialog (versus configuring ours) you must configure this
* pane yourself by overriding {@link SubSystemConfiguration#customizeChangeFilterPropertyPage(SystemChangeFilterPropertyPage, ISystemFilter, Shell)}
* If you have your own change filter dialog (versus configuring ours) you must
* configure this pane yourself by overriding
* {@link SubSystemConfigurationAdapter#customizeChangeFilterPropertyPage(ISubSystemConfiguration, SystemChangeFilterPropertyPage, ISystemFilter, Shell)}
* and configuring the pane as described in that method's javadoc.
*/
public class SystemChangeFilterPropertyPage extends SystemBasePropertyPage
@ -218,6 +223,11 @@ public class SystemChangeFilterPropertyPage extends SystemBasePropertyPage
ISubSystemConfiguration ssf = SubSystemHelpers.getParentSubSystemConfiguration(selectedFilter);
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);
changeFilterPane.setInputObject(getElement());

View file

@ -19,6 +19,7 @@
* 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) - [225506] [api][breaking] RSE UI leaks non-API types
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
********************************************************************************/
package org.eclipse.rse.ui.view;
@ -547,10 +548,18 @@ public class SystemTableView
try
{
Object key = descriptor.getId();
Object propertyValue = ad.getPropertyValue(key, false);
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)
{
results.add(String.class);

View file

@ -21,6 +21,7 @@
* 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
* 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;
@ -33,6 +34,7 @@ import java.util.List;
import java.util.Map;
import java.util.Vector;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
@ -400,6 +402,14 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
ISubSystemConfiguration[] factories = sr.getSubSystemConfigurationsBySystemType(systemType, true);
for (int idx = 0; idx < factories.length; idx++) {
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);
if (pages != null) {

View file

@ -35,6 +35,7 @@
* 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 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;
@ -143,8 +144,6 @@ import org.eclipse.ui.progress.WorkbenchJob;
public abstract class SubSystem extends RSEModelObject
implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
{
protected static final String SUBSYSTEM_FILE_NAME = "subsystem"; //$NON-NLS-1$
//protected transient SubSystemConfiguration parentFactory = null;
@ -182,11 +181,12 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
protected IHost _host;
protected String _name = null;
protected String _subsystemConfigurationId = null;
protected boolean _hidden = false;
private boolean _isInitialized = false;
/**
* @generated This field/method will be replaced during code generation.
@ -2007,13 +2007,23 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
return false;
}
/**
* Return the children of this subsystem, to populate the GUI subtree of this subsystem.
* By default, this method:
* Return the children of this subsystem, to populate the GUI subtree of
* this subsystem. By default, this method:
* <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
* supportsFilters() is true for our factory.
* <li>If supportsFilters() is false from our factory, returns null
* </ul>
* 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()
{
@ -2112,6 +2122,10 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
if (isConnected())
{
if (!supportsConnecting && !_isInitialized) {
// Lazy Loading: Load adapters (e.g. Local Subsystem)
initializeSubSystem(monitor);
}
Object[] results = internalResolveFilterString(filterString, monitor);
if (sortResults && (results!=null))
results = sortResolvedFilterStringObjects(results);
@ -2149,6 +2163,10 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
}
if (isConnected())
{
if (!supportsConnecting && !_isInitialized) {
// Lazy Loading: Load adapters (e.g. Local Subsystem)
initializeSubSystem(monitor);
}
Object[] results = internalResolveFilterStrings(filterStrings, monitor);
if (sortResults && (results!=null))
results = sortResolvedFilterStringObjects(results);
@ -2197,6 +2215,10 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
{
if (isConnected())
{
if (!supportsConnecting && !_isInitialized) {
// Lazy Loading: Load adapters (e.g. Local Subsystem)
initializeSubSystem(monitor);
}
Object[] results= internalResolveFilterString(parent, filterString, monitor);
if (sortResults && (results!=null))
results = sortResolvedFilterStringObjects(results);
@ -2269,26 +2291,37 @@ implements IAdaptable, ISubSystem, ISystemFilterPoolReferenceManagerProvider
}
/**
* Initialize this subsystem instance after the corresponding {@link IConnectorService} connect method finishes.
* This method should be overridden if any initialization for the subsystem needs
* to occur at this time
* <p> The default implementation currently does nothing, but overriding methods should call super.
* @param monitor a monitor that can be used to show progress or provide cancellation.
* Initialize this subsystem instance after the corresponding
* {@link IConnectorService} connect method finishes. This method should be
* overridden if any initialization for the subsystem needs to occur at this
* time.
* <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) {
_isInitialized = true;
}
/**
* Uninitialize this subsystem just after disconnect.
* The default implementation currently does nothing.
* Overriding methods should call super.
* @param monitor a progress monitor that can be used to show uninitialization progress can provide cancellation.
* Uninitialize this subsystem just after disconnect. The default
* implementation currently does nothing. Overriding methods should call
* super after doing their own 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 uninitializeSubSystem(IProgressMonitor monitor) {
_isInitialized = false;
}
/*
* Connect to a remote system with a monitor.
* Required for Bug 176603

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* 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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -9,6 +9,7 @@
* Tobias Schwarz (Wind River) - initial API and implementation
* 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) - [218304] Improve deferred adapter loading
*******************************************************************************/
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;
/**
* Simple test subsystem with branches and leafes.
* Further childs can be added or removed via context menu actions.
* Simple test subsystem with branches and leaves. Further children can be added
* or removed via context menu actions.
*/
public class TestSubSystem extends SubSystem implements ITestSubSystem {
@ -35,8 +36,9 @@ public class TestSubSystem extends SubSystem implements ITestSubSystem {
/**
* Constructor.
* @param host
* @param connectorService
*
* @param host the host to connect
* @param connectorService connector service to use
*/
public TestSubSystem(IHost host, IConnectorService connectorService) {
super(host, connectorService);
@ -46,6 +48,7 @@ public class TestSubSystem extends SubSystem implements ITestSubSystem {
* @see org.eclipse.rse.core.subsystems.SubSystem#initializeSubSystem(org.eclipse.core.runtime.IProgressMonitor)
*/
public void initializeSubSystem(IProgressMonitor monitor) {
super.initializeSubSystem(monitor);
TestSubSystemContainerNode parent0 = new TestSubSystemContainerNode("0"); //$NON-NLS-1$
TestSubSystemContainerNode child0 = new TestSubSystemContainerNode("0:0"); //$NON-NLS-1$
parent0.addChildNode(child0);
@ -63,19 +66,20 @@ public class TestSubSystem extends SubSystem implements ITestSubSystem {
*/
public void uninitializeSubSystem(IProgressMonitor monitor) {
fChildren.clear();
super.uninitializeSubSystem(monitor);
}
/* (non-Javadoc)
* @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();
for (int i = 0; i < childs.length; i++) {
if (childs[i].getName().equalsIgnoreCase(key)) {
return childs[i];
}
}
return super.getObjectWithAbsoluteName(key);
return super.getObjectWithAbsoluteName(key, monitor);
}
/* (non-Javadoc)