Search in sources :

Example 31 with Clipboard

use of org.eclipse.swt.dnd.Clipboard in project GT by Tencent.

the class CopyAllFromTableViewAction method run.

@Override
public void run() {
    StringBuffer sb = getContents();
    clipboard = new Clipboard(Display.getCurrent());
    Transfer[] transfers = new Transfer[] { TextTransfer.getInstance() };
    clipboard.setContents(new String[] { sb.toString() }, transfers);
}
Also used : TextTransfer(org.eclipse.swt.dnd.TextTransfer) Transfer(org.eclipse.swt.dnd.Transfer) Clipboard(org.eclipse.swt.dnd.Clipboard)

Example 32 with Clipboard

use of org.eclipse.swt.dnd.Clipboard in project GT by Tencent.

the class CopyAllFromTreeViewAction method run.

@Override
public void run() {
    StringBuffer sb = getContents();
    clipboard = new Clipboard(Display.getCurrent());
    Transfer[] transfers = new Transfer[] { TextTransfer.getInstance() };
    clipboard.setContents(new String[] { sb.toString() }, transfers);
}
Also used : TextTransfer(org.eclipse.swt.dnd.TextTransfer) Transfer(org.eclipse.swt.dnd.Transfer) Clipboard(org.eclipse.swt.dnd.Clipboard)

Example 33 with Clipboard

use of org.eclipse.swt.dnd.Clipboard in project GT by Tencent.

the class CopySelectedItemsFromTreeViewAction method run.

@Override
public void run() {
    StringBuffer sb = getContents();
    clipboard = new Clipboard(Display.getCurrent());
    Transfer[] transfers = new Transfer[] { TextTransfer.getInstance() };
    clipboard.setContents(new String[] { sb.toString() }, transfers);
}
Also used : TextTransfer(org.eclipse.swt.dnd.TextTransfer) Transfer(org.eclipse.swt.dnd.Transfer) Clipboard(org.eclipse.swt.dnd.Clipboard)

Example 34 with Clipboard

use of org.eclipse.swt.dnd.Clipboard in project dbeaver by serge-rider.

the class ResultSetUtils method getAttributeValueFromClipboard.

@Nullable
public static Object getAttributeValueFromClipboard(DBDAttributeBinding attribute) throws DBCException {
    DBPDataSource dataSource = attribute.getDataSource();
    Clipboard clipboard = new Clipboard(Display.getCurrent());
    try (DBCSession session = DBUtils.openUtilSession(VoidProgressMonitor.INSTANCE, dataSource, "Copy from clipboard")) {
        String strValue = (String) clipboard.getContents(TextTransfer.getInstance());
        return attribute.getValueHandler().getValueFromObject(session, attribute.getAttribute(), strValue, true);
    } finally {
        clipboard.dispose();
    }
}
Also used : DBPDataSource(org.jkiss.dbeaver.model.DBPDataSource) Clipboard(org.eclipse.swt.dnd.Clipboard) Nullable(org.jkiss.code.Nullable)

Example 35 with Clipboard

use of org.eclipse.swt.dnd.Clipboard in project dbeaver by serge-rider.

the class ResultSetUtils method copyToClipboard.

public static void copyToClipboard(String string) {
    if (string != null && string.length() > 0) {
        Clipboard clipboard = new Clipboard(Display.getCurrent());
        try {
            TextTransfer textTransfer = TextTransfer.getInstance();
            clipboard.setContents(new Object[] { string }, new Transfer[] { textTransfer });
        } finally {
            clipboard.dispose();
        }
    }
}
Also used : Clipboard(org.eclipse.swt.dnd.Clipboard) 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