public void undo() {
   if (listener != null) combo.removeModifyListener(listener);
   wc.setAttribute(key, oldVal);
   if (combo != null && !combo.isDisposed()) combo.setText(oldVal);
   if (listener != null) combo.addModifyListener(listener);
   postOp(POST_UNDO);
 }
Example #2
0
  private void populateOperationCombo() {
    if (_operationSelectionCombo != null && !_operationSelectionCombo.isDisposed()) {
      _operationSelectionCombo.removeAll();
      _operationSelectionCombo.clearSelection();

      if (getTargetObject() == null) {
        PictogramElement[] pes =
            SwitchyardSCAEditor.getActiveEditor().getSelectedPictogramElements();
        if (pes.length > 0) {
          Object bo =
              SwitchyardSCAEditor.getActiveEditor()
                  .getDiagramTypeProvider()
                  .getFeatureProvider()
                  .getBusinessObjectForPictogramElement(pes[0]);
          if (bo instanceof Contract) {
            setTargetObject(bo);
          }
        }
      }
      if (getTargetObject() != null && getTargetObject() instanceof Contract) {
        String[] operations = InterfaceOpsUtil.gatherOperations((Contract) getTargetObject());
        for (int i = 0; i < operations.length; i++) {
          _operationSelectionCombo.add(operations[i]);
        }
      }
    }
  }
  private void refresh(final boolean repopulateCombo) {
    if (combo == null || combo.isDisposed()) {
      return;
    }
    // $TODO GTK workaround
    try {
      if (diagram == null || domain == null) {
        combo.setEnabled(false);
        combo.setText(StringUtil.EMPTY_STRING);
      } else {
        if (repopulateCombo) {
          combo.setItems(getPickableConcerns());
        }

        String currentConcern = StringUtil.EMPTY_STRING;
        if (getDiagram().getCurrentConcern() != null) {
          currentConcern = getDiagram().getCurrentConcern().getName();
        }
        final int index = combo.indexOf(currentConcern);
        if (index == -1 || forceSetText) {
          combo.setText(currentConcern);
        } else {
          combo.select(index);
        }
        combo.setEnabled(true);
      }
    } catch (final SWTException exception) {
      if (!"gtk".equals(SWT.getPlatform())) { // $NON-NLS-1$
        throw exception;
      }
    }
  }
 public IStatus redo() {
   if (listener != null) combo.removeModifyListener(listener);
   wc.setAttribute(key, newVal);
   if (combo != null && !combo.isDisposed()) combo.setText(newVal);
   if (listener != null) combo.addModifyListener(listener);
   postOp(POST_REDO);
   return Status.OK_STATUS;
 }
 @Override
 public void doit(PropertyChangeEvent evt, Display display) {
   if (!displayType.isDisposed()) {
     String type = displayType.getItem(displayType.getSelectionIndex());
     chartFrame.setChart(createChart(type));
     chartFrame.redraw();
   }
 }
 /*
  * (non-Javadoc)
  * @see it.baeyens.avreclipse.ui.editors.targets.AbstractTCSectionPart#setFocus(java.lang.String)
  */
 @Override
 public boolean setFocus(String attribute) {
   if (attribute.equals(ATTR_MCU)) {
     if (fMCUcombo != null && !fMCUcombo.isDisposed()) {
       fMCUcombo.setFocus();
     }
     return true;
   }
   return false;
 }
  public void setRGB(RGB rgb) {
    oldRgb = rgb;
    if (combo.isDisposed()) {
      return;
    }

    colorSelector.setColorValue(rgb);

    String newComboText = predefinedColor;
    if (predefinedColor == null) {
      if (rgb == null) {
        newComboText = NONE_CHOICE;
      } else {
        newComboText = formatRGB(rgb);
      }
    }
    if (!combo.getText().equals(newComboText)) {
      combo.setText(newComboText);
    }
  }
 public void setLocationText(String location) {
   if (cmbDirectoryLocation != null && !cmbDirectoryLocation.isDisposed())
     cmbDirectoryLocation.setText(location);
 }