Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Watson2009-10-06 19:51:26 +0000
committerGreg Watson2009-10-06 19:51:26 +0000
commit25904bc991a00078ebd19f91d678581811cc445e (patch)
tree0d82f03537d1b32f9864f6245a8298ba0f5227fc
parentab3fc1583804e194303d3db275aadb8ebc4e9dee (diff)
downloadorg.eclipse.ptp-25904bc991a00078ebd19f91d678581811cc445e.tar.gz
org.eclipse.ptp-25904bc991a00078ebd19f91d678581811cc445e.tar.xz
org.eclipse.ptp-25904bc991a00078ebd19f91d678581811cc445e.zip
Add autostart flag
-rw-r--r--core/org.eclipse.ptp.core/src/org/eclipse/ptp/rmsystem/AbstractResourceManagerServiceProvider.java76
-rw-r--r--core/org.eclipse.ptp.core/src/org/eclipse/ptp/rmsystem/IResourceManagerConfiguration.java48
2 files changed, 74 insertions, 50 deletions
diff --git a/core/org.eclipse.ptp.core/src/org/eclipse/ptp/rmsystem/AbstractResourceManagerServiceProvider.java b/core/org.eclipse.ptp.core/src/org/eclipse/ptp/rmsystem/AbstractResourceManagerServiceProvider.java
index c6969949e..8eba0a1b6 100644
--- a/core/org.eclipse.ptp.core/src/org/eclipse/ptp/rmsystem/AbstractResourceManagerServiceProvider.java
+++ b/core/org.eclipse.ptp.core/src/org/eclipse/ptp/rmsystem/AbstractResourceManagerServiceProvider.java
@@ -36,6 +36,7 @@ public abstract class AbstractResourceManagerServiceProvider
extends ServiceProvider
implements IResourceManagerConfiguration
{
+ private static final String TAG_AUTOSTART = "autoStart"; //$NON-NLS-1$
private static final String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
private static final String TAG_NAME = "name"; //$NON-NLS-1$
private static final String TAG_UNIQUE_NAME = "uniqName"; //$NON-NLS-1$
@@ -46,7 +47,7 @@ public abstract class AbstractResourceManagerServiceProvider
private final IModelManager fModelManager = PTPCorePlugin.getDefault().getModelManager();
private final IServiceModelManager fServiceManager = ServiceModelManager.getInstance();
private final IService fLaunchService = fServiceManager.getService(IServiceConstants.LAUNCH_SERVICE);
-
+
/*
* Keep a copy of our service configuration so we don't have to search for it
*/
@@ -54,6 +55,14 @@ public abstract class AbstractResourceManagerServiceProvider
private IModelManagerChildListener fModelListener = new IModelManagerChildListener() {
+ public void handleEvent(IChangedResourceManagerEvent e) {
+ // Don't need to do anything
+ }
+
+ public void handleEvent(INewResourceManagerEvent e) {
+ // Don't need to do anything
+ }
+
public void handleEvent(IRemoveResourceManagerEvent e) {
if (e.getResourceManager().getUniqueName().equals(getUniqueName())) {
/*
@@ -67,14 +76,6 @@ public abstract class AbstractResourceManagerServiceProvider
}
}
}
-
- public void handleEvent(INewResourceManagerEvent e) {
- // Don't need to do anything
- }
-
- public void handleEvent(IChangedResourceManagerEvent e) {
- // Don't need to do anything
- }
};
private IServiceModelEventListener fEventListener = new IServiceModelEventListener() {
@@ -139,21 +140,9 @@ public abstract class AbstractResourceManagerServiceProvider
registerListeners();
}
- public void registerListeners() {
- fServiceManager.addEventListener(fEventListener,
- IServiceModelEvent.SERVICE_CONFIGURATION_REMOVED |
- IServiceModelEvent.SERVICE_CONFIGURATION_CHANGED);
- fModelManager.addListener(fModelListener);
- }
-
- public void unregisterListeners() {
- fServiceManager.removeEventListener(fEventListener);
- fModelManager.removeListener(fModelListener);
- }
-
@Override
public abstract Object clone();
-
+
/**
* Create a resource manager using this configuration.
*
@@ -162,12 +151,19 @@ public abstract class AbstractResourceManagerServiceProvider
public abstract IResourceManagerControl createResourceManager();
/* (non-Javadoc)
+ * @see org.eclipse.ptp.rmsystem.IResourceManagerConfiguration#getAutoStart()
+ */
+ public boolean getAutoStart() {
+ return getBoolean(TAG_AUTOSTART, false);
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.ptp.rmsystem.IResourceManagerConfiguration#getConnectionName()
*/
public String getConnectionName() {
return getString(TAG_CONNECTION_NAME, ""); //$NON-NLS-1$
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ptp.rmsystem.IResourceManagerConfiguration#getDescription()
*/
@@ -196,7 +192,7 @@ public abstract class AbstractResourceManagerServiceProvider
public String getResourceManagerId() {
return super.getId();
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ptp.rmsystem.IResourceManagerConfiguration#getState()
*/
@@ -210,7 +206,7 @@ public abstract class AbstractResourceManagerServiceProvider
public String getType() {
return super.getName();
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ptp.rmsystem.IResourceManagerConfiguration#getUniqueName()
*/
@@ -234,6 +230,17 @@ public abstract class AbstractResourceManagerServiceProvider
return false;
}
+ /**
+ * Register for service model configuration change and remove events
+ * Register for runtime model events
+ */
+ public void registerListeners() {
+ fServiceManager.addEventListener(fEventListener,
+ IServiceModelEvent.SERVICE_CONFIGURATION_REMOVED |
+ IServiceModelEvent.SERVICE_CONFIGURATION_CHANGED);
+ fModelManager.addListener(fModelListener);
+ }
+
/* (non-Javadoc)
* @see org.eclipse.ptp.rmsystem.IResourceManagerConfiguration#save(org.eclipse.ui.IMemento)
*/
@@ -246,6 +253,13 @@ public abstract class AbstractResourceManagerServiceProvider
}
/* (non-Javadoc)
+ * @see org.eclipse.ptp.rmsystem.IResourceManagerConfiguration#setAutoStart(boolean)
+ */
+ public void setAutoStart(boolean flag) {
+ putBoolean(TAG_AUTOSTART, flag);
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.ptp.rmsystem.IResourceManagerConfiguration#setConnectionName(java.lang.String)
*/
public void setConnectionName(String name) {
@@ -258,7 +272,7 @@ public abstract class AbstractResourceManagerServiceProvider
public void setDescription(String description) {
putString(TAG_DESCRIPTION, description);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ptp.rmsystem.IResourceManagerConfiguration#setName(java.lang.String)
*/
@@ -272,7 +286,7 @@ public abstract class AbstractResourceManagerServiceProvider
public void setRemoteServicesId(String id) {
putString(TAG_REMOTE_SERVICES_ID, id);
}
-
+
/**
* @param id
*/
@@ -297,4 +311,12 @@ public abstract class AbstractResourceManagerServiceProvider
public void setUniqueName(String id) {
putString(TAG_UNIQUE_NAME, id);
}
+
+ /**
+ * Unregister from listening to service model and runtime models.
+ */
+ public void unregisterListeners() {
+ fServiceManager.removeEventListener(fEventListener);
+ fModelManager.removeListener(fModelListener);
+ }
}
diff --git a/core/org.eclipse.ptp.core/src/org/eclipse/ptp/rmsystem/IResourceManagerConfiguration.java b/core/org.eclipse.ptp.core/src/org/eclipse/ptp/rmsystem/IResourceManagerConfiguration.java
index 8ce9f1ea1..6d87c78e7 100644
--- a/core/org.eclipse.ptp.core/src/org/eclipse/ptp/rmsystem/IResourceManagerConfiguration.java
+++ b/core/org.eclipse.ptp.core/src/org/eclipse/ptp/rmsystem/IResourceManagerConfiguration.java
@@ -18,11 +18,9 @@
*******************************************************************************/
package org.eclipse.ptp.rmsystem;
-import org.eclipse.ptp.core.elements.attributes.ResourceManagerAttributes;
import org.eclipse.ui.IMemento;
public interface IResourceManagerConfiguration extends Cloneable {
-
/**
* Create a copy of this configuration.
*
@@ -31,6 +29,15 @@ public interface IResourceManagerConfiguration extends Cloneable {
public Object clone();
/**
+ * Get the auto start flag for this resource manager. If the auto start
+ * flag is set to true, an attempt will be made to start the resource
+ * manager when Eclipse is launched.
+ *
+ * @return state of the auto start flag
+ */
+ public boolean getAutoStart();
+
+ /**
* Get the connection name. This is a string used by the remote service provider to
* identify a particular connection. A resource manager only supports a single
* connection at time. If the resource manager is purely local, then this will
@@ -39,7 +46,7 @@ public interface IResourceManagerConfiguration extends Cloneable {
* @return connection name
*/
public String getConnectionName();
-
+
/**
* Returns the description of the resource manager.
*
@@ -62,36 +69,28 @@ public interface IResourceManagerConfiguration extends Cloneable {
* @return remote service provider ID
*/
public String getRemoteServicesId();
-
+
/**
* Returns the id of the factory that created the resource manager.
*
* @return the id of the factory that created the resource manager
*/
public String getResourceManagerId();
-
- /**
- * Get the last known state of the resource manager. This is primarily used to persist
- * the the state of the resource manager, and so that it can be restored on startup.
- *
- * @return state of the resource manager
- */
- public ResourceManagerAttributes.State getState();
-
+
/**
* Returns the type of the resource manager. This is the name of the resource manager factory.
*
* @return the type of the resource manager
*/
public String getType();
-
+
/**
* Get a unique name for this resource manager.
*
* @return unique name
*/
public String getUniqueName();
-
+
/**
* This resource manager needs the debugger to help with
* a debug launch. What this means depends on the type
@@ -101,15 +100,25 @@ public interface IResourceManagerConfiguration extends Cloneable {
* @return true if help is required
*/
public boolean needsDebuggerLaunchHelp();
-
+
/**
* Save the state of the configuration.
*
* @param memento
+ * @deprecated
*/
public void save(IMemento memento);
/**
+ * Set the auto start flag for this resource manager. If the auto start
+ * flag is set to true, an attempt will be made to start the resource
+ * manager when Eclipse is launched.
+ *
+ * @param flag auto start flag
+ */
+ public void setAutoStart(boolean flag);
+
+ /**
* Set the name of the connection used by this resource manager. The
* connection name is unique to a particular remote service provider.
*
@@ -142,11 +151,4 @@ public interface IResourceManagerConfiguration extends Cloneable {
* @param id remote service provider extension ID
*/
public void setRemoteServicesId(String id);
-
- /**
- * Set the last known state of the resource manager
- *
- * @param state state of the resource manager
- */
- public void setState(ResourceManagerAttributes.State state);
}

Back to the top