use of org.eclipse.swt.dnd.TextTransfer in project janrufmonitor by tbrandt77.
the class ClipboardAction method run.
public void run() {
Viewer v = this.m_app.getApplication().getViewer();
if (v != null && v instanceof Viewer) {
IStructuredSelection selection = (IStructuredSelection) v.getSelection();
if (!selection.isEmpty()) {
Object o = selection.getFirstElement();
ITableCellRenderer tcr = RendererRegistry.getInstance().getRenderer("number");
if (tcr != null) {
tcr.updateData(o);
Clipboard cb = new Clipboard(DisplayManager.getDefaultDisplay());
String textData = tcr.renderAsText();
TextTransfer textTransfer = TextTransfer.getInstance();
cb.setContents(new Object[] { (textData != null ? textData : "") }, new Transfer[] { textTransfer });
}
}
}
}
use of org.eclipse.swt.dnd.TextTransfer in project janrufmonitor by tbrandt77.
the class ClipboardAddressAction method run.
public void run() {
Viewer v = this.m_app.getApplication().getViewer();
if (v != null && v instanceof Viewer) {
IStructuredSelection selection = (IStructuredSelection) v.getSelection();
if (!selection.isEmpty()) {
Object o = selection.getFirstElement();
ITableCellRenderer tcr = RendererRegistry.getInstance().getRenderer("name");
if (tcr != null) {
tcr.updateData(o);
Clipboard cb = new Clipboard(DisplayManager.getDefaultDisplay());
String textData = tcr.renderAsText();
TextTransfer textTransfer = TextTransfer.getInstance();
cb.setContents(new Object[] { (textData != null ? textData : "") }, new Transfer[] { textTransfer });
}
}
}
}
use of org.eclipse.swt.dnd.TextTransfer in project janrufmonitor by tbrandt77.
the class NotesClipboardAction method run.
public void run() {
Viewer v = this.m_app.getApplication().getViewer();
if (v != null && v instanceof Viewer) {
IStructuredSelection selection = (IStructuredSelection) v.getSelection();
if (!selection.isEmpty()) {
Object o = selection.getFirstElement();
ITableCellRenderer tcr = RendererRegistry.getInstance().getRenderer("notes");
if (tcr != null) {
tcr.updateData(o);
Clipboard cb = new Clipboard(DisplayManager.getDefaultDisplay());
String textData = tcr.renderAsText();
TextTransfer textTransfer = TextTransfer.getInstance();
cb.setContents(new Object[] { (textData != null ? textData : "") }, new Transfer[] { textTransfer });
}
}
}
}
use of org.eclipse.swt.dnd.TextTransfer in project egit by eclipse.
the class CopyHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Repository repo = getRepository(event);
RevCommit commit = getSelectedCommit(event, repo);
if (commit != null) {
Clipboard clipboard = new Clipboard(null);
try {
TextTransfer textTransfer = TextTransfer.getInstance();
Transfer[] transfers = new Transfer[] { textTransfer };
Object[] data = new Object[] { ObjectId.toString(commit) };
clipboard.setContents(data, transfers);
} finally {
clipboard.dispose();
}
}
return null;
}
use of org.eclipse.swt.dnd.TextTransfer in project tdq-studio-se by Talend.
the class CopyNodeNameAction method run.
/**
* Copy the name of the selected node to the clipboard.
*
* @see org.eclipse.jface.action.IAction#run()
*/
public void run() {
Clipboard clipBoard = new Clipboard(Display.getCurrent());
TextTransfer textTransfer = TextTransfer.getInstance();
StringBuffer text = new StringBuffer("");
String sep = "";
for (int i = 0; i < _selectedNodes.length; i++) {
text.append(sep);
text.append(_selectedNodes[i].getQualifiedName());
sep = ", ";
}
clipBoard.setContents(new Object[] { text.toString() }, new Transfer[] { textTransfer });
}
Aggregations