Ejemplo n.º 1
0
  @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);
  }
Ejemplo n.º 2
0
 public static void closeAllEditors() {
   for (IWorkbenchWindow window : PlatformUI.getWorkbench().getWorkbenchWindows()) {
     IWorkbenchPage page = window.getActivePage();
     if (page != null) {
       page.closeAllEditors(false);
     }
   }
 }
Ejemplo n.º 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());
    }
  }
Ejemplo n.º 4
0
 @Override
 public void tearDown() throws Exception {
   TaskTestUtil.resetTaskListAndRepositories();
   activePage.closeAllEditors(false);
 }