Ejemplo n.º 1
0
  public void testBlocking() {
    final Composite parentComposite =
        ReflectionUtils.invokeHidden(subModuleNodeView, "getParentComposite");
    final Composite contentComposite =
        ReflectionUtils.invokeHidden(subModuleNodeView, "getContentComposite");
    final Cursor oldCursor = parentComposite.getCursor();
    final Cursor waitCursor = parentComposite.getDisplay().getSystemCursor(SWT.CURSOR_WAIT);

    node.setBlocked(true);

    assertFalse(contentComposite.isEnabled());
    assertSame(waitCursor, parentComposite.getCursor());

    node.setBlocked(false);

    assertTrue(contentComposite.isEnabled());
    assertSame(oldCursor, parentComposite.getCursor());

    // blocking several times should still have the same cursor outcome
    node.setBlocked(true);
    node.setBlocked(true);

    assertFalse(contentComposite.isEnabled());
    assertSame(waitCursor, parentComposite.getCursor());

    node.setBlocked(false);

    assertTrue(contentComposite.isEnabled());
    assertSame(oldCursor, parentComposite.getCursor());
  }
  @Override
  protected void saveSettings() {
    List<ProcessorOption> elements;
    boolean isProjSpecificDisabled = (fJProj != null) && !fBlockControl.isEnabled();
    if (isProjSpecificDisabled) {
      // We're in a project properties pane but the entire configuration
      // block control is disabled.  That means the per-project settings checkbox
      // is unchecked.  To save that state, we'll clear the proc options map.
      elements = Collections.<ProcessorOption>emptyList();
    } else {
      elements = getListElements();
    }
    saveProcessorOptions(elements);
    super.saveSettings();
    if (null != fAptProject) {
      if (isProjSpecificDisabled) { // compare against workspace defaults
        if (!fOriginalGenSrcDir.equals(AptConfig.getGenSrcDir(null))) {
          fAptProject.preferenceChanged(AptPreferenceConstants.APT_GENSRCDIR);
        }
        if (fOriginalAptEnabled != AptConfig.isEnabled(null)) {
          // make JDT "processingEnabled" setting track APT "enabled" setting.
          setJDTProcessAnnotationsSetting(fAptEnabledField.isSelected());

          fAptProject.preferenceChanged(AptPreferenceConstants.APT_ENABLED);
        }
        if (fOriginalReconcileEnabled != AptConfig.shouldProcessDuringReconcile(null)) {
          fAptProject.preferenceChanged(AptPreferenceConstants.APT_RECONCILEENABLED);
        }
      } else { // compare against current settings
        if (!fOriginalGenSrcDir.equals(fGenSrcDirField.getText()))
          fAptProject.preferenceChanged(AptPreferenceConstants.APT_GENSRCDIR);
        boolean isAptEnabled = fAptEnabledField.isSelected();
        if (fOriginalAptEnabled != isAptEnabled) {
          // make JDT "processingEnabled" setting track APT "enabled" setting.
          setJDTProcessAnnotationsSetting(isAptEnabled);

          fAptProject.preferenceChanged(AptPreferenceConstants.APT_ENABLED);
        }
        if (fOriginalReconcileEnabled != fReconcileEnabledField.isSelected())
          fAptProject.preferenceChanged(AptPreferenceConstants.APT_RECONCILEENABLED);
      }
    }
  }