1 | package de.uka.ipd.sdq.pcmbench.application; |
2 | |
3 | import java.net.*; |
4 | |
5 | import org.eclipse.core.resources.IWorkspaceRoot; |
6 | import org.eclipse.core.resources.ResourcesPlugin; |
7 | import org.eclipse.core.runtime.*; |
8 | import org.eclipse.jface.resource.*; |
9 | import org.eclipse.ui.application.*; |
10 | import org.eclipse.ui.ide.*; |
11 | import org.eclipse.ui.internal.ide.*; |
12 | import org.eclipse.ui.internal.ide.model.*; |
13 | import org.osgi.framework.*; |
14 | |
15 | /** |
16 | * Methods copied from {@link org.eclipse.ui.internal.ide.IDEWorkbenchAdvisor} |
17 | */ |
18 | @SuppressWarnings("restriction") |
19 | public abstract class WorkbenchAdvisorHack extends WorkbenchAdvisor |
20 | { |
21 | /** |
22 | * Declares all IDE-specific workbench images. This includes both "shared" |
23 | * images (named in {@link IDE.SharedImages}) and internal images (named in |
24 | * {@link org.eclipse.ui.internal.ide.IDEInternalWorkbenchImages}). |
25 | * |
26 | * @see org.eclipse.ui.internal.ide.IDEWorkbenchAdvisor#declareImage |
27 | */ |
28 | protected void declareWorkbenchImages() |
29 | { |
30 | final String ICONS_PATH = "$nl$/icons/full/";//$NON-NLS-1$ |
31 | final String PATH_ELOCALTOOL = ICONS_PATH + "elcl16/"; // Enabled |
32 | // //$NON-NLS-1$ |
33 | |
34 | // toolbar |
35 | // icons. |
36 | final String PATH_DLOCALTOOL = ICONS_PATH + "dlcl16/"; // Disabled |
37 | // //$NON-NLS-1$ |
38 | // //$NON-NLS-1$ |
39 | // toolbar |
40 | // icons. |
41 | final String PATH_ETOOL = ICONS_PATH + "etool16/"; // Enabled toolbar |
42 | // //$NON-NLS-1$ |
43 | // //$NON-NLS-1$ |
44 | // icons. |
45 | final String PATH_DTOOL = ICONS_PATH + "dtool16/"; // Disabled toolbar |
46 | // //$NON-NLS-1$ |
47 | // //$NON-NLS-1$ |
48 | // icons. |
49 | final String PATH_OBJECT = ICONS_PATH + "obj16/"; // Model object |
50 | // //$NON-NLS-1$ |
51 | // //$NON-NLS-1$ |
52 | // icons |
53 | final String PATH_WIZBAN = ICONS_PATH + "wizban/"; // Wizard |
54 | // //$NON-NLS-1$ |
55 | // //$NON-NLS-1$ |
56 | // icons |
57 | |
58 | Bundle ideBundle = Platform.getBundle(IDEWorkbenchPlugin.IDE_WORKBENCH); |
59 | |
60 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC, |
61 | PATH_ETOOL + "build_exec.gif", false); //$NON-NLS-1$ |
62 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC_HOVER, |
63 | PATH_ETOOL + "build_exec.gif", false); //$NON-NLS-1$ |
64 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_ETOOL_BUILD_EXEC_DISABLED, |
65 | PATH_DTOOL + "build_exec.gif", false); //$NON-NLS-1$ |
66 | |
67 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC, |
68 | PATH_ETOOL + "search_src.gif", false); //$NON-NLS-1$ |
69 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC_HOVER, |
70 | PATH_ETOOL + "search_src.gif", false); //$NON-NLS-1$ |
71 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_ETOOL_SEARCH_SRC_DISABLED, |
72 | PATH_DTOOL + "search_src.gif", false); //$NON-NLS-1$ |
73 | |
74 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_ETOOL_NEXT_NAV, PATH_ETOOL |
75 | + "next_nav.gif", false); //$NON-NLS-1$ |
76 | |
77 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_ETOOL_PREVIOUS_NAV, |
78 | PATH_ETOOL + "prev_nav.gif", false); //$NON-NLS-1$ |
79 | |
80 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_WIZBAN_NEWPRJ_WIZ, |
81 | PATH_WIZBAN + "newprj_wiz.png", false); //$NON-NLS-1$ |
82 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_WIZBAN_NEWFOLDER_WIZ, |
83 | PATH_WIZBAN + "newfolder_wiz.png", false); //$NON-NLS-1$ |
84 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_WIZBAN_NEWFILE_WIZ, |
85 | PATH_WIZBAN + "newfile_wiz.png", false); //$NON-NLS-1$ |
86 | |
87 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_WIZBAN_IMPORTDIR_WIZ, |
88 | PATH_WIZBAN + "importdir_wiz.png", false); //$NON-NLS-1$ |
89 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_WIZBAN_IMPORTZIP_WIZ, |
90 | PATH_WIZBAN + "importzip_wiz.png", false); //$NON-NLS-1$ |
91 | |
92 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_WIZBAN_EXPORTDIR_WIZ, |
93 | PATH_WIZBAN + "exportdir_wiz.png", false); //$NON-NLS-1$ |
94 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_WIZBAN_EXPORTZIP_WIZ, |
95 | PATH_WIZBAN + "exportzip_wiz.png", false); //$NON-NLS-1$ |
96 | |
97 | declareWorkbenchImage(ideBundle, |
98 | IDEInternalWorkbenchImages.IMG_WIZBAN_RESOURCEWORKINGSET_WIZ, PATH_WIZBAN |
99 | + "workset_wiz.png", false); //$NON-NLS-1$ |
100 | |
101 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_DLGBAN_SAVEAS_DLG, |
102 | PATH_WIZBAN + "saveas_wiz.png", false); //$NON-NLS-1$ |
103 | |
104 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_DLGBAN_QUICKFIX_DLG, |
105 | PATH_WIZBAN + "quick_fix.png", false); //$NON-NLS-1$ |
106 | |
107 | declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OBJ_PROJECT, PATH_OBJECT |
108 | + "prj_obj.gif", true); //$NON-NLS-1$ |
109 | declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED, PATH_OBJECT |
110 | + "cprj_obj.gif", true); //$NON-NLS-1$ |
111 | declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OPEN_MARKER, PATH_ELOCALTOOL |
112 | + "gotoobj_tsk.gif", true); //$NON-NLS-1$ |
113 | |
114 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_ELCL_QUICK_FIX_ENABLED, |
115 | PATH_ELOCALTOOL + "smartmode_co.gif", true); //$NON-NLS-1$ |
116 | |
117 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_DLCL_QUICK_FIX_DISABLED, |
118 | PATH_DLOCALTOOL + "smartmode_co.gif", true); //$NON-NLS-1$ |
119 | |
120 | // task objects |
121 | // declareRegistryImage(IDEInternalWorkbenchImages.IMG_OBJS_HPRIO_TSK, |
122 | // PATH_OBJECT+"hprio_tsk.gif"); |
123 | // declareRegistryImage(IDEInternalWorkbenchImages.IMG_OBJS_MPRIO_TSK, |
124 | // PATH_OBJECT+"mprio_tsk.gif"); |
125 | // declareRegistryImage(IDEInternalWorkbenchImages.IMG_OBJS_LPRIO_TSK, |
126 | // PATH_OBJECT+"lprio_tsk.gif"); |
127 | |
128 | declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OBJS_TASK_TSK, PATH_OBJECT |
129 | + "taskmrk_tsk.gif", true); //$NON-NLS-1$ |
130 | declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OBJS_BKMRK_TSK, PATH_OBJECT |
131 | + "bkmrk_tsk.gif", true); //$NON-NLS-1$ |
132 | |
133 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_OBJS_COMPLETE_TSK, |
134 | PATH_OBJECT + "complete_tsk.gif", true); //$NON-NLS-1$ |
135 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_OBJS_INCOMPLETE_TSK, |
136 | PATH_OBJECT + "incomplete_tsk.gif", true); //$NON-NLS-1$ |
137 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_OBJS_WELCOME_ITEM, |
138 | PATH_OBJECT + "welcome_item.gif", true); //$NON-NLS-1$ |
139 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_OBJS_WELCOME_BANNER, |
140 | PATH_OBJECT + "welcome_banner.gif", true); //$NON-NLS-1$ |
141 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_OBJS_ERROR_PATH, |
142 | PATH_OBJECT + "error_tsk.gif", true); //$NON-NLS-1$ |
143 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_OBJS_WARNING_PATH, |
144 | PATH_OBJECT + "warn_tsk.gif", true); //$NON-NLS-1$ |
145 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_OBJS_INFO_PATH, PATH_OBJECT |
146 | + "info_tsk.gif", true); //$NON-NLS-1$ |
147 | |
148 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_LCL_FLAT_LAYOUT, |
149 | PATH_ELOCALTOOL + "flatLayout.gif", true); //$NON-NLS-1$ |
150 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_LCL_HIERARCHICAL_LAYOUT, |
151 | PATH_ELOCALTOOL + "hierarchicalLayout.gif", true); //$NON-NLS-1$ |
152 | declareWorkbenchImage(ideBundle, IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEM_CATEGORY, |
153 | PATH_ETOOL + "problem_category.gif", true); //$NON-NLS-1$ |
154 | } |
155 | |
156 | /** |
157 | * Declares an IDE-specific workbench image. |
158 | * |
159 | * @param symbolicName |
160 | * the symbolic name of the image |
161 | * @param path |
162 | * the path of the image file; this path is relative to the base |
163 | * of the IDE plug-in |
164 | * @param shared |
165 | * <code>true</code> if this is a shared image, and |
166 | * <code>false</code> if this is not a shared image |
167 | * @see org.eclipse.ui.internal.ide.IDEWorkbenchAdvisor#declareImage |
168 | */ |
169 | private void declareWorkbenchImage(Bundle ideBundle, String symbolicName, String path, |
170 | boolean shared) |
171 | { |
172 | URL url = FileLocator.find(ideBundle, new Path(path), null); |
173 | ImageDescriptor desc = ImageDescriptor.createFromURL(url); |
174 | getWorkbenchConfigurer().declareImage(symbolicName, desc, shared); |
175 | } |
176 | |
177 | @Override |
178 | public void initialize(IWorkbenchConfigurer configurer) |
179 | { |
180 | configurer.setSaveAndRestore(true); |
181 | declareWorkbenchImages(); |
182 | } |
183 | |
184 | @Override |
185 | public IAdaptable getDefaultPageInput() |
186 | { |
187 | IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); |
188 | return root; |
189 | } |
190 | |
191 | @SuppressWarnings("restriction") |
192 | @Override |
193 | public void preStartup() |
194 | { |
195 | WorkbenchAdapterBuilder.registerAdapters(); |
196 | } |
197 | } |