/** * {@inheritDoc} */ public RefactoringStatus checkPostConditions(IProgressMonitor monitor) throws CoreException { fCodeGeneratorSettings= null; if (fStatus == null || fStatus.isOK()) { return super.checkPostConditions(monitor); } else { return fStatus; } }
private IStatus asStatus(RefactoringStatus status) { if (status.isOK()) { return Status.OK_STATUS; } else { return status.getEntryWithHighestSeverity().toStatus(); } }
public static ReorgTypedSourcePasteStarter create(TypedSource[] typedSources, IJavaElement destination) { Assert.isNotNull(typedSources); Assert.isNotNull(destination); PasteTypedSourcesRefactoring pasteRefactoring= PasteTypedSourcesRefactoring.create(typedSources); if (pasteRefactoring == null) return null; if (! pasteRefactoring.setDestination(destination).isOK()) return null; return new ReorgTypedSourcePasteStarter(pasteRefactoring); }
private IStatus asStatus(RefactoringStatus status) { if (status.isOK()) { return Status.OK_STATUS; } else { return status.getEntryWithHighestSeverity().toStatus(); } }
private IStatus createStatus(ExecuteResult result) { if (!result.validationStatus.isOK()) { return result.validationStatus.getEntryWithHighestSeverity().toStatus(); } else { return new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, RefactoringCoreMessages.UndoableOperation2ChangeAdapter_error_message, null); } }
private IStatus asStatus(RefactoringStatus status) { if (status.isOK()) { return new Status(IStatus.OK, RefactoringCorePlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$ } else { return status.getEntryWithHighestSeverity().toStatus(); } }
private IStatus createStatus(ExecuteResult result) { if (!result.validationStatus.isOK()) { return result.validationStatus.getEntryWithHighestSeverity().toStatus(); } else { return new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, RefactoringCoreMessages.UndoableOperation2ChangeAdapter_error_message, null); } }
public static ReorgMoveStarter create(IJavaElement[] javaElements, IResource[] resources, IJavaElement destination) throws JavaModelException { Assert.isNotNull(javaElements); Assert.isNotNull(resources); Assert.isNotNull(destination); IMovePolicy policy= ReorgPolicyFactory.createMovePolicy(resources, javaElements); if (!policy.canEnable()) return null; JavaMoveProcessor processor= new JavaMoveProcessor(policy); if (! processor.setDestination(destination).isOK()) return null; return new ReorgMoveStarter(processor); }
public static ReorgCopyStarter create(IJavaElement[] javaElements, IResource[] resources, IJavaElement destination) throws JavaModelException { Assert.isNotNull(javaElements); Assert.isNotNull(resources); Assert.isNotNull(destination); ICopyPolicy copyPolicy= ReorgPolicyFactory.createCopyPolicy(resources, javaElements); if (!copyPolicy.canEnable()) return null; JavaCopyProcessor copyProcessor= new JavaCopyProcessor(copyPolicy); if (!copyProcessor.setDestination(destination).isOK()) return null; return new ReorgCopyStarter(copyProcessor); }
public static ReorgCopyStarter create(IJavaElement[] javaElements, IResource[] resources, IReorgDestination destination) throws JavaModelException { Assert.isNotNull(javaElements); Assert.isNotNull(resources); if (destination == null) return null; ICopyPolicy copyPolicy= ReorgPolicyFactory.createCopyPolicy(resources, javaElements); if (!copyPolicy.canEnable()) return null; JavaCopyProcessor copyProcessor= new JavaCopyProcessor(copyPolicy); if (!copyProcessor.setDestination(destination).isOK()) return null; return new ReorgCopyStarter(copyProcessor); }
private boolean willRenameCU() { String name = JavaCore.removeJavaLikeExtension(fType.getCompilationUnit().getElementName()); if (!(Checks.isTopLevel(fType) && name.equals(fType.getElementName()))) { return false; } if (!checkNewPathValidity().isOK()) { return false; } if (!Checks.checkCompilationUnitNewName(fType.getCompilationUnit(), getNewElementName()).isOK()) { return false; } return true; }
private boolean willRenameCU() throws CoreException{ String name = JavaCore.removeJavaLikeExtension(fType.getCompilationUnit().getElementName()); if (! (Checks.isTopLevel(fType) && name.equals(fType.getElementName()))) return false; if (! checkNewPathValidity().isOK()) return false; if (! Checks.checkCompilationUnitNewName(fType.getCompilationUnit(), getNewElementName()).isOK()) return false; return true; }
private boolean willRenameCU() { String name = JavaCore.removeJavaLikeExtension(fType.getCompilationUnit().getElementName()); if (! (Checks.isTopLevel(fType) && name.equals(fType.getElementName()))) return false; if (! checkNewPathValidity().isOK()) return false; if (! Checks.checkCompilationUnitNewName(fType.getCompilationUnit(), getNewElementName()).isOK()) return false; return true; }
@Override public void widgetSelected(SelectionEvent e) { IType factoryType= chooseFactoryClass(); if (factoryType == null) return; RefactoringStatus status= getUseFactoryRefactoring().setFactoryClass(factoryType.getFullyQualifiedName()); boolean nameOk= status.isOK(); factoryTypeName.setText(factoryType.getFullyQualifiedName()); IntroduceFactoryInputPage.this.setPageComplete(nameOk); IntroduceFactoryInputPage.this.setErrorMessage(nameOk ? "" : //$NON-NLS-1$ status.getMessageMatchingSeverity(RefactoringStatus.ERROR)); } });
private final void verifyDestination(Object selected, boolean initialVerification) { try { RefactoringStatus status= verifyDestination(selected); if (initialVerification) setPageComplete(status.isOK()); else setPageComplete(status); } catch (JavaModelException e) { JavaPlugin.log(e); setPageComplete(false); } }
private IStatus validateType() { if (fType == null) return null; String type= fType.getText(); RefactoringStatus status= TypeContextChecker.checkParameterTypeSyntax(type, fContext.getCuHandle().getJavaProject()); if (status == null || status.isOK()) return Status.OK_STATUS; if (status.hasError()) return createErrorStatus(status.getEntryWithHighestSeverity().getMessage()); else return createWarningStatus(status.getEntryWithHighestSeverity().getMessage()); }
private IStatus validateType() { if (fType == null) return null; String type= fType.getText(); RefactoringStatus status= TypeContextChecker.checkParameterTypeSyntax(type, fContext.getCuHandle().getJavaProject()); if (status == null || status.isOK()) return createOkStatus(); if (status.hasError()) return createErrorStatus(status.getEntryWithHighestSeverity().getMessage()); else return createWarningStatus(status.getEntryWithHighestSeverity().getMessage()); }
private int handleValidateCopy(Object target) throws JavaModelException { final ICopyPolicy policy= ReorgPolicyFactory.createCopyPolicy(ReorgUtils.getResources(fElements), ReorgUtils.getJavaElements(fElements)); fCopyProcessor= policy.canEnable() ? new JavaCopyProcessor(policy) : null; if (!canCopyElements()) return DND.DROP_NONE; if (fCopyProcessor == null) return DND.DROP_NONE; if (!fCopyProcessor.setDestination(ReorgDestinationFactory.createDestination(target)).isOK()) return DND.DROP_NONE; return DND.DROP_COPY; }
public static boolean isApplicable(IInvocationContext context) throws CoreException { ICompilationUnit unit= context.getCompilationUnit(); CompilationUnit ast= SharedASTProvider.getAST(unit, SharedASTProvider.WAIT_NO, null); if (ast == null) return true; Selection selection= Selection.createFromStartLength(context.getSelectionOffset(), context.getSelectionLength()); SurroundWithAnalyzer analyzer= new SurroundWithAnalyzer(unit, selection, false); context.getASTRoot().accept(analyzer); return analyzer.getStatus().isOK() && analyzer.hasSelectedNodes(); }
public static boolean isApplicable(IInvocationContext context) throws JavaModelException { ICompilationUnit unit= context.getCompilationUnit(); CompilationUnit ast= ASTProvider.getASTProvider().getAST(unit, ASTProvider.WAIT_NO, null); if (ast == null) return true; Selection selection= Selection.createFromStartLength(context.getSelectionOffset(), context.getSelectionLength()); SurroundWithAnalyzer analyzer= new SurroundWithAnalyzer(unit, selection); context.getASTRoot().accept(analyzer); return analyzer.getStatus().isOK() && analyzer.hasSelectedNodes(); }