예제 #1
0
 public void copySelectionToClipboard() {
   clipSelection();
   String selection = commandLineText.getSelectionText();
   if (selection.isEmpty()) {
     selection = getContents();
   }
   clipboard.setContent(new StringRegisterContent(ContentType.TEXT, selection));
 }
  private void updateMenuItemStatus(StyledText text) {
    String selectionText = text.getSelectionText().trim();

    boolean deleteEnabled =
        selectionText.length() > 0
            && selectionText.startsWith(Constants.CONST_PARAMETER_START)
            && selectionText.endsWith(Constants.CONST_PARAMETER_END);

    quickFixMenu.getItem(0).setEnabled(selectionText.length() > 0 && !deleteEnabled);
    quickFixMenu.getItem(1).setEnabled(deleteEnabled);
  }
  private void deleteXMLParameter(StyledText text) {
    String selectedValue = text.getSelectionText();
    String changedValue = selectedValue.substring(2, selectedValue.length() - 2);

    resetXPathText(text, changedValue);
  }
 private void createXMLParameter(StyledText text) {
   String selectedValue = text.getSelectionText();
   String changedValue =
       Constants.CONST_PARAMETER_START + selectedValue + Constants.CONST_PARAMETER_END;
   resetXPathText(text, changedValue);
 }
예제 #5
0
 /**
  * Returns the selected text.
  *
  * @return String selected text, or an empty String if there is no selection.
  * @see StyledText#getSelectionText()
  */
 public String getSelectionText() {
   return textWidget.getSelectionText();
 }