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); |