public static NLSRefactoring create(ICompilationUnit cu) { if (cu == null || !cu.exists()) return null; return new NLSRefactoring(cu); }
public static NLSRefactoring create(ICompilationUnit cu) { if (cu == null || !cu.exists()) return null; return new NLSRefactoring(cu); }
public static NLSRefactoring create(ICompilationUnit cu) { if (cu == null || !cu.exists()) return null; return new NLSRefactoring(cu); }
public static boolean isRenameAvailable(final ICompilationUnit unit) { if (unit == null) return false; if (!unit.exists()) return false; if (!JavaModelUtil.isPrimary(unit)) return false; if (unit.isReadOnly()) return false; return true; }
public static boolean isRenameAvailable(final ICompilationUnit unit) { if (unit == null) return false; if (!unit.exists()) return false; if (!JavaModelUtil.isPrimary(unit)) return false; if (unit.isReadOnly()) return false; return true; }
public static IType getSingleSelectedType(IStructuredSelection selection) throws JavaModelException { Object first= selection.getFirstElement(); if (first instanceof IType) return (IType) first; if (first instanceof ICompilationUnit) { final ICompilationUnit unit= (ICompilationUnit) first; if (unit.exists()) return JavaElementUtil.getMainType(unit); } return null; }
public static IType getSingleSelectedType(IStructuredSelection selection) throws JavaModelException { Object first= selection.getFirstElement(); if (first instanceof IType) return (IType) first; if (first instanceof ICompilationUnit) { final ICompilationUnit unit= (ICompilationUnit) first; if (unit.exists()) return JavaElementUtil.getMainType(unit); } return null; }
public static IType getSingleSelectedType(IStructuredSelection selection) throws JavaModelException { Object first= selection.getFirstElement(); if (first instanceof IType) return (IType) first; if (first instanceof ICompilationUnit) { final ICompilationUnit unit= (ICompilationUnit) first; if (unit.exists()) return JavaElementUtil.getMainType(unit); } return null; }
private static final String getFullPath(ICompilationUnit cu) { Assert.isTrue(cu.exists()); return cu.getResource().getFullPath().toString(); }
private static String getFullPath(ICompilationUnit cu) { Assert.isTrue(cu.exists()); return cu.getResource().getFullPath().toString(); }
private boolean canOverwrite(ICompilationUnit cu) { if (fDestination instanceof IPackageFragment){ IPackageFragment destination= (IPackageFragment)fDestination; return ! destination.equals(cu.getParent()) && destination.getCompilationUnit(cu.getElementName()).exists(); } else { return willOverwrite(ReorgUtils.getResource(cu)); } }
private boolean canOverwrite(ICompilationUnit cu) { if (fDestination instanceof IPackageFragment){ IPackageFragment destination= (IPackageFragment)fDestination; return ! destination.equals(cu.getParent()) && destination.getCompilationUnit(cu.getElementName()).exists(); } else { return willOverwrite(ReorgUtils.getResource(cu)); } }
private boolean canOverwrite(ICompilationUnit cu) { if (fDestination instanceof IPackageFragment){ IPackageFragment destination= (IPackageFragment)fDestination; return ! destination.equals(cu.getParent()) && destination.getCompilationUnit(cu.getElementName()).exists(); } else { return willOverwrite(ReorgUtils.getResource(cu)); } }
public boolean willCreateAccessorClass() throws JavaModelException { ICompilationUnit compilationUnit= getAccessorCu(); if (compilationUnit.exists()) { return false; } if (typeNameExistsInPackage(fAccessorClassPackage, fAccessorClassName)) { return false; } return (!Checks.resourceExists(getAccessorCUPath())); }
public boolean willCreateAccessorClass() throws JavaModelException { ICompilationUnit compilationUnit= getAccessorCu(); if (compilationUnit.exists()) { return false; } if (typeNameExistsInPackage(fAccessorClassPackage, fAccessorClassName)) { return false; } return (!Checks.resourceExists(getAccessorCUPath())); }
public boolean willCreateAccessorClass() throws JavaModelException { ICompilationUnit compilationUnit= getAccessorCu(); if (compilationUnit.exists()) { return false; } if (typeNameExistsInPackage(fAccessorClassPackage, fAccessorClassName)) { return false; } return (!Checks.resourceExists(getAccessorCUPath())); }
private void openWizard(ICompilationUnit unit) { try { if (unit != null && unit.exists()) { NLSRefactoring refactoring= NLSRefactoring.create(unit); if (refactoring != null) new RefactoringStarter().activate(refactoring, new ExternalizeWizard(refactoring), getShell(), ActionMessages.ExternalizeStringsAction_dialog_title, RefactoringSaveHelper.SAVE_NON_JAVA_UPDATES); } } catch (JavaModelException e) { ExceptionHandler.handle(e, ActionMessages.ExternalizeStringsAction_dialog_title, ActionMessages.FindStringsToExternalizeAction_error_message); } }
private void openWizard(ICompilationUnit unit) { try { if (unit != null && unit.exists()) { NLSRefactoring refactoring= NLSRefactoring.create(unit); if (refactoring != null) new RefactoringStarter().activate(refactoring, new ExternalizeWizard(refactoring), getShell(), ActionMessages.ExternalizeStringsAction_dialog_title, RefactoringSaveHelper.SAVE_NON_JAVA_UPDATES); } } catch (JavaModelException e) { ExceptionHandler.handle(e, ActionMessages.FindStringsToExternalizeAction_dialog_title, ActionMessages.FindStringsToExternalizeAction_error_message); } }
private RefactoringStatus checkPackageClass() { RefactoringStatus status= new RefactoringStatus(); IType type= fDescriptor.getType(); IPackageFragmentRoot ancestor= (IPackageFragmentRoot) type.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); IPackageFragment packageFragment= ancestor.getPackageFragment(fDescriptor.getPackage()); if (packageFragment.getCompilationUnit(fDescriptor.getClassName() + JavaModelUtil.DEFAULT_CU_SUFFIX).exists()) status.addError(Messages.format(RefactoringCoreMessages.ExtractClassRefactoring_error_toplevel_name_clash, new Object[] { BasicElementLabels.getJavaElementName(fDescriptor.getClassName()), BasicElementLabels.getJavaElementName(fDescriptor.getPackage()) })); return status; }
private RefactoringStatus checkPackageClass() { RefactoringStatus status= new RefactoringStatus(); IType type= fDescriptor.getType(); IPackageFragmentRoot ancestor= (IPackageFragmentRoot) type.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); IPackageFragment packageFragment= ancestor.getPackageFragment(fDescriptor.getPackage()); if (packageFragment.getCompilationUnit(fDescriptor.getClassName() + JavaModelUtil.DEFAULT_CU_SUFFIX).exists()) status.addError(Messages.format(RefactoringCoreMessages.ExtractClassRefactoring_error_toplevel_name_clash, new Object[] { BasicElementLabels.getJavaElementName(fDescriptor.getClassName()), BasicElementLabels.getJavaElementName(fDescriptor.getPackage()) })); return status; }