• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Messages类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.jdt.internal.corext.util.Messages的典型用法代码示例。如果您正苦于以下问题:Java Messages类的具体用法?Java Messages怎么用?Java Messages使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Messages类属于org.eclipse.jdt.internal.corext.util包,在下文中一共展示了Messages类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: validatePage

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的package包/类
protected boolean validatePage() {
	if (getSourceFolderText().getText().length() == 0) {
		setErrorMessage("Source Folder 不能为空!");
		setPageComplete(false);
		return false;
	}
	IStatus sta = containerChanged();
	if (sta.getSeverity() == IStatus.ERROR) {
		setErrorMessage(Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidPackageName, sta.getMessage()));
		setPageComplete(false);
		return false;
	}

	sta = packageChanged();
	if (sta.getSeverity() == IStatus.ERROR) {
		setErrorMessage(Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidPackageName, sta.getMessage()));
		setPageComplete(false);
		return false;
	}

	setErrorMessage(null);
	setPageComplete(true);
	return true;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:25,代码来源:ExportToJavaBeanWizardPage.java


示例2: createChange

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的package包/类
/** {@inheritDoc} */
public CompilationUnitChange createChange(IProgressMonitor progressMonitor) throws CoreException {
  CompilationUnitRewrite cuRewrite =
      new CompilationUnitRewrite(
          (ICompilationUnit) fCompilationUnit.getJavaElement(), fCompilationUnit);

  fLinkedProposalModel.clear();
  for (int i = 0; i < fOperations.length; i++) {
    CompilationUnitRewriteOperation operation = fOperations[i];
    operation.rewriteAST(cuRewrite, fLinkedProposalModel);
  }

  CompilationUnitChange result = cuRewrite.createChange(getDisplayString(), true, null);
  if (result == null)
    throw new CoreException(
        new Status(
            IStatus.ERROR,
            JavaPlugin.ID_PLUGIN,
            Messages.format(
                FixMessages.CompilationUnitRewriteOperationsFix_nullChangeError,
                getDisplayString())));

  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:CompilationUnitRewriteOperationsFix.java


示例3: createNewName

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的package包/类
public String createNewName(IResource res, IContainer destination) {
  if (isNewNameOk(destination, res.getName())) return null;
  if (!ReorgUtils.isParentInWorkspaceOrOnDisk(res, destination)) return null;
  int i = 1;
  while (true) {
    String newName;
    if (i == 1)
      newName =
          Messages.format(
              RefactoringCoreMessages.CopyRefactoring_resource_copyOf1,
              res.getName()); // Don't use BasicElementLabels! No RTL!
    else
      newName =
          Messages.format(
              RefactoringCoreMessages.CopyRefactoring_resource_copyOfMore,
              new String[] {
                String.valueOf(i), res.getName()
              }); // Don't use BasicElementLabels! No RTL!
    if (isNewNameOk(destination, newName) && !fAutoGeneratedNewNames.contains(newName)) {
      fAutoGeneratedNewNames.add(newName);
      return newName;
    }
    i++;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:ReorgPolicyFactory.java


示例4: isValid

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的package包/类
@Override
public RefactoringStatus isValid(IProgressMonitor pm)
    throws CoreException, OperationCanceledException {
  if (!fResourceDescription.isValid()) {
    return RefactoringStatus.createFatalErrorStatus(
        Messages.format(
            RefactoringCoreMessages.UndoDeleteResourceChange_cannot_restore,
            BasicElementLabels.getResourceName(fResourceDescription.getName())));
  }

  if (fResourceDescription.verifyExistence(true)) {
    return RefactoringStatus.createFatalErrorStatus(
        Messages.format(
            RefactoringCoreMessages.UndoDeleteResourceChange_already_exists,
            BasicElementLabels.getResourceName(fResourceDescription.getName())));
  }

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


示例5: createIndirectAccessToStaticFix

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的package包/类
public static CompilationUnitRewriteOperationsFix createIndirectAccessToStaticFix(
    CompilationUnit compilationUnit, IProblemLocation problem) {
  if (!isIndirectStaticAccess(problem)) return null;

  ToStaticAccessOperation operations[] =
      createToStaticAccessOperations(
          compilationUnit, new HashMap<ASTNode, Block>(), problem, false);
  if (operations == null) return null;

  String label =
      Messages.format(
          FixMessages.CodeStyleFix_ChangeStaticAccess_description,
          operations[0].getAccessorName());
  return new CodeStyleFix(
      label, compilationUnit, new CompilationUnitRewriteOperation[] {operations[0]});
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:CodeStyleFix.java


示例6: createTypeRefChangeFullProposal

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的package包/类
static CUCorrectionProposal createTypeRefChangeFullProposal(
    ICompilationUnit cu, ITypeBinding binding, ASTNode node, int relevance) {
  ASTRewrite rewrite = ASTRewrite.create(node.getAST());
  String label =
      Messages.format(
          CorrectionMessages.UnresolvedElementsSubProcessor_change_full_type_description,
          BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_DEFAULT));
  Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);

  ASTRewriteCorrectionProposal proposal =
      new ASTRewriteCorrectionProposal(label, cu, rewrite, relevance, image);

  ImportRewrite imports = proposal.createImportRewrite((CompilationUnit) node.getRoot());
  Type type = imports.addImport(binding, node.getAST());

  rewrite.replace(node, type, null);
  return proposal;
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:UnresolvedElementsSubProcessor.java


示例7: rewriteAST

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void rewriteAST(CompilationUnitRewrite cuRewrite, LinkedProposalModel model)
    throws CoreException {
  AST ast = cuRewrite.getRoot().getAST();
  ListRewrite listRewrite =
      cuRewrite
          .getASTRewrite()
          .getListRewrite(fBodyDeclaration, fBodyDeclaration.getModifiersProperty());
  Annotation newAnnotation = ast.newMarkerAnnotation();
  newAnnotation.setTypeName(ast.newSimpleName(fAnnotation));
  TextEditGroup group =
      createTextEditGroup(
          Messages.format(
              FixMessages.Java50Fix_AddMissingAnnotation_description,
              BasicElementLabels.getJavaElementName(fAnnotation)),
          cuRewrite);
  listRewrite.insertFirst(newAnnotation, group);
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:Java50Fix.java


示例8: CorrectMainTypeNameProposal

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的package包/类
/**
 * Constructor for CorrectTypeNameProposal.
 *
 * @param cu the compilation unit
 * @param context the invocation context
 * @param oldTypeName the old type name
 * @param newTypeName the new type name
 * @param relevance the relevance
 */
public CorrectMainTypeNameProposal(
    ICompilationUnit cu,
    IInvocationContext context,
    String oldTypeName,
    String newTypeName,
    int relevance) {
  super("", cu, null, relevance, null); // $NON-NLS-1$
  fContext = context;

  setDisplayName(
      Messages.format(
          CorrectionMessages.ReorgCorrectionsSubProcessor_renametype_description,
          BasicElementLabels.getJavaElementName(newTypeName)));
  setImage(JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE));

  fOldName = oldTypeName;
  fNewName = newTypeName;
}
 
开发者ID:eclipse,项目名称:che,代码行数:28,代码来源:CorrectMainTypeNameProposal.java


示例9: getDisplayString

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的package包/类
private static String getDisplayString(
    SimpleName simpleName, IBinding binding, boolean removeAllAssignements) {
  String name = BasicElementLabels.getJavaElementName(simpleName.getIdentifier());
  switch (binding.getKind()) {
    case IBinding.TYPE:
      return Messages.format(FixMessages.UnusedCodeFix_RemoveType_description, name);
    case IBinding.METHOD:
      if (((IMethodBinding) binding).isConstructor()) {
        return Messages.format(FixMessages.UnusedCodeFix_RemoveConstructor_description, name);
      } else {
        return Messages.format(FixMessages.UnusedCodeFix_RemoveMethod_description, name);
      }
    case IBinding.VARIABLE:
      if (removeAllAssignements) {
        return Messages.format(
            FixMessages.UnusedCodeFix_RemoveFieldOrLocalWithInitializer_description, name);
      } else {
        return Messages.format(FixMessages.UnusedCodeFix_RemoveFieldOrLocal_description, name);
      }
    default:
      return ""; // $NON-NLS-1$
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:UnusedCodeFix.java


示例10: AssignToVariableAssistProposal

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的package包/类
public AssignToVariableAssistProposal(
    ICompilationUnit cu,
    SingleVariableDeclaration parameter,
    VariableDeclarationFragment existingFragment,
    ITypeBinding typeBinding,
    int relevance) {
  super("", cu, null, relevance, null); // $NON-NLS-1$

  fVariableKind = FIELD;
  fNodeToAssign = parameter;
  fTypeBinding = typeBinding;
  fExistingFragment = existingFragment;

  if (existingFragment == null) {
    setDisplayName(
        CorrectionMessages.AssignToVariableAssistProposal_assignparamtofield_description);
  } else {
    setDisplayName(
        Messages.format(
            CorrectionMessages.AssignToVariableAssistProposal_assigntoexistingfield_description,
            BasicElementLabels.getJavaElementName(existingFragment.getName().getIdentifier())));
  }
  setImage(JavaPluginImages.get(JavaPluginImages.IMG_FIELD_PRIVATE));
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:AssignToVariableAssistProposal.java


示例11: addUpdates

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的package包/类
private void addUpdates(
    TextChangeManager changeManager,
    ICompilationUnit movedUnit,
    IProgressMonitor pm,
    RefactoringStatus status)
    throws CoreException {
  try {
    pm.beginTask("", 3); // $NON-NLS-1$
    pm.subTask(
        Messages.format(
            RefactoringCoreMessages.MoveCuUpdateCreator_searching,
            BasicElementLabels.getFileName(movedUnit)));

    if (isInAnotherFragmentOfSamePackage(movedUnit, fDestination)) {
      pm.worked(3);
      return;
    }

    addImportToSourcePackageTypes(movedUnit, new SubProgressMonitor(pm, 1));
    removeImportsToDestinationPackageTypes(movedUnit);
    addReferenceUpdates(changeManager, movedUnit, new SubProgressMonitor(pm, 2), status);
  } finally {
    pm.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:MoveCuUpdateCreator.java


示例12: ImplementInterfaceProposal

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的package包/类
public ImplementInterfaceProposal(
    ICompilationUnit targetCU,
    ITypeBinding binding,
    CompilationUnit astRoot,
    ITypeBinding newInterface,
    int relevance) {
  super(
      "",
      targetCU,
      null,
      relevance,
      JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE)); // $NON-NLS-1$

  Assert.isTrue(binding != null && Bindings.isDeclarationBinding(binding));

  fBinding = binding;
  fAstRoot = astRoot;
  fNewInterface = newInterface;

  String[] args = {
    BasicElementLabels.getJavaElementName(binding.getName()),
    BasicElementLabels.getJavaElementName(Bindings.getRawName(newInterface))
  };
  setDisplayName(Messages.format(CorrectionMessages.ImplementInterfaceProposal_name, args));
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:ImplementInterfaceProposal.java


示例13: checkIfDeletedParametersUsed

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的package包/类
protected void checkIfDeletedParametersUsed() {
  for (Iterator<ParameterInfo> iter = getDeletedInfos().iterator(); iter.hasNext(); ) {
    ParameterInfo info = iter.next();
    VariableDeclaration paramDecl = getParameter(info.getOldIndex());
    TempOccurrenceAnalyzer analyzer = new TempOccurrenceAnalyzer(paramDecl, false);
    analyzer.perform();
    SimpleName[] paramRefs = analyzer.getReferenceNodes();

    if (paramRefs.length > 0) {
      RefactoringStatusContext context =
          JavaStatusContext.create(fCuRewrite.getCu(), paramRefs[0]);
      String typeName = getFullTypeName();
      Object[] keys =
          new String[] {
            BasicElementLabels.getJavaElementName(paramDecl.getName().getIdentifier()),
            BasicElementLabels.getJavaElementName(getMethod().getElementName()),
            BasicElementLabels.getJavaElementName(typeName)
          };
      String msg =
          Messages.format(
              RefactoringCoreMessages.ChangeSignatureRefactoring_parameter_used, keys);
      fResult.addError(msg, context);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:ChangeSignatureProcessor.java


示例14: getFullTypeName

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的package包/类
protected String getFullTypeName() {
  ASTNode node = getNode();
  while (true) {
    node = node.getParent();
    if (node instanceof AbstractTypeDeclaration) {
      String typeName = ((AbstractTypeDeclaration) node).getName().getIdentifier();
      if (getNode() instanceof LambdaExpression) {
        return Messages.format(
            RefactoringCoreMessages.ChangeSignatureRefactoring_lambda_expression, typeName);
      }
      return typeName;
    } else if (node instanceof ClassInstanceCreation) {
      ClassInstanceCreation cic = (ClassInstanceCreation) node;
      return Messages.format(
          RefactoringCoreMessages.ChangeSignatureRefactoring_anonymous_subclass,
          BasicElementLabels.getJavaElementName(ASTNodes.asString(cic.getType())));
    } else if (node instanceof EnumConstantDeclaration) {
      EnumDeclaration ed = (EnumDeclaration) node.getParent();
      return Messages.format(
          RefactoringCoreMessages.ChangeSignatureRefactoring_anonymous_subclass,
          BasicElementLabels.getJavaElementName(ASTNodes.asString(ed.getName())));
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:ChangeSignatureProcessor.java


示例15: checkOverloading

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的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


示例16: checkNewElementName

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的package包/类
public RefactoringStatus checkNewElementName(String newName) throws JavaModelException {
  RefactoringStatus result = Checks.checkFieldName(newName, fCu);
  if (!Checks.startsWithLowerCase(newName))
    if (fIsComposite) {
      final String nameOfParent =
          JavaElementLabels.getElementLabel(
              fLocalVariable.getParent(), JavaElementLabels.ALL_DEFAULT);
      final String nameOfType =
          JavaElementLabels.getElementLabel(
              fLocalVariable.getAncestor(IJavaElement.TYPE), JavaElementLabels.ALL_DEFAULT);
      result.addWarning(
          Messages.format(
              RefactoringCoreMessages.RenameTempRefactoring_lowercase2,
              new String[] {
                BasicElementLabels.getJavaElementName(newName), nameOfParent, nameOfType
              }));
    } else {
      result.addWarning(RefactoringCoreMessages.RenameTempRefactoring_lowercase);
    }
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:RenameLocalVariableProcessor.java


示例17: checkNewAccessor

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的package包/类
private RefactoringStatus checkNewAccessor(IMethod existingAccessor, String newAccessorName)
    throws CoreException {
  RefactoringStatus result = new RefactoringStatus();
  IMethod accessor =
      JavaModelUtil.findMethod(
          newAccessorName,
          existingAccessor.getParameterTypes(),
          false,
          fField.getDeclaringType());
  if (accessor == null || !accessor.exists()) return null;

  String message =
      Messages.format(
          RefactoringCoreMessages.RenameFieldRefactoring_already_exists,
          new String[] {
            JavaElementUtil.createMethodSignature(accessor),
            BasicElementLabels.getJavaElementName(
                fField.getDeclaringType().getFullyQualifiedName('.'))
          });
  result.addError(message, JavaStatusContext.create(accessor));
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:RenameFieldProcessor.java


示例18: checkNestedHierarchy

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的package包/类
private RefactoringStatus checkNestedHierarchy(IType type) throws CoreException {
  IType[] nestedTypes = type.getTypes();
  if (nestedTypes == null) return null;
  RefactoringStatus result = new RefactoringStatus();
  for (int i = 0; i < nestedTypes.length; i++) {
    IField otherField = nestedTypes[i].getField(getNewElementName());
    if (otherField.exists()) {
      String msg =
          Messages.format(
              RefactoringCoreMessages.RenameFieldRefactoring_hiding,
              new String[] {
                BasicElementLabels.getJavaElementName(fField.getElementName()),
                BasicElementLabels.getJavaElementName(getNewElementName()),
                BasicElementLabels.getJavaElementName(nestedTypes[i].getFullyQualifiedName('.'))
              });
      result.addWarning(msg, JavaStatusContext.create(otherField));
    }
    result.merge(checkNestedHierarchy(nestedTypes[i]));
  }
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:RenameFieldProcessor.java


示例19: checkIfComesFromInterface

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的package包/类
public static RefactoringStatus checkIfComesFromInterface(
    IMethod method, ITypeHierarchy hierarchy, IProgressMonitor monitor)
    throws JavaModelException {
  IMethod inInterface = MethodChecks.isDeclaredInInterface(method, hierarchy, monitor);

  if (inInterface == null) return null;

  RefactoringStatusContext context = JavaStatusContext.create(inInterface);
  String message =
      Messages.format(
          RefactoringCoreMessages.MethodChecks_implements,
          new String[] {
            JavaElementUtil.createMethodSignature(inInterface),
            JavaElementLabels.getElementLabel(
                inInterface.getDeclaringType(), JavaElementLabels.ALL_FULLY_QUALIFIED)
          });
  return RefactoringStatus.createStatus(
      RefactoringStatus.FATAL,
      message,
      context,
      Corext.getPluginId(),
      RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE,
      inInterface);
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:MethodChecks.java


示例20: getName

import org.eclipse.jdt.internal.corext.util.Messages; //导入依赖的package包/类
@Override
public String getName() {
  ICompilationUnit cu = getCompilationUnit();
  IPackageFragment parentPack = (IPackageFragment) cu.getParent();
  try {
    IPackageDeclaration[] decls = cu.getPackageDeclarations();
    if (parentPack.isDefaultPackage() && decls.length > 0) {
      return Messages.format(
          CorrectionMessages.CorrectPackageDeclarationProposal_remove_description,
          BasicElementLabels.getJavaElementName(decls[0].getElementName()));
    }
    if (!parentPack.isDefaultPackage() && decls.length == 0) {
      return (Messages.format(
          CorrectionMessages.CorrectPackageDeclarationProposal_add_description,
          JavaElementLabels.getElementLabel(parentPack, JavaElementLabels.ALL_DEFAULT)));
    }
  } catch (JavaModelException e) {
    JavaPlugin.log(e);
  }
  return (Messages.format(
      CorrectionMessages.CorrectPackageDeclarationProposal_change_description,
      JavaElementLabels.getElementLabel(parentPack, JavaElementLabels.ALL_DEFAULT)));
}
 
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:CorrectPackageDeclarationProposal.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IAnswerData类代码示例发布时间:2022-05-23
下一篇:
Java JavaBeanDeserializer类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap