Project

General

Profile

Download (2.05 KB) Statistics
| Branch: | Tag: | Revision:
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.core.runtime.Platform;
9
import org.eclipse.jface.resource.ImageDescriptor;
10
import org.eclipse.ui.application.IWorkbenchConfigurer;
11
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
12
import org.eclipse.ui.application.WorkbenchAdvisor;
13
import org.eclipse.ui.application.WorkbenchWindowAdvisor;
14
import org.eclipse.ui.ide.IDE;
15
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
16
import org.eclipse.ui.internal.ide.model.WorkbenchAdapterBuilder;
17
import org.osgi.framework.Bundle;
18

    
19
public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
20

    
21
	private static final String PERSPECTIVE_ID = "eu.etaxonomy.taxeditor.editor.perspective";
22

    
23
	public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
24
			IWorkbenchWindowConfigurer configurer) {
25
		return new ApplicationWorkbenchWindowAdvisor(configurer);
26
	}
27

    
28
	public String getInitialWindowPerspectiveId() {
29
		return PERSPECTIVE_ID;
30
	}
31

    
32
	public void initialize(IWorkbenchConfigurer configurer) {
33

    
34
		WorkbenchAdapterBuilder.registerAdapters();
35

    
36
		final String ICONS_PATH = "icons/full/";
37
		final String PATH_OBJECT = ICONS_PATH + "obj16/";
38
		Bundle ideBundle = Platform.getBundle(IDEWorkbenchPlugin.IDE_WORKBENCH);
39
		declareWorkbenchImage(configurer, ideBundle,
40
				IDE.SharedImages.IMG_OBJ_PROJECT, PATH_OBJECT + "prj_obj.gif",
41
				true);
42
		declareWorkbenchImage(configurer, ideBundle,
43
				IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED, PATH_OBJECT
44
						+ "cprj_obj.gif", true);
45

    
46
	}
47

    
48
	private void declareWorkbenchImage(IWorkbenchConfigurer configurer_p,
49
			Bundle ideBundle, String symbolicName, String path, boolean shared) {
50
		URL url = ideBundle.getEntry(path);
51
		ImageDescriptor desc = ImageDescriptor.createFromURL(url);
52
		configurer_p.declareImage(symbolicName, desc, shared);
53
	}
54

    
55
	public IAdaptable getDefaultPageInput() {
56
		IWorkspace workspace = ResourcesPlugin.getWorkspace();
57
		return workspace.getRoot();
58
	}
59

    
60
}
(3-3/6)