1
|
package eu.etaxonomy.taxeditor.editor;
|
2
|
|
3
|
import java.net.URL;
|
4
|
|
5
|
import org.eclipse.core.resources.IWorkspace;
|
6
|
import org.eclipse.core.resources.ResourcesPlugin;
|
7
|
import org.eclipse.core.runtime.IAdaptable;
|
8
|
import org.eclipse.jface.resource.ImageDescriptor;
|
9
|
import org.eclipse.ui.application.IWorkbenchConfigurer;
|
10
|
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
|
11
|
import org.eclipse.ui.application.WorkbenchAdvisor;
|
12
|
import org.eclipse.ui.application.WorkbenchWindowAdvisor;
|
13
|
import org.osgi.framework.Bundle;
|
14
|
|
15
|
@SuppressWarnings("restriction")
|
16
|
public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
|
17
|
|
18
|
private static final String PERSPECTIVE_ID = "eu.etaxonomy.taxeditor.editor.perspective";
|
19
|
|
20
|
public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
|
21
|
IWorkbenchWindowConfigurer configurer) {
|
22
|
return new ApplicationWorkbenchWindowAdvisor(configurer);
|
23
|
}
|
24
|
|
25
|
public String getInitialWindowPerspectiveId() {
|
26
|
return PERSPECTIVE_ID;
|
27
|
}
|
28
|
|
29
|
public void initialize(IWorkbenchConfigurer configurer) {
|
30
|
|
31
|
// WorkbenchAdapterBuilder.registerAdapters();
|
32
|
//
|
33
|
// final String ICONS_PATH = "icons/full/";
|
34
|
// final String PATH_OBJECT = ICONS_PATH + "obj16/";
|
35
|
// Bundle ideBundle = Platform.getBundle(IDEWorkbenchPlugin.IDE_WORKBENCH);
|
36
|
// declareWorkbenchImage(configurer, ideBundle,
|
37
|
// IDE.SharedImages.IMG_OBJ_PROJECT, PATH_OBJECT + "prj_obj.gif",
|
38
|
// true);
|
39
|
// declareWorkbenchImage(configurer, ideBundle,
|
40
|
// IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED, PATH_OBJECT
|
41
|
// + "cprj_obj.gif", true);
|
42
|
|
43
|
}
|
44
|
|
45
|
private void declareWorkbenchImage(IWorkbenchConfigurer configurer_p,
|
46
|
Bundle ideBundle, String symbolicName, String path, boolean shared) {
|
47
|
URL url = ideBundle.getEntry(path);
|
48
|
ImageDescriptor desc = ImageDescriptor.createFromURL(url);
|
49
|
configurer_p.declareImage(symbolicName, desc, shared);
|
50
|
}
|
51
|
|
52
|
public IAdaptable getDefaultPageInput() {
|
53
|
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
54
|
return workspace.getRoot();
|
55
|
}
|
56
|
|
57
|
}
|