Exemple #1
0
 public static void updateFromPreferences() {
   IPreferenceStore store = Activator.getDefault().getPreferenceStore();
   if (rollMax != null && !rollMax.isDisposed())
     rollMax.setText(store.getString(PreferenceConstants.P_CMD_ROLL));
   if (pitchMax != null && !pitchMax.isDisposed())
     pitchMax.setText(store.getString(PreferenceConstants.P_CMD_PITCH));
 }
  @Override
  public void refresh() {
    _inUpdate = true;
    try {
      org.eclipse.soa.sca.sca1_1.model.sca.Composite composite = getTargetObject();
      if (composite != null) {
        _businessObject = composite;
        if (_nameListener == null) {
          _nameListener = new NameListener();
        }
        composite.eAdapters().add(_nameListener);

        if (_nameText != null && !_nameText.isDisposed()) {
          String name = composite.getName();
          _nameText.setText(name == null ? "" : name); // $NON-NLS-1$
        }
        if (_targetNamespaceText != null && !_targetNamespaceText.isDisposed()) {
          // update TNS text box based on SY/composite settings
          String tns = composite.getTargetNamespace();
          _targetNamespaceText.setText(tns);
        }
      }
    } finally {
      _inUpdate = false;
    }
  }
Exemple #3
0
  public void applyColor(ColorType type, RGB rgb) {
    Color newColor = new Color(SwtUtils.DISPLAY, rgb);
    Color oldColor = null;

    switch (type) {
      case BACKGROUND:
        {
          oldColor = iniAppearance.getColorBackground();

          for (Control control : controls) {
            if (control.isDisposed()) continue;

            control.setBackground(newColor);
          }
          for (Text chat : chatControls) {
            if (chat.isDisposed()) continue;

            chat.setBackground(newColor);
          }

          iniAppearance.setColorBackground(newColor);
          break;
        }
      case FOREGROUND:
        {
          oldColor = iniAppearance.getColorForeground();

          for (Control control : controls) {
            if (control.isDisposed()) continue;

            control.setForeground(newColor);
          }
          for (Text chat : chatControls) {
            if (chat.isDisposed()) continue;

            chat.setForeground(newColor);
          }

          iniAppearance.setColorForeground(newColor);
          break;
        }
      case LOG_BACKGROUND:
        {
          oldColor = iniAppearance.getColorLogBackground();

          for (StyledText text : logControls) {
            if (text.isDisposed()) continue;

            text.setBackground(newColor);
            text.setForeground(newColor);
          }

          iniAppearance.setColorLogBackground(newColor);
        }
    }

    if (oldColor != null) oldColor.dispose();
  }
  private void showHideTexts() {
    if (passwordText != null && !passwordText.isDisposed()) {
      boolean enablePasswordField = false;
      if (connection != null) {
        IRepositoryFactory factory =
            RepositoryFactoryProvider.getRepositoriyById(connection.getRepositoryId());
        if (factory != null && factory.isAuthenticationNeeded()) {
          enablePasswordField = true;
        }
      } else if (getRepository() != null
          && RepositoryConstants.REPOSITORY_REMOTE_ID.equals(getRepository().getId())) {
        enablePasswordField = true;
      }

      if (enablePasswordField) {
        passwordText.setBackground(LoginDialogV2.WHITE_COLOR);
      } else {
        passwordText.setText(""); // $NON-NLS-1$
        passwordText.setBackground(LoginDialogV2.GREY_COLOR);
      }
      passwordText.setEnabled(enablePasswordField);
      passwordText.setEditable(enablePasswordField);

      hideControl(passwordText, !enablePasswordField, false);
      hideControl(passwordLabel, !enablePasswordField, false);

      passwordText.getParent().layout();
    }
  }
Exemple #5
0
  public void appendText(String text, long type) {
    if (m_Text.isDisposed()) return;

    // This is needed because the text control (on Windows) stores newlines
    // as \r\n and selections and character counts will get out of synch if
    // we
    // work in the text control but reason about the text and they have
    // different newlines.
    // (We still use \n everywhere else as the newline marker because that's
    // what Soar uses)
    text = text.replaceAll(AbstractView.kLineSeparator, AbstractView.kSystemLineSeparator);

    boolean show = true;
    int recordIndex = -1;

    if (m_FilteringEnabled) {
      // Record the text in our master filter document.
      // Also decide if we should show this particular line of text.
      recordIndex = m_FilterDoc.addRecord(text, false, type);
      show = m_FilterDoc.show(type);
    }

    if (show) {
      appendTextInternal(text, false, recordIndex);

      // Decide if we have caused the window to scroll or not
      if (m_LastTopIndex != m_Text.getTopIndex()) {
        scrolled();
        m_LastTopIndex = m_Text.getTopIndex();
      }
    }
  }
Exemple #6
0
  public void applyFont(FontType type, FontData data) {
    Font newFont = new Font(SwtUtils.DISPLAY, data);
    Font oldFont = null;

    switch (type) {
      case GLOBAL:
        {
          oldFont = iniAppearance.getFontGlobal();

          for (Control control : controls) {
            if (control.isDisposed()) continue;

            control.setFont(newFont);
          }

          for (Label label : labels) {
            if (label.isDisposed()) continue;

            label.setFont(newFont);
          }

          for (Button button : buttons) {
            if (button.isDisposed()) continue;

            button.setFont(newFont);
          }

          iniAppearance.setFontGlobal(newFont);
          break;
        }
      case LOG:
        {
          oldFont = iniAppearance.getFontLog();

          for (StyledText control : logControls) {
            if (control.isDisposed()) continue;

            control.setFont(newFont);
          }

          iniAppearance.setFontLog(newFont);
          break;
        }
      case CHAT:
        {
          oldFont = iniAppearance.getFontChat();

          for (Text control : chatControls) {
            if (control.isDisposed()) continue;

            control.setFont(newFont);
          }

          iniAppearance.setFontChat(newFont);
          break;
        }
    }

    if (oldFont != null) oldFont.dispose();
  }
Exemple #7
0
 @Override
 protected void presentValue(ISingleObject data, Object value, String presentValue) {
   if (control.isDisposed()) {
     return;
   }
   control.setText(presentValue);
 }
Exemple #8
0
  DataSetHandle createSelectedDataSet() {
    DataSetHandle dataSetHandle = null;

    try {
      if (useODAV3) {
        dataSetHandle = createDataSetODAV3();
      } else {
        dataSetHandle = createDataSetODAV2();
      }

      if (nameEditor != null && !nameEditor.isDisposed())
        dataSetHandle.setName(nameEditor.getText());

      return dataSetHandle;
    } catch (SemanticException e) {
      ExceptionHandler.handle(e);
      return null;
    } catch (IllegalStateException e) {
      ExceptionHandler.handle(e);
      return null;
    } catch (OdaException e) {
      ExceptionHandler.handle(e);
      return null;
    }
  }
 private void remove() {
   if (label != null && !label.isDisposed()) {
     label.dispose();
   }
   if (text != null && !text.isDisposed()) {
     text.dispose();
   }
 }
 /*
  * (non-Javadoc)
  *
  * @see org.xmind.ui.properties.PropertyEditor#setFocus()
  */
 @Override
 public void setFocus() {
   if (text != null && !text.isDisposed()) {
     text.setFocus();
   } else {
     super.setFocus();
   }
 }
 @Override
 public void nodeNameChanged(SceneNode node) {
   if (target == node && !nameText.isDisposed() && !nameText.getText().equals(node.getName())) {
     nameText.removeListener(SWT.Modify, nameChangedlLstener);
     nameText.setText(target.getName());
     nameText.addListener(SWT.Modify, nameChangedlLstener);
   }
 }
Exemple #12
0
 @Override
 public void clearControls() {
   if (_javaClassText != null && !_javaClassText.isDisposed()) {
     _javaModel = new org.jboss.tools.fuse.transformation.model.Model("", "");
     _modelViewer.setModel(_javaModel);
     _javaClassText.setText("");
   }
   notifyListeners();
 }
 /*
  * Set the text contents of the popup.
  */
 void setContents(String newContents) {
   if (newContents == null) {
     newContents = EMPTY;
   }
   this.contents = newContents;
   if (text != null && !text.isDisposed()) {
     text.setText(contents);
   }
 }
  private void setGridFields() {

    if (gcodeProgram == null) return;

    ignoreStepTextModifyListener = true;
    if (scanStepXText != null && !scanStepXText.isDisposed())
      scanStepXText.setText("" + gcodeProgram.getXSteps());
    if (scanStepYText != null && !scanStepYText.isDisposed())
      scanStepYText.setText("" + gcodeProgram.getYSteps());
    ignoreStepTextModifyListener = false;

    if (scanStepWidthXLabel != null && !scanStepWidthXLabel.isDisposed())
      scanStepWidthXLabel.setText(
          String.format(IConstant.FORMAT_COORDINATE, gcodeProgram.getStepWidthX()));
    if (scanStepWidthYLabel != null && !scanStepWidthYLabel.isDisposed())
      scanStepWidthYLabel.setText(
          String.format(IConstant.FORMAT_COORDINATE, gcodeProgram.getStepWidthY()));
  }
 protected void bindResourceText() {
   if (resourceText != null
       && element.getInputType() == FileWidgetInputType.RESOURCE
       && !resourceText.isDisposed()) {
     dataBindingContext.bindValue(
         SWTObservables.observeText(resourceText, SWT.Modify),
         EMFEditObservables.observeValue(
             editingDomain, element, FormPackage.Literals.FILE_WIDGET__INITIAL_RESOURCE_PATH));
   }
 }
  @Override
  public void dispose() {
    super.dispose();

    if (!dynamicEnabled) return;

    Text text = getText();
    if (!text.isDisposed()) {
      text.removeModifyListener(modifyListener);
    }
  }
Exemple #17
0
 /**
  * ************************************************************************* Do a half-blink
  * *************************************************************************
  */
 void blink() {
   if (!m_promptText.isDisposed()) {
     if (m_blinkSwitch) {
       m_blinkSwitch = false;
       m_promptText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW));
     } else {
       m_blinkSwitch = true;
       m_promptText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
     }
     m_promptText.redraw();
   }
 }
Exemple #18
0
 /**
  * Handle entry updated.
  *
  * @param entry the entry
  */
 private void handleEntryUpdated(IPlayer player, IGameEntry entry) {
   Text txt;
   TableViewer scoreViewer = this.scoreViewers.get(player);
   scoreViewer.update(entry, null);
   if (player != null) {
     txt = this.playerScoreLeft.get(player);
     if (!txt.isDisposed()) {
       txt.setText(this.getPlayerCurrentScore(player));
       scoreViewer.reveal(entry);
     }
   }
 }
 protected void updateFilter() {
   pattern = null;
   filterString = null;
   if (searchText != null && !searchText.isDisposed() && !Const.isEmpty(searchText.getText())) {
     if (wbRegex.getSelection()) {
       pattern = Pattern.compile(searchText.getText());
     } else {
       filterString = searchText.getText().toUpperCase();
     }
   }
   refresh();
 }
 private void undo(Control control) {
   if (control.equals(_targetNamespaceText)) {
     if (_targetNamespaceText != null && !_targetNamespaceText.isDisposed()) {
       // update TNS text box based on SY/composite settings
       if (_businessObject instanceof org.eclipse.soa.sca.sca1_1.model.sca.Composite) {
         final org.eclipse.soa.sca.sca1_1.model.sca.Composite composite =
             (org.eclipse.soa.sca.sca1_1.model.sca.Composite) _businessObject;
         _targetNamespaceText.setText(composite.getTargetNamespace());
       }
     }
   }
 }
  @Inject
  public void setGcodeProgram(
      @Optional @Named(IServiceConstants.ACTIVE_SELECTION) IGcodeProgram program) {

    LOG.debug("setGcodeProgram: program=" + program);

    gcodeProgram = program;
    setGridFields();

    if (scanClearanceZText != null && !scanClearanceZText.isDisposed()) { // gui created
      setControlsEnabled(true);
    }
  }
  public void setResourceProvider(ResourceProvider rp) {

    this.resourceProvider = rp;
    name = findPotentialName(rp);

    if (text != null && !text.isDisposed()) {
      text.setText(name);
      text.setFocus();
      text.selectAll();
    }

    setPageComplete(!name.isEmpty());
  }
 /**
  * Sets the current error message or none if null
  *
  * @param errorMessage
  * @since 3.3
  */
 public void setErrorMessage(String errorMessage) {
   fErrorMessage = errorMessage;
   if (fErrorTextWidget != null && !fErrorTextWidget.isDisposed()) {
     fErrorTextWidget.setText(errorMessage == null ? "" : errorMessage); // $NON-NLS-1$
     fErrorTextWidget.getParent().update();
     // Access the ok button by id, in case clients have overridden button creation.
     // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643
     Control button = getButton(IDialogConstants.OK_ID);
     if (button != null) {
       button.setEnabled(errorMessage == null);
     }
   }
 }
  protected void keyReleaseOccured(KeyEvent keyEvent) {
    boolean proposalOpened = contentProposalAdapter.isProposalOpened();
    if (!proposalOpened) {

      if (keyEvent.character == '\r') { // Return key
        if (text != null && !text.isDisposed() && (text.getStyle() & SWT.MULTI) != 0) {
          if ((keyEvent.stateMask & SWT.CTRL) != 0) {
            return;
          }
        }
        keyEvent.doit = false;
      }
      cellEditorClassKeyReleasedOccured(keyEvent);
    }
  }
Exemple #25
0
 @Override
 public void roiDragged(ROIEvent evt) {
   if (roiViewer == null) return;
   roiViewer.cancelEditing();
   IRegion region = (IRegion) evt.getSource();
   if (region == null) return;
   IROI roi = evt.getROI();
   if (roi != null) {
     roiViewer.setTableValues(roi);
     if (nameText != null && !nameText.isDisposed()) nameText.setText(region.getName());
     regionName = region.getName();
   }
   roiChanged = true;
   this.region = region;
 }
 public void setErrorMessage(String errorMessage) {
   this.errorMessage = errorMessage;
   if (errorMessageText != null && !errorMessageText.isDisposed()) {
     errorMessageText.setText(errorMessage == null ? " \n " : errorMessage); // $NON-NLS-1$
     boolean hasError =
         errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0;
     errorMessageText.setEnabled(hasError);
     errorMessageText.setVisible(hasError);
     errorMessageText.getParent().update();
     Control button = getButton(IDialogConstants.OK_ID);
     if (button != null) {
       button.setEnabled(errorMessage == null);
     }
   }
 }
Exemple #27
0
 @Override
 protected void setEditable(boolean editable) {
   if (control.isDisposed() || control == null) {
     return;
   }
   if (isComputeField) {
     control.setEditable(false);
   } else {
     control.setEditable(editable);
     //			Display display = control.getDisplay();
     //			control.setForeground(editable ? display
     //					.getSystemColor(SWT.COLOR_BLACK) : display
     //					.getSystemColor(SWT.COLOR_GRAY));
   }
   this.isEditable = editable;
 }
 @Override
 public void refresh(IElementParameter param, boolean checkErrorsWhenViewRefreshed) {
   Text text = (Text) hashCurControls.get(param.getName());
   if (text == null || text.isDisposed()) {
     return;
   }
   Object value = param.getValue();
   if (value == null) {
     text.setText(""); // $NON-NLS-1$
   } else {
     if (!value.equals(text.getText())) {
       text.setText((String) value);
     }
   }
   if (checkErrorsWhenViewRefreshed) {
     checkErrorsForPropertiesOnly(text);
   }
 }
        @Override
        public void run() {
          updating = true;
          try {
            if (!text.isDisposed()) {
              Boolean oldIsComplete = Boolean.valueOf(editMaskParser.isComplete());

              editMaskParser.setInput(text.getText());
              text.setText(editMaskParser.getFormattedResult());
              String newRawText = editMaskParser.getRawResult();

              updateSelectionPosition(newRawText);
              firePropertyChangeEvents(oldIsComplete, newRawText);
            }
          } finally {
            updating = false;
          }
        }
 /**
  * Sets or clears the error message. If not <code>null</code>, the OK button is disabled.
  *
  * @param errorMessage the error message, or <code>null</code> to clear
  */
 public void setErrorMessage(String errorMessage) {
   this.errorMessage = errorMessage;
   if (errorMessageText != null && !errorMessageText.isDisposed()) {
     errorMessageText.setText(errorMessage == null ? " \n " : errorMessage); // $NON-NLS-1$
     // Disable the error message text control if there is no error, or
     // no error text (empty or whitespace only). Hide it also to avoid color change.
     boolean hasError =
         errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0;
     errorMessageText.setEnabled(hasError);
     errorMessageText.setVisible(hasError);
     errorMessageText.getParent().update();
     // Access the ok button by id, in case clients have overridden button creation.
     Control button = getButton(IDialogConstants.OK_ID);
     if (button != null) {
       button.setEnabled(errorMessage == null);
     }
   }
 }