UML Modeling Layer

com.ibm.xtools.uml.msl.lang
Class ActiveLanguageManager

java.lang.Object
  extended by com.ibm.xtools.uml.msl.lang.ActiveLanguageManager

public class ActiveLanguageManager
extends Object

Public API for working with the Active Language.


Method Summary
static String getActiveLanguage(EObject semanticContext, EObject modelContext)
          Determines the active language.
static String getPersistedLanguageInRootPackage(EObject context)
          Utility method to get the persisted language in the model.
static void setActiveLanguage(String languageId)
          Set the active language.
static void setFirstDescriptorActive()
          Sets the active language to be the derived language descriptor 'First'.
static void setModelDescriptorActive()
          Sets the active language to be the Model descriptor.
static void setPersistedLanguageInRootPackage(EObject context, String languageID, boolean loadLanguageData)
          Persists the language id of the given descriptor in to the root package that owns the given context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getActiveLanguage

public static String getActiveLanguage(EObject semanticContext,
                                       EObject modelContext)
Determines the active language.

Parameters:
semanticContext - - the semantic element that will store the code fragment. Note: This context element will be used by the 'First' language descriptor to determine the 'first' language found.
modelContext - - The context to determine the persisted model language from (Note: this is needed if the current active language is set to be Model)
Returns:
the String identifier for the language that is currently designated as "active" in the tooling environment.

setActiveLanguage

public static void setActiveLanguage(String languageId)
Set the active language.

Parameters:
languageId - The new language to be set as active

setModelDescriptorActive

public static void setModelDescriptorActive()
Sets the active language to be the Model descriptor. This means that the active language will be determined based on the persisted language stored in the root package/model.


setFirstDescriptorActive

public static void setFirstDescriptorActive()
Sets the active language to be the derived language descriptor 'First'. This means that the active language will be determined based on the first language stored in the given semantic context element.


getPersistedLanguageInRootPackage

public static String getPersistedLanguageInRootPackage(EObject context)
Utility method to get the persisted language in the model.

Parameters:
context - The context to find the root package from
Returns:
The persisted language or "" if none exists

setPersistedLanguageInRootPackage

public static void setPersistedLanguageInRootPackage(EObject context,
                                                     String languageID,
                                                     boolean loadLanguageData)
Persists the language id of the given descriptor in to the root package that owns the given context.

Parameters:
context - The context to find the root package from
descriptor - The language descriptor that defines the language to persist. Or null if the persisted language should be removed from the root package.
loadLanguageDefaults - true if the given discriptor's Libraries, profiles, etc should be applied to the root model false if just the language should be persisted

UML Modeling Layer

© Copyright IBM Corp. 2009. All rights reserved.