Commit | Line | Data |
---|---|---|
76fccfb0 | 1 | /********************************************************************** |
9d2e08b9 | 2 | * Copyright (c) 2013, 2014 Ericsson, École Polytechnique de Montréal |
76fccfb0 MK |
3 | * |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Matthew Khouzam - Initial API and implementation | |
67c53011 | 11 | * Patrick Tasse - Update open trace and add open experiment |
9d2e08b9 | 12 | * Geneviève Bastien - Merge methods to open trace and experiments |
1aec2e92 | 13 | * Bernd Hufmann - Updated handling of directory traces |
76fccfb0 MK |
14 | **********************************************************************/ |
15 | ||
16 | package org.eclipse.linuxtools.tmf.ui.project.model; | |
17 | ||
18 | import java.io.File; | |
19 | import java.util.List; | |
20 | ||
21 | import org.eclipse.core.resources.IFile; | |
22 | import org.eclipse.core.resources.IFolder; | |
76fccfb0 | 23 | import org.eclipse.core.resources.IResource; |
76fccfb0 MK |
24 | import org.eclipse.core.runtime.CoreException; |
25 | import org.eclipse.core.runtime.IPath; | |
26 | import org.eclipse.core.runtime.IStatus; | |
27 | import org.eclipse.core.runtime.Path; | |
28 | import org.eclipse.core.runtime.Status; | |
89730b51 | 29 | import org.eclipse.core.runtime.URIUtil; |
09b9832c | 30 | import org.eclipse.jface.util.OpenStrategy; |
76fccfb0 MK |
31 | import org.eclipse.linuxtools.internal.tmf.ui.Activator; |
32 | import org.eclipse.linuxtools.internal.tmf.ui.project.model.TmfImportHelper; | |
89730b51 | 33 | import org.eclipse.linuxtools.tmf.core.TmfCommonConstants; |
76fccfb0 MK |
34 | import org.eclipse.linuxtools.tmf.core.event.ITmfEvent; |
35 | import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException; | |
47aafe74 | 36 | import org.eclipse.linuxtools.tmf.core.project.model.TmfTraceImportException; |
1aec2e92 | 37 | import org.eclipse.linuxtools.tmf.core.project.model.TmfTraceType; |
47aafe74 | 38 | import org.eclipse.linuxtools.tmf.core.project.model.TraceTypeHelper; |
76fccfb0 | 39 | import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace; |
67c53011 | 40 | import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment; |
76fccfb0 MK |
41 | import org.eclipse.linuxtools.tmf.ui.editors.TmfEditorInput; |
42 | import org.eclipse.linuxtools.tmf.ui.editors.TmfEventsEditor; | |
9d2e08b9 | 43 | import org.eclipse.osgi.util.NLS; |
76fccfb0 MK |
44 | import org.eclipse.swt.widgets.Display; |
45 | import org.eclipse.swt.widgets.MessageBox; | |
46 | import org.eclipse.swt.widgets.Shell; | |
47 | import org.eclipse.ui.IEditorInput; | |
48 | import org.eclipse.ui.IEditorPart; | |
371536f0 | 49 | import org.eclipse.ui.IEditorReference; |
eb271b88 | 50 | import org.eclipse.ui.IReusableEditor; |
76fccfb0 MK |
51 | import org.eclipse.ui.IWorkbench; |
52 | import org.eclipse.ui.IWorkbenchPage; | |
53 | import org.eclipse.ui.PartInitException; | |
54 | import org.eclipse.ui.PlatformUI; | |
55 | import org.eclipse.ui.ide.IDE; | |
56 | import org.eclipse.ui.part.FileEditorInput; | |
57 | ||
58 | /** | |
59 | * Open trace helper | |
60 | * | |
61 | * Helper class for opening trace resources and loading them to a tracing | |
62 | * project. | |
63 | * | |
64 | * @author Matthew Khouzam | |
65 | * @since 2.1 | |
66 | */ | |
67 | public class TmfOpenTraceHelper { | |
68 | ||
977ca87f PT |
69 | private TmfOpenTraceHelper() { |
70 | } | |
71 | ||
76fccfb0 MK |
72 | private static final String ENDL = System.getProperty("line.separator"); //$NON-NLS-1$ |
73 | ||
74 | /** | |
977ca87f PT |
75 | * Opens a trace from a path while importing it to the destination folder. |
76 | * The trace is linked as a resource. | |
76fccfb0 | 77 | * |
977ca87f PT |
78 | * @param destinationFolder |
79 | * The destination trace folder | |
76fccfb0 MK |
80 | * @param path |
81 | * the file to import | |
82 | * @param shell | |
83 | * the shell to use for dialogs | |
84 | * @return IStatus OK if successful | |
85 | * @throws CoreException | |
86 | * core exceptions if something is not well set up in the back | |
87 | * end | |
977ca87f | 88 | * @since 3.0 |
76fccfb0 | 89 | */ |
977ca87f PT |
90 | public static IStatus openTraceFromPath(TmfTraceFolder destinationFolder, String path, Shell shell) throws CoreException { |
91 | return openTraceFromPath(destinationFolder, path, shell, null); | |
4958a213 MK |
92 | } |
93 | ||
94 | /** | |
977ca87f PT |
95 | * Opens a trace from a path while importing it to the destination folder. |
96 | * The trace is linked as a resource. | |
4958a213 | 97 | * |
977ca87f PT |
98 | * @param destinationFolder |
99 | * The destination trace folder | |
4958a213 MK |
100 | * @param path |
101 | * the file to import | |
102 | * @param shell | |
103 | * the shell to use for dialogs | |
104 | * @param tracetypeHint | |
105 | * The trace type id, can be null | |
106 | * @return IStatus OK if successful | |
107 | * @throws CoreException | |
108 | * core exceptions if something is not well set up in the back | |
109 | * end | |
110 | * | |
977ca87f | 111 | * @since 3.0 |
4958a213 | 112 | */ |
977ca87f | 113 | public static IStatus openTraceFromPath(TmfTraceFolder destinationFolder, String path, Shell shell, String tracetypeHint) throws CoreException { |
1aec2e92 | 114 | final String pathToUse = checkTracePath(path); |
76fccfb0 MK |
115 | TraceTypeHelper traceTypeToSet = null; |
116 | try { | |
1aec2e92 | 117 | traceTypeToSet = TmfTraceTypeUIUtils.selectTraceType(pathToUse, null, tracetypeHint); |
76fccfb0 MK |
118 | } catch (TmfTraceImportException e) { |
119 | MessageBox mb = new MessageBox(shell); | |
120 | mb.setMessage(e.getMessage()); | |
121 | mb.open(); | |
122 | return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage()); | |
123 | } | |
1aec2e92 | 124 | |
977ca87f | 125 | IFolder folder = destinationFolder.getResource(); |
1aec2e92 BH |
126 | String traceName = getTraceName(pathToUse, folder); |
127 | if (traceExists(pathToUse, folder)) { | |
977ca87f | 128 | return openTraceFromFolder(destinationFolder, traceName); |
76fccfb0 | 129 | } |
1aec2e92 | 130 | final IPath pathString = Path.fromOSString(pathToUse); |
76fccfb0 | 131 | IResource linkedTrace = TmfImportHelper.createLink(folder, pathString, traceName); |
d3e89107 BH |
132 | |
133 | if (linkedTrace == null || !linkedTrace.exists()) { | |
134 | return new Status(IStatus.ERROR, Activator.PLUGIN_ID, | |
135 | Messages.TmfOpenTraceHelper_LinkFailed); | |
136 | } | |
137 | ||
1aec2e92 | 138 | String sourceLocation = URIUtil.toUnencodedString(pathString.toFile().toURI()); |
89730b51 PT |
139 | linkedTrace.setPersistentProperty(TmfCommonConstants.SOURCE_LOCATION, sourceLocation); |
140 | ||
d3e89107 BH |
141 | // No trace type was determined. |
142 | if (traceTypeToSet == null) { | |
143 | return Status.OK_STATUS; | |
144 | } | |
145 | ||
a6e37e4c | 146 | IStatus ret = TmfTraceTypeUIUtils.setTraceType(linkedTrace, traceTypeToSet); |
d3e89107 | 147 | if (ret.isOK()) { |
977ca87f | 148 | ret = openTraceFromFolder(destinationFolder, traceName); |
76fccfb0 | 149 | } |
d3e89107 | 150 | return ret; |
76fccfb0 MK |
151 | } |
152 | ||
1aec2e92 BH |
153 | /** |
154 | * Checks whether the parent or grandparent of given path to a file is a | |
155 | * valid directory trace. If it is a directory trace then return the parent | |
156 | * or grandparent path. | |
157 | * | |
158 | * @param path | |
159 | * the path to check | |
160 | * @return path to use for trace type validation. | |
161 | */ | |
162 | private static String checkTracePath(String path) { | |
163 | File file = new File(path); | |
164 | if (file.exists() && !file.isDirectory()) { | |
165 | // First check parent | |
166 | File parent = file.getParentFile(); | |
167 | String pathToUse = parent.getAbsolutePath(); | |
a4a116c3 | 168 | if (TmfTraceType.isDirectoryTrace(pathToUse)) { |
1aec2e92 BH |
169 | return pathToUse; |
170 | } | |
171 | // Second check grandparent | |
172 | File grandParent = parent.getParentFile(); | |
173 | if (grandParent != null) { | |
174 | pathToUse = grandParent.getAbsolutePath(); | |
a4a116c3 | 175 | if (TmfTraceType.isDirectoryTrace(pathToUse)) { |
1aec2e92 BH |
176 | return pathToUse; |
177 | } | |
178 | } | |
179 | } | |
180 | return path; | |
181 | } | |
182 | ||
977ca87f PT |
183 | private static boolean traceExists(String path, IFolder folder) { |
184 | String val = getTraceName(path, folder); | |
76fccfb0 MK |
185 | return (folder.findMember(val) != null); |
186 | } | |
187 | ||
977ca87f PT |
188 | private static boolean isWrongMember(IFolder folder, String name, final File traceFile) { |
189 | final IResource candidate = folder.findMember(name); | |
76fccfb0 MK |
190 | if (candidate != null) { |
191 | final IPath rawLocation = candidate.getRawLocation(); | |
192 | final File file = rawLocation.toFile(); | |
193 | return !file.equals(traceFile); | |
194 | } | |
195 | return false; | |
196 | } | |
197 | ||
198 | /** | |
199 | * Gets the display name, either "filename" or "filename(n)" if there is | |
977ca87f | 200 | * already a filename existing where n is the next unused integer starting |
76fccfb0 MK |
201 | * from 2 |
202 | * | |
977ca87f PT |
203 | * @param path |
204 | * the file path | |
76fccfb0 MK |
205 | * @param folder |
206 | * the folder to import to | |
207 | * @return the filename | |
208 | */ | |
977ca87f PT |
209 | private static String getTraceName(String path, IFolder folder) { |
210 | String name; | |
211 | final File traceFile = new File(path); | |
212 | name = traceFile.getName(); | |
213 | for (int i = 2; isWrongMember(folder, name, traceFile); i++) { | |
214 | name = traceFile.getName() + '(' + i + ')'; | |
76fccfb0 | 215 | } |
977ca87f | 216 | return name; |
76fccfb0 MK |
217 | } |
218 | ||
219 | /** | |
977ca87f | 220 | * Open a trace from a trace folder |
76fccfb0 | 221 | * |
977ca87f PT |
222 | * @param destinationFolder |
223 | * The destination trace folder | |
76fccfb0 MK |
224 | * @param traceName |
225 | * the trace name | |
226 | * @return success or error | |
977ca87f | 227 | * @since 3.0 |
76fccfb0 | 228 | */ |
977ca87f PT |
229 | private static IStatus openTraceFromFolder(TmfTraceFolder destinationFolder, String traceName) { |
230 | final List<ITmfProjectModelElement> elements = destinationFolder.getChildren(); | |
231 | TmfTraceElement traceElement = null; | |
232 | for (ITmfProjectModelElement element : elements) { | |
233 | if (element instanceof TmfTraceElement && element.getName().equals(traceName)) { | |
234 | traceElement = (TmfTraceElement) element; | |
76fccfb0 MK |
235 | } |
236 | } | |
977ca87f | 237 | if (traceElement == null) { |
9d2e08b9 | 238 | return new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(Messages.TmfOpenTraceHelper_TraceNotFound, traceName)); |
76fccfb0 | 239 | } |
977ca87f | 240 | openTraceFromElement(traceElement); |
67c53011 | 241 | return Status.OK_STATUS; |
76fccfb0 MK |
242 | } |
243 | ||
9d2e08b9 GB |
244 | private static ITmfTrace openTraceElement(final TmfTraceElement traceElement) { |
245 | final ITmfTrace trace = traceElement.instantiateTrace(); | |
246 | final ITmfEvent traceEvent = traceElement.instantiateEvent(); | |
247 | if ((trace == null) || (traceEvent == null)) { | |
248 | TraceUtils.displayErrorMsg(NLS.bind(Messages.TmfOpenTraceHelper_OpenElement, traceElement.getTypeName()), | |
2d2397a6 | 249 | Messages.TmfOpenTraceHelper_NoTraceType); |
9d2e08b9 GB |
250 | if (trace != null) { |
251 | trace.dispose(); | |
252 | } | |
253 | return null; | |
254 | } | |
67c53011 | 255 | |
67c53011 | 256 | try { |
f06ca6d0 | 257 | trace.initTrace(traceElement.getResource(), traceElement.getResource().getLocation().toOSString(), traceEvent.getClass(), traceElement.getElementPath()); |
9d2e08b9 GB |
258 | } catch (final TmfTraceException e) { |
259 | TraceUtils.displayErrorMsg(NLS.bind(Messages.TmfOpenTraceHelper_OpenElement, traceElement.getTypeName()), | |
260 | Messages.TmfOpenTraceHelper_InitError + ENDL + ENDL + e); | |
261 | trace.dispose(); | |
262 | return null; | |
67c53011 | 263 | } |
9d2e08b9 GB |
264 | return trace; |
265 | } | |
67c53011 | 266 | |
deaae6e1 | 267 | private static ITmfTrace openExperimentElement(final TmfExperimentElement experimentElement) { |
9d2e08b9 GB |
268 | /* Experiment element now has an experiment type associated with it */ |
269 | final TmfExperiment experiment = experimentElement.instantiateTrace(); | |
270 | if (experiment == null) { | |
271 | TraceUtils.displayErrorMsg(NLS.bind(Messages.TmfOpenTraceHelper_OpenElement, experimentElement.getTypeName()), | |
272 | NLS.bind(Messages.TmfOpenTraceHelper_NoTraceOrExperimentType, experimentElement.getTypeName())); | |
273 | return null; | |
67c53011 PT |
274 | } |
275 | ||
9d2e08b9 GB |
276 | // Instantiate the experiment's traces |
277 | final List<TmfTraceElement> traceEntries = experimentElement.getTraces(); | |
278 | int cacheSize = Integer.MAX_VALUE; | |
279 | final ITmfTrace[] traces = new ITmfTrace[traceEntries.size()]; | |
280 | for (int i = 0; i < traceEntries.size(); i++) { | |
281 | TmfTraceElement element = traceEntries.get(i); | |
76fccfb0 | 282 | |
9d2e08b9 GB |
283 | // Since trace is under an experiment, use the original trace from |
284 | // the traces folder | |
285 | element = element.getElementUnderTraceFolder(); | |
76fccfb0 | 286 | |
9d2e08b9 GB |
287 | ITmfTrace trace = openTraceElement(element); |
288 | ||
289 | if (trace == null) { | |
290 | for (int j = 0; j < i; j++) { | |
291 | traces[j].dispose(); | |
76fccfb0 | 292 | } |
9d2e08b9 GB |
293 | return null; |
294 | } | |
295 | cacheSize = Math.min(cacheSize, trace.getCacheSize()); | |
76fccfb0 | 296 | |
9d2e08b9 GB |
297 | traces[i] = trace; |
298 | } | |
76fccfb0 | 299 | |
9d2e08b9 GB |
300 | // Create the experiment |
301 | experiment.initExperiment(ITmfEvent.class, experimentElement.getName(), traces, cacheSize, experimentElement.getResource()); | |
9d2e08b9 GB |
302 | |
303 | return experiment; | |
304 | } | |
305 | ||
deaae6e1 | 306 | private static ITmfTrace openProjectElement(final TmfCommonProjectElement element) { |
9d2e08b9 GB |
307 | ITmfTrace trace = null; |
308 | if (element instanceof TmfTraceElement) { | |
309 | trace = openTraceElement((TmfTraceElement) element); | |
310 | } else if (element instanceof TmfExperimentElement) { | |
deaae6e1 | 311 | trace = openExperimentElement((TmfExperimentElement) element); |
9d2e08b9 GB |
312 | } |
313 | return trace; | |
67c53011 PT |
314 | } |
315 | ||
316 | /** | |
9d2e08b9 GB |
317 | * Open a trace (or experiment) from a project element. If the trace is already opened, its |
318 | * editor is activated and brought to top. | |
67c53011 | 319 | * |
9d2e08b9 GB |
320 | * @param traceElement |
321 | * the {@link TmfTraceElement} to open | |
322 | * @since 3.0 | |
67c53011 | 323 | */ |
9d2e08b9 | 324 | public static void openTraceFromElement(final TmfCommonProjectElement traceElement) { |
67c53011 PT |
325 | |
326 | final IFile file; | |
327 | try { | |
9d2e08b9 | 328 | file = traceElement.createBookmarksFile(); |
67c53011 | 329 | } catch (final CoreException e) { |
9d2e08b9 GB |
330 | Activator.getDefault().logError(NLS.bind(Messages.TmfOpenTraceHelper_ErrorOpeningElement, traceElement.getTypeName()) + ' ' + traceElement.getName()); |
331 | TraceUtils.displayErrorMsg(NLS.bind(Messages.TmfOpenTraceHelper_OpenElement, traceElement.getTypeName()), | |
332 | NLS.bind(Messages.TmfOpenTraceHelper_ErrorElement, traceElement.getTypeName()) + ENDL + ENDL + e.getMessage()); | |
67c53011 PT |
333 | return; |
334 | } | |
335 | ||
336 | final IWorkbench wb = PlatformUI.getWorkbench(); | |
337 | final IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage(); | |
371536f0 | 338 | final IEditorPart editor = findEditor(new FileEditorInput(file), true); |
67c53011 PT |
339 | if (editor != null) { |
340 | activePage.activate(editor); | |
341 | return; | |
342 | } | |
343 | ||
09b9832c BH |
344 | // If a trace type is not set then delegate it to the eclipse platform |
345 | if ((traceElement instanceof TmfTraceElement) && (traceElement.getResource() instanceof IFile) && (traceElement.getTraceType() == null)) { | |
346 | try { | |
347 | boolean activate = OpenStrategy.activateOnOpen(); | |
348 | // only local open is supported | |
349 | IDE.openEditor(activePage, file, activate); | |
350 | } catch (PartInitException e) { | |
351 | TraceUtils.displayErrorMsg(NLS.bind(Messages.TmfOpenTraceHelper_OpenElement, traceElement.getTypeName()), | |
352 | NLS.bind(Messages.TmfOpenTraceHelper_ErrorOpeningElement, traceElement.getElementPath()) + ENDL + ENDL + e.getMessage()); | |
353 | } | |
354 | return; | |
355 | } | |
356 | ||
67c53011 PT |
357 | Thread thread = new Thread() { |
358 | @Override | |
359 | public void run() { | |
deaae6e1 | 360 | final ITmfTrace trace = openProjectElement(traceElement); |
09b9832c | 361 | |
9d2e08b9 GB |
362 | if (trace == null) { |
363 | return; | |
67c53011 PT |
364 | } |
365 | ||
9d2e08b9 GB |
366 | // Get the editor id from the extension point |
367 | String traceEditorId = traceElement.getEditorId(); | |
368 | final String editorId = (traceEditorId != null) ? traceEditorId : TmfEventsEditor.ID; | |
369 | final IEditorInput editorInput = new TmfEditorInput(file, trace); | |
67c53011 PT |
370 | |
371 | Display.getDefault().asyncExec(new Runnable() { | |
372 | @Override | |
373 | public void run() { | |
374 | try { | |
375 | activePage.openEditor(editorInput, editorId); | |
376 | IDE.setDefaultEditor(file, editorId); | |
377 | // editor should dispose the trace on close | |
378 | } catch (final PartInitException e) { | |
9d2e08b9 GB |
379 | TraceUtils.displayErrorMsg(NLS.bind(Messages.TmfOpenTraceHelper_OpenElement, traceElement.getTypeName()), |
380 | NLS.bind(Messages.TmfOpenTraceHelper_ErrorOpeningElement, traceElement.getTypeName()) + ENDL + ENDL + e.getMessage()); | |
381 | Activator.getDefault().logError(NLS.bind(Messages.TmfOpenTraceHelper_ErrorOpeningElement, traceElement.getTypeName()) + ' ' + traceElement.getName()); | |
382 | trace.dispose(); | |
67c53011 PT |
383 | } |
384 | } | |
385 | }); | |
386 | } | |
387 | }; | |
388 | thread.start(); | |
76fccfb0 MK |
389 | } |
390 | ||
371536f0 | 391 | /** |
4958a213 MK |
392 | * Returns the editor with the specified input. Returns null if there is no |
393 | * opened editor with that input. If restore is requested, the method finds | |
394 | * and returns the editor even if it is not restored yet after a restart. | |
395 | * | |
396 | * @param input | |
397 | * the editor input | |
398 | * @param restore | |
399 | * true if the editor should be restored | |
400 | * @return an editor with input equals to <code>input</code> | |
401 | */ | |
371536f0 PT |
402 | private static IEditorPart findEditor(IEditorInput input, boolean restore) { |
403 | final IWorkbench wb = PlatformUI.getWorkbench(); | |
404 | final IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage(); | |
405 | for (IEditorReference editorReference : activePage.getEditorReferences()) { | |
406 | try { | |
407 | IEditorInput editorInput = editorReference.getEditorInput(); | |
408 | if (editorInput.equals(input)) { | |
409 | return editorReference.getEditor(restore); | |
410 | } | |
411 | } catch (PartInitException e) { | |
412 | } | |
413 | } | |
414 | return null; | |
4958a213 | 415 | } |
371536f0 | 416 | |
eb271b88 | 417 | /** |
9d2e08b9 GB |
418 | * Reopen a trace or experiment from a project element in the provided |
419 | * editor | |
eb271b88 PT |
420 | * |
421 | * @param traceElement | |
422 | * the {@link TmfTraceElement} to open | |
423 | * @param editor | |
424 | * the reusable editor | |
9d2e08b9 | 425 | * @since 3.0 |
eb271b88 | 426 | */ |
9d2e08b9 | 427 | public static void reopenTraceFromElement(final TmfCommonProjectElement traceElement, final IReusableEditor editor) { |
eb271b88 PT |
428 | |
429 | final IFile file; | |
430 | try { | |
431 | file = traceElement.createBookmarksFile(); | |
432 | } catch (final CoreException e) { | |
9d2e08b9 GB |
433 | Activator.getDefault().logError(NLS.bind(Messages.TmfOpenTraceHelper_ErrorOpeningElement, traceElement.getTypeName()) + ' ' + traceElement.getName()); |
434 | TraceUtils.displayErrorMsg(NLS.bind(Messages.TmfOpenTraceHelper_OpenElement, traceElement.getTypeName()), | |
435 | NLS.bind(Messages.TmfOpenTraceHelper_ErrorElement, traceElement.getTypeName()) + ENDL + ENDL + e.getMessage()); | |
eb271b88 PT |
436 | return; |
437 | } | |
438 | ||
439 | Thread thread = new Thread() { | |
440 | @Override | |
441 | public void run() { | |
442 | ||
deaae6e1 | 443 | final ITmfTrace trace = openProjectElement(traceElement); |
9d2e08b9 | 444 | if (trace == null) { |
eb271b88 PT |
445 | return; |
446 | } | |
447 | ||
448 | final IEditorInput editorInput = new TmfEditorInput(file, trace); | |
449 | ||
450 | Display.getDefault().asyncExec(new Runnable() { | |
451 | @Override | |
452 | public void run() { | |
453 | final IWorkbench wb = PlatformUI.getWorkbench(); | |
454 | final IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage(); | |
455 | activePage.reuseEditor(editor, editorInput); | |
456 | activePage.activate(editor); | |
457 | } | |
458 | }); | |
459 | } | |
460 | }; | |
461 | thread.start(); | |
462 | } | |
463 | ||
76fccfb0 | 464 | } |