public static boolean isProcessable(Shell shell, IJavaElement element) { if (element == null) return true; if (isOnBuildPath(element)) return true; MessageDialog.openInformation(shell, ActionMessages.ActionUtil_notOnBuildPath_title, ActionMessages.ActionUtil_notOnBuildPath_message); return false; }
public static boolean isProcessable(Shell shell, IJavaElement element) { if (element == null) return true; if (isOnBuildPath(element)) return true; MessageDialog.openInformation(shell, ActionMessages.ActionUtil_notOnBuildPath_title, ActionMessages.ActionUtil_notOnBuildPath_message); return false; }
public static boolean isProcessable(Shell shell, IJavaElement element) { if (element == null) return true; if (isOnBuildPath(element)) return true; MessageDialog.openInformation(shell, ActionMessages.ActionUtil_notOnBuildPath_title, ActionMessages.ActionUtil_notOnBuildPath_message); return false; }
boolean canOperateOn(IJavaElement element) { if (element == null || fValidTypes == null || fValidTypes.length == 0 || !ActionUtil.isOnBuildPath(element)) return false; for (int i= 0; i < fValidTypes.length; i++) { if (fValidTypes[i].isInstance(element)) { if (element.getElementType() == IJavaElement.PACKAGE_FRAGMENT) return hasChildren((IPackageFragment)element); else return true; } } return false; }
boolean canOperateOn(IJavaElement element) { if (element == null || fValidTypes == null || fValidTypes.length == 0 || !ActionUtil.isOnBuildPath(element)) return false; for (int i= 0; i < fValidTypes.length; i++) { if (fValidTypes[i].isInstance(element)) { if (element.getElementType() == IJavaElement.PACKAGE_FRAGMENT) return hasChildren((IPackageFragment)element); else return true; } } return false; }
boolean canOperateOn(IJavaElement element) { if (element == null || fValidTypes == null || fValidTypes.length == 0 || !ActionUtil.isOnBuildPath(element)) return false; for (int i= 0; i < fValidTypes.length; i++) { if (fValidTypes[i].isInstance(element)) { if (element.getElementType() == IJavaElement.PACKAGE_FRAGMENT) return hasChildren((IPackageFragment)element); else return true; } } return false; }
public static IStorage getResourceBundle(ICompilationUnit compilationUnit) throws JavaModelException { if (compilationUnit == null) return null; if (!ActionUtil.isOnBuildPath(compilationUnit)) return null; IType[] types= compilationUnit.getTypes(); if (types.length != 1) return null; if (!isPotentialNLSAccessor(compilationUnit)) return null; return NLSHintHelper.getResourceBundle(compilationUnit); }
public static boolean areProcessable(Shell shell, IJavaElement[] elements) { for (int i= 0; i < elements.length; i++) { if (! isOnBuildPath(elements[i])) { MessageDialog.openInformation(shell, ActionMessages.ActionUtil_notOnBuildPath_title, Messages.format(ActionMessages.ActionUtil_notOnBuildPath_resource_message, new Object[] {elements[i].getPath()})); return false; } } return true; }
public static IStorage getResourceBundle(ICompilationUnit compilationUnit) throws JavaModelException { if (compilationUnit == null) return null; if (!ActionUtil.isOnBuildPath(compilationUnit)) return null; IType[] types= compilationUnit.getTypes(); if (types.length != 1) return null; if (!isPotentialNLSAccessor(compilationUnit)) return null; return NLSHintHelper.getResourceBundle(compilationUnit); }
private SearchPatternData tryIfPropertyCuSelected(ICompilationUnit compilationUnit) throws JavaModelException { if (compilationUnit == null) return null; if (!ActionUtil.isOnBuildPath(compilationUnit)) return null; IType[] types= compilationUnit.getTypes(); if (types.length > 1) return null; IStorage bundle= NLSHintHelper.getResourceBundle(compilationUnit); if (!(bundle instanceof IFile)) return null; return new SearchPatternData(types[0], (IFile)bundle); }
public static boolean areProcessable(Shell shell, IJavaElement[] elements) { for (int i= 0; i < elements.length; i++) { if (! isOnBuildPath(elements[i])) { MessageDialog.openInformation(shell, ActionMessages.ActionUtil_notOnBuildPath_title, Messages.format(ActionMessages.ActionUtil_notOnBuildPath_resource_message, new Object[] {BasicElementLabels.getPathLabel(elements[i].getPath(), false)})); return false; } } return true; }
public static boolean areProcessable(Shell shell, IJavaElement[] elements) { for (int i= 0; i < elements.length; i++) { if (! isOnBuildPath(elements[i])) { MessageDialog.openInformation(shell, ActionMessages.ActionUtil_notOnBuildPath_title, Messages.format(ActionMessages.ActionUtil_notOnBuildPath_resource_message, new Object[] {BasicElementLabels.getPathLabel(elements[i].getPath(), false)})); return false; } } return true; }
private void addRefactorSubmenu(IMenuManager menu) { MenuManager refactorSubmenu= new MenuManager(ActionMessages.RefactorMenu_label, MENU_ID); refactorSubmenu.setActionDefinitionId(QUICK_MENU_ID); if (fEditor != null) { final ITypeRoot element= getEditorInput(); if (element != null && ActionUtil.isOnBuildPath(element)) { refactorSubmenu.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { refactorMenuShown(manager); } }); refactorSubmenu.add(fNoActionAvailable); menu.appendToGroup(fGroupName, refactorSubmenu); } } else { ISelection selection= fSelectionProvider.getSelection(); for (Iterator<SelectionDispatchAction> iter= fActions.iterator(); iter.hasNext(); ) { iter.next().update(selection); } if (fillRefactorMenu(refactorSubmenu) > 0) menu.appendToGroup(fGroupName, refactorSubmenu); } }
private void addRefactorSubmenu(IMenuManager menu) { MenuManager refactorSubmenu= new MenuManager(ActionMessages.RefactorMenu_label, MENU_ID); refactorSubmenu.setActionDefinitionId(QUICK_MENU_ID); if (fEditor != null) { final ITypeRoot element= getEditorInput(); if (element != null && ActionUtil.isOnBuildPath(element)) { refactorSubmenu.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { refactorMenuShown(manager); } }); refactorSubmenu.add(fNoActionAvailable); menu.appendToGroup(fGroupName, refactorSubmenu); } } else { ISelection selection= fSelectionProvider.getSelection(); for (Iterator<SelectionDispatchAction> iter= fActions.iterator(); iter.hasNext(); ) { iter.next().update(selection); } if (fillRefactorMenu(refactorSubmenu) > 0) menu.appendToGroup(fGroupName, refactorSubmenu); } }
public void helpRequested(HelpEvent e) { try { Object[] selected= null; if (fViewer != null) { ISelection selection= fViewer.getSelection(); if (selection instanceof IStructuredSelection) { selected= ((IStructuredSelection)selection).toArray(); } } else if (fEditor != null) { IJavaElement input= SelectionConverter.getInput(fEditor); if (ActionUtil.isOnBuildPath(input)) { selected= SelectionConverter.codeResolve(fEditor); } } JavadocHelpContext.displayHelp(fContextId, selected); } catch (CoreException x) { } } }
@Override public Object getParent(Object element) { if (element instanceof IType && ((IType) element).isBinary()) { IType declaringType= ((IType) element).getDeclaringType(); if (declaringType != null) return declaringType; } Object result= fParent.getParent(element); if (result instanceof ITypeRoot) { if (ActionUtil.isOnBuildPath((IJavaElement) result)) { result= fParent.getParent(result); } else { result= ((ITypeRoot) result).getResource(); if (result instanceof IFile) result= fParent.getParent(result); } } return result; }
public void helpRequested(HelpEvent e) { try { Object[] selected= null; if (fViewer != null) { ISelection selection= fViewer.getSelection(); if (selection instanceof IStructuredSelection) { selected= ((IStructuredSelection)selection).toArray(); } } else if (fEditor != null) { IJavaElement input= SelectionConverter.getInput(fEditor); if (ActionUtil.isOnBuildPath(input)) { selected= SelectionConverter.codeResolve(fEditor); } } JavadocHelpContext.displayHelp(fContextId, selected); } catch (CoreException x) { JavaPlugin.log(x); } } }
@Override public void helpRequested(HelpEvent e) { try { Object[] selected= null; if (fViewer != null) { ISelection selection= fViewer.getSelection(); if (selection instanceof IStructuredSelection) { selected= ((IStructuredSelection)selection).toArray(); } } else if (fEditor != null) { IJavaElement input= SelectionConverter.getInput(fEditor); if (input != null && ActionUtil.isOnBuildPath(input)) { selected= SelectionConverter.codeResolve(fEditor); } } JavadocHelpContext.displayHelp(fContextId, selected); } catch (CoreException x) { JavaPlugin.log(x); } } }
@Override public void helpRequested(HelpEvent e) { try { Object[] selected= null; if (fViewer != null) { ISelection selection= fViewer.getSelection(); if (selection instanceof IStructuredSelection) { selected= ((IStructuredSelection)selection).toArray(); } } else if (fEditor != null) { IJavaElement input= SelectionConverter.getInput(fEditor); if (input != null && ActionUtil.isOnBuildPath(input)) { selected= SelectionConverter.codeResolve(fEditor); } } JavadocHelpContext.displayHelp(fContextId, selected); } catch (CoreException x) { JavaPlugin.log(x); } } }
@Override public Object getParent(Object element) { if (element instanceof IType && ((IType) element).isBinary()) { IType declaringType= ((IType) element).getDeclaringType(); if (declaringType != null) return declaringType; } if (element instanceof IModuleDescription) { IJavaElement parent= ((IModuleDescription) element).getParent(); if (parent instanceof ITypeRoot && parent.getParent().exists()) // no containing package if not on the classpath element= parent; } Object result= fParent.getParent(element); if (result instanceof ITypeRoot) { if (ActionUtil.isOnBuildPath((IJavaElement) result)) { result= fParent.getParent(result); } else { result= ((ITypeRoot) result).getResource(); if (result instanceof IFile) result= fParent.getParent(result); } } return result; }