1 /* |
1 /* |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Definitions for the class ActivateTrace |
|
15 * |
8 * |
16 */ |
9 * Initial Contributors: |
17 |
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Definitions for the class ActivateTrace |
|
15 * |
|
16 */ |
18 |
17 |
19 package com.nokia.s60tools.analyzetool; |
18 package com.nokia.s60tools.analyzetool; |
20 |
19 |
21 import org.eclipse.ui.IStartup; |
20 import org.eclipse.ui.IStartup; |
22 import org.eclipse.core.runtime.*; |
21 import org.eclipse.core.runtime.*; |
23 import com.nokia.s60tools.analyzetool.ui.IActionListener; |
22 import com.nokia.s60tools.analyzetool.ui.IActionListener; |
24 import com.nokia.s60tools.analyzetool.ui.MainView; |
23 import com.nokia.s60tools.analyzetool.ui.MainView; |
25 |
24 |
26 /** |
25 /** |
27 * Checks at plugin startup is trace plugin available |
26 * Checks at plugin startup is trace plugin available and sets MainView trace |
28 * and sets MainView trace actions state |
27 * actions state |
|
28 * |
29 * @author kihe |
29 * @author kihe |
30 * |
30 * |
31 */ |
31 */ |
32 public class ActivateTrace implements IStartup { |
32 public class ActivateTrace implements IStartup { |
33 |
33 |
34 /** |
34 /** |
35 * Check is AnalyzeTool trace plugin registered. |
35 * Check is AnalyzeTool trace plug-in registered. |
36 * |
36 * |
37 * If not registered disables AnalyzeTool trace buttons. |
37 * If not registered disables AnalyzeTool trace buttons. |
38 * |
38 * |
39 * @see org.eclipse.ui.IStartup#earlyStartup() |
39 * @see org.eclipse.ui.IStartup#earlyStartup() |
40 */ |
40 */ |
41 public final void earlyStartup() { |
41 public final void earlyStartup() { |
42 |
42 |
43 //get action listener |
43 // get action listener |
44 final IActionListener listener = Activator.getActionListener(); |
44 final IActionListener listener = Activator.getActionListener(); |
45 |
45 |
46 //get extension registry |
46 // get extension registry |
47 IExtensionRegistry registry = RegistryFactory.getRegistry(); |
47 IExtensionRegistry registry = RegistryFactory.getRegistry(); |
48 if( registry == null ) { |
48 if (registry == null) { |
49 MainView.enableTrace = false; |
49 MainView.enableTrace = false; |
50 if(listener != null) { |
50 if (listener != null) { |
51 listener.disableTraceActions(false); |
51 listener.disableTraceActions(false); |
52 } |
52 } |
53 return; |
53 return; |
54 } |
54 } |
55 |
55 |
56 //get analyzetool extension |
56 // get analyzetool extension |
57 final IExtensionPoint extensionPoint = registry.getExtensionPoint("com.nokia.s60tools.analyzetool.AnalyzeTool"); |
57 final IExtensionPoint extensionPoint = registry |
|
58 .getExtensionPoint("com.nokia.s60tools.analyzetool.AnalyzeTool"); |
58 |
59 |
59 //try find analyzetool trace extension |
60 // try find analyzetool trace extension |
60 IExtension extension = null; |
61 IExtension extension = null; |
61 if( extensionPoint != null ) { |
62 if (extensionPoint != null) { |
62 extension = extensionPoint.getExtension("com.nokia.s60tools.analyzetool.trace.ActivateTrace"); |
63 extension = extensionPoint |
|
64 .getExtension("com.nokia.s60tools.analyzetool.trace.ActivateTrace"); |
63 } |
65 } |
64 |
66 |
65 |
67 // if trace extension found => enable trace buttons in the MainView |
66 |
68 if (extension != null && extension.isValid()) { |
67 //if trace extension found => enable trace buttons in the MainView |
|
68 if(extension != null && extension.isValid()) { |
|
69 MainView.enableTrace = true; |
69 MainView.enableTrace = true; |
70 if(listener != null) { |
70 if (listener != null) { |
71 listener.disableTraceActions(true); |
71 listener.disableTraceActions(true); |
72 } |
72 } |
73 } |
73 } |
74 //no trace extension found => disable trace buttons |
74 // no trace extension found => disable trace buttons |
75 else { |
75 else { |
76 MainView.enableTrace = false; |
76 MainView.enableTrace = false; |
77 if(listener != null) { |
77 if (listener != null) { |
78 listener.disableTraceActions(false); |
78 listener.disableTraceActions(false); |
79 } |
79 } |
80 } |
80 } |
81 |
|
82 } |
81 } |
83 } |
82 } |