@Test
 @UI
 public void testErrorGoesAwayWhenFixed() {
   final WritableValue status1 = new WritableValue(ValidationStatus.error("error"), IStatus.class);
   final MultiValidator validator1 =
       new MultiValidator() {
         @Override
         protected IStatus validate() {
           return (IStatus) status1.getValue();
         }
       };
   mDataBindingContext.addValidationStatusProvider(validator1);
   final WritableValue status2 = new WritableValue(new RequiredStatus("required"), IStatus.class);
   final MultiValidator validator2 =
       new MultiValidator() {
         @Override
         protected IStatus validate() {
           return (IStatus) status2.getValue();
         }
       };
   mDataBindingContext.addValidationStatusProvider(validator2);
   mWizardDialog.open();
   assertThat(mWizardPage.getErrorMessage(), is("error"));
   assertThat(mWizardPage.isPageComplete(), is(false));
   status1.setValue(ValidationStatus.ok());
   assertThat(mWizardPage.getErrorMessage(), nullValue());
   assertThat(mWizardPage.isPageComplete(), is(false));
 }
Ejemplo n.º 2
0
 @Inject
 public void setSelectedElement(
     @Optional @Named("selectedTreeElement") MApplicationElement element) {
   if (element instanceof MApplication) {
     master.setValue(element);
   } else {
     master.setValue(null);
   }
 }
  /**
   * Asserts the use case of specifying null on construction for the detail type of the detail list.
   *
   * @throws Exception
   */
  public void testElementTypeNull() throws Exception {
    WritableValue observableValue =
        new WritableValue(new WritableList(new ArrayList(), Object.class), null);

    WritableListFactory factory = new WritableListFactory();
    DetailObservableList detailObservable =
        new DetailObservableList(factory, observableValue, null);
    assertNull(detailObservable.getElementType());

    // change the type returned from the factory
    factory.type = String.class;
    observableValue.setValue(new WritableList(new ArrayList(), String.class));
    assertNull("element type not null", detailObservable.getElementType());
  }
  /**
   * Asserts that you can't change the type across multiple inner observables.
   *
   * @throws Exception
   */
  public void testElementTypeNotNull() throws Exception {
    WritableValue observableValue =
        new WritableValue(new WritableList(new ArrayList(), Object.class), null);

    WritableListFactory factory = new WritableListFactory();
    DetailObservableList detailObservable =
        new DetailObservableList(factory, observableValue, Object.class);
    assertEquals(factory.type, detailObservable.getElementType());

    try {
      factory.type = String.class;
      observableValue.setValue(
          new WritableList(Arrays.asList(new Object[] {new Object()}), String.class));
      fail("if an element type is set this cannot be changed");
    } catch (AssertionFailedException e) {
    }
  }
 @Test
 @UI
 public void testRequiredStatusDoesNotTriggerError() {
   final WritableValue status = new WritableValue(new RequiredStatus("required"), IStatus.class);
   final MultiValidator validator =
       new MultiValidator() {
         @Override
         protected IStatus validate() {
           return (IStatus) status.getValue();
         }
       };
   mDataBindingContext.addValidationStatusProvider(validator);
   mWizardDialog.open();
   assertThat(mWizardPage.getErrorMessage(), nullValue());
   assertThat(mWizardPage.isPageComplete(), is(false));
   status.setValue(ValidationStatus.ok());
   assertThat(mWizardPage.getErrorMessage(), nullValue());
   assertThat(mWizardPage.isPageComplete(), is(true));
   status.setValue(new RequiredStatus("required2"));
   assertThat(mWizardPage.getErrorMessage(), nullValue());
   assertThat(mWizardPage.isPageComplete(), is(false));
 }
  @Override
  public void setBinding(Binding impl) {
    super.setBinding(impl);
    if (impl instanceof CamelMailBindingType) {
      _binding = (CamelMailBindingType) impl;

      _bindingValue.setValue(_binding);

      if (_binding.getConsume() == null) {
        TransactionalEditingDomain domain = getDomain(_binding);
        if (domain != null) {
          domain
              .getCommandStack()
              .execute(
                  new RecordingCommand(domain) {
                    protected void doExecute() {
                      _binding.setConsume(MailFactory.eINSTANCE.createCamelMailConsumerType());
                    }
                  });
        } else {
          _binding.setConsume(MailFactory.eINSTANCE.createCamelMailConsumerType());
        }
      }

      // refresh the operation selector control
      if (_opSelectorComposite != null
          && !_opSelectorComposite.isDisposed()
          && getTargetObject() != null) {
        _opSelectorComposite.setTargetObject(getTargetObject());
      }

      _opSelectorComposite.setBinding(_binding);
    } else {
      _bindingValue.setValue(null);
    }
  }
Ejemplo n.º 7
0
    @Override
    public void createControl(final Composite parent) {
      initializeDialogUnits(parent);

      final Composite composite = new Composite(parent, SWT.NONE);
      composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
      composite.setLayout(LayoutUtil.createContentGrid(1));

      final IRLibPaths rLibPaths = fRPkgManager.getRLibPaths();
      {
        final Group group = new Group(composite, SWT.NONE);
        group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
        group.setText("Target Library:");
        group.setLayout(LayoutUtil.createGroupGrid(1));

        fSelectTargetControl = new RLibrarySelectionComposite(group);
        fSelectTargetControl.setLayoutData(fSelectTargetControl.createGD());
        fSelectTargetControl.getValidator().setRequired(IRLibPaths.WRITABLE);
        fSelectTargetControl.setInput(rLibPaths);

        if (fMode == MODE_UPDATE) {
          fSameTargetControl = new Button(group, SWT.CHECK);
          fSameTargetControl.setText(
              "Install updates to the library of the installed package, if possible.");
          fSameTargetControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
        }
      }

      Dialog.applyDialogFont(composite);
      setControl(composite);

      final DataBindingSupport databinding = new DataBindingSupport(composite);
      addBindings(databinding);

      fTargetLibraryValue.setValue(RPkgUtil.getDefaultInstallLocation(rLibPaths));
      WizardPageSupport.create(this, databinding.getContext());
    }
 /* (non-Javadoc)
  * @see org.switchyard.tools.ui.editor.diagram.shared.AbstractSwitchyardComposite#dispose()
  */
 @Override
 public void dispose() {
   _bindingValue.dispose();
   super.dispose();
 }
Ejemplo n.º 9
0
 public IRLibraryLocation getInstallTargetLocation() {
   return (IRLibraryLocation) fTargetLibraryValue.getValue();
 }
Ejemplo n.º 10
0
 public boolean getInstallSameLocation() {
   return (fSameTargetValue != null && ((Boolean) fSameTargetValue.getValue()).booleanValue());
 }
Ejemplo n.º 11
0
 public TriggerSequence[] getStopRecordShortcuts() {
   return (TriggerSequence[]) stopRecordShortcutsObservable.getValue();
 }
Ejemplo n.º 12
0
 private void setModel(ITestCase value) {
   testCase.setValue(value);
 }
 private void createModel() {
   myShop = ShopFactory.eINSTANCE.createShop();
   myShop.setName("NWS");
   myBoolOV = WritableValue.withValueType(EcorePackage.Literals.EBOOLEAN);
 }
Ejemplo n.º 14
0
 private void updateTriggerSequence(String commandId, WritableValue value) {
   TriggerSequence[] sequences = bindingService.getActiveBindingsFor(commandId);
   value.setValue(sequences);
 }
Ejemplo n.º 15
0
 public TriggerSequence[] getReplayShortcuts() {
   return (TriggerSequence[]) replayShortcutsObservable.getValue();
 }
 @Override
 public synchronized void dispose() {
   disposed = true;
   super.dispose();
 }
Ejemplo n.º 17
0
 public void saveSettings() {
   final IDialogSettings settings = getDialogSettings();
   DialogUtil.saveHistorySettings(settings, fHistoryId, (String) fNewLocationString.getValue());
 }
Ejemplo n.º 18
0
 public TriggerSequence[] getRecordModeShortcuts() {
   return (TriggerSequence[]) recordModeShortcutsObservable.getValue();
 }
Ejemplo n.º 19
0
 public TriggerSequence[] getAssertModeShortcuts() {
   return (TriggerSequence[]) assertModeShortcutsObservable.getValue();
 }
Ejemplo n.º 20
0
 private ITestCase getModel() {
   return (ITestCase) testCase.getValue();
 }