@Override public void launch(IEditorPart editor, final String mode) { Activator.logInfo("launch shortcut: editor" + editor.getTitle() + " mode " + mode); IEditorInput ei = editor.getEditorInput(); if (ei != null && ei instanceof FileEditorInput) { FileEditorInput fei = (FileEditorInput) ei; IFile file = fei.getFile(); final String fName = file.getProjectRelativePath().toOSString(); final String pName = file.getProject().getName(); launch(pName, fName, mode); } }
@Override public void launch(ISelection selection, final String mode) { Activator.logInfo("launch shortcut: selection " + selection + " mode " + mode); if (selection != null) { if (selection instanceof TreeSelection) { TreeSelection ts = (TreeSelection) selection; Object e = ts.getFirstElement(); if (e instanceof IFile) { IFile file = (IFile) e; final String fName = file.getProjectRelativePath().toOSString(); final String pName = file.getProject().getName(); launch(pName, fName, mode); } } } }
public static void main(String[] args) { Lexer lexer = new Lexer(); Tokenizer tokenizer = new Tokenizer(lexer); VariableParser fparser = new VariableParser(tokenizer, null, null); try { lexer.scan(new File("test/test_go/import_test.go")); for (Var var : fparser.vars) { Activator.logInfo("================================================="); Activator.logInfo(var.getDocumentation()); Activator.logInfo("-------------------------------------------------"); Activator.logInfo(var.getName()); Activator.logInfo(var.getInsertionText()); Activator.logInfo("-------------------------------------------------"); } } catch (IOException e) { Activator.logError(e); } }