trace/tracebuilder/com.nokia.tracebuilder.eclipse/src/com/nokia/tracebuilder/eclipse/PluginStartup.java
author Matti Laitinen <matti.t.laitinen@nokia.com>
Wed, 23 Jun 2010 14:35:40 +0300
changeset 10 ed1c9f64298a
permissions -rw-r--r--
TraceBuilder 2.4.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     1
/*
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     8
*
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    11
*
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    12
* Contributors:
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    13
*
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    14
* Description:
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    15
*
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    16
* The plugin startup class
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    17
*
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    18
*/
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    19
package com.nokia.tracebuilder.eclipse;
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    20
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    21
import org.eclipse.ui.IStartup;
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    22
import org.eclipse.ui.PlatformUI;
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    23
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    24
import com.nokia.tracebuilder.engine.TraceBuilderGlobals;
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    25
import com.nokia.tracebuilder.utils.ConsoleFactory;
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    26
import com.nokia.tracebuilder.utils.DocumentFactory;
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    27
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    28
/**
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    29
 * The plugin startup class
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    30
 * 
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    31
 */
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    32
public class PluginStartup implements IStartup {
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    33
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    34
	/**
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    35
	 * Trace project monitor
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    36
	 */
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    37
	private TraceProjectMonitor projectMonitor;
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    38
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    39
	/**
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    40
	 * Runnable which initializes the project opener
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    41
	 */
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    42
	private final class ProjectOpenerInitRunnable implements Runnable {
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    43
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    44
		/*
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    45
		 * (non-Javadoc)
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    46
		 * 
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    47
		 * @see java.lang.Runnable#run()
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    48
		 */
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    49
		public void run() {
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    50
			if (TraceBuilderGlobals.isViewRegistered()) {
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    51
				projectMonitor.startMonitor();
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    52
			}
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    53
		}
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    54
	}
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    55
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    56
	/*
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    57
	 * (non-Javadoc)
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    58
	 * 
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    59
	 * @see org.eclipse.ui.IStartup#earlyStartup()
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    60
	 */
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    61
	public void earlyStartup() {
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    62
		projectMonitor = new TraceProjectMonitor();
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    63
		TraceBuilderGlobals.setProjectMonitor(projectMonitor);
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    64
		DocumentFactory.registerDocumentFramework(new WorkbenchEditorMonitor(
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    65
				projectMonitor), JFaceDocumentFactory.class);
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    66
		ConsoleFactory.registerConsole(EclipseConsole.class);
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    67
		PlatformUI.getWorkbench().getDisplay().asyncExec(
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    68
				new ProjectOpenerInitRunnable());
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    69
	}
ed1c9f64298a TraceBuilder 2.4.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    70
}