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;
}
}
}
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);
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;
}
}
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) {
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;