/** * Performs this action. */ public void run() { // Get the selected property IStructuredSelection selection = (IStructuredSelection) getPropertySheet() .getSelection(); if (selection.isEmpty()) { return; } // Assume single selection IPropertySheetEntry entry = (IPropertySheetEntry) selection .getFirstElement(); // Place text on the clipboard StringBuffer buffer = new StringBuffer(); buffer.append(entry.getDisplayName()); buffer.append("\t"); //$NON-NLS-1$ buffer.append(entry.getValueAsString()); setClipboard(buffer.toString()); }
/** * Updates enablement based on the current selection. * * @param sel the selection */ public void selectionChanged(IStructuredSelection sel) { setEnabled(!sel.isEmpty()); }
copyAction = new CopyPropertyAction(viewer, "copy", clipboard); //$NON-NLS-1$ copyAction.setText(PropertiesMessages.CopyProperty_text); copyAction.setImageDescriptor(sharedImages .getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
copyAction = new CopyPropertyAction(viewer, "copy", clipboard); //$NON-NLS-1$ copyAction.setText(PropertiesMessages.CopyProperty_text); copyAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
copyAction = new CopyPropertyAction(viewer, "copy", clipboard); //$NON-NLS-1$ copyAction.setText(PropertiesMessages.CopyProperty_text); copyAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
/** * Performs this action. */ @Override public void run() { // Get the selected property IStructuredSelection selection = (IStructuredSelection) getPropertySheet() .getSelection(); if (selection.isEmpty()) { return; } // Assume single selection IPropertySheetEntry entry = (IPropertySheetEntry) selection .getFirstElement(); // Place text on the clipboard StringBuilder buffer = new StringBuilder(); buffer.append(entry.getDisplayName()); buffer.append("\t"); //$NON-NLS-1$ buffer.append(entry.getValueAsString()); setClipboard(buffer.toString()); }
/** * Updates enablement based on the current selection. * * @param sel the selection */ public void selectionChanged(IStructuredSelection sel) { setEnabled(!sel.isEmpty()); }
/** * Performs this action. */ @Override public void run() { // Get the selected property IStructuredSelection selection = (IStructuredSelection) getPropertySheet() .getSelection(); if (selection.isEmpty()) { return; } // Assume single selection IPropertySheetEntry entry = (IPropertySheetEntry) selection .getFirstElement(); // Place text on the clipboard StringBuffer buffer = new StringBuffer(); buffer.append(entry.getDisplayName()); buffer.append("\t"); //$NON-NLS-1$ buffer.append(entry.getValueAsString()); setClipboard(buffer.toString()); }
/** * Updates enablement based on the current selection. * * @param sel the selection */ public void selectionChanged(IStructuredSelection sel) { setEnabled(!sel.isEmpty()); }
private void setClipboard(String text) { try { Object[] data = new Object[] { text }; Transfer[] transferTypes = new Transfer[] { TextTransfer .getInstance() }; clipboard.setContents(data, transferTypes); } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) { throw e; } if (MessageDialog.openQuestion(getPropertySheet().getControl() .getShell(), PropertiesMessages.CopyToClipboardProblemDialog_title, PropertiesMessages.CopyToClipboardProblemDialog_message)) { setClipboard(text); } } } }
private void setClipboard(String text) { try { Object[] data = new Object[] { text }; Transfer[] transferTypes = new Transfer[] { TextTransfer .getInstance() }; clipboard.setContents(data, transferTypes); } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) { throw e; } if (MessageDialog.openQuestion(getPropertySheet().getControl() .getShell(), PropertiesMessages.CopyToClipboardProblemDialog_title, PropertiesMessages.CopyToClipboardProblemDialog_message)) { setClipboard(text); } } } }
private void setClipboard(String text) { try { Object[] data = new Object[] { text }; Transfer[] transferTypes = new Transfer[] { TextTransfer .getInstance() }; clipboard.setContents(data, transferTypes); } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) { throw e; } if (MessageDialog.openQuestion(getPropertySheet().getControl() .getShell(), PropertiesMessages.CopyToClipboardProblemDialog_title, PropertiesMessages.CopyToClipboardProblemDialog_message)) { setClipboard(text); } } } }