plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/internal/Activator.java
author Eugene Ostroukhov <eugeneo@symbian.org>
Thu, 02 Sep 2010 16:31:16 -0700
changeset 485 df4f55e8569e
parent 484 f5df819c1852
permissions -rw-r--r--
Fixed copyright headers and removed unneeded WRT mentions from TMW code
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
471
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     1
/*******************************************************************************
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     2
 * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     3
 * All rights reserved.
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     5
 * under the terms of the License "Eclipse Public License v1.0"
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     8
 *
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     9
 * Initial Contributors:
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    10
 * Symbian Foundation - initial contribution.
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    11
 * Contributors:
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    12
 * Description:
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    13
 * Overview:
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    14
 * Details:
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    15
 * Platforms/Drives/Compatibility:
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    16
 * Assumptions/Requirement/Pre-requisites:
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    17
 * Failures and causes:
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    18
 *******************************************************************************/
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    19
package org.symbian.tools.tmw.debug.internal;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    20
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    21
import java.util.logging.Level;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    22
import java.util.logging.Logger;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    23
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    24
import org.eclipse.core.runtime.IStatus;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    25
import org.eclipse.core.runtime.Platform;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    26
import org.eclipse.core.runtime.Status;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    27
import org.eclipse.jface.resource.ImageRegistry;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    28
import org.eclipse.ui.plugin.AbstractUIPlugin;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    29
import org.osgi.framework.BundleContext;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    30
import org.symbian.tools.tmw.debug.internal.launch.ChromeInstancesManager;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    31
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    32
/**
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    33
 * The activator class controls the plug-in life cycle
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    34
 */
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    35
public class Activator extends AbstractUIPlugin {
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    36
484
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    37
    // The plug-in ID
485
df4f55e8569e Fixed copyright headers and removed unneeded WRT mentions from TMW code
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 484
diff changeset
    38
    public static final String PLUGIN_ID = "org.symbian.tools.tmw.debug.core";
471
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    39
484
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    40
    public static final boolean DEBUG = Platform.inDebugMode()
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    41
            && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debug"));
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    42
    public static final boolean DEBUG_CONNECTION = DEBUG
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    43
            && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debugConnection"));
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    44
    public static final boolean DEBUG_RESOURCES = DEBUG
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    45
            && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debugResources"));
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    46
    public static final boolean DEBUG_BREAKPOINTS = DEBUG
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    47
            && Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debugBreakpoints"));
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    48
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    49
    // The shared instance
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    50
    private static Activator plugin;
471
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    51
484
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    52
    private final ChromeInstancesManager chromes = new ChromeInstancesManager();
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    53
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    54
    /**
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    55
     * The constructor
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    56
     */
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    57
    public Activator() {
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    58
    }
471
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    59
484
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    60
    /*
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    61
     * (non-Javadoc)
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    62
     * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    63
     */
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    64
    public void start(BundleContext context) throws Exception {
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    65
        super.start(context);
471
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    66
        Logger.getLogger("org.chromium.sdk").setLevel(Level.WARNING);
484
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    67
        plugin = this;
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    68
    }
471
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    69
484
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    70
    /*
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    71
     * (non-Javadoc)
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    72
     * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    73
     */
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    74
    public void stop(BundleContext context) throws Exception {
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    75
        plugin = null;
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    76
        chromes.shutdown();
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    77
        super.stop(context);
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    78
    }
471
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    79
484
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    80
    /**
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    81
     * Returns the shared instance
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    82
     *
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    83
     * @return the shared instance
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    84
     */
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    85
    public static Activator getDefault() {
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    86
        return plugin;
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    87
    }
471
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    88
484
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    89
    public ChromeInstancesManager getChromeInstancesManager() {
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    90
        return chromes;
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    91
    }
471
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    92
484
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    93
    public static void log(Throwable e) {
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    94
        log(e.getLocalizedMessage(), e);
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    95
    }
471
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    96
484
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    97
    private static void log(String message, Throwable exception) {
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    98
        getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
    99
    }
471
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   100
484
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
   101
    @Override
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
   102
    protected void initializeImageRegistry(ImageRegistry reg) {
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
   103
        Images.initImageRegistry(reg);
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
   104
    }
471
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   105
484
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
   106
    public static void log(String message) {
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
   107
        log(message, null);
f5df819c1852 Checkstyle was used to review coding conventions
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 471
diff changeset
   108
    }
471
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   109
}