Mobile Tools for Java
Release 1.0

org.eclipse.mtj.core
Class MTJCore

java.lang.Object
  extended by Plugin
      extended by org.eclipse.mtj.core.MTJCore
All Implemented Interfaces:
IMTJCoreConstants

public class MTJCore
extends Plugin
implements IMTJCoreConstants

The main plug-in class to be used in the workbench.

EXPERIMENTAL. This class or interface has been added as part of a work in progress. There is no guarantee that this API will work or that it will remain the same. Please do not use this API without consulting with the MTJ team.

Since:
1.0
Restriction:
This class is not intended to be subclassed by clients.

Field Summary
static IStatus OK_STATUS
          Status code for which a UI prompter is registered.
 
Fields inherited from interface org.eclipse.mtj.core.IMTJCoreConstants
ECLIPSE_ME_NATURE, EMULATION_FOLDER_NAME, ERR_COULD_NOT_FIND_JAR_TOOL, ERR_OBFUSCATION_ERRORS, ERR_OTA_NO_MIDLETS, INFO_DEBUGGER_SETTINGS_CHECK, INFO_NEED_SIGNATURE_PASSWORDS, J2ME_CONFIGURATIONS_ID, J2ME_PREPROCESSED_CONTAINER, J2ME_PREPROCESSED_NATURE_ID, J2ME_PREPROCESSING_NATURE_ID, J2ME_PREPROCESSOR_ID, J2ME_PREVERIFIER_ID, J2ME_PROFILES_ID, J2ME_TOOLKIT_TYPES_ID, JAVAME_MISSING_DEVICE_MARKER, JAVAME_PROBLEM_MARKER, JMUNIT_NATURE_ID, L10N_BUILDER_ID, L10N_NATURE_ID, LAUNCH_FROM_JAD_FOLDER, MANIFEST_FILE_NAME, MIDLET_SUPERCLASS, MTJ_NATURE_ID, MTJ_PROCESS_TYPE, PLUGIN_ID, PREF_ANTENNA_JAR, PREF_AUTO_LAUNCH_MIGRATION, PREF_DEFAULT_PREVERIFIER, PREF_DEPLOYMENT_DIR, PREF_FORCE_JAVA11, PREF_OBFUSCATION_USE_PROJECT, PREF_OTA_AUTODEPLOY, PREF_OTA_PORT, PREF_OTA_PORT_DEFINED, PREF_OTA_SERVER_START_AT_START, PREF_PKG_AUTOVERSION, PREF_PKG_BUILD_XML, PREF_PKG_EXCLUDED_PROPS, PREF_PKG_USE_PROJECT, PREF_PREPROCESS_DEBUG_LEVEL, PREF_PREPROCESS_USE_PROJECT, PREF_PREVERIFY_CONFIG_LOCATION, PREF_PREVERIFY_CONFIG_LOCATION_JAD, PREF_PREVERIFY_CONFIG_LOCATION_PLATFORM, PREF_PREVERIFY_CONFIG_LOCATION_SPECIFIED, PREF_PREVERIFY_CONFIG_VALUE, PREF_PREVERIFY_USE_PROJECT, PREF_PROGUARD_DIR, PREF_PROGUARD_KEEP, PREF_PROGUARD_OPTIONS, PREF_PROGUARD_USE_SPECIFIED, PREF_RESOURCES_DIR, PREF_RMTDBG_INTERVAL, PREF_RMTDBG_TIMEOUT, PREF_USE_RESOURCES_DIR, PREF_VERIFIED_DIR, PREF_WTK_ROOT, PROGUARD_JAR, PROP_DUMP_LAUNCH, RUNTIME_FOLDER_NAME, TEMP_FOLDER_NAME, VERIFIED_FOLDER_NAME
 
Constructor Summary
MTJCore()
          The constructor.
 
Method Summary
static ILibrarySpecification createLibrarySpecification(String identifier, String name, Version version)
           
static IDeviceClasspath createNewDeviceClasspath()
           
static ILibrary createNewLibrary()
          Create a new ILibrary instance.
static IPreverifier createPreverifier(String preverifierType, Object param)
          Create a new Preverifier instance based on the preverifier type.
static MTJCore getDefault()
          Returns the shared instance.
static String getDeploymentDirectoryName()
          Get the deployment directory name the user has specified in the preferences.
static IDeviceFinder getDeviceFinder()
          Return the IDeviceFinder instance that can be used to find for devices in a specific directory.
static IDeviceRegistry getDeviceRegistry()
           
static ILibraryImporter getLibraryImporter(String type)
          Returns a library importer associated to a specific type.
static IMetaData getMetaData(IProject project, ProjectType projectType)
           
static String getPluginVersion()
          Return the current version associated with this plug-in.
static File getProguardJarFile()
          Return the File instance representing the Proguard implementation jar file as defined by the user preferences.
static boolean getProjectBooleanPreference(IProject project, String key)
          Return a boolean preference scoped to the specified project where possible, otherwise falling back to instance scope.
static IEclipsePreferences getProjectPreferences(IProject context)
          Return the preferences that are specific to the project and plugin.
static String getProjectStringPreference(IProject project, String key)
          Return a String preference scoped to the specified project where possible, otherwise falling back to instance scope.
static InputStream getResourceAsStream(IPath path)
          Gets the InputStream for a resource inside the plug-in.
static String getResourcesDirectoryName()
          Get the resources directory name the user has specified in the preferences.
static ISymbolSetFactory getSymbolSetFactory()
          Returns the symbol set registry that can be used to manage the symbols that are saved on the workspace
static ISymbolSetRegistry getSymbolSetRegistry()
          Returns the symbol set registry that can be used to manage the symbols that are saved on the workspace
static String getVerifiedOutputDirectoryName()
          Get the verified output directory name the user has specified in the preferences.
static IWorkspace getWorkspace()
          Returns the workspace instance.
static void log(int severity, String message)
          Log the specified message.
static void log(int severity, String message, Throwable throwable)
          Log the specified message and exception
static void log(int severity, Throwable throwable)
          Log the specified exception.
static IStatus newStatus(int severity, int code, String message)
          Creates a new status object for our plug-in.
static IStatus newStatus(int severity, int code, String message, Throwable exception)
          Creates a new status object for our plug-in.
static void setResourcesAsDerived(IContainer container)
          Recursively set the resources in the specified container and all resources within that container as derived.
 void start(BundleContext context)
           
static Object statusPrompt(IStatus status, Object source)
          Attempt to prompt on a status object.
 void stop(BundleContext context)
           
static void throwCoreException(int severity, int code, String message)
          Throw a new CoreException wrapped around the specified String.
static void throwCoreException(int severity, int code, Throwable exception)
          Throw a new CoreException wrapped around the specified exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OK_STATUS

public static final IStatus OK_STATUS
Status code for which a UI prompter is registered.

Constructor Detail

MTJCore

public MTJCore()
The constructor.

Restriction:
This constructor is not intended to be referenced by clients.
Method Detail

createLibrarySpecification

public static ILibrarySpecification createLibrarySpecification(String identifier,
                                                               String name,
                                                               Version version)
Parameters:
identifier -
name -
version -
Returns:

createNewDeviceClasspath

public static IDeviceClasspath createNewDeviceClasspath()
Returns:

createNewLibrary

public static ILibrary createNewLibrary()
Create a new ILibrary instance.

Returns:
the new ILibrary.

createPreverifier

public static IPreverifier createPreverifier(String preverifierType,
                                             Object param)
                                      throws CoreException
Create a new Preverifier instance based on the preverifier type. Returns null if the preverifier cannot be created for some reason.

Parameters:
preverifierType - type of the preverifier to be created
param - Any parameter that is required by each preverifier type. Please check PreverifierType for information about each type available and the parameters they accept
Returns:
the preverifier instance or null if the preverifier cannot be created for some reason.
Throws:
CoreException - if failed to get the preverifier parameters.

getSymbolSetRegistry

public static ISymbolSetRegistry getSymbolSetRegistry()
Returns the symbol set registry that can be used to manage the symbols that are saved on the workspace

Returns:
symbol set registry

getDeviceFinder

public static IDeviceFinder getDeviceFinder()
Return the IDeviceFinder instance that can be used to find for devices in a specific directory.

Returns:
the IDeviceFinder instance.

getSymbolSetFactory

public static ISymbolSetFactory getSymbolSetFactory()
Returns the symbol set registry that can be used to manage the symbols that are saved on the workspace

Returns:
symbol set registry

getDefault

public static MTJCore getDefault()
Returns the shared instance.


getDeploymentDirectoryName

public static String getDeploymentDirectoryName()
Get the deployment directory name the user has specified in the preferences.

Returns:

getDeviceRegistry

public static IDeviceRegistry getDeviceRegistry()
Returns:

getLibraryImporter

public static ILibraryImporter getLibraryImporter(String type)
Returns a library importer associated to a specific type. The library importer is used to importer the libraries defined by each sdk

Parameters:
type - library importer type
Returns:
library importer

getMetaData

public static IMetaData getMetaData(IProject project,
                                    ProjectType projectType)
Parameters:
project -
Returns:

getPluginVersion

public static String getPluginVersion()
Return the current version associated with this plug-in.

Returns:
the plug-in version

getProguardJarFile

public static File getProguardJarFile()
Return the File instance representing the Proguard implementation jar file as defined by the user preferences. This File is not guaranteed to exist.

Returns:

getProjectBooleanPreference

public static boolean getProjectBooleanPreference(IProject project,
                                                  String key)
Return a boolean preference scoped to the specified project where possible, otherwise falling back to instance scope.

Parameters:
project -
key -
Returns:

getProjectPreferences

public static IEclipsePreferences getProjectPreferences(IProject context)
Return the preferences that are specific to the project and plugin.

Parameters:
context -
Returns:

getProjectStringPreference

public static String getProjectStringPreference(IProject project,
                                                String key)
Return a String preference scoped to the specified project where possible, otherwise falling back to instance scope.

Parameters:
project -
key -
Returns:

getResourceAsStream

public static InputStream getResourceAsStream(IPath path)
Gets the InputStream for a resource inside the plug-in.

Parameters:
path - relative resource path.
Returns:
the resource InputStream.

getResourcesDirectoryName

public static String getResourcesDirectoryName()
Get the resources directory name the user has specified in the preferences. This directory will automatically be added to the emulator classpath when running MIDlets from source.

Returns:

getVerifiedOutputDirectoryName

public static String getVerifiedOutputDirectoryName()
Get the verified output directory name the user has specified in the preferences.

Returns:

getWorkspace

public static IWorkspace getWorkspace()
Returns the workspace instance.


log

public static void log(int severity,
                       String message)
Log the specified message.

Parameters:
severity -
message -

log

public static void log(int severity,
                       String message,
                       Throwable throwable)
Log the specified message and exception

Parameters:
severity -
message -
throwable -

log

public static void log(int severity,
                       Throwable throwable)
Log the specified exception.

Parameters:
severity -
throwable -

newStatus

public static IStatus newStatus(int severity,
                                int code,
                                String message)
Creates a new status object for our plug-in. The created status has no children.

Parameters:
severity - the severity; one of OK, ERROR, INFO, or WARNING
code - the plug-in-specific status code, or OK
message - a human-readable message, localized to the current locale

newStatus

public static IStatus newStatus(int severity,
                                int code,
                                String message,
                                Throwable exception)
Creates a new status object for our plug-in. The created status has no children.

Parameters:
severity - the severity; one of OK, ERROR, INFO, or WARNING
code - the plug-in-specific status code, or OK
message - a human-readable message, localized to the current locale
exception - a low-level exception, or null if not applicable

setResourcesAsDerived

public static void setResourcesAsDerived(IContainer container)
                                  throws CoreException
Recursively set the resources in the specified container and all resources within that container as derived.

Parameters:
container -
Throws:
CoreException

statusPrompt

public static Object statusPrompt(IStatus status,
                                  Object source)
                           throws CoreException
Attempt to prompt on a status object. If prompting fails, a CoreException will be thrown.

Parameters:
status -
source -
Returns:
Throws:
CoreException

throwCoreException

public static void throwCoreException(int severity,
                                      int code,
                                      String message)
                               throws CoreException
Throw a new CoreException wrapped around the specified String.

Parameters:
severity -
code -
message -
Throws:
CoreException

throwCoreException

public static void throwCoreException(int severity,
                                      int code,
                                      Throwable exception)
                               throws CoreException
Throw a new CoreException wrapped around the specified exception.

Parameters:
severity -
code -
exception -
Throws:
CoreException

start

public void start(BundleContext context)
           throws Exception
Throws:
Exception

stop

public void stop(BundleContext context)
          throws Exception
Throws:
Exception

Mobile Tools for Java
Release 1.0