plugins/org.symbian.tools.tmw.core/src/org/symbian/tools/tmw/core/TMWCore.java
author Eugene Ostroukhov <eugeneo@symbian.org>
Thu, 02 Sep 2010 15:18:58 -0700
changeset 484 f5df819c1852
parent 470 d4809db37847
child 485 df4f55e8569e
permissions -rw-r--r--
Checkstyle was used to review coding conventions
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
461
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     1
package org.symbian.tools.tmw.core;
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     2
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     3
import org.eclipse.core.resources.IProject;
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     4
import org.eclipse.core.runtime.IStatus;
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     5
import org.eclipse.core.runtime.Plugin;
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     6
import org.eclipse.core.runtime.Status;
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     7
import org.osgi.framework.BundleContext;
463
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 461
diff changeset
     8
import org.symbian.tools.tmw.core.internal.facets.FProjSupportImpl;
461
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     9
import org.symbian.tools.tmw.core.internal.projects.ProjectsSupportManager;
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    10
import org.symbian.tools.tmw.core.internal.runtimes.RuntimeClasspathManager;
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    11
import org.symbian.tools.tmw.core.internal.runtimes.RuntimesManagerImpl;
463
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 461
diff changeset
    12
import org.symbian.tools.tmw.core.projects.IFProjSupport;
468
a05c6e5cc7d9 Previewer now is TMWed (can support projects with different natures). Note: this commit does not compile. This previewer still only supports WRT libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
    13
import org.symbian.tools.tmw.core.projects.ITMWProject;
461
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    14
import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntimeManager;
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    15
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    16
/**
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    17
 * The activator class controls the plug-in life cycle
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    18
 */
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    19
public class TMWCore extends Plugin {
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    20
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    21
    // The plug-in ID
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    22
    public static final String PLUGIN_ID = "org.symbian.tools.tmw.core"; //$NON-NLS-1$
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    23
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    24
    // The shared instance
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    25
    private static TMWCore plugin;
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    26
463
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 461
diff changeset
    27
    private IFProjSupport fprojSupport;
461
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    28
    private IMobileWebRuntimeManager runtimesManager;
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    29
    private ProjectsSupportManager projectsSupport;
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    30
    private RuntimeClasspathManager classpathManager;
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    31
484
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
    32
    public static final String CORE_FACET = "tmw.core";
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
    33
461
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    34
    /*
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    35
     * (non-Javadoc)
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    36
     * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    37
     */
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    38
    public void start(BundleContext context) throws Exception {
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    39
        super.start(context);
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    40
        plugin = this;
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    41
        runtimesManager = new RuntimesManagerImpl();
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    42
        projectsSupport = new ProjectsSupportManager();
463
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 461
diff changeset
    43
        fprojSupport = new FProjSupportImpl();
461
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    44
        classpathManager = new RuntimeClasspathManager();
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    45
    }
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    46
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    47
    /*
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    48
     * (non-Javadoc)
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    49
     * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    50
     */
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    51
    public void stop(BundleContext context) throws Exception {
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    52
        plugin = null;
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    53
        super.stop(context);
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    54
    }
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    55
463
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 461
diff changeset
    56
    public static IMobileWebRuntimeManager getRuntimesManager() {
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 461
diff changeset
    57
        return getDefault().runtimesManager;
461
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    58
    }
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    59
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    60
    public RuntimeClasspathManager getClasspathManager() {
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    61
        return classpathManager;
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    62
    }
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    63
468
a05c6e5cc7d9 Previewer now is TMWed (can support projects with different natures). Note: this commit does not compile. This previewer still only supports WRT libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 463
diff changeset
    64
    public static ITMWProject create(IProject project) {
463
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 461
diff changeset
    65
        return getDefault().projectsSupport.create(project);
461
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    66
    }
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    67
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    68
    /**
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    69
     * Returns the shared instance
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    70
     *
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    71
     * @return the shared instance
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    72
     */
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    73
    public static TMWCore getDefault() {
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    74
        return plugin;
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    75
    }
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    76
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    77
    public static void log(String message, Exception exception) {
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    78
        getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    79
    }
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    80
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    81
    public static void log(String message, Object... args) {
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    82
        log(String.format(message, args), (Exception) null);
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    83
    }
463
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 461
diff changeset
    84
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 461
diff changeset
    85
    public static IFProjSupport getFProjSupport() {
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 461
diff changeset
    86
        return getDefault().fprojSupport;
aea4c83725d8 Project template work-in-progress
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 461
diff changeset
    87
    }
461
7a8f9fa8d278 Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    88
}