private SearchPatternData tryIfPropertyFileSelected(IFile file) { IType accessorType= getAccessorType(file); return (accessorType != null) ? new SearchPatternData(accessorType, file) : null; }
@Override protected void fillMenu(IMenuManager menu) { SurroundWithTryCatchAction surroundWithTryCatch= SurroundWithActionGroup.createSurroundWithTryCatchAction(editor); SurroundWithTryMultiCatchAction surroundWithTryMultiCatch= SurroundWithActionGroup.createSurroundWithTryMultiCatchAction(editor); SurroundWithTemplateMenuAction.fillMenu(menu, editor, surroundWithTryCatch, surroundWithTryMultiCatch); } }.createMenu();
public FilterUncategorizedMembersAction() { setText(ActionMessages.CategoryFilterActionGroup_ShowUncategorizedMembers); setChecked(!fFilterUncategorizedMembers); setId(FILTER_CATEGORY_ACTION_ID); }
public AllCleanUpsAction(IWorkbenchSite site) { super(site); setToolTipText(ActionMessages.CleanUpAction_tooltip); setDescription(ActionMessages.CleanUpAction_description); installPreferenceListener(); updateActionLabel(); // PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.ORGANIZE_IMPORTS_ACTION); }
private void updateActionLabel() { if (showWizard()) { setText(ActionMessages.CleanUpAction_labelWizard); } else { setText(ActionMessages.CleanUpAction_label); } }
public static boolean canOperateOn(JavaEditor editor) { if (editor == null) return false; return getInput(editor) != null; }
/** * Perform a code resolve at the current selection of an editor * * @param editor the editor * @return the resolved elements (only from primary working copies) * @throws JavaModelException when the type root can not be accessed */ public static IJavaElement[] codeResolve(JavaEditor editor) throws JavaModelException { return codeResolve(editor, true); }
private IJavaElement elementAtOffset() { try { return SelectionConverter.getElementAtOffset(fEditor); } catch(JavaModelException e) { } return null; }
/** * Returns the formatted resource string associated with the given key in the resource bundle. * <code>MessageFormat</code> is used to format the message. If there isn't any value * under the given key, the key is returned. * * @param key the resource key * @param arg the message argument * @return the string */ public static String getFormattedString(String key, Object arg) { return getFormattedString(key, new Object[] { arg }); }
public GenerateConstructorUsingFieldsValidator(GenerateConstructorUsingFieldsSelectionDialog dialog, ITypeBinding type, int entries) { fEntries= entries; fDialog= dialog; fType= type; fSignatures= getExistingConstructorSignatures(); }
/** * Creates a new action group with a given set of actions. * * @param actions the actions for this multi group * @param currentSelection decides which action is selected in the menu on start up. * Denotes the location in the actions array of the current * selected state. It cannot be null. */ public MultiActionGroup(IAction[] actions, int currentSelection) { super(); setActions(actions, currentSelection); }
private boolean processChildren(IJavaElement[] children, IResultCollector collector) { for (int i= 0; i < children.length; i++) { if (collectCategories(children[i], collector)) return true; } return false; }
@Override public void selectionChanged(IAction action, ISelection selection) { super.selectionChanged(action, selection); fSelection= selection; }
private boolean canEnable(Object[] objects) { for (int i= 0; i < objects.length; i++) { Object element= objects[i]; if (isValideElement(element)) return true; } return false; }
@Override protected void fillMenu(IMenuManager menu) { SurroundWithTryCatchAction surroundWithTryCatch= SurroundWithActionGroup.createSurroundWithTryCatchAction(editor); SurroundWithTryMultiCatchAction surroundWithTryMultiCatch= SurroundWithActionGroup.createSurroundWithTryMultiCatchAction(editor); SurroundWithTemplateMenuAction.fillMenu(menu, editor, surroundWithTryCatch, surroundWithTryMultiCatch); } }.createMenu();
private SearchPatternData tryIfPropertyFileSelected(IFile file) { IType accessorType= getAccessorType(file); return (accessorType != null) ? new SearchPatternData(accessorType, file) : null; }
public static ICompilationUnit getInputAsCompilationUnit(JavaEditor editor) { Object editorInput= SelectionConverter.getInput(editor); if (editorInput instanceof ICompilationUnit) return (ICompilationUnit)editorInput; return null; }
private IJavaElement getJavaElementFromEditor() throws JavaModelException { IJavaElement[] elements= SelectionConverter.codeResolve(fEditor); if (elements == null || elements.length != 1) return null; return elements[0]; }
/** * Returns the formatted resource string associated with the given key in the resource bundle. * <code>MessageFormat</code> is used to format the message. If there isn't any value * under the given key, the key is returned. * * @param key the resource key * @param arg the message argument * @return the string */ public static String getFormattedString(String key, Object arg) { return getFormattedString(key, new Object[] { arg }); }
public static IClassFile getInputAsClassFile(JavaEditor editor) { Object editorInput= SelectionConverter.getInput(editor); if (editorInput instanceof IClassFile) return (IClassFile)editorInput; return null; }