use of org.eclipse.jface.preference.IPreferenceStore in project che by eclipse.
the class UnresolvedTypesQuickFixTest method setUp.
@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");
}
use of org.eclipse.jface.preference.IPreferenceStore in project che by eclipse.
the class ReturnTypeQuickFixTest method setUp.
//
// public static Test suite() {
// return setUpTest(new TestSuite(THIS));
// }
//
// public static Test setUpTest(Test test) {
// return new ProjectTestSetup(test);
// }
@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");
}
use of org.eclipse.jface.preference.IPreferenceStore in project che by eclipse.
the class ConvertForLoopQuickFixTest method setUp.
// public static Test suite() {
// return setUpTest(new TestSuite(THIS));
// }
// public static Test setUpTest(Test test) {
// return new ProjectTestSetup(test);
// }
@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;
}
use of org.eclipse.jface.preference.IPreferenceStore in project che by eclipse.
the class AssistQuickFixTest method testAssignParamToField4.
@Test
public void testAssignParamToField4() throws Exception {
IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
store.setValue(PreferenceConstants.CODEGEN_KEYWORD_THIS, true);
IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" private long count;\n");
buf.append("\n");
buf.append(" public void foo(int count) {\n");
buf.append(" count++;\n");
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
int offset = buf.toString().indexOf("int count");
AssistContext context = getCorrectionContext(cu, offset, 0);
List proposals = collectAssists(context, false);
assertNumberOfProposals(proposals, 2);
assertCorrectLabels(proposals);
CUCorrectionProposal proposal = (CUCorrectionProposal) proposals.get(0);
String preview1 = getPreviewContent(proposal);
buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" private long count;\n");
buf.append(" private int count2;\n");
buf.append("\n");
buf.append(" public void foo(int count) {\n");
buf.append(" this.count2 = count;\n");
buf.append(" count++;\n");
buf.append(" }\n");
buf.append("}\n");
String expected1 = buf.toString();
proposal = (CUCorrectionProposal) proposals.get(1);
String preview2 = getPreviewContent(proposal);
buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" private long count;\n");
buf.append("\n");
buf.append(" public void foo(int count) {\n");
buf.append(" this.count = count;\n");
buf.append(" count++;\n");
buf.append(" }\n");
buf.append("}\n");
String expected2 = buf.toString();
assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
}
use of org.eclipse.jface.preference.IPreferenceStore in project che by eclipse.
the class AdvancedQuickAssistTest method setUp.
@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");
}
Aggregations