blob: 6d6d04fbd93760e219670d7a167b6a1fc2103871 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
package org.eclipse.help.ui.internal;
/*
* (c) Copyright IBM Corp. 2000, 2002.
* All Rights Reserved.
*/
import org.eclipse.core.runtime.*;
import org.eclipse.help.internal.HelpSystem;
import org.eclipse.help.internal.appserver.WebappManager;
import org.eclipse.help.browser.IBrowser;
import org.eclipse.help.internal.browser.BrowserManager;
import org.eclipse.help.ui.internal.util.*;
import org.eclipse.help.ui.internal.workingset.HelpWorkingSetSynchronizer;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
* This class is a UI plugin. This may need to change to regular
* plugin if the plugin class is moved into the base help.
*/
public class WorkbenchHelpPlugin extends AbstractUIPlugin {
private static WorkbenchHelpPlugin plugin;
private IBrowser browser;
private HelpWorkingSetSynchronizer workingSetListener;
/**
* WorkbenchHelpPlugin constructor. It is called as part of plugin
* activation.
*/
public WorkbenchHelpPlugin(IPluginDescriptor descriptor) {
super(descriptor);
plugin = this;
}
/**
* @return HelpViewerPlugin
*/
public static WorkbenchHelpPlugin getDefault() {
return plugin;
}
/**
* Shuts down this plug-in and discards all plug-in state.
* @exception CoreException if this method fails to shut down
* this plug-in
*/
public void shutdown() throws CoreException {
// stop the web app
WebappManager.stop("help");
BrowserManager.getInstance().closeAll();
if (HelpSystem.getMode() == HelpSystem.MODE_WORKBENCH) {
PlatformUI
.getWorkbench()
.getWorkingSetManager()
.removePropertyChangeListener(
workingSetListener);
HelpSystem.getWorkingSetManager().removePropertyChangeListener(
workingSetListener);
}
super.shutdown();
}
/**
* Called by Platform after loading the plugin
*/
public void startup() {
HelpSystem.setDefaultErrorUtil(new ErrorUtil());
if (HelpSystem.getMode() == HelpSystem.MODE_WORKBENCH) {
// register the working set listener to keep the ui and the help working sets in sych
workingSetListener = new HelpWorkingSetSynchronizer();
PlatformUI
.getWorkbench()
.getWorkingSetManager()
.addPropertyChangeListener(
workingSetListener);
HelpSystem.getWorkingSetManager().addPropertyChangeListener(
workingSetListener);
}
}
public IBrowser getHelpBrowser() {
if (browser == null)
browser = BrowserManager.getInstance().createBrowser();
return browser;
}
public HelpWorkingSetSynchronizer getWorkingSetSynchronizer() {
return workingSetListener;
}
}
|