本文整理汇总了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)
};
}
示例2: getExceptionVariableName
import org.eclipse.jdt.ui.PreferenceConstants; //导入方法依赖的package包/类
public static String getExceptionVariableName(IJavaProject project) {
return PreferenceConstants.getPreference(
PreferenceConstants.CODEGEN_EXCEPTION_VAR_NAME, project);
}
示例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);
}
}
}
示例4: getExceptionVariableName
import org.eclipse.jdt.ui.PreferenceConstants; //导入方法依赖的package包/类
public static String getExceptionVariableName(IJavaProject project) {
return PreferenceConstants.getPreference(PreferenceConstants.CODEGEN_EXCEPTION_VAR_NAME, project);
}
示例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