コード例 #1
0
 public void copySelectionToClipboard() {
   clipSelection();
   String selection = commandLineText.getSelectionText();
   if (selection.isEmpty()) {
     selection = getContents();
   }
   clipboard.setContent(new StringRegisterContent(ContentType.TEXT, selection));
 }
コード例 #2
0
  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);
  }
コード例 #3
0
  private void deleteXMLParameter(StyledText text) {
    String selectedValue = text.getSelectionText();
    String changedValue = selectedValue.substring(2, selectedValue.length() - 2);

    resetXPathText(text, changedValue);
  }
コード例 #4
0
 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();
 }