当前位置: 首页>>代码示例>>Java>>正文


Java RefactoringStatus.merge方法代码示例

本文整理汇总了Java中org.eclipse.ltk.core.refactoring.RefactoringStatus.merge方法的典型用法代码示例。如果您正苦于以下问题:Java RefactoringStatus.merge方法的具体用法?Java RefactoringStatus.merge怎么用?Java RefactoringStatus.merge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.ltk.core.refactoring.RefactoringStatus的用法示例。


在下文中一共展示了RefactoringStatus.merge方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkParameterNames

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
/**
 * Checks if the parameter names are valid.
 *
 * @return validation status
 */
public RefactoringStatus checkParameterNames() {
	RefactoringStatus result = new RefactoringStatus();
	for (Iterator<ParameterInfo> iter = fParameterInfos.iterator(); iter.hasNext();) {
		ParameterInfo parameter = iter.next();
		result.merge(Checks.checkIdentifier(parameter.getNewName(), fCUnit));
		for (Iterator<ParameterInfo> others = fParameterInfos.iterator(); others.hasNext();) {
			ParameterInfo other = others.next();
			if (parameter != other && other.getNewName().equals(parameter.getNewName())) {
				result.addError(Messages.format(RefactoringCoreMessages.ExtractMethodRefactoring_error_sameParameter, BasicElementLabels.getJavaElementName(other.getNewName())));
				return result;
			}
		}
		if (parameter.isRenamed() && fUsedNames.contains(parameter.getNewName())) {
			result.addError(Messages.format(RefactoringCoreMessages.ExtractMethodRefactoring_error_nameInUse, BasicElementLabels.getJavaElementName(parameter.getNewName())));
			return result;
		}
	}
	return result;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:25,代码来源:ExtractMethodRefactoring.java

示例2: checkFinalConditions

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
@Override
public RefactoringStatus checkFinalConditions(IProgressMonitor pm) throws CoreException {
	pm.beginTask(RefactoringCoreMessages.ExtractMethodRefactoring_checking_new_name, 2);
	pm.subTask(EMPTY);

	RefactoringStatus result = checkMethodName();
	result.merge(checkParameterNames());
	result.merge(checkVarargOrder());
	pm.worked(1);
	if (pm.isCanceled()) {
		throw new OperationCanceledException();
	}

	BodyDeclaration node = fAnalyzer.getEnclosingBodyDeclaration();
	if (node != null) {
		fAnalyzer.checkInput(result, fMethodName, fDestination);
		pm.worked(1);
	}
	pm.done();
	return result;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:22,代码来源:ExtractMethodRefactoring.java

示例3: checkSelection

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
private RefactoringStatus checkSelection(IProgressMonitor pm) throws JavaModelException {
  try {
    pm.beginTask("", 2); // $NON-NLS-1$

    IExpressionFragment selectedExpression = getSelectedExpression();

    if (selectedExpression == null) {
      String message = RefactoringCoreMessages.ExtractConstantRefactoring_select_expression;
      return CodeRefactoringUtil.checkMethodSyntaxErrors(
          fSelectionStart, fSelectionLength, fCuRewrite.getRoot(), message);
    }
    pm.worked(1);

    RefactoringStatus result = new RefactoringStatus();
    result.merge(checkExpression());
    if (result.hasFatalError()) return result;
    pm.worked(1);

    return result;
  } finally {
    pm.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:ExtractConstantRefactoring.java

示例4: checkInitialConditions

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
  pm.beginTask("", 1); // $NON-NLS-1$
  try {
    RefactoringStatus result = new RefactoringStatus();
    result.merge(
        RefactoringStatus.create(
            Resources.checkInSync(ReorgUtils.getNotNulls(fMovePolicy.getResources()))));
    IResource[] javaResources = ReorgUtils.getResources(fMovePolicy.getJavaElements());
    result.merge(
        RefactoringStatus.create(Resources.checkInSync(ReorgUtils.getNotNulls(javaResources))));
    return result;
  } finally {
    pm.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:JavaMoveProcessor.java

示例5: validateModifiesFiles

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
public static RefactoringStatus validateModifiesFiles(IFile[] filesToModify, Object context) {
	RefactoringStatus result = new RefactoringStatus();
	IStatus status = Resources.checkInSync(filesToModify);
	if (!status.isOK()) {
		result.merge(RefactoringStatus.create(status));
	}
	status = Resources.makeCommittable(filesToModify, context);
	if (!status.isOK()) {
		result.merge(RefactoringStatus.create(status));
		if (!result.hasFatalError()) {
			result.addFatalError(RefactoringCoreMessages.Checks_validateEdit);
		}
	}
	return result;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:16,代码来源:Checks.java

示例6: checkInput

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
public void checkInput(RefactoringStatus status, String methodName, ASTNode destination) {
	ITypeBinding[] arguments = getArgumentTypes();
	ITypeBinding type = ASTNodes.getEnclosingType(destination);
	status.merge(Checks.checkMethodInType(type, methodName, arguments));
	ITypeBinding superClass = type.getSuperclass();
	if (superClass != null) {
		status.merge(Checks.checkMethodInHierarchy(superClass, methodName, null, arguments));
	}
	for (ITypeBinding superInterface : type.getInterfaces()) {
		status.merge(Checks.checkMethodInHierarchy(superInterface, methodName, null, arguments));
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:13,代码来源:ExtractMethodAnalyzer.java

示例7: checkActivationBasics

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
public RefactoringStatus checkActivationBasics(CompilationUnit rootNode) throws CoreException {
	RefactoringStatus result = new RefactoringStatus();
	fRootNode = rootNode;

	fAnalyzer = new SurroundWithTryCatchAnalyzer(fCUnit, fSelection);
	fRootNode.accept(fAnalyzer);
	result.merge(fAnalyzer.getStatus());
	ITypeBinding[] exceptions = fAnalyzer.getExceptions();
	if (fIsMultiCatch && (exceptions == null || exceptions.length <= 1)) {
		result.merge(RefactoringStatus.createWarningStatus(RefactoringCoreMessages.SurroundWithTryCatchRefactoring_notMultipleexceptions));
	}
	return result;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:14,代码来源:SurroundWithTryCatchRefactoring.java

示例8: analyzeAffectedCompilationUnits

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
private RefactoringStatus analyzeAffectedCompilationUnits(IProgressMonitor pm)
    throws CoreException {
  RefactoringStatus result = new RefactoringStatus();

  result.merge(Checks.checkCompileErrorsInAffectedFiles(fReferences, fType.getResource()));

  pm.beginTask("", fReferences.length); // $NON-NLS-1$
  result.merge(checkConflictingTypes(pm));
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:RenameTypeProcessor.java

示例9: doCheckFinalConditions

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
@Override
protected RefactoringStatus doCheckFinalConditions(
    IProgressMonitor pm, CheckConditionsContext context) throws CoreException {
  try {
    if (fWillRenameType && (!fCu.isStructureKnown())) {
      RefactoringStatus result1 = new RefactoringStatus();

      RefactoringStatus result2 = new RefactoringStatus();
      result2.merge(
          Checks.checkCompilationUnitNewName(fCu, removeFileNameExtension(getNewElementName())));
      if (result2.hasFatalError())
        result1.addError(
            Messages.format(
                RefactoringCoreMessages.RenameCompilationUnitRefactoring_not_parsed_1,
                BasicElementLabels.getFileName(fCu)));
      else
        result1.addError(
            Messages.format(
                RefactoringCoreMessages.RenameCompilationUnitRefactoring_not_parsed,
                BasicElementLabels.getFileName(fCu)));
      result1.merge(result2);
    }

    if (fWillRenameType) {
      return fRenameTypeProcessor.checkFinalConditions(pm, context);
    } else {
      return Checks.checkCompilationUnitNewName(
          fCu, removeFileNameExtension(getNewElementName()));
    }
  } finally {
    pm.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:34,代码来源:RenameCompilationUnitProcessor.java

示例10: doRename

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
void doRename(IProgressMonitor pm, RefactoringStatus result) throws CoreException {
  pm.beginTask("", 16); // $NON-NLS-1$
  if (fProcessor.getUpdateReferences()) {
    pm.setTaskName(RefactoringCoreMessages.RenamePackageRefactoring_searching);

    String binaryRefsDescription =
        Messages.format(
            RefactoringCoreMessages.ReferencesInBinaryContext_ref_in_binaries_description,
            getElementLabel(fPackage));
    ReferencesInBinaryContext binaryRefs = new ReferencesInBinaryContext(binaryRefsDescription);

    fOccurrences = getReferences(new SubProgressMonitor(pm, 4), binaryRefs, result);
    fReferencesToTypesInNamesakes =
        getReferencesToTypesInNamesakes(new SubProgressMonitor(pm, 4), result);
    fReferencesToTypesInPackage =
        getReferencesToTypesInPackage(new SubProgressMonitor(pm, 4), binaryRefs, result);
    binaryRefs.addErrorIfNecessary(result);

    pm.setTaskName(RefactoringCoreMessages.RenamePackageRefactoring_checking);
    result.merge(analyzeAffectedCompilationUnits());
    pm.worked(1);
  } else {
    fOccurrences = new SearchResultGroup[0];
    pm.worked(13);
  }

  if (result.hasFatalError()) return;

  if (fProcessor.getUpdateReferences()) addReferenceUpdates(new SubProgressMonitor(pm, 3));
  else pm.worked(3);

  pm.done();
}
 
开发者ID:eclipse,项目名称:che,代码行数:34,代码来源:RenamePackageProcessor.java

示例11: createRefactoring

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @return always null
 */
public Refactoring createRefactoring(final RefactoringStatus status) throws CoreException {
  status.merge(
      RefactoringStatus.createFatalErrorStatus(
          RefactoringCoreMessages.DefaultRefactoringDescriptor_cannot_create_refactoring));
  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:12,代码来源:DefaultRefactoringDescriptor.java

示例12: checkFinalConditions

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
@Override
public RefactoringStatus checkFinalConditions(IProgressMonitor pm) throws CoreException {
  try {
    pm.beginTask(RefactoringCoreMessages.ExtractTempRefactoring_checking_preconditions, 4);

    fCURewrite = new CompilationUnitRewrite(fCu, fCompilationUnitNode);
    fCURewrite.getASTRewrite().setTargetSourceRangeComputer(new NoCommentSourceRangeComputer());

    doCreateChange(new SubProgressMonitor(pm, 2));

    fChange =
        fCURewrite.createChange(
            RefactoringCoreMessages.ExtractTempRefactoring_change_name,
            true,
            new SubProgressMonitor(pm, 1));

    RefactoringStatus result = new RefactoringStatus();
    if (Arrays.asList(getExcludedVariableNames()).contains(fTempName))
      result.addWarning(
          Messages.format(
              RefactoringCoreMessages.ExtractTempRefactoring_another_variable,
              BasicElementLabels.getJavaElementName(fTempName)));

    result.merge(checkMatchingFragments());

    fChange.setKeepPreviewEdits(true);

    if (fCheckResultForCompileProblems) {
      checkNewSource(new SubProgressMonitor(pm, 1), result);
    }

    return result;
  } finally {
    pm.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:37,代码来源:ExtractTempRefactoring.java

示例13: checkParameterName

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
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));
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:ChangeSignatureProcessor.java

示例14: createChanges

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
private RefactoringStatus createChanges(IProgressMonitor pm) throws CoreException {
  pm.beginTask(RefactoringCoreMessages.RenameFieldRefactoring_checking, 10);
  RefactoringStatus result = new RefactoringStatus();
  if (!fIsComposite) fChangeManager.clear();

  // Delegate creation requires ASTRewrite which
  // creates a new change -> do this first.
  if (fDelegateUpdating) result.merge(addDelegates());

  addDeclarationUpdate();

  if (fUpdateReferences) {
    addReferenceUpdates(new SubProgressMonitor(pm, 1));
    result.merge(analyzeRenameChanges(new SubProgressMonitor(pm, 2)));
    if (result.hasFatalError()) return result;
  } else {
    pm.worked(3);
  }

  if (getGetter() != null && fRenameGetter) {
    addGetterOccurrences(new SubProgressMonitor(pm, 1), result);
  } else {
    pm.worked(1);
  }

  if (getSetter() != null && fRenameSetter) {
    addSetterOccurrences(new SubProgressMonitor(pm, 1), result);
  } else {
    pm.worked(1);
  }

  if (fUpdateTextualMatches) {
    addTextMatches(new SubProgressMonitor(pm, 5));
  } else {
    pm.worked(5);
  }
  pm.done();
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:40,代码来源:RenameFieldProcessor.java

示例15: checkInitialConditions

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
/**
 * Checks if the refactoring can be activated. Activation typically means, if a corresponding menu
 * entry can be added to the UI.
 *
 * @param pm a progress monitor to report progress during activation checking.
 * @return the refactoring status describing the result of the activation check.
 * @throws CoreException if checking fails
 */
@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
  RefactoringStatus result = new RefactoringStatus();
  pm.beginTask("", 100); // $NON-NLS-1$

  if (fSelectionStart < 0 || fSelectionLength == 0) return mergeTextSelectionStatus(result);

  IFile[] changedFiles = ResourceUtil.getFiles(new ICompilationUnit[] {fCUnit});
  result.merge(Checks.validateModifiesFiles(changedFiles, getValidationContext()));
  if (result.hasFatalError()) return result;
  result.merge(
      ResourceChangeChecker.checkFilesToBeChanged(changedFiles, new SubProgressMonitor(pm, 1)));

  if (fRoot == null) {
    fRoot =
        RefactoringASTParser.parseWithASTProvider(fCUnit, true, new SubProgressMonitor(pm, 99));
  }
  fImportRewriter = StubUtility.createImportRewrite(fRoot, true);

  fAST = fRoot.getAST();
  fRoot.accept(createVisitor());

  fSelectionStart = fAnalyzer.getSelection().getOffset();
  fSelectionLength = fAnalyzer.getSelection().getLength();

  result.merge(fAnalyzer.checkInitialConditions(fImportRewriter));
  if (result.hasFatalError()) return result;
  if (fVisibility == -1) {
    setVisibility(Modifier.PRIVATE);
  }
  initializeParameterInfos();
  initializeUsedNames();
  initializeDuplicates();
  initializeDestinations();
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:45,代码来源:ExtractMethodRefactoring.java


注:本文中的org.eclipse.ltk.core.refactoring.RefactoringStatus.merge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。