@Override
  public void setUp() throws Exception {
    taskList = TasksUiPlugin.getTaskList();

    TaskTestUtil.resetTaskListAndRepositories();
    TasksUiPlugin.getDefault().getLocalTaskRepository();

    cat1 = new TaskCategory("First Category");
    taskList.addCategory(cat1);

    cat1task1 = TasksUiInternal.createNewLocalTask("task 1");
    cat1task1.setPriority(PriorityLevel.P1.toString());
    cat1task1.setCompletionDate(new Date());
    taskList.addTask(cat1task1, cat1);

    cat1task2 = TasksUiInternal.createNewLocalTask("task 2");
    cat1task2.setPriority(PriorityLevel.P2.toString());
    taskList.addTask(cat1task2, cat1);

    assertEquals(cat1.getChildren().size(), 2);

    activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    assertTrue(activePage.closeAllEditors(false));
    assertEquals(0, activePage.getEditorReferences().length);
  }
예제 #2
0
 public static void closeAllEditors() {
   for (IWorkbenchWindow window : PlatformUI.getWorkbench().getWorkbenchWindows()) {
     IWorkbenchPage page = window.getActivePage();
     if (page != null) {
       page.closeAllEditors(false);
     }
   }
 }
예제 #3
0
  private void cleanupWorkspace() throws CoreException {
    IWorkbenchWindow w = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    for (IWorkbenchPage p : w.getPages()) {
      p.closeAllEditors(true);
    }

    // TODO: close all open projects
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    for (IProject p : root.getProjects()) {
      p.delete(true, new NullProgressMonitor());
    }
  }
 @Override
 public void tearDown() throws Exception {
   TaskTestUtil.resetTaskListAndRepositories();
   activePage.closeAllEditors(false);
 }