private static IAction[] getTemplateActions(JavaEditor editor) { ITextSelection textSelection= getTextSelection(editor); if (textSelection == null || textSelection.getLength() == 0) return null; ICompilationUnit cu= JavaUI.getWorkingCopyManager().getWorkingCopy(editor.getEditorInput()); if (cu == null) return null; QuickTemplateProcessor quickTemplateProcessor= new QuickTemplateProcessor(); IInvocationContext context= new AssistContext(cu, textSelection.getOffset(), textSelection.getLength()); try { IJavaCompletionProposal[] proposals= quickTemplateProcessor.getAssists(context, null); if (proposals == null || proposals.length == 0) return null; return getActionsFromProposals(proposals, context.getSelectionOffset(), editor.getViewer()); } catch (CoreException e) { JavaPlugin.log(e); } return null; }
private static IAction[] getTemplateActions(JavaEditor editor) { ITextSelection textSelection= getTextSelection(editor); if (textSelection == null || textSelection.getLength() == 0) return null; ICompilationUnit cu= JavaUI.getWorkingCopyManager().getWorkingCopy(editor.getEditorInput()); if (cu == null) return null; QuickTemplateProcessor quickTemplateProcessor= new QuickTemplateProcessor(); IInvocationContext context= new AssistContext(cu, textSelection.getOffset(), textSelection.getLength()); try { IJavaCompletionProposal[] proposals= quickTemplateProcessor.getAssists(context, null); if (proposals == null || proposals.length == 0) return null; return getActionsFromProposals(proposals, context.getSelectionOffset(), editor.getViewer()); } catch (CoreException e) { JavaPlugin.log(e); } return null; }
return null; return getActionsFromProposals(proposals, context.getSelectionOffset(), editor.getViewer()); } catch (CoreException e) { JavaPlugin.log(e);