Search in sources :

Example 11 with Clipboard

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;
}
Also used : Group(org.eclipse.swt.widgets.Group) StyledText(org.eclipse.swt.custom.StyledText) Composite(org.eclipse.swt.widgets.Composite) StyleRange(org.eclipse.swt.custom.StyleRange) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) StyledText(org.eclipse.swt.custom.StyledText) Text(org.eclipse.swt.widgets.Text) Point(org.eclipse.swt.graphics.Point) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TextTransfer(org.eclipse.swt.dnd.TextTransfer) Transfer(org.eclipse.swt.dnd.Transfer) Clipboard(org.eclipse.swt.dnd.Clipboard) TextTransfer(org.eclipse.swt.dnd.TextTransfer)

Example 12 with Clipboard

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() });
    }
}
Also used : BlobFile(com.microsoft.tooling.msservices.model.storage.BlobFile) Clipboard(org.eclipse.swt.dnd.Clipboard)

Example 13 with Clipboard

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() });
    }
}
Also used : Transfer(org.eclipse.swt.dnd.Transfer) TextTransfer(org.eclipse.swt.dnd.TextTransfer) FileTransfer(org.eclipse.swt.dnd.FileTransfer) Clipboard(org.eclipse.swt.dnd.Clipboard)

Example 14 with Clipboard

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()));
    }
}
Also used : ResourceDependencyModel(org.talend.designer.camel.resource.core.model.ResourceDependencyModel) Clipboard(org.eclipse.swt.dnd.Clipboard)

Example 15 with Clipboard

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;
    }
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem) Clipboard(org.eclipse.swt.dnd.Clipboard) Point(org.eclipse.swt.graphics.Point) TextTransfer(org.eclipse.swt.dnd.TextTransfer)

Aggregations

Clipboard (org.eclipse.swt.dnd.Clipboard)49 TextTransfer (org.eclipse.swt.dnd.TextTransfer)38 Transfer (org.eclipse.swt.dnd.Transfer)13 Point (org.eclipse.swt.graphics.Point)8 TableItem (org.eclipse.swt.widgets.TableItem)8 StyledText (org.eclipse.swt.custom.StyledText)7 Control (org.eclipse.swt.widgets.Control)6 ArrayList (java.util.ArrayList)4 IAction (org.eclipse.jface.action.IAction)4 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 GridData (org.eclipse.swt.layout.GridData)4 GridLayout (org.eclipse.swt.layout.GridLayout)4 Composite (org.eclipse.swt.widgets.Composite)4 Button (org.eclipse.swt.widgets.Button)3 Label (org.eclipse.swt.widgets.Label)3 Shell (org.eclipse.swt.widgets.Shell)3 SchemaInfo (com.cubrid.common.core.common.model.SchemaInfo)2 ICopiableFromTable (com.cubrid.common.ui.query.editor.ICopiableFromTable)2 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)2