X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/AbstractHTTPQueryAction.java b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/AbstractHTTPQueryAction.java index 1592734..2191117 100644 --- a/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/AbstractHTTPQueryAction.java +++ b/net.sourceforge.phpeclipse.phphelp/src/net/sourceforge/phpdt/httpquery/AbstractHTTPQueryAction.java @@ -27,16 +27,19 @@ public abstract class AbstractHTTPQueryAction implements IEditorActionDelegate { abstract protected Configuration getConfiguration(String name); public void setActiveEditor(IAction action, IEditorPart targetEditor) { - if (targetEditor != null && (targetEditor instanceof AbstractTextEditor)) { + if (targetEditor != null + && (targetEditor instanceof AbstractTextEditor)) { editor = (AbstractTextEditor) targetEditor; } } public void run(IAction action) { - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + IWorkbenchWindow window = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow(); if (editor == null) { IEditorPart targetEditor = window.getActivePage().getActiveEditor(); - if (targetEditor != null && (targetEditor instanceof AbstractTextEditor)) { + if (targetEditor != null + && (targetEditor instanceof AbstractTextEditor)) { editor = (AbstractTextEditor) targetEditor; } } @@ -66,11 +69,13 @@ public abstract class AbstractHTTPQueryAction implements IEditorActionDelegate { } public IDocument getDocument() { - IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput()); + IDocument doc = editor.getDocumentProvider().getDocument( + editor.getEditorInput()); return doc; } - public static String getSelectedText(AbstractTextEditor editor, IDocument document, int initialPos) { + public static String getSelectedText(AbstractTextEditor editor, + IDocument document, int initialPos) { try { int pos = initialPos; int line = document.getLineOfOffset(pos); @@ -78,9 +83,9 @@ public abstract class AbstractHTTPQueryAction implements IEditorActionDelegate { int end = start + document.getLineInformation(line).getLength(); /* - * The line does not include \n or \r so pos can be > end. Making pos = - * end in this case is safe for the purposes of determining the TextRegion - * at the cursor position + * The line does not include \n or \r so pos can be > end. Making + * pos = end in this case is safe for the purposes of determining + * the TextRegion at the cursor position */ if (pos > end) { pos = end; @@ -105,7 +110,8 @@ public abstract class AbstractHTTPQueryAction implements IEditorActionDelegate { } } if (textStart != (-1) && textEnd != (-1) && textStart < textEnd) { - return new String(word.toCharArray(), textStart, textEnd - textStart); + return new String(word.toCharArray(), textStart, textEnd + - textStart); } } catch (Exception e) { @@ -115,7 +121,8 @@ public abstract class AbstractHTTPQueryAction implements IEditorActionDelegate { public String generateUrl(Configuration config, String template) { IDocument doc = getDocument(); - ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection(); + ITextSelection selection = (ITextSelection) editor + .getSelectionProvider().getSelection(); int pos = selection.getOffset(); int len = selection.getLength(); String wikiTitle;