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


Java PreferenceConstants.getPreference方法代码示例

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


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

示例1: getRelevantOptions

import org.eclipse.jdt.ui.PreferenceConstants; //导入方法依赖的package包/类
private String[] getRelevantOptions(IJavaProject project) {
	return new String[] {
		project.getOption(JavaCore.CODEASSIST_FIELD_PREFIXES, true),
		project.getOption(JavaCore.CODEASSIST_FIELD_SUFFIXES, true),
		PreferenceConstants.getPreference(PreferenceConstants.CODEGEN_IS_FOR_GETTERS, project)
	};
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:SelfEncapsulateFieldInputPage.java

示例2: getExceptionVariableName

import org.eclipse.jdt.ui.PreferenceConstants; //导入方法依赖的package包/类
public static String getExceptionVariableName(IJavaProject project) {
  return PreferenceConstants.getPreference(
      PreferenceConstants.CODEGEN_EXCEPTION_VAR_NAME, project);
}
 
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:StubUtility.java

示例3: addStaticImportFavoriteProposals

import org.eclipse.jdt.ui.PreferenceConstants; //导入方法依赖的package包/类
private static void addStaticImportFavoriteProposals(
    IInvocationContext context,
    SimpleName node,
    boolean isMethod,
    Collection<ICommandAccess> proposals)
    throws JavaModelException {
  IJavaProject project = context.getCompilationUnit().getJavaProject();
  if (JavaModelUtil.is50OrHigher(project)) {
    String pref =
        PreferenceConstants.getPreference(
            PreferenceConstants.CODEASSIST_FAVORITE_STATIC_MEMBERS, project);
    String[] favourites = pref.split(";"); // $NON-NLS-1$
    if (favourites.length == 0) {
      return;
    }

    CompilationUnit root = context.getASTRoot();
    AST ast = root.getAST();

    String name = node.getIdentifier();
    String[] staticImports =
        SimilarElementsRequestor.getStaticImportFavorites(
            context.getCompilationUnit(), name, isMethod, favourites);
    for (int i = 0; i < staticImports.length; i++) {
      String curr = staticImports[i];

      ImportRewrite importRewrite = StubUtility.createImportRewrite(root, true);
      ASTRewrite astRewrite = ASTRewrite.create(ast);

      String label;
      String qualifiedTypeName = Signature.getQualifier(curr);
      String elementLabel =
          BasicElementLabels.getJavaElementName(
              JavaModelUtil.concatenateName(Signature.getSimpleName(qualifiedTypeName), name));

      String res =
          importRewrite.addStaticImport(
              qualifiedTypeName,
              name,
              isMethod,
              new ContextSensitiveImportRewriteContext(
                  root, node.getStartPosition(), importRewrite));
      int dot = res.lastIndexOf('.');
      if (dot != -1) {
        String usedTypeName = importRewrite.addImport(qualifiedTypeName);
        Name newName = ast.newQualifiedName(ast.newName(usedTypeName), ast.newSimpleName(name));
        astRewrite.replace(node, newName, null);
        label =
            Messages.format(
                CorrectionMessages
                    .UnresolvedElementsSubProcessor_change_to_static_import_description,
                elementLabel);
      } else {
        label =
            Messages.format(
                CorrectionMessages.UnresolvedElementsSubProcessor_add_static_import_description,
                elementLabel);
      }

      Image image = JavaPluginImages.get(JavaPluginImages.IMG_OBJS_IMPDECL);
      ASTRewriteCorrectionProposal proposal =
          new ASTRewriteCorrectionProposal(
              label,
              context.getCompilationUnit(),
              astRewrite,
              IProposalRelevance.ADD_STATIC_IMPORT,
              image);
      proposal.setImportRewrite(importRewrite);
      proposals.add(proposal);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:73,代码来源:UnresolvedElementsSubProcessor.java

示例4: getExceptionVariableName

import org.eclipse.jdt.ui.PreferenceConstants; //导入方法依赖的package包/类
public static String getExceptionVariableName(IJavaProject project) {
	return PreferenceConstants.getPreference(PreferenceConstants.CODEGEN_EXCEPTION_VAR_NAME, project);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:4,代码来源:StubUtility.java

示例5: addStaticImportFavoriteProposals

import org.eclipse.jdt.ui.PreferenceConstants; //导入方法依赖的package包/类
private static void addStaticImportFavoriteProposals(IInvocationContext context, SimpleName node, boolean isMethod, Collection<ICommandAccess> proposals) throws JavaModelException {
	IJavaProject project= context.getCompilationUnit().getJavaProject();
	if (JavaModelUtil.is50OrHigher(project)) {
		String pref= PreferenceConstants.getPreference(PreferenceConstants.CODEASSIST_FAVORITE_STATIC_MEMBERS, project);
		String[] favourites= pref.split(";"); //$NON-NLS-1$
		if (favourites.length == 0) {
			return;
		}

		CompilationUnit root= context.getASTRoot();
		AST ast= root.getAST();
		
		String name= node.getIdentifier();
		String[] staticImports= SimilarElementsRequestor.getStaticImportFavorites(context.getCompilationUnit(), name, isMethod, favourites);
		for (int i= 0; i < staticImports.length; i++) {
			String curr= staticImports[i];
			
			ImportRewrite importRewrite= StubUtility.createImportRewrite(root, true);
			ASTRewrite astRewrite= ASTRewrite.create(ast);
			
			String label;
			String qualifiedTypeName= Signature.getQualifier(curr);
			String elementLabel= BasicElementLabels.getJavaElementName(JavaModelUtil.concatenateName(Signature.getSimpleName(qualifiedTypeName), name));
			
			String res= importRewrite.addStaticImport(qualifiedTypeName, name, isMethod, new ContextSensitiveImportRewriteContext(root, node.getStartPosition(), importRewrite));
			int dot= res.lastIndexOf('.');
			if (dot != -1) {
				String usedTypeName= importRewrite.addImport(qualifiedTypeName);
				Name newName= ast.newQualifiedName(ast.newName(usedTypeName), ast.newSimpleName(name));
				astRewrite.replace(node, newName, null);
				label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_change_to_static_import_description, elementLabel);
			} else {
				label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_add_static_import_description, elementLabel);
			}

			Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_IMPDECL);
			ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(), astRewrite, IProposalRelevance.ADD_STATIC_IMPORT, image);
			proposal.setImportRewrite(importRewrite);
			proposals.add(proposal);
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:43,代码来源:UnresolvedElementsSubProcessor.java

示例6: addStaticImportFavoriteProposals

import org.eclipse.jdt.ui.PreferenceConstants; //导入方法依赖的package包/类
private static void addStaticImportFavoriteProposals(IInvocationContext context, SimpleName node, boolean isMethod, Collection<ICommandAccess> proposals) throws JavaModelException {
	IJavaProject project= context.getCompilationUnit().getJavaProject();
	if (JavaModelUtil.is50OrHigher(project)) {
		String pref= PreferenceConstants.getPreference(PreferenceConstants.CODEASSIST_FAVORITE_STATIC_MEMBERS, project);
		String[] favourites= pref.split(";"); //$NON-NLS-1$
		if (favourites.length == 0) {
			return;
		}

		CompilationUnit root= context.getASTRoot();
		AST ast= root.getAST();
		
		String name= node.getIdentifier();
		String[] staticImports= SimilarElementsRequestor.getStaticImportFavorites(context.getCompilationUnit(), name, isMethod, favourites);
		for (int i= 0; i < staticImports.length; i++) {
			String curr= staticImports[i];
			
			ImportRewrite importRewrite= StubUtility.createImportRewrite(root, true);
			ASTRewrite astRewrite= ASTRewrite.create(ast);
			
			String label;
			String qualifiedTypeName= Signature.getQualifier(curr);
			String elementLabel= BasicElementLabels.getJavaElementName(JavaModelUtil.concatenateName(Signature.getSimpleName(qualifiedTypeName), name));
			
			String res= importRewrite.addStaticImport(qualifiedTypeName, name, isMethod, new ContextSensitiveImportRewriteContext(root, node.getStartPosition(), importRewrite));
			int dot= res.lastIndexOf('.');
			if (dot != -1) {
				String usedTypeName= importRewrite.addImport(qualifiedTypeName);
				Name newName= ast.newQualifiedName(ast.newName(usedTypeName), ast.newSimpleName(name));
				astRewrite.replace(node, newName, null);
				label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_change_to_static_import_description, elementLabel);
			} else {
				label= Messages.format(CorrectionMessages.UnresolvedElementsSubProcessor_add_static_import_description, elementLabel);
			}

			Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_IMPDECL);
			ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(), astRewrite, 5, image);
			proposal.setImportRewrite(importRewrite);
			proposals.add(proposal);
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:43,代码来源:UnresolvedElementsSubProcessor.java


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