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


Java RefactoringStatus.createWarningStatus方法代码示例

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


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

示例1: checkName

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
/**
 * Returns a fatal error in case the name is empty. In all other cases, an
 * error based on the given status is returned.
 *
 * @param name
 *            a name
 * @param status
 *            a status
 * @return RefactoringStatus based on the given status or the name, if
 *         empty.
 */
public static RefactoringStatus checkName(String name, IStatus status) {
	RefactoringStatus result = new RefactoringStatus();
	if ("".equals(name)) {
		return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.Checks_Choose_name);
	}

	if (status.isOK()) {
		return result;
	}

	switch (status.getSeverity()) {
		case IStatus.ERROR:
			return RefactoringStatus.createFatalErrorStatus(status.getMessage());
		case IStatus.WARNING:
			return RefactoringStatus.createWarningStatus(status.getMessage());
		case IStatus.INFO:
			return RefactoringStatus.createInfoStatus(status.getMessage());
		default: //no nothing
			return new RefactoringStatus();
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:33,代码来源:Checks.java

示例2: checkNewPathValidity

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
private RefactoringStatus checkNewPathValidity() {
  IContainer c = fType.getCompilationUnit().getResource().getParent();

  String notRename = RefactoringCoreMessages.RenameTypeRefactoring_will_not_rename;
  IStatus status = c.getWorkspace().validateName(getNewElementName(), IResource.FILE);
  if (status.getSeverity() == IStatus.ERROR)
    return RefactoringStatus.createWarningStatus(
        status.getMessage() + ". " + notRename); // $NON-NLS-1$

  status = c.getWorkspace().validatePath(createNewPath(getNewElementName()), IResource.FILE);
  if (status.getSeverity() == IStatus.ERROR)
    return RefactoringStatus.createWarningStatus(
        status.getMessage() + ". " + notRename); // $NON-NLS-1$

  return new RefactoringStatus();
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:RenameTypeProcessor.java

示例3: checkName

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
/**
 * Returns a fatal error in case the name is empty. In all other cases, an error based on the
 * given status is returned.
 *
 * @param name a name
 * @param status a status
 * @return RefactoringStatus based on the given status or the name, if empty.
 */
public static RefactoringStatus checkName(String name, IStatus status) {
  RefactoringStatus result = new RefactoringStatus();
  if ("".equals(name)) // $NON-NLS-1$
  return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.Checks_Choose_name);

  if (status.isOK()) return result;

  switch (status.getSeverity()) {
    case IStatus.ERROR:
      return RefactoringStatus.createFatalErrorStatus(status.getMessage());
    case IStatus.WARNING:
      return RefactoringStatus.createWarningStatus(status.getMessage());
    case IStatus.INFO:
      return RefactoringStatus.createInfoStatus(status.getMessage());
    default: // no nothing
      return new RefactoringStatus();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:Checks.java

示例4: checkOverloading

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
private RefactoringStatus checkOverloading() {
  try {
    if (fIntermediaryType != null) {
      IMethod[] toCheck = fIntermediaryType.getMethods();
      for (int i = 0; i < toCheck.length; i++) {
        IMethod method = toCheck[i];
        if (method.getElementName().equals(fIntermediaryMethodName))
          return RefactoringStatus.createWarningStatus(
              Messages.format(
                  RefactoringCoreMessages
                      .IntroduceIndirectionRefactoring_duplicate_method_name_in_declaring_type_error,
                  BasicElementLabels.getJavaElementName(fIntermediaryMethodName)));
      }
    }
  } catch (JavaModelException e) {
    return RefactoringStatus.createFatalErrorStatus(
        RefactoringCoreMessages
            .IntroduceIndirectionRefactoring_could_not_parse_declaring_type_error);
  }
  return new RefactoringStatus();
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:IntroduceIndirectionRefactoring.java

示例5: createInputWarningStatus

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
/**
 * Creates a warning status telling that the input element does not exist.
 *
 * @param element the input element, or <code>null</code>
 * @param name the name of the refactoring
 * @param id the id of the refactoring
 * @return the refactoring status
 */
public static RefactoringStatus createInputWarningStatus(
    final Object element, final String name, final String id) {
  Assert.isNotNull(name);
  Assert.isNotNull(id);
  if (element != null)
    return RefactoringStatus.createWarningStatus(
        Messages.format(
            RefactoringCoreMessages.InitializableRefactoring_input_not_exists,
            new String[] {
              JavaElementLabels.getTextLabel(element, JavaElementLabels.ALL_FULLY_QUALIFIED),
              name,
              id
            }));
  else
    return RefactoringStatus.createWarningStatus(
        Messages.format(
            RefactoringCoreMessages.InitializableRefactoring_inputs_do_not_exist,
            new String[] {name, id}));
}
 
开发者ID:eclipse,项目名称:che,代码行数:28,代码来源:JavaRefactoringDescriptorUtil.java

示例6: checkVisibilityChanges

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
private RefactoringStatus checkVisibilityChanges() throws JavaModelException {
  if (isVisibilitySameAsInitial()) return null;
  if (fRippleMethods.length == 1) return null;
  Assert.isTrue(JdtFlags.getVisibilityCode(fMethod) != Modifier.PRIVATE);
  if (fVisibility == Modifier.PRIVATE)
    return RefactoringStatus.createWarningStatus(
        RefactoringCoreMessages.ChangeSignatureRefactoring_non_virtual);
  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:ChangeSignatureProcessor.java

示例7: checkNewElementName

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
public final RefactoringStatus checkNewElementName(String newName) {
  Assert.isNotNull(newName, "new name"); // $NON-NLS-1$

  RefactoringStatus status =
      Checks.checkName(newName, JavaConventionsUtil.validateMethodName(newName, fMethod));
  if (status.isOK() && !Checks.startsWithLowerCase(newName))
    status =
        RefactoringStatus.createWarningStatus(
            fIsComposite
                ? Messages.format(
                    RefactoringCoreMessages.Checks_method_names_lowercase2,
                    new String[] {
                      BasicElementLabels.getJavaElementName(newName), getDeclaringTypeLabel()
                    })
                : RefactoringCoreMessages.Checks_method_names_lowercase);

  if (Checks.isAlreadyNamed(fMethod, newName))
    status.addFatalError(
        fIsComposite
            ? Messages.format(
                RefactoringCoreMessages.RenameMethodRefactoring_same_name2,
                new String[] {
                  BasicElementLabels.getJavaElementName(newName), getDeclaringTypeLabel()
                })
            : RefactoringCoreMessages.RenameMethodRefactoring_same_name,
        JavaStatusContext.create(fMethod));
  return status;
}
 
开发者ID:eclipse,项目名称:che,代码行数:29,代码来源:RenameMethodProcessor.java

示例8: checkIfConstructorName

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
/**
 * Checks if method will have a constructor name after renaming.
 *
 * @param method
 * @param newMethodName
 * @param newTypeName
 * @return <code>RefactoringStatus</code> with <code>WARNING</code> severity if the give method
 *     will have a constructor name after renaming <code>null</code> otherwise.
 */
public static RefactoringStatus checkIfConstructorName(
    IMethod method, String newMethodName, String newTypeName) {
  if (!newMethodName.equals(newTypeName)) return null;
  else
    return RefactoringStatus.createWarningStatus(
        Messages.format(
            RefactoringCoreMessages.Checks_constructor_name,
            new Object[] {
              JavaElementUtil.createMethodSignature(method),
              JavaElementLabels.getElementLabel(
                  method.getDeclaringType(), JavaElementLabels.ALL_FULLY_QUALIFIED)
            }));
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:Checks.java

示例9: checkMethodName

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
/**
 * Checks if the given name is a valid Java method name.
 *
 * @param name the java method name.
 * @param context an {@link IJavaElement} or <code>null</code>
 * @return a refactoring status containing the error message if the name is not a valid java
 *     method name.
 */
public static RefactoringStatus checkMethodName(String name, IJavaElement context) {
  RefactoringStatus status =
      checkName(name, JavaConventionsUtil.validateMethodName(name, context));
  if (status.isOK() && !startsWithLowerCase(name))
    return RefactoringStatus.createWarningStatus(
        RefactoringCoreMessages.Checks_method_names_lowercase);
  else return status;
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:Checks.java

示例10: createWarningAboutCall

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
private RefactoringStatus createWarningAboutCall(
    IMember enclosing, ASTNode concreteNode, String message) {
  String name = JavaElementLabels.getElementLabel(enclosing, JavaElementLabels.ALL_DEFAULT);
  String container =
      JavaElementLabels.getElementLabel(
          enclosing.getDeclaringType(), JavaElementLabels.ALL_FULLY_QUALIFIED);
  return RefactoringStatus.createWarningStatus(
      Messages.format(message, new String[] {name, container}),
      JavaStatusContext.create(enclosing.getCompilationUnit(), concreteNode));
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:IntroduceIndirectionRefactoring.java

示例11: createFrom

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
private static RefactoringStatus createFrom(IStatus status) {
  if (status.isOK()) return new RefactoringStatus();

  if (!status.isMultiStatus()) {
    switch (status.getSeverity()) {
      case IStatus.OK:
        return new RefactoringStatus();
      case IStatus.INFO:
        return RefactoringStatus.createInfoStatus(status.getMessage());
      case IStatus.WARNING:
        return RefactoringStatus.createWarningStatus(status.getMessage());
      case IStatus.ERROR:
        return RefactoringStatus.createErrorStatus(status.getMessage());
      case IStatus.CANCEL:
        return RefactoringStatus.createFatalErrorStatus(status.getMessage());
      default:
        return RefactoringStatus.createFatalErrorStatus(status.getMessage());
    }
  } else {
    IStatus[] children = status.getChildren();
    RefactoringStatus result = new RefactoringStatus();
    for (int i = 0; i < children.length; i++) {
      result.merge(createFrom(children[i]));
    }
    return result;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:28,代码来源:ResourceChangeChecker.java

示例12: checkMethodName

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
/**
 * Checks if the given name is a valid Java method name.
 *
 * @param name
 *            the java method name.
 * @param context
 *            an {@link IJavaElement} or <code>null</code>
 * @return a refactoring status containing the error message if the name is
 *         not a valid java method name.
 */
public static RefactoringStatus checkMethodName(String name, IJavaElement context) {
	RefactoringStatus status = checkName(name, JavaConventionsUtil.validateMethodName(name, context));
	if (status.isOK() && !startsWithLowerCase(name)) {
		return RefactoringStatus.createWarningStatus(RefactoringCoreMessages.Checks_method_names_lowercase);
	} else {
		return status;
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:19,代码来源:Checks.java

示例13: createInputWarningStatus

import org.eclipse.ltk.core.refactoring.RefactoringStatus; //导入方法依赖的package包/类
/**
 * Creates a warning status telling that the input element does not exist.
 *
 * @param element
 *            the input element, or <code>null</code>
 * @param name
 *            the name of the refactoring
 * @param id
 *            the id of the refactoring
 * @return the refactoring status
 */
public static RefactoringStatus createInputWarningStatus(final Object element, final String name, final String id) {
	Assert.isNotNull(name);
	Assert.isNotNull(id);
	if (element != null) {
		return RefactoringStatus
				.createWarningStatus(Messages.format(RefactoringCoreMessages.InitializableRefactoring_input_not_exists, new String[] { JavaElementLabels.getTextLabel(element, JavaElementLabels.ALL_FULLY_QUALIFIED), name, id }));
	} else {
		return RefactoringStatus.createWarningStatus(Messages.format(RefactoringCoreMessages.InitializableRefactoring_inputs_do_not_exist, new String[] { name, id }));
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:22,代码来源:JavaRefactoringDescriptorUtil.java


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