Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Pazderski2020-05-24 18:39:08 +0000
committerPaul Pazderski2020-06-30 15:59:58 +0000
commitf624f1e041e6e85acf4d750fd92b5d08c5cca71a (patch)
tree234d2999879c72e38b84221925faf0567a08121c /org.eclipse.debug.ui/ui/org
parent57d79764eaace00697da31d84379a04ff27042c0 (diff)
downloadeclipse.platform.debug-f624f1e041e6e85acf4d750fd92b5d08c5cca71a.tar.gz
eclipse.platform.debug-f624f1e041e6e85acf4d750fd92b5d08c5cca71a.tar.xz
eclipse.platform.debug-f624f1e041e6e85acf4d750fd92b5d08c5cca71a.zip
Bug 563752 - [console] FileLink with offset need line number which is
ignored FileLink can be created with offset+length or line number to be selected once the link is activated. All of those position parameters are optional and there is no reason to specify offset+length and line number on the same link. However before this commit the offset+length was ignored if no line number >= 0 was given. Change-Id: Iaf105bc25acaec064763ebe60abf7cdcc409b58c Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
Diffstat (limited to 'org.eclipse.debug.ui/ui/org')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java21
1 files changed, 11 insertions, 10 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java
index 04cf4febd..897526c27 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java
@@ -57,14 +57,15 @@ public class FileLink implements IConsoleHyperlink {
/**
* Constructs a hyperlink to the specified file.
*
- * @param file the file to open when activated
- * @param editorId the identifier of the editor to open the file in, or
- * <code>null</code> if the default editor should be used
- * @param fileOffset the offset in the file to select when activated, or -1
- * @param fileLength the length of text to select in the file when activated
- * or -1
- * @param fileLineNumber the line number to select in the file when
- * activated, or -1
+ * @param file the file to open when activated
+ * @param editorId the identifier of the editor to open the file in, or
+ * <code>null</code> if the default editor should be used
+ * @param fileOffset the offset in the file to select when activated, or -1
+ * @param fileLength the length of text to select in the file when activated
+ * or -1
+ * @param fileLineNumber the line number to select in the file when activated,
+ * or -1. First line number is 1. Only used if
+ * <em>fileOffset</em> is not set.
*/
public FileLink(IFile file, String editorId, int fileOffset, int fileLength, int fileLineNumber) {
fFile = file;
@@ -82,7 +83,7 @@ public class FileLink implements IConsoleHyperlink {
if (page != null) {
try {
IEditorPart editorPart = page.openEditor(new FileEditorInput(fFile), getEditorId() , true);
- if (fFileLineNumber > 0) {
+ if (fFileLineNumber > 0 || (fFileOffset >= 0 && fFileLength >= 0)) {
ITextEditor textEditor = null;
if (editorPart instanceof ITextEditor) {
textEditor = (ITextEditor) editorPart;
@@ -90,8 +91,8 @@ public class FileLink implements IConsoleHyperlink {
textEditor = editorPart.getAdapter(ITextEditor.class);
}
if (textEditor != null) {
- IEditorInput input = editorPart.getEditorInput();
if (fFileOffset < 0) {
+ IEditorInput input = editorPart.getEditorInput();
IDocumentProvider provider = textEditor.getDocumentProvider();
try {
provider.connect(input);

Back to the top