Beispiel #1
0
  public void testCheckProviderWithFilter() {
    CheckboxTreeViewer ctv = (CheckboxTreeViewer) fViewer;

    final CheckStateProviderTestsUtil.Filter filter = new CheckStateProviderTestsUtil.Filter();
    ctv.addFilter(filter);

    // First provider
    // Should cause visible items' check state adhere to provider
    final TestCheckStateProvider checkStateProvider = new TestCheckStateProvider(0);
    ctv.setCheckStateProvider(checkStateProvider);
    ctv.expandAll();

    // Check that all states are properly set
    checkAllStates("Testing checkbox state with a sorter", ctv, 0);

    // Check that the provider is only invoked on elements which pass the filter
    for (Iterator i = checkStateProvider.isCheckedInvokedOn.iterator(); i.hasNext(); ) {
      TestElement element = (TestElement) i.next();
      assertTrue(
          "The check provider should not be invoked on elements which did not get through the filter",
          filter.select(ctv, null, element));
    }

    for (Iterator i = checkStateProvider.isGrayedInvokedOn.iterator(); i.hasNext(); ) {
      TestElement element = (TestElement) i.next();
      assertTrue(
          "The check provider should not be invoked on elements which did not get through the filter",
          filter.select(ctv, null, element));
    }
  }
 /** @see org.eclipse.epf.ui.wizards.BaseWizardPage#onEnterPage(Object) */
 public void onEnterPage(Object obj) {
   if (obj != null && obj instanceof String) {
     String configName = (String) obj;
     config =
         LibraryServiceUtil.getMethodConfiguration(
             LibraryService.getInstance().getCurrentMethodLibrary(), configName);
     if (config != null) {
       processViewer.setInput(config);
       initControls();
       processViewer.expandAll();
     } else {
       // For config free process publishing
       config =
           ConfigFreeProcessPublishUtil.getInstance().getMethodConfigurationForConfigFreeProcess();
       processViewer.setInput(LibraryService.getInstance().getCurrentMethodLibrary());
       initControls();
       processViewer.expandAll();
     }
   }
 }
Beispiel #3
0
  public void testCheckProviderWithSorter() {
    CheckboxTreeViewer ctv = (CheckboxTreeViewer) fViewer;

    ctv.setSorter(new CheckStateProviderTestsUtil.Sorter());

    // First provider
    // Should cause visible items' check state adhere to provider
    ctv.setCheckStateProvider(new TestCheckStateProvider(0));
    ctv.expandAll();

    // Check that all states are properly set
    checkAllStates("Testing checkbox state with a sorter", ctv, 0);
  }
Beispiel #4
0
  public void testSetNewCheckProvider() {
    CheckboxTreeViewer ctv = (CheckboxTreeViewer) fViewer;

    // First provider
    // Should cause visible items' check state to adhere to provider
    ctv.setCheckStateProvider(new TestCheckStateProvider(0));
    ctv.expandAll();

    checkAllStates("Testing checkbox state after first refresh", ctv, 0);

    // Put in a new check state provider
    ctv.setCheckStateProvider(new TestCheckStateProvider(1));

    // Check that setting a new check provider caused a refresh,
    // and thus all the items have their new appropriate check
    // states.
    checkAllStates("Testing checkbox state after setting new check provider", ctv, 1);
  }
Beispiel #5
0
  public void testSetCheckProviderRefreshesItems() {
    CheckboxTreeViewer ctv = (CheckboxTreeViewer) fViewer;

    // First provider
    // Should cause visible items' check state adhere to provider
    ctv.setCheckStateProvider(new TestCheckStateProvider(0));

    ctv.expandAll();

    // Check that all states are properly set
    checkAllStates("Testing checkbox state after refresh", ctv, 0);

    // Remove the check state provider
    ctv.setCheckStateProvider(null);

    // Test that an update doesn't fail
    TestElement update = fRootElement.getFirstChild().getChildAt(5);
    ctv.update(update, null);

    // Test that a refresh doesn't fail
    ctv.refresh();
  }
 /** Causes the tree viewer to expand all its items */
 public void expandAll() {
   fTreeViewer.expandAll();
 }
Beispiel #7
0
 public void testWithoutCheckProvider() {
   // Check that without a provider, no exceptions are thrown
   CheckboxTreeViewer ctv = (CheckboxTreeViewer) fViewer;
   ctv.expandAll();
   ctv.refresh();
 }