use of org.eclipse.swt.dnd.Clipboard in project linuxtools by eclipse.
the class BasePropertySection method createControls.
@Override
public void createControls(final Composite parent, final TabbedPropertySheetPage propertySheetPage) {
GridLayoutFactory.fillDefaults().numColumns(1).applyTo(parent);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(parent);
final Composite container = new Composite(parent, SWT.NONE);
container.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
GridLayoutFactory.fillDefaults().numColumns(1).margins(5, 5).applyTo(container);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).hint(400, 180).applyTo(container);
this.treeViewer = createTableTreeViewer(container);
if (this.clipboard != null)
this.clipboard.dispose();
this.clipboard = new Clipboard(Display.getCurrent());
this.pageSite = propertySheetPage.getSite();
initContextMenu(pageSite, clipboard);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(treeViewer.getControl());
}
use of org.eclipse.swt.dnd.Clipboard in project linuxtools by eclipse.
the class NewDockerConnectionPage method createControl.
@Override
public void createControl(final Composite parent) {
final ScrolledComposite scrollTop = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
scrollTop.setExpandVertical(true);
scrollTop.setExpandHorizontal(true);
final Composite container = new Composite(scrollTop, SWT.NONE);
GridLayoutFactory.fillDefaults().numColumns(1).applyTo(container);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).applyTo(container);
createConnectionSettingsContainer(container);
// attach the Databinding context status to this wizard page.
WizardPageSupport.create(this, this.dbc);
Clipboard clip = new Clipboard(Display.getCurrent());
String content = (String) clip.getContents(TextTransfer.getInstance(), DND.SELECTION_CLIPBOARD);
// DOCKER_HOST is the minimal property needed
if (content != null && content.contains(DefaultDockerConnectionSettingsFinder.DOCKER_HOST)) {
retrieveConnectionSettings(content);
} else {
content = (String) clip.getContents(TextTransfer.getInstance(), DND.CLIPBOARD);
if (content != null && content.contains(DefaultDockerConnectionSettingsFinder.DOCKER_HOST)) {
retrieveConnectionSettings(content);
} else {
retrieveDefaultConnectionSettings();
}
}
scrollTop.setContent(container);
Point point = container.computeSize(SWT.DEFAULT, SWT.DEFAULT);
scrollTop.setSize(point);
scrollTop.setMinSize(point);
setControl(container);
}
use of org.eclipse.swt.dnd.Clipboard in project linuxtools by eclipse.
the class PrepareCommitHandler method populateClipboardBuffer.
private void populateClipboardBuffer(String input) {
TextTransfer plainTextTransfer = TextTransfer.getInstance();
Clipboard clipboard = new Clipboard(PlatformUI.getWorkbench().getDisplay());
clipboard.setContents(new String[] { input }, new Transfer[] { plainTextTransfer });
clipboard.dispose();
}
use of org.eclipse.swt.dnd.Clipboard in project linuxtools by eclipse.
the class NewDockerConnectionSWTBotTest method clearClipboards.
@Before
public void clearClipboards() {
// Clear all clipboards
Display.getDefault().syncExec(() -> {
Clipboard clip = new Clipboard(Display.getCurrent());
clip.clearContents(DND.CLIPBOARD);
clip.clearContents(DND.SELECTION_CLIPBOARD);
});
}
use of org.eclipse.swt.dnd.Clipboard in project yamcs-studio by yamcs.
the class CloneCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute() {
Clipboard clipboard = new Clipboard(Display.getCurrent());
DisplayModel tempModel = new DisplayModel();
for (AbstractWidgetModel widget : _models) {
tempModel.addChild(widget, false);
}
String xml = XMLUtil.widgetToXMLString(tempModel, false);
clipboard.setContents(new Object[] { xml }, new Transfer[] { OPIWidgetsTransfer.getInstance() });
_clonedWidgets = getWidgetsFromClipboard();
_compoundCommand = new CompoundCommand();
int i = 0;
for (AbstractWidgetModel widgetModel : _clonedWidgets) {
if (_difference != null) {
widgetModel.setLocation((widgetModel.getLocation().x + _difference.width), (widgetModel.getLocation().y + _difference.height));
} else {
widgetModel.setLocation((widgetModel.getLocation().x + 10), (widgetModel.getLocation().y + 10));
}
_compoundCommand.add(new WidgetCreateCommand(widgetModel, _parent, new Rectangle(widgetModel.getLocation(), widgetModel.getSize()), (i++ == 0 ? false : true)));
if (_hGuide != null) {
ChangeGuideCommand hGuideCommand = new ChangeGuideCommand(widgetModel, true);
hGuideCommand.setNewGuide(_hGuide, _hAlignment);
_compoundCommand.add(hGuideCommand);
}
if (_vGuide != null) {
ChangeGuideCommand vGuideCommand = new ChangeGuideCommand(widgetModel, false);
vGuideCommand.setNewGuide(_vGuide, _vAlignment);
_compoundCommand.add(vGuideCommand);
}
}
_compoundCommand.execute();
}
Aggregations