use of org.eclipse.swt.dnd.Clipboard in project translationstudio8 by heartsome.
the class GetActiveKeyDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite tparent = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout();
layout.marginWidth = 10;
layout.marginTop = 10;
tparent.setLayout(layout);
GridDataFactory.fillDefaults().grab(true, true).applyTo(tparent);
Composite compNav = new Composite(tparent, SWT.NONE);
GridLayout navLayout = new GridLayout();
compNav.setLayout(navLayout);
createNavigation(compNav);
Group groupActivekey = new Group(tparent, SWT.NONE);
groupActivekey.setText(Messages.getString("license.GetActiveKeyDialog.activekey"));
GridDataFactory.fillDefaults().grab(true, true).applyTo(groupActivekey);
GridLayout layoutGroup = new GridLayout(2, false);
layoutGroup.marginWidth = 5;
layoutGroup.marginHeight = 20;
groupActivekey.setLayout(layoutGroup);
StyledText text = new StyledText(groupActivekey, SWT.WRAP | SWT.READ_ONLY);
text.setBackground(text.getParent().getBackground());
text.setText(Messages.getString("license.GetActiveKeyDialog.activemessage"));
GridData dataText = new GridData();
dataText.horizontalSpan = 2;
dataText.widthHint = 470;
text.setLayoutData(dataText);
int start = Messages.getString("license.GetActiveKeyDialog.activemessage").indexOf(Messages.getString("license.GetActiveKeyDialog.ts"));
int length = Messages.getString("license.GetActiveKeyDialog.ts").length();
StyleRange styleRange = new StyleRange();
styleRange.start = start;
styleRange.length = length;
styleRange.fontStyle = SWT.BOLD;
styleRange.foreground = Display.getDefault().getSystemColor(SWT.COLOR_BLUE);
text.setStyleRange(styleRange);
Label label = new Label(groupActivekey, SWT.WRAP | SWT.NONE);
label.setText(Messages.getString("license.GetActiveKeyDialog.activemessage1"));
GridDataFactory.fillDefaults().span(2, 1).applyTo(label);
textActivekey = new Text(groupActivekey, SWT.MULTI | SWT.WRAP);
textActivekey.setEditable(false);
textActivekey.setText(activekey);
textActivekey.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, 150).applyTo(textActivekey);
Button btnCopy = new Button(groupActivekey, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.END).applyTo(btnCopy);
btnCopy.setImage(Activator.getImageDescriptor("images/help/copy.png").createImage());
btnCopy.setToolTipText(Messages.getString("license.GetActiveKeyDialog.copytoclipboard"));
btnCopy.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
Clipboard cb = new Clipboard(Display.getCurrent());
String textData = textActivekey.getText();
TextTransfer textTransfer = TextTransfer.getInstance();
cb.setContents(new Object[] { textData }, new Transfer[] { textTransfer });
}
});
return tparent;
}
use of org.eclipse.swt.dnd.Clipboard in project azure-tools-for-java by Microsoft.
the class BlobExplorerFileEditor method copyURLSelectedFile.
private void copyURLSelectedFile() {
BlobFile fileSelection = getFileSelection();
if (fileSelection != null) {
final Clipboard cb = new Clipboard(PlatformUI.getWorkbench().getDisplay());
cb.setContents(new Object[] { fileSelection.getUri() }, new Transfer[] { TextTransfer.getInstance() });
}
}
use of org.eclipse.swt.dnd.Clipboard in project tdi-studio-se by Talend.
the class CopyAction method run.
/*
* @see Action#run()
*/
@Override
public void run() {
if (textData == null || textData.length() == 0) {
return;
}
Clipboard clipboard = new Clipboard(Display.getDefault());
if (filesData.size() > 0) {
Object[] clipboardData = new Object[] { filesData.toArray(new String[0]), textData };
Transfer[] clipboardDataTypes = new Transfer[] { FileTransfer.getInstance(), TextTransfer.getInstance() };
clipboard.setContents(clipboardData, clipboardDataTypes);
} else {
clipboard.setContents(new Object[] { textData }, new Transfer[] { TextTransfer.getInstance() });
}
}
use of org.eclipse.swt.dnd.Clipboard in project tesb-studio-se by Talend.
the class ManageRouteResourcePanel method copyPath.
/**
* Copy class path
*/
protected void copyPath() {
final ResourceDependencyModel item = getSelectedItem();
if (item != null) {
Clipboard clipboard = new Clipboard(getDisplay());
clipboard.setContents(new String[] { item.getClassPathUrl() }, new Transfer[] { TextTransfer.getInstance() });
MessageDialog.openInformation(getShell(), Messages.ManageRouteResourceDialog_copyTitle, MessageFormat.format(Messages.ManageRouteResourceDialog_copyMsg, item.getClassPathUrl()));
}
}
use of org.eclipse.swt.dnd.Clipboard in project tdi-studio-se by Talend.
the class DataSetTableKeyListener method keyPressed.
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.events.KeyListener#keyPressed(org.eclipse.swt.events.KeyEvent)
*/
public void keyPressed(KeyEvent e) {
switch(e.character) {
case CTRL_C:
try {
Clipboard clipBoard = new Clipboard(Display.getCurrent());
TextTransfer textTransfer = TextTransfer.getInstance();
TableItem[] items = ptable.getSelection();
if (items == null || items.length == 0) {
return;
}
int columnIndex = pcursor.getColumn();
clipBoard.setContents(new Object[] { items[0].getText(columnIndex) }, new Transfer[] { textTransfer });
} catch (Exception ex) {
//$NON-NLS-1$
SqlBuilderPlugin.log(Messages.getString("DataSetTableKeyListener.logMessage1"), ex);
}
break;
case CTRL_F:
// column name typeahead
createPopup();
break;
default:
return;
}
}
Aggregations