當前位置: 首頁>>代碼示例>>Java>>正文


Java IProblem.Task方法代碼示例

本文整理匯總了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());
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:39,代碼來源:ReorgQuickFixTest.java

示例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());
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:40,代碼來源:ReorgQuickFixTest.java

示例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());
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:39,代碼來源:ReorgQuickFixTest.java

示例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());
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:41,代碼來源:ReorgQuickFixTest.java

示例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());
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:40,代碼來源:ReorgQuickFixTest.java

示例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());
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:40,代碼來源:ReorgQuickFixTest.java

示例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());
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:44,代碼來源:ReorgQuickFixTest.java


注:本文中的org.eclipse.jdt.core.compiler.IProblem.Task方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。