View | Details | Raw Unified | Return to bug 218655
Collapse All | Expand All

(-)UI/org/eclipse/rse/ui/RSESystemTypeAdapter.java (-21 / +21 lines)
Lines 1-5 Link Here
1
/********************************************************************************
1
/********************************************************************************
2
 * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
2
 * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
5
 * available at http://www.eclipse.org/legal/epl-v10.html
5
 * available at http://www.eclipse.org/legal/epl-v10.html
Lines 19-24 Link Here
19
 * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
19
 * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
20
 * Martin Oberhuber (Wind River) - [181939] avoid subsystem plugin activation just for enablement checking
20
 * Martin Oberhuber (Wind River) - [181939] avoid subsystem plugin activation just for enablement checking
21
 * Uwe Stieber (Wind River)      - [199032] [api] Remove method acceptContextMenuActionContribution(...) from RSESystemTypeAdapter
21
 * Uwe Stieber (Wind River)      - [199032] [api] Remove method acceptContextMenuActionContribution(...) from RSESystemTypeAdapter
22
 * Martin Oberhuber (Wind River) - [218655][api] Provide SystemType enablement info in non-UI
22
 ********************************************************************************/
23
 ********************************************************************************/
23
package org.eclipse.rse.ui;
24
package org.eclipse.rse.ui;
24
25
Lines 32-40 Link Here
32
import org.eclipse.jface.resource.ImageDescriptor;
33
import org.eclipse.jface.resource.ImageDescriptor;
33
import org.eclipse.rse.core.IRSESystemType;
34
import org.eclipse.rse.core.IRSESystemType;
34
import org.eclipse.rse.core.IRSESystemTypeConstants;
35
import org.eclipse.rse.core.IRSESystemTypeConstants;
35
import org.eclipse.rse.core.RSECorePlugin;
36
import org.eclipse.rse.core.RSEPreferencesManager;
36
import org.eclipse.rse.core.RSEPreferencesManager;
37
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
38
import org.eclipse.rse.internal.ui.RSEAdapter;
37
import org.eclipse.rse.internal.ui.RSEAdapter;
39
import org.eclipse.rse.ui.wizards.registries.IRSEWizardDescriptor;
38
import org.eclipse.rse.ui.wizards.registries.IRSEWizardDescriptor;
40
import org.eclipse.ui.IViewPart;
39
import org.eclipse.ui.IViewPart;
Lines 101-110 Link Here
101
     * image file. bundle parameter is used as the base for relative paths and
100
     * image file. bundle parameter is used as the base for relative paths and
102
     * is allowed to be null.
101
     * is allowed to be null.
103
     *
102
     *
104
     * @param value
103
     * @param value the absolute or relative path
105
     *            the absolute or relative path
104
     * @param definingBundle bundle to be used for relative paths (may be null)
106
     * @param definingBundle
107
     *            bundle to be used for relative paths (may be null)
108
     * @return ImageDescriptor
105
     * @return ImageDescriptor
109
     */
106
     */
110
    public static ImageDescriptor getImage(String value, Bundle definingBundle) {
107
    public static ImageDescriptor getImage(String value, Bundle definingBundle) {
Lines 116-125 Link Here
116
	 * Create a URL from the argument absolute or relative path. The bundle parameter is 
113
	 * Create a URL from the argument absolute or relative path. The bundle parameter is 
117
	 * used as the base for relative paths and may be null.
114
	 * used as the base for relative paths and may be null.
118
	 * 
115
	 * 
119
	 * @param value
116
	 * @param value the absolute or relative path
120
	 *            the absolute or relative path
117
	 * @param definingBundle bundle to be used for relative paths (may be null)
121
	 * @param definingBundle
122
	 *            bundle to be used for relative paths (may be null)
123
	 * @return the URL to the resource
118
	 * @return the URL to the resource
124
	 */
119
	 */
125
	public static URL getUrl(String value, Bundle definingBundle) {
120
	public static URL getUrl(String value, Bundle definingBundle) {
Lines 187-212 Link Here
187
	 * @param object the object being adapted, usually a system type.
182
	 * @param object the object being adapted, usually a system type.
188
	 * @return true if that system type is enabled. false if the object is
183
	 * @return true if that system type is enabled. false if the object is
189
	 * not a system type or if it is not enabled.
184
	 * not a system type or if it is not enabled.
185
	 * @deprecated Clients should use {@link IRSESystemType#isEnabled()}, which is
186
	 *     available without UI dependencies, in order to guarantee consistent
187
	 *     availability of system types.
188
	 *     Providers of custom RSESystemTypeAdapter implementations, which override
189
	 *     this method, should move their code to their IRSESystemType implementations.
190
	 */
190
	 */
191
	public boolean isEnabled(Object object) {
191
	public final boolean isEnabled(Object object) {
192
		IRSESystemType systemType = getSystemType(object);
192
		IRSESystemType systemType = getSystemType(object);
193
		if ( systemType != null && RSEPreferencesManager.getIsSystemTypeEnabled(systemType)) {
193
		if (systemType != null) {
194
			// if enabled, check if the system type has any registered subsystems. If
194
			return systemType.isEnabled();
195
			// not, this will auto-disable the system type.
196
			ISubSystemConfigurationProxy[] proxies = RSECorePlugin.getTheSystemRegistry().getSubSystemConfigurationProxies();
197
			for (int i=0; i<proxies.length; i++) {
198
				if (proxies[i].appliesToSystemType(systemType)) {
199
					return true;
200
				}
201
			}
202
		}
195
		}
203
		return false;
196
		return false;
204
	}
197
	}
205
198
206
	/**
199
	/**
207
	 * Sets the enabled state of a particular system type.
200
	 * Sets the enabled state of a particular system type.
201
	 * <p>
202
	 * Note that system types which are provided by extenders via the dynamic
203
	 * sytemTypeProviders extension point may have their own logic to determine
204
	 * whether they are enabled or not, so changing the enabled setting may
205
	 * not work for them.
206
	 *  
208
	 * @param object The system type being adapted.
207
	 * @param object The system type being adapted.
209
	 * @param isEnabled true if the system type is enabled. false if it is not.
208
	 * @param isEnabled true if the system type is enabled. false if it is not.
209
	 * @deprecated Set the enabled state in {@link RSEPreferencesManager} directly
210
	 */
210
	 */
211
	public void setIsEnabled(Object object, boolean isEnabled) {
211
	public void setIsEnabled(Object object, boolean isEnabled) {
212
		IRSESystemType systemType = getSystemType(object);
212
		IRSESystemType systemType = getSystemType(object);
(-)src/org/eclipse/rse/core/IRSESystemType.java (-2 / +19 lines)
Lines 1-5 Link Here
1
/********************************************************************************
1
/********************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others. All rights reserved.
2
 * Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
5
 * available at http://www.eclipse.org/legal/epl-v10.html
5
 * available at http://www.eclipse.org/legal/epl-v10.html
Lines 13-19 Link Here
13
 * Contributors:
13
 * Contributors:
14
 * Uwe Stieber (Wind River) - Extended system type -> subsystemConfiguration association.
14
 * Uwe Stieber (Wind River) - Extended system type -> subsystemConfiguration association.
15
 * Martin Oberhuber (Wind River) - [185098] Provide constants for all well-known system types
15
 * Martin Oberhuber (Wind River) - [185098] Provide constants for all well-known system types
16
 * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() 
16
 * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
17
 * Martin Oberhuber (Wind River) - [218655][api] Provide SystemType enablement info in non-UI
17
 ********************************************************************************/
18
 ********************************************************************************/
18
19
19
package org.eclipse.rse.core;
20
package org.eclipse.rse.core;
Lines 248-253 Link Here
248
	public boolean testProperty(String key, boolean expectedValue);
249
	public boolean testProperty(String key, boolean expectedValue);
249
	
250
	
250
	/**
251
	/**
252
	 * Tests whether the system type is currently enabled.
253
	 * 
254
	 * The enabled state is a dynamic property of a system type, compared to the
255
	 * static configuration by plugin markup. Enablement is a non-UI property,
256
	 * which can be set by a Product in the Preferences or modified by a user
257
	 * to hide certain system types.
258
	 * <p>
259
	 * Implementers of custom system types (which are registered by a SystemTypeProvider)
260
	 * can override this method to provide more advanced enabled checks e.g. based on
261
	 * license availability.
262
	 *   
263
	 * @return <code>true</code> if the system type is currently enabled, or <code>false</code> otherwise.
264
	 */
265
	public boolean isEnabled();
266
267
	/**
251
	 * Tests whether the system type refers to the local system.
268
	 * Tests whether the system type refers to the local system.
252
	 * This is a shortcut for
269
	 * This is a shortcut for
253
	 * <pre> 
270
	 * <pre> 
(-)src/org/eclipse/rse/core/PasswordPersistenceManager.java (-1 / +5 lines)
Lines 1-5 Link Here
1
/********************************************************************************
1
/********************************************************************************
2
 * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
2
 * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
5
 * available at http://www.eclipse.org/legal/epl-v10.html
5
 * available at http://www.eclipse.org/legal/epl-v10.html
Lines 16-21 Link Here
16
 * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
16
 * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
17
 * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
17
 * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
18
 * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() 
18
 * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() 
19
 * Martin Oberhuber (Wind River) - [218655][api] Provide SystemType enablement info in non-UI
19
 ********************************************************************************/
20
 ********************************************************************************/
20
21
21
package org.eclipse.rse.core;
22
package org.eclipse.rse.core;
Lines 94-99 Link Here
94
		public Object getAdapter(Class adapter) {
95
		public Object getAdapter(Class adapter) {
95
			return null;
96
			return null;
96
		}
97
		}
98
		public boolean isEnabled() {
99
			return true;
100
		}
97
	}
101
	}
98
	
102
	
99
	/**
103
	/**
(-)src/org/eclipse/rse/core/AbstractRSESystemType.java (-1 / +21 lines)
Lines 1-5 Link Here
1
/********************************************************************************
1
/********************************************************************************
2
 * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
2
 * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
5
 * available at http://www.eclipse.org/legal/epl-v10.html
5
 * available at http://www.eclipse.org/legal/epl-v10.html
Lines 15-20 Link Here
15
 * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
15
 * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
16
 * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() 
16
 * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() 
17
 * Martin Oberhuber (Wind River) - [186868] Fix IRSESystemType.testProperty() semantics 
17
 * Martin Oberhuber (Wind River) - [186868] Fix IRSESystemType.testProperty() semantics 
18
 * Martin Oberhuber (Wind River) - [218655][api] Provide SystemType enablement info in non-UI
18
 ********************************************************************************/
19
 ********************************************************************************/
19
package org.eclipse.rse.core;
20
package org.eclipse.rse.core;
20
21
Lines 25-30 Link Here
25
import org.eclipse.rse.core.model.Host;
26
import org.eclipse.rse.core.model.Host;
26
import org.eclipse.rse.core.model.IHost;
27
import org.eclipse.rse.core.model.IHost;
27
import org.eclipse.rse.core.model.ISystemProfile;
28
import org.eclipse.rse.core.model.ISystemProfile;
29
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
28
import org.osgi.framework.Bundle;
30
import org.osgi.framework.Bundle;
29
31
30
/**
32
/**
Lines 157-162 Link Here
157
159
158
	/*
160
	/*
159
	 * (non-Javadoc)
161
	 * (non-Javadoc)
162
	 * @see org.eclipse.rse.core.IRSESystemType#isEnabled()
163
	 */
164
	public boolean isEnabled() {
165
		if (RSEPreferencesManager.getIsSystemTypeEnabled(this)) {
166
			// if enabled, check if the system type has any registered subsystems. If
167
			// not, this will auto-disable the system type.
168
			ISubSystemConfigurationProxy[] proxies = RSECorePlugin.getTheSystemRegistry().getSubSystemConfigurationProxies();
169
			for (int i=0; i<proxies.length; i++) {
170
				if (proxies[i].appliesToSystemType(this)) {
171
					return true;
172
				}
173
			}
174
		}
175
		return false;
176
	}
177
178
	/*
179
	 * (non-Javadoc)
160
	 * @see org.eclipse.rse.core.IRSESystemType#isLocal()
180
	 * @see org.eclipse.rse.core.IRSESystemType#isLocal()
161
	 */
181
	 */
162
	public boolean isLocal() {
182
	public boolean isLocal() {

Return to bug 218655