本文整理了Java中org.eclipse.swt.dnd.Clipboard.<init>()
方法的一些代码示例,展示了Clipboard.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Clipboard.<init>()
方法的具体详情如下:
包路径:org.eclipse.swt.dnd.Clipboard
类名称:Clipboard
方法名:<init>
[英]Constructs a new instance of this class. Creating an instance of a Clipboard may cause system resources to be allocated depending on the platform. It is therefore mandatory that the Clipboard instance be disposed when no longer required.
[中]构造该类的新实例。创建剪贴板实例可能会导致根据平台分配系统资源。因此,当不再需要剪贴板实例时,必须将其释放。
代码示例来源:origin: pentaho/pentaho-kettle
/**
* @return Returns the clipboard.
*/
public Clipboard getNewClipboard() {
if ( clipboard != null ) {
clipboard.dispose();
clipboard = null;
}
clipboard = new Clipboard( display );
return clipboard;
}
代码示例来源:origin: pentaho/pentaho-kettle
private boolean checkPaste() {
try {
Clipboard clipboard = new Clipboard( xParent.getDisplay() );
TextTransfer transfer = TextTransfer.getInstance();
String text = (String) clipboard.getContents( transfer );
if ( text != null && text.length() > 0 ) {
return true;
} else {
return false;
}
} catch ( Exception e ) {
return false;
}
}
代码示例来源:origin: pentaho/pentaho-kettle
private void clipSelected() {
if ( clipboard != null ) {
clipboard.dispose();
clipboard = null;
}
clipboard = new Clipboard( getDisplay() );
TextTransfer tran = TextTransfer.getInstance();
String clip = getSelectedText();
if ( clip == null ) {
return;
}
clipboard.setContents( new String[]{ clip }, new Transfer[]{ tran } );
}
代码示例来源:origin: pentaho/pentaho-kettle
@Override public void keyPressed( KeyEvent keyEvent ) {
int state = keyEvent.stateMask, key = keyEvent.keyCode;
boolean copyContent = state == SWT.CTRL && key == SWT.F6,
arrowNavigation = ( state == SWT.COMMAND || state == SWT.ALT )
&& ( key == SWT.ARROW_LEFT || key == SWT.ARROW_RIGHT ),
backslashNavigation = ( state == SWT.SHIFT && key == SWT.BS ),
reloadContent = state == SWT.CTRL && ( key == SWT.F5 || key == 114 /* r key */ ) || key == SWT.F5,
zoomContent = state == SWT.CTRL && ( key == SWT.KEYPAD_ADD || key == SWT.KEYPAD_SUBTRACT
|| key == 61 /* + key */ || key == 45 /* - key */ );
if ( copyContent ) {
Browser thisBrowser = (Browser) keyEvent.getSource();
Clipboard clipboard = new Clipboard( thisBrowser.getDisplay() );
clipboard.setContents( new String[] { lastNavigateURL }, new Transfer[] { TextTransfer.getInstance() } );
clipboard.dispose();
} else if ( arrowNavigation || backslashNavigation || reloadContent || zoomContent ) {
keyEvent.doit = false;
}
}
代码示例来源:origin: caoxinyu/RedisClient
@Override
public void mouseDown(MouseEvent e) {
text = inputCmd;
final Clipboard cb = new Clipboard(tabFolder.getShell().getDisplay());
TextTransfer transfer = TextTransfer.getInstance();
String data = (String) cb.getContents(transfer);
if(data != null)
menu.getItem(2).setEnabled(true);
else
menu.getItem(2).setEnabled(false);
if(inputCmd.getSelectionText().length() > 0){
menu.getItem(0).setEnabled(true);
menu.getItem(1).setEnabled(true);
}else{
menu.getItem(0).setEnabled(false);
menu.getItem(1).setEnabled(false);
}
inputCmd.setMenu(menu);
}
});
代码示例来源:origin: pentaho/pentaho-kettle
clipboard = new Clipboard( getDisplay() );
TextTransfer tran = TextTransfer.getInstance();
代码示例来源:origin: pentaho/pentaho-kettle
clipboard = null;
clipboard = new Clipboard( getDisplay() );
TextTransfer tran = TextTransfer.getInstance();
String text = (String) clipboard.getContents( tran );
代码示例来源:origin: BiglySoftware/BiglyBT
@Override
public void handleEvent(Event event) {
Clipboard clipboard = new Clipboard(shellForChildren.getDisplay());
String sClipText = (String) clipboard.getContents(TextTransfer.getInstance());
if (sClipText != null) {
addTorrentsFromTextList(sClipText.trim(), false);
}
}
});
代码示例来源:origin: org.eclipse/org.eclipse.search
private void copyToClipboard(String text, Shell shell) {
Clipboard clipboard= new Clipboard(shell.getDisplay());
try {
copyToClipboard(clipboard, text, shell);
} finally {
clipboard.dispose();
}
}
代码示例来源:origin: BiglySoftware/BiglyBT
@Override
public void mouseDown(MouseEvent arg0) {
String hash_str = hash.getText();
if(hash_str != null && hash_str.length() != 0)
new Clipboard(display).setContents(new Object[] {hash_str.replaceAll(" ","")}, new Transfer[] {TextTransfer.getInstance()});
}
});
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide
/**
* Return the clipboard for the receiver.
*
* @return Clipboard
*/
Clipboard getClipboard() {
if (clipboard == null) {
clipboard = new Clipboard(viewer.getControl().getDisplay());
}
return clipboard;
}
代码示例来源:origin: BiglySoftware/BiglyBT
@Override
public void handleEvent(Event event) {
new Clipboard(Display.getCurrent()).setContents(
new Object[] { txtFP.getText() },
new Transfer[] { TextTransfer.getInstance() });
}
});
代码示例来源:origin: BiglySoftware/BiglyBT
protected void
writeToClipboard(
String str )
{
new Clipboard(Utils.getDisplay()).setContents(
new Object[] {str },
new Transfer[] {TextTransfer.getInstance()});
}
代码示例来源:origin: BiglySoftware/BiglyBT
@Override
public void
widgetSelected(
SelectionEvent arg0)
{
new Clipboard(menu.getDisplay()).setContents(new Object[] {text}, new Transfer[] {TextTransfer.getInstance()});
}
});
代码示例来源:origin: org.eclipse.egit/ui
public void run() {
TextTransfer plainTextTransfer = TextTransfer.getInstance();
Clipboard clipboard = new Clipboard(getShell().getDisplay());
clipboard.setContents(new String[] { content },
new Transfer[] { plainTextTransfer });
clipboard.dispose();
}
});
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
@Override
public void widgetSelected(SelectionEvent e) {
String text = fMessageLabel.getText();
if (text != null && text.length() > 0) {
text = LegacyActionTools.removeMnemonics(text);
Clipboard cp = new Clipboard(e.display);
cp.setContents(new Object[] { text },
new Transfer[] { TextTransfer.getInstance() });
cp.dispose();
}
}
});
代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui
protected String getClipboardText() {
Clipboard clipboard = new Clipboard(Display.getDefault());
try {
TextTransfer textTransfer = TextTransfer.getInstance();
return (String) clipboard.getContents(textTransfer);
} finally {
clipboard.dispose();
}
}
代码示例来源:origin: org.eclipse/org.eclipse.ajdt.ui
/**
* Copy the contents of the statuses to the clipboard.
*/
private void copyToClipboard() {
if (clipboard != null)
clipboard.dispose();
clipboard = new Clipboard(list.getDisplay());
clipboard.setContents(new Object[] { longMessage },
new Transfer[] { TextTransfer.getInstance() });
}
代码示例来源:origin: org.eclipse.equinox.p2/ui
public void copyToClipboard(Control activeControl) {
String text = getClipboardText(activeControl);
if (text.length() == 0)
return;
Clipboard clipboard = new Clipboard(PlatformUI.getWorkbench().getDisplay());
clipboard.setContents(new Object[] {text}, new Transfer[] {TextTransfer.getInstance()});
clipboard.dispose();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.team.ui
public PasteAction(IWorkbenchPart part) {
super(TeamUIMessages.PasteAction_1);
final ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE);
setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));
fShell = part.getSite().getShell();
Assert.isNotNull(fShell);
fClipboard = new Clipboard(fShell.getDisplay());
setToolTipText(TeamUIMessages.PasteAction_2);
setId(ID);
}
内容来源于网络,如有侵权,请联系作者删除!