本文整理汇总了Java中org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants类的典型用法代码示例。如果您正苦于以下问题:Java DefaultCodeFormatterConstants类的具体用法?Java DefaultCodeFormatterConstants怎么用?Java DefaultCodeFormatterConstants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultCodeFormatterConstants类属于org.eclipse.jdt.core.formatter包,在下文中一共展示了DefaultCodeFormatterConstants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDefaultOptions
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; //导入依赖的package包/类
public static Hashtable<String, String> getDefaultOptions() {
Hashtable<String, String> result = JavaCore.getDefaultOptions();
result.put(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING, JavaCore.IGNORE);
result.put(JavaCore.COMPILER_PB_FIELD_HIDING, JavaCore.IGNORE);
result.put(JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER, JavaCore.IGNORE);
result.put(JavaCore.COMPILER_PB_UNUSED_LOCAL, JavaCore.IGNORE);
result.put(JavaCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaCore.IGNORE);
result.put(JavaCore.COMPILER_PB_UNUSED_WARNING_TOKEN, JavaCore.IGNORE);
result.put(JavaCore.COMPILER_PB_DEAD_CODE, JavaCore.IGNORE);
result.put(JavaCore.COMPILER_PB_UNUSED_IMPORT, JavaCore.ERROR);
result.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
result.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
JavaCore.setComplianceOptions("1.8", result);
return result;
}
示例2: setUp
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; //导入依赖的package包/类
protected void setUp() throws Exception {
// super.setUp();
// fWasAutobuild= CoreUtility.setAutoBuilding(false);
// if (JavaPlugin.getActivePage() != null)
// JavaPlugin.getActivePage().close();
Hashtable options = TestOptions.getDefaultOptions();
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.TAB);
options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "0");
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, String.valueOf(9999));
JavaCore.setOptions(options);
TestOptions.initializeCodeGenerationOptions();
JavaPlugin.getDefault().getCodeTemplateStore().load();
StringBuffer comment = new StringBuffer();
comment.append("/**\n");
comment.append(" * ${tags}\n");
comment.append(" */");
StubUtility.setCodeTemplate(
CodeTemplateContextType.CONSTRUCTORCOMMENT_ID, comment.toString(), null);
}
示例3: setUp
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
super.setUp();
Hashtable options = TestOptions.getDefaultOptions();
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
JavaCore.setOptions(options);
IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
fJProject1 = ProjectTestSetup.getProject();
String newFileTemplate = "${package_declaration}\n\n${type_declaration}";
StubUtility.setCodeTemplate(CodeTemplateContextType.NEWTYPE_ID, newFileTemplate, null);
StubUtility.setCodeTemplate(CodeTemplateContextType.TYPECOMMENT_ID, "", null);
StubUtility.setCodeTemplate(CodeTemplateContextType.METHODSTUB_ID, "", null);
fSourceFolder = JavaProjectHelper.addSourceContainer(fJProject1, "src");
}
示例4: setUp
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
super.setUp();
Hashtable options = TestOptions.getDefaultOptions();
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
JavaCore.setOptions(options);
IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
store.setValue(PreferenceConstants.CODEGEN_KEYWORD_THIS, false);
StubUtility.setCodeTemplate(
CodeTemplateContextType.METHODSTUB_ID, "//TODO\n${body_statement}", null);
fJProject1 = Java18ProjectTestSetup.getProject();
fSourceFolder = JavaProjectHelper.addSourceContainer(fJProject1, "src");
}
示例5: setUp
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
super.setUp();
Hashtable options = TestOptions.getDefaultOptions();
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
JavaCore.setOptions(options);
IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
fJProject1 = ProjectTestSetup.getProject();
fSourceFolder = JavaProjectHelper.addSourceContainer(fJProject1, "src");
fConvertLoopProposal = null;
}
示例6: setUp
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
super.setUp();
Hashtable options = TestOptions.getDefaultOptions();
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
options.put(
DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_LOCAL_VARIABLE,
JavaCore.DO_NOT_INSERT);
JavaCore.setOptions(options);
IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
fJProject1 = Java17ProjectTestSetup.getProject();
StubUtility.setCodeTemplate(CodeTemplateContextType.METHODSTUB_ID, "", null);
StubUtility.setCodeTemplate(CodeTemplateContextType.CONSTRUCTORSTUB_ID, "", null);
fSourceFolder = JavaProjectHelper.addSourceContainer(fJProject1, "src");
}
示例7: setUp
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
super.setUp();
Hashtable options = TestOptions.getDefaultOptions();
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
options.put(
DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE,
String.valueOf(99));
options.put(JavaCore.COMPILER_PB_STATIC_ACCESS_RECEIVER, JavaCore.ERROR);
options.put(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION, JavaCore.IGNORE);
JavaCore.setOptions(options);
IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
StubUtility.setCodeTemplate(CodeTemplateContextType.CATCHBLOCK_ID, "", null);
StubUtility.setCodeTemplate(CodeTemplateContextType.CONSTRUCTORSTUB_ID, "", null);
StubUtility.setCodeTemplate(CodeTemplateContextType.METHODSTUB_ID, "", null);
fJProject1 = ProjectTestSetup.getProject();
fSourceFolder = JavaProjectHelper.addSourceContainer(fJProject1, "src");
}
示例8: setUp
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
super.setUp();
Hashtable options = TestOptions.getDefaultOptions();
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
options.put(
DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_LOCAL_VARIABLE,
JavaCore.DO_NOT_INSERT);
options.put(JavaCore.COMPILER_PB_STATIC_ACCESS_RECEIVER, JavaCore.ERROR);
options.put(JavaCore.COMPILER_PB_MISSING_SYNCHRONIZED_ON_INHERITED_METHOD, JavaCore.ERROR);
JavaCore.setOptions(options);
IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
fJProject1 = ProjectTestSetup.getProject();
StubUtility.setCodeTemplate(CodeTemplateContextType.METHODSTUB_ID, "", null);
StubUtility.setCodeTemplate(CodeTemplateContextType.CONSTRUCTORSTUB_ID, "", null);
fSourceFolder = JavaProjectHelper.addSourceContainer(fJProject1, "src");
}
示例9: setUp
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
super.setUp();
Hashtable options = TestOptions.getDefaultOptions();
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
JavaCore.setOptions(options);
IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
StubUtility.setCodeTemplate(
CodeTemplateContextType.METHODSTUB_ID, "//TODO\n${body_statement}", null);
fJProject1 = Java18ProjectTestSetup.getProject();
fSourceFolder = JavaProjectHelper.addSourceContainer(fJProject1, "src");
}
示例10: setUp
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
super.setUp();
Hashtable options = TestOptions.getDefaultOptions();
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
options.put(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION, JavaCore.IGNORE);
JavaCore.setOptions(options);
IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
fJProject1 = ProjectTestSetup.getProject();
fSourceFolder = JavaProjectHelper.addSourceContainer(fJProject1, "src");
}
示例11: setUp
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
super.setUp();
Hashtable options = TestOptions.getDefaultOptions();
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
options.put(JavaCore.COMPILER_PB_UNUSED_IMPORT, JavaCore.ERROR);
JavaCore.setOptions(options);
IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
fJProject1 = ProjectTestSetup.getProject();
fSourceFolder = JavaProjectHelper.addSourceContainer(fJProject1, "src");
}
示例12: setUp
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
super.setUp();
Hashtable options = TestOptions.getDefaultOptions();
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
JavaCore.setOptions(options);
IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
fProject = ProjectTestSetup.getProject();
fSourceFolder = JavaProjectHelper.addSourceContainer(fProject, "src");
fConvertLoopProposal = null;
}
示例13: setUp
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
super.setUp();
Hashtable options = TestOptions.getDefaultOptions();
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
JavaCore.setOptions(options);
IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
store.setValue(PreferenceConstants.CODEGEN_KEYWORD_THIS, false);
StubUtility.setCodeTemplate(
CodeTemplateContextType.METHODSTUB_ID, "//TODO\n${body_statement}", null);
// Preferences corePrefs = JavaPlugin.getJavaCorePluginPreferences();
// corePrefs.setValue(JavaCore.CODEASSIST_FIELD_PREFIXES, "");
// corePrefs.setValue(JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES, "");
// corePrefs.setValue(JavaCore.CODEASSIST_FIELD_SUFFIXES, "");
// corePrefs.setValue(JavaCore.CODEASSIST_STATIC_FIELD_SUFFIXES, "");
fJProject1 = ProjectTestSetup.getProject();
fSourceFolder = JavaProjectHelper.addSourceContainer(fJProject1, "src");
}
示例14: setUp
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
super.setUp();
Hashtable options = TestOptions.getDefaultOptions();
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
JavaCore.setOptions(options);
IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
store.setValue(PreferenceConstants.CODEGEN_KEYWORD_THIS, false);
StubUtility.setCodeTemplate(
CodeTemplateContextType.METHODSTUB_ID, "//TODO\n${body_statement}", null);
// Preferences corePrefs = JavaPlugin.getJavaCorePluginPreferences();
// corePrefs.setValue(JavaCore.CODEASSIST_FIELD_PREFIXES, "");
// corePrefs.setValue(JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES, "");
// corePrefs.setValue(JavaCore.CODEASSIST_FIELD_SUFFIXES, "");
// corePrefs.setValue(JavaCore.CODEASSIST_STATIC_FIELD_SUFFIXES, "");
fJProject1 = Java17ProjectTestSetup.getProject();
fSourceFolder = JavaProjectHelper.addSourceContainer(fJProject1, "src");
}
示例15: getTabWidth
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; //导入依赖的package包/类
/**
* Gets the current tab width.
*
* @param project The project where the source is used, used for project specific options or
* <code>null</code> if the project is unknown and the workspace default should be used
* @return The tab width
*/
public static int getTabWidth(IJavaProject project) {
/*
* If the tab-char is SPACE, FORMATTER_INDENTATION_SIZE is not used
* by the core formatter.
* We piggy back the visual tab length setting in that preference in
* that case.
*/
String key;
if (JavaCore.SPACE.equals(
getCoreOption(project, DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR)))
key = DefaultCodeFormatterConstants.FORMATTER_INDENTATION_SIZE;
else key = DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE;
return getCoreOption(project, key, 4);
}