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


Java DefaultCodeFormatterConstants类代码示例

本文整理汇总了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;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:19,代码来源:TestOptions.java

示例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);
}
 
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:AbstractRefactoringTestSetup.java

示例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");
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:UnresolvedTypesQuickFixTest.java

示例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");
}
 
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:AdvancedQuickAssistTest18.java

示例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;
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:ConvertForLoopQuickFixTest.java

示例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");
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:ModifierCorrectionsQuickFixTest17.java

示例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");
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:TypeMismatchQuickFixTests.java

示例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");
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:ModifierCorrectionsQuickFixTest.java

示例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");
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:AssistQuickFixTest18.java

示例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");
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:ReturnTypeQuickFixTest.java

示例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");
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:ReorgQuickFixTest.java

示例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;
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:ConvertIterableLoopQuickFixTest.java

示例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");
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:AdvancedQuickAssistTest.java

示例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");
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:AdvancedQuickAssistTest17.java

示例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);
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:CodeFormatterUtil.java


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