### Eclipse Workspace Patch 1.0 #P org.eclipse.rse.ui Index: UI/org/eclipse/rse/ui/RSESystemTypeAdapter.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSESystemTypeAdapter.java,v retrieving revision 1.28 diff -u -r1.28 RSESystemTypeAdapter.java --- UI/org/eclipse/rse/ui/RSESystemTypeAdapter.java 8 Nov 2007 13:51:14 -0000 1.28 +++ UI/org/eclipse/rse/ui/RSESystemTypeAdapter.java 12 Feb 2008 17:26:35 -0000 @@ -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 @@ -19,6 +19,7 @@ * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [181939] avoid subsystem plugin activation just for enablement checking * Uwe Stieber (Wind River) - [199032] [api] Remove method acceptContextMenuActionContribution(...) from RSESystemTypeAdapter + * Martin Oberhuber (Wind River) - [218655][api] Provide SystemType enablement info in non-UI ********************************************************************************/ package org.eclipse.rse.ui; @@ -32,9 +33,7 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.IRSESystemTypeConstants; -import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.RSEPreferencesManager; -import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy; import org.eclipse.rse.internal.ui.RSEAdapter; import org.eclipse.rse.ui.wizards.registries.IRSEWizardDescriptor; import org.eclipse.ui.IViewPart; @@ -101,10 +100,8 @@ * image file. bundle parameter is used as the base for relative paths and * is allowed to be null. * - * @param value - * the absolute or relative path - * @param definingBundle - * bundle to be used for relative paths (may be null) + * @param value the absolute or relative path + * @param definingBundle bundle to be used for relative paths (may be null) * @return ImageDescriptor */ public static ImageDescriptor getImage(String value, Bundle definingBundle) { @@ -116,10 +113,8 @@ * Create a URL from the argument absolute or relative path. The bundle parameter is * used as the base for relative paths and may be null. * - * @param value - * the absolute or relative path - * @param definingBundle - * bundle to be used for relative paths (may be null) + * @param value the absolute or relative path + * @param definingBundle bundle to be used for relative paths (may be null) * @return the URL to the resource */ public static URL getUrl(String value, Bundle definingBundle) { @@ -187,26 +182,31 @@ * @param object the object being adapted, usually a system type. * @return true if that system type is enabled. false if the object is * not a system type or if it is not enabled. + * @deprecated Clients should use {@link IRSESystemType#isEnabled()}, which is + * available without UI dependencies, in order to guarantee consistent + * availability of system types. + * Providers of custom RSESystemTypeAdapter implementations, which override + * this method, should move their code to their IRSESystemType implementations. */ - public boolean isEnabled(Object object) { + public final boolean isEnabled(Object object) { IRSESystemType systemType = getSystemType(object); - if ( systemType != null && RSEPreferencesManager.getIsSystemTypeEnabled(systemType)) { - // if enabled, check if the system type has any registered subsystems. If - // not, this will auto-disable the system type. - ISubSystemConfigurationProxy[] proxies = RSECorePlugin.getTheSystemRegistry().getSubSystemConfigurationProxies(); - for (int i=0; i + * Note that system types which are provided by extenders via the dynamic + * sytemTypeProviders extension point may have their own logic to determine + * whether they are enabled or not, so changing the enabled setting may + * not work for them. + * * @param object The system type being adapted. * @param isEnabled true if the system type is enabled. false if it is not. + * @deprecated Set the enabled state in {@link RSEPreferencesManager} directly */ public void setIsEnabled(Object object, boolean isEnabled) { IRSESystemType systemType = getSystemType(object); #P org.eclipse.rse.core Index: src/org/eclipse/rse/core/IRSESystemType.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSESystemType.java,v retrieving revision 1.18 diff -u -r1.18 IRSESystemType.java --- src/org/eclipse/rse/core/IRSESystemType.java 24 May 2007 11:05:38 -0000 1.18 +++ src/org/eclipse/rse/core/IRSESystemType.java 12 Feb 2008 17:26:36 -0000 @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2000, 2007 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -13,7 +13,8 @@ * Contributors: * Uwe Stieber (Wind River) - Extended system type -> subsystemConfiguration association. * Martin Oberhuber (Wind River) - [185098] Provide constants for all well-known system types - * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() + * Martin Oberhuber (Wind River) - [218655][api] Provide SystemType enablement info in non-UI ********************************************************************************/ package org.eclipse.rse.core; @@ -248,6 +249,22 @@ public boolean testProperty(String key, boolean expectedValue); /** + * Tests whether the system type is currently enabled. + * + * The enabled state is a dynamic property of a system type, compared to the + * static configuration by plugin markup. Enablement is a non-UI property, + * which can be set by a Product in the Preferences or modified by a user + * to hide certain system types. + *

+ * Implementers of custom system types (which are registered by a SystemTypeProvider) + * can override this method to provide more advanced enabled checks e.g. based on + * license availability. + * + * @return true if the system type is currently enabled, or false otherwise. + */ + public boolean isEnabled(); + + /** * Tests whether the system type refers to the local system. * This is a shortcut for *

 
Index: src/org/eclipse/rse/core/PasswordPersistenceManager.java
===================================================================
RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/PasswordPersistenceManager.java,v
retrieving revision 1.8
diff -u -r1.8 PasswordPersistenceManager.java
--- src/org/eclipse/rse/core/PasswordPersistenceManager.java	14 May 2007 08:52:32 -0000	1.8
+++ src/org/eclipse/rse/core/PasswordPersistenceManager.java	12 Feb 2008 17:26:36 -0000
@@ -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
@@ -16,6 +16,7 @@
  * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
  * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
  * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() 
+ * Martin Oberhuber (Wind River) - [218655][api] Provide SystemType enablement info in non-UI
  ********************************************************************************/
 
 package org.eclipse.rse.core;
@@ -94,6 +95,9 @@
 		public Object getAdapter(Class adapter) {
 			return null;
 		}
+		public boolean isEnabled() {
+			return true;
+		}
 	}
 	
 	/**
Index: src/org/eclipse/rse/core/AbstractRSESystemType.java
===================================================================
RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/AbstractRSESystemType.java,v
retrieving revision 1.3
diff -u -r1.3 AbstractRSESystemType.java
--- src/org/eclipse/rse/core/AbstractRSESystemType.java	23 May 2007 12:41:20 -0000	1.3
+++ src/org/eclipse/rse/core/AbstractRSESystemType.java	12 Feb 2008 17:26:36 -0000
@@ -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
@@ -15,6 +15,7 @@
  * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
  * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() 
  * Martin Oberhuber (Wind River) - [186868] Fix IRSESystemType.testProperty() semantics 
+ * Martin Oberhuber (Wind River) - [218655][api] Provide SystemType enablement info in non-UI
  ********************************************************************************/
 package org.eclipse.rse.core;
 
@@ -25,6 +26,7 @@
 import org.eclipse.rse.core.model.Host;
 import org.eclipse.rse.core.model.IHost;
 import org.eclipse.rse.core.model.ISystemProfile;
+import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
 import org.osgi.framework.Bundle;
 
 /**
@@ -157,6 +159,24 @@
 
 	/*
 	 * (non-Javadoc)
+	 * @see org.eclipse.rse.core.IRSESystemType#isEnabled()
+	 */
+	public boolean isEnabled() {
+		if (RSEPreferencesManager.getIsSystemTypeEnabled(this)) {
+			// if enabled, check if the system type has any registered subsystems. If
+			// not, this will auto-disable the system type.
+			ISubSystemConfigurationProxy[] proxies = RSECorePlugin.getTheSystemRegistry().getSubSystemConfigurationProxies();
+			for (int i=0; i