本文整理匯總了Java中org.eclipse.jdt.core.compiler.IProblem.Task方法的典型用法代碼示例。如果您正苦於以下問題:Java IProblem.Task方法的具體用法?Java IProblem.Task怎麽用?Java IProblem.Task使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jdt.core.compiler.IProblem
的用法示例。
在下文中一共展示了IProblem.Task方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testTodoTasks1
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
@Test
public void testTodoTasks1() throws Exception {
IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" public void foo() {\n");
buf.append(" // TODO: XXX\n");
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
String str = "TODO: XXX";
AssistContext context = getCorrectionContext(cu, buf.toString().indexOf(str), 0);
ProblemLocation problem =
new ProblemLocation(
buf.toString().indexOf(str),
str.length(),
IProblem.Task,
new String[0],
true,
IJavaModelMarker.TASK_MARKER);
ArrayList proposals = collectCorrections(context, problem);
assertNumberOfProposals(proposals, 1);
assertCorrectLabels(proposals);
CUCorrectionProposal proposal = (CUCorrectionProposal) proposals.get(0);
String preview = getPreviewContent(proposal);
buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" public void foo() {\n");
buf.append(" }\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
示例2: testTodoTasks2
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
@Test
public void testTodoTasks2() throws Exception {
IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" public void foo() {\n");
buf.append(" // Some other text TODO: XXX\n");
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
String str = "TODO: XXX";
AssistContext context = getCorrectionContext(cu, buf.toString().indexOf(str), 0);
ProblemLocation problem =
new ProblemLocation(
buf.toString().indexOf(str),
str.length(),
IProblem.Task,
new String[0],
true,
IJavaModelMarker.TASK_MARKER);
ArrayList proposals = collectCorrections(context, problem);
assertNumberOfProposals(proposals, 1);
assertCorrectLabels(proposals);
CUCorrectionProposal proposal = (CUCorrectionProposal) proposals.get(0);
String preview = getPreviewContent(proposal);
buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" public void foo() {\n");
buf.append(" // Some other text \n");
buf.append(" }\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
示例3: testTodoTasks3
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
@Test
public void testTodoTasks3() throws Exception {
IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" public void foo() {\n");
buf.append(" /* TODO: XXX */\n");
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
String str = "TODO: XXX";
AssistContext context = getCorrectionContext(cu, buf.toString().indexOf(str), 0);
ProblemLocation problem =
new ProblemLocation(
buf.toString().indexOf(str),
str.length(),
IProblem.Task,
new String[0],
true,
IJavaModelMarker.TASK_MARKER);
ArrayList proposals = collectCorrections(context, problem);
assertNumberOfProposals(proposals, 1);
assertCorrectLabels(proposals);
CUCorrectionProposal proposal = (CUCorrectionProposal) proposals.get(0);
String preview = getPreviewContent(proposal);
buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" public void foo() {\n");
buf.append(" }\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
示例4: testTodoTasks4
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
@Test
public void testTodoTasks4() throws Exception {
IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" public void foo() {\n");
buf.append(" /**\n");
buf.append(" TODO: XXX\n");
buf.append(" */\n");
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
String str = "TODO: XXX";
AssistContext context = getCorrectionContext(cu, buf.toString().indexOf(str), 0);
ProblemLocation problem =
new ProblemLocation(
buf.toString().indexOf(str),
str.length(),
IProblem.Task,
new String[0],
true,
IJavaModelMarker.TASK_MARKER);
ArrayList proposals = collectCorrections(context, problem);
assertNumberOfProposals(proposals, 1);
assertCorrectLabels(proposals);
CUCorrectionProposal proposal = (CUCorrectionProposal) proposals.get(0);
String preview = getPreviewContent(proposal);
buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" public void foo() {\n");
buf.append(" }\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
示例5: testTodoTasks6
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
@Test
public void testTodoTasks6() throws Exception {
IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" public void foo() {\n");
buf.append(" ;// TODO: XXX\n");
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
String str = "TODO: XXX";
AssistContext context = getCorrectionContext(cu, buf.toString().indexOf(str), 0);
ProblemLocation problem =
new ProblemLocation(
buf.toString().indexOf(str),
str.length(),
IProblem.Task,
new String[0],
true,
IJavaModelMarker.TASK_MARKER);
ArrayList proposals = collectCorrections(context, problem);
assertNumberOfProposals(proposals, 1);
assertCorrectLabels(proposals);
CUCorrectionProposal proposal = (CUCorrectionProposal) proposals.get(0);
String preview = getPreviewContent(proposal);
buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" public void foo() {\n");
buf.append(" ;\n");
buf.append(" }\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
示例6: testTodoTasks7
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
@Test
public void testTodoTasks7() throws Exception {
IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" public void foo() {\n");
buf.append(" /* TODO: XXX*/;\n");
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
String str = "TODO: XXX";
AssistContext context = getCorrectionContext(cu, buf.toString().indexOf(str), 0);
ProblemLocation problem =
new ProblemLocation(
buf.toString().indexOf(str),
str.length(),
IProblem.Task,
new String[0],
true,
IJavaModelMarker.TASK_MARKER);
ArrayList proposals = collectCorrections(context, problem);
assertNumberOfProposals(proposals, 1);
assertCorrectLabels(proposals);
CUCorrectionProposal proposal = (CUCorrectionProposal) proposals.get(0);
String preview = getPreviewContent(proposal);
buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" public void foo() {\n");
buf.append(" ;\n");
buf.append(" }\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
}
示例7: testTodoTasks5
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
@Test
public void testTodoTasks5() throws Exception {
IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" public void foo() {\n");
buf.append(" /**\n");
buf.append(" Some other text: TODO: XXX\n");
buf.append(" */\n");
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu = pack1.createCompilationUnit("E.java", buf.toString(), false, null);
String str = "TODO: XXX";
AssistContext context = getCorrectionContext(cu, buf.toString().indexOf(str), 0);
ProblemLocation problem =
new ProblemLocation(
buf.toString().indexOf(str),
str.length(),
IProblem.Task,
new String[0],
true,
IJavaModelMarker.TASK_MARKER);
ArrayList proposals = collectCorrections(context, problem);
assertNumberOfProposals(proposals, 1);
assertCorrectLabels(proposals);
CUCorrectionProposal proposal = (CUCorrectionProposal) proposals.get(0);
String preview = getPreviewContent(proposal);
buf = new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" public void foo() {\n");
buf.append(" /**\n");
buf.append(" Some other text: \n");
buf.append(" */\n");
buf.append(" }\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
}