Lines 7-12
Link Here
|
7 |
* |
7 |
* |
8 |
* Contributors: |
8 |
* Contributors: |
9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
|
|
10 |
* Peter Friese <peter.friese@gentleware.com> - bug 184473 |
10 |
*******************************************************************************/ |
11 |
*******************************************************************************/ |
11 |
package org.eclipse.pde.internal.runtime.logview; |
12 |
package org.eclipse.pde.internal.runtime.logview; |
12 |
|
13 |
|
Lines 15-51
Link Here
|
15 |
import org.eclipse.core.runtime.IPath; |
16 |
import org.eclipse.core.runtime.IPath; |
16 |
import org.eclipse.core.runtime.Path; |
17 |
import org.eclipse.core.runtime.Path; |
17 |
import org.eclipse.jface.action.Action; |
18 |
import org.eclipse.jface.action.Action; |
|
|
19 |
import org.eclipse.jface.text.IDocument; |
18 |
import org.eclipse.pde.internal.runtime.PDERuntimePlugin; |
20 |
import org.eclipse.pde.internal.runtime.PDERuntimePlugin; |
|
|
21 |
import org.eclipse.ui.IEditorPart; |
19 |
import org.eclipse.ui.IWorkbenchPage; |
22 |
import org.eclipse.ui.IWorkbenchPage; |
20 |
import org.eclipse.ui.IWorkbenchWindow; |
23 |
import org.eclipse.ui.IWorkbenchWindow; |
21 |
import org.eclipse.ui.PartInitException; |
24 |
import org.eclipse.ui.PartInitException; |
22 |
import org.eclipse.ui.ide.IDE; |
25 |
import org.eclipse.ui.ide.IDE; |
|
|
26 |
import org.eclipse.ui.texteditor.AbstractTextEditor; |
27 |
import org.eclipse.ui.texteditor.IDocumentProvider; |
28 |
import org.eclipse.ui.texteditor.ITextEditor; |
23 |
|
29 |
|
24 |
/* |
30 |
/* |
25 |
* This action is used to Open the Log File from the LogView if both org.eclipse.ui.ide and |
31 |
* This action is used to Open the Log File from the LogView if both |
26 |
* org.eclipse.core.filesystem are available. If both plugins are resolved, we will open |
32 |
* org.eclipse.ui.ide and org.eclipse.core.filesystem are available. If both |
27 |
* the log file through the IDE's file association preferences. Otherwise, |
33 |
* plugins are resolved, we will open the log file through the IDE's file |
28 |
* LogView.getOpenLogJob() is called to open the file. |
34 |
* association preferences. Otherwise, LogView.getOpenLogJob() is called to open |
|
|
35 |
* the file. |
29 |
*/ |
36 |
*/ |
30 |
public class OpenIDELogFileAction extends Action { |
37 |
public class OpenIDELogFileAction extends Action { |
31 |
|
38 |
|
32 |
private LogView fView; |
39 |
private LogView fView; |
33 |
|
40 |
|
34 |
public OpenIDELogFileAction (LogView logView) { |
41 |
public OpenIDELogFileAction(LogView logView) { |
35 |
fView = logView; |
42 |
fView = logView; |
36 |
} |
43 |
} |
37 |
|
44 |
|
38 |
public void run() { |
45 |
public void run() { |
39 |
IPath logPath = new Path(fView.getLogFile().getAbsolutePath()); |
46 |
IPath logPath = new Path(fView.getLogFile().getAbsolutePath()); |
40 |
IFileStore fileStore= EFS.getLocalFileSystem().getStore(logPath); |
47 |
IFileStore fileStore = EFS.getLocalFileSystem().getStore(logPath); |
41 |
if (!fileStore.fetchInfo().isDirectory() && fileStore.fetchInfo().exists()) { |
48 |
if (!fileStore.fetchInfo().isDirectory() && fileStore.fetchInfo().exists()) { |
42 |
IWorkbenchWindow ww = PDERuntimePlugin.getActiveWorkbenchWindow(); |
49 |
IWorkbenchWindow ww = PDERuntimePlugin.getActiveWorkbenchWindow(); |
43 |
IWorkbenchPage page = ww.getActivePage(); |
50 |
IWorkbenchPage page = ww.getActivePage(); |
44 |
try { |
51 |
try { |
45 |
IDE.openEditorOnFileStore(page, fileStore); |
52 |
IEditorPart editorPart = IDE.openEditorOnFileStore(page, fileStore); |
|
|
53 |
|
54 |
// bug 184473: try to jump right to the end of the file |
55 |
if (!(editorPart instanceof AbstractTextEditor)) |
56 |
return; |
57 |
ITextEditor editor = (ITextEditor) editorPart; |
58 |
IDocumentProvider dp = editor.getDocumentProvider(); |
59 |
IDocument doc = dp.getDocument(editor.getEditorInput()); |
60 |
int offset = doc.getLength(); |
61 |
editor.selectAndReveal(offset, 0); |
46 |
} catch (PartInitException e) { |
62 |
} catch (PartInitException e) { |
47 |
} |
63 |
} |
48 |
} |
64 |
} |
49 |
} |
65 |
} |
50 |
|
|
|
51 |
} |
66 |
} |