private void check(RefactoringStatus status) { if (fBeforeTypeReferenced != null) status.addFatalError(fBeforeTypeReferenced); if (fSelectedTypeReferenced != null) status.addFatalError(fSelectedTypeReferenced); } }
/** * Adds a <code>FATAL</code> entry filled with the given message to this status. * The severity of this status will changed to <code>FATAL</code>. * * @param msg the message of the fatal entry * * @see RefactoringStatusEntry */ public void addFatalError(String msg) { addFatalError(msg, null); }
private void checkDuplicateKeys(RefactoringStatus status) { for (int i= 0; i < fSubstitutions.length; i++) { NLSSubstitution substitution= fSubstitutions[i]; if (conflictingKeys(substitution)) { status.addFatalError(NLSUIMessages.ExternalizeWizardPage_warning_conflicting); return; } } }
@Override public RefactoringStatus checkNewElementName(String newName) { Assert.isNotNull(newName, "new name"); //$NON-NLS-1$ RefactoringStatus result = Checks.checkTypeName(newName, fType); if (Checks.isAlreadyNamed(fType, newName)) { result.addFatalError(RefactoringCoreMessages.RenameTypeRefactoring_choose_another_name); } return result; }
private void checkExpression(RefactoringStatus status) { ASTNode[] nodes= getSelectedNodes(); if (nodes != null && nodes.length == 1) { ASTNode node= nodes[0]; if (node instanceof Type) { status.addFatalError(RefactoringCoreMessages.ExtractMethodAnalyzer_cannot_extract_type_reference, JavaStatusContext.create(fCUnit, node)); } else if (node.getLocationInParent() == SwitchCase.EXPRESSION_PROPERTY) { status.addFatalError(RefactoringCoreMessages.ExtractMethodAnalyzer_cannot_extract_switch_case, JavaStatusContext.create(fCUnit, node)); } } }
public static RefactoringStatus isValid(IDocument document, int length) { RefactoringStatus result= new RefactoringStatus(); if (length != document.getLength()) { result.addFatalError(RefactoringCoreMessages.TextChanges_error_document_content_changed); } return result; } }
public static RefactoringStatus isValid(IDocument document, int length) { RefactoringStatus result= new RefactoringStatus(); if (length != document.getLength()) { result.addFatalError(RefactoringCoreMessages.TextChanges_error_document_content_changed); } return result; } }
private static void checkExistence(RefactoringStatus status, IResource element) { if (element == null) { status.addFatalError(RefactoringCoreMessages.ResourceChange_error_no_input); } else if (!element.exists()) { status.addFatalError(Messages.format(RefactoringCoreMessages.ResourceChange_error_does_not_exist, BasicElementLabels.getPathLabel(element.getFullPath(), false))); } }
private void checkParameterName(RefactoringStatus result, ParameterInfo info, int position) { if (info.getNewName().trim().length() == 0) { result.addFatalError(Messages.format( RefactoringCoreMessages.ChangeSignatureRefactoring_param_name_not_empty, Integer.toString(position))); } else { result.merge(Checks.checkTempName(info.getNewName(), fMethod)); } }
private RefactoringStatus mappingErrorFound(RefactoringStatus result, ASTNode node) { if (node != null && (node.getFlags() & ASTNode.MALFORMED) != 0 && processCompilerError(result, node)) return result; result.addFatalError(getMappingErrorMessage()); return result; }
private RefactoringStatus mappingErrorFound(RefactoringStatus result, ASTNode node) { if (node != null && (node.getFlags() & ASTNode.MALFORMED) != 0 && processCompilerError(result, node)) { return result; } result.addFatalError(getMappingErrorMessage()); return result; }
public void checkSameReadOnly(RefactoringStatus status, boolean valueToMatch) { if (fReadOnly != valueToMatch) { status.addFatalError(Messages.format(RefactoringCoreMessages.ResourceChange_error_read_only_state_changed, BasicElementLabels.getPathLabel(fResource.getFullPath(), false))); } }
public void checkReadOnly(RefactoringStatus status) { if (fReadOnly) { status.addFatalError(Messages.format(RefactoringCoreMessages.ResourceChange_error_read_only, BasicElementLabels.getPathLabel(fResource.getFullPath(), false))); } }
@Override public RefactoringStatus checkNewElementName(String newName) throws CoreException { Assert.isNotNull(newName, "new name"); //$NON-NLS-1$ String typeName= removeFileNameExtension(newName); RefactoringStatus result= Checks.checkCompilationUnitName(newName, fCu); if (fWillRenameType) result.merge(fRenameTypeProcessor.checkNewElementName(typeName)); if (Checks.isAlreadyNamed(fCu, newName)) result.addFatalError(RefactoringCoreMessages.RenameCompilationUnitRefactoring_same_name); return result; }
@Override public RefactoringStatus checkNewElementName(String newName) throws CoreException { RefactoringStatus result= Checks.checkEnumConstantName(newName, getField()); if (Checks.isAlreadyNamed(getField(), newName)) { result.addFatalError(RefactoringCoreMessages.RenameEnumConstRefactoring_another_name); } if (getField().getDeclaringType().getField(newName).exists()) { result.addFatalError(RefactoringCoreMessages.RenameEnumConstRefactoring_const_already_defined); } return result; }
public void saveIfDirty(RefactoringStatus status, long stampToMatch, IProgressMonitor pm) throws CoreException { if (fDirty) { if (fKind == DOCUMENT && fTextFileBuffer != null && stampToMatch == fModificationStamp) { fTextFileBuffer.commit(pm, false); } else { status.addFatalError(Messages.format(RefactoringCoreMessages.ResourceChange_error_unsaved, BasicElementLabels.getPathLabel(fResource.getFullPath(), false))); } } }
private boolean processCompilerError(RefactoringStatus result, ASTNode node) { Message[] messages = ASTNodes.getMessages(node, ASTNodes.INCLUDE_ALL_PARENTS); if (messages.length == 0) { return false; } result.addFatalError(Messages.format(RefactoringCoreMessages.SelfEncapsulateField_compiler_errors_field, new String[] { BasicElementLabels.getJavaElementName(fField.getElementName()), messages[0].getMessage() })); return true; }
private boolean processCompilerError(RefactoringStatus result, ASTNode node) { Message[] messages= ASTNodes.getMessages(node, ASTNodes.INCLUDE_ALL_PARENTS); if (messages.length == 0) return false; result.addFatalError(Messages.format( RefactoringCoreMessages.SelfEncapsulateField_compiler_errors_field, new String[] { BasicElementLabels.getJavaElementName(fField.getElementName()), messages[0].getMessage()})); return true; }
private RefactoringStatus checkIfAnythingToDo() throws JavaModelException { if (NLSSubstitution.countItems(fSubstitutions, NLSSubstitution.EXTERNALIZED) != 0 && willCreateAccessorClass()) return null; if (willModifyPropertyFile()) return null; if (willModifySource()) return null; RefactoringStatus result= new RefactoringStatus(); result.addFatalError(NLSMessages.NLSRefactoring_nothing_to_do); return result; }
public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException, OperationCanceledException { RefactoringStatus result = new RefactoringStatus(); // Make sure the element exists if (mProfileToDelete == null || ProfileManager.getInstance().getProfileByName(mProfileToDelete.getName()) == null) { result.addFatalError(ConnectivityUIPlugin.getDefault().getResourceString("CPDeleteChange.error.ProfileDoesNotExist")); } return result; }