org.netbeans.modules.java.api.common/0 1.37

org.netbeans.modules.java.api.common.ui
Class PlatformUiSupport

java.lang.Object
  extended by org.netbeans.modules.java.api.common.ui.PlatformUiSupport

public final class PlatformUiSupport
extends Object

Support class for JavaPlatform manipulation in project customizer.


Method Summary
static ComboBoxModel createPlatformComboBoxModel(String activePlatform)
          Create a ComboBoxModel of Java platforms.
static ListCellRenderer createPlatformListCellRenderer()
          Create a ListCellRenderer for rendering items of the ComboBoxModel created by the createPlatformComboBoxModel(String) method.
static ComboBoxModel createSourceLevelComboBoxModel(ComboBoxModel platformComboBoxModel, String initialSourceLevel, String initialTargetLevel)
          Exactly like #createSourceLevelComboBoxModel(ComboBoxModel, String, String, JDK) but without any minimal JDK version.
static ComboBoxModel createSourceLevelComboBoxModel(ComboBoxModel platformComboBoxModel, String initialSourceLevel, String initialTargetLevel, SpecificationVersion minimalSpecificationVersion)
          Create ComboBoxModel of source levels for active platform.
static ListCellRenderer createSourceLevelListCellRenderer()
          Create ListCellRenderer for source levels.
static JavaPlatform getPlatform(Object platformKey)
          Return a JavaPlatform for an item obtained from the ComboBoxModel created by the createPlatformComboBoxModel(String) method.
static void storePlatform(EditableProperties props, UpdateHelper helper, String projectConfigurationNamespace, Object platformKey, Object sourceLevelKey)
          Stores active platform, javac.source and javac.target into the project's metadata.
static void storePlatform(EditableProperties props, UpdateHelper helper, String projectConfigurationNamespace, Object platformKey, Object sourceLevelKey, boolean updatePreferredPlatform)
          Stores active platform, javac.source and javac.target into the project's metadata.
static void storePlatform(EditableProperties props, UpdateHelper helper, String projectConfigurationNamespace, String platformName, SpecificationVersion sourceLevel)
          Like #storePlatform(EditableProperties, UpdateHelper, Object, Object), but platform name may be null (in such case the default platform is used).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createPlatformComboBoxModel

public static ComboBoxModel createPlatformComboBoxModel(String activePlatform)
Create a ComboBoxModel of Java platforms. The model listens on the JavaPlatformManager and update its state according to the changes.

Parameters:
activePlatform - the active project's platform, can be null.
Returns:
ComboBoxModel.

createPlatformListCellRenderer

public static ListCellRenderer createPlatformListCellRenderer()
Create a ListCellRenderer for rendering items of the ComboBoxModel created by the createPlatformComboBoxModel(String) method.

Returns:
ListCellRenderer.

storePlatform

public static void storePlatform(EditableProperties props,
                                 UpdateHelper helper,
                                 String projectConfigurationNamespace,
                                 String platformName,
                                 SpecificationVersion sourceLevel)
Like #storePlatform(EditableProperties, UpdateHelper, Object, Object), but platform name may be null (in such case the default platform is used).

Parameters:
props - project's shared properties.
helper - UpdateHelper that is capable to upgrade project metadata if needed.
projectConfigurationNamespace - project configuration namespace.
platformName - platform name to store, can be null.
sourceLevel - specification version to store.

storePlatform

public static void storePlatform(@NonNull
                                 EditableProperties props,
                                 @NonNull
                                 UpdateHelper helper,
                                 @NonNull
                                 String projectConfigurationNamespace,
                                 @NonNull
                                 Object platformKey,
                                 @NullAllowed
                                 Object sourceLevelKey)
Stores active platform, javac.source and javac.target into the project's metadata.

Parameters:
props - project's shared properties
helper - UpdateHelper that is capable to upgrade project metadata if needed.
projectConfigurationNamespace - project configuration namespace.
platformKey - the PlatformKey got from the platform model.
sourceLevelKey - SourceLevelKey representing source level; can be null.

storePlatform

public static void storePlatform(@NonNull
                                 EditableProperties props,
                                 @NonNull
                                 UpdateHelper helper,
                                 @NonNull
                                 String projectConfigurationNamespace,
                                 @NonNull
                                 Object platformKey,
                                 @NullAllowed
                                 Object sourceLevelKey,
                                 boolean updatePreferredPlatform)
Stores active platform, javac.source and javac.target into the project's metadata.

Parameters:
props - project's shared properties
helper - UpdateHelper that is capable to upgrade project metadata if needed.
projectConfigurationNamespace - project configuration namespace.
platformKey - the PlatformKey got from the platform model.
sourceLevelKey - SourceLevelKey representing source level; can be null.
updatePreferredPlatform - if true the PreferredProjectPlatform will be updated
Since:
1.37

getPlatform

public static JavaPlatform getPlatform(Object platformKey)
Return a JavaPlatform for an item obtained from the ComboBoxModel created by the createPlatformComboBoxModel(String) method. This method can return null if the platform is broken.

Parameters:
platformKey - an item obtained from ComboBoxModel created by createPlatformComboBoxModel(String).
Returns:
JavaPlatform or null in case when platform is broken.
Throws:
IllegalArgumentException - if the input parameter is not an object created by platform combobox model.

createSourceLevelComboBoxModel

public static ComboBoxModel createSourceLevelComboBoxModel(ComboBoxModel platformComboBoxModel,
                                                           String initialSourceLevel,
                                                           String initialTargetLevel,
                                                           SpecificationVersion minimalSpecificationVersion)
Create ComboBoxModel of source levels for active platform. The model listens on the platform's ComboBoxModel and update its state according to the changes. It is possible to define minimal JDK version.

Parameters:
platformComboBoxModel - the platform's model used for listenning.
initialSourceLevel - initial source level value, null if unknown.
initialTargetLevel - initial target level value, null if unknown.
minimalSpecificationVersion - minimal JDK version to be displayed. It can be null if all the JDK versions should be displayed (typically for Java SE project).
Returns:
ComboBoxModel of SourceLevelKey.
See Also:
createSourceLevelComboBoxModel(ComboBoxModel, String, String)

createSourceLevelComboBoxModel

public static ComboBoxModel createSourceLevelComboBoxModel(ComboBoxModel platformComboBoxModel,
                                                           String initialSourceLevel,
                                                           String initialTargetLevel)
Exactly like #createSourceLevelComboBoxModel(ComboBoxModel, String, String, JDK) but without any minimal JDK version.

Parameters:
platformComboBoxModel - the platform's model used for listenning.
initialSourceLevel - initial source level value, null if unknown.
initialTargetLevel - initial target level value, null if unknown.
Returns:
ComboBoxModel of SourceLevelKey.
See Also:
#createSourceLevelComboBoxModel(ComboBoxModel, String, String, JDK)

createSourceLevelListCellRenderer

public static ListCellRenderer createSourceLevelListCellRenderer()
Create ListCellRenderer for source levels. This method could be used when highlighting of illegal source levels is needed.

Returns:
ListCellRenderer for source levels.

org.netbeans.modules.java.api.common/0 1.37

Built on May 22 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.