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; } }
public void dragOver( DropTargetEvent e ) { styledText.setFocus(); Point location = xParent.getDisplay().map( null, styledText, e.x, e.y ); location.x = Math.max( 0, location.x ); location.y = Math.max( 0, location.y ); try { int offset = styledText.getOffsetAtLocation( new Point( location.x, location.y ) ); styledText.setCaretOffset( offset ); } catch ( IllegalArgumentException ex ) { int maxOffset = styledText.getCharCount(); Point maxLocation = styledText.getLocationAtOffset( maxOffset ); if ( location.y >= maxLocation.y ) { if ( location.x >= maxLocation.x ) { styledText.setCaretOffset( maxOffset ); } else { int offset = styledText.getOffsetAtLocation( new Point( location.x, maxLocation.y ) ); styledText.setCaretOffset( offset ); } } else { styledText.setCaretOffset( maxOffset ); } } }
public void clearAll( boolean ask ) { int id = SWT.YES; if ( ask ) { MessageBox mb = new MessageBox( parent.getShell(), SWT.YES | SWT.NO | SWT.ICON_QUESTION ); mb.setMessage( BaseMessages.getString( PKG, "TableView.MessageBox.ClearTable.message" ) ); mb.setText( BaseMessages.getString( PKG, "TableView.MessageBox.ClearTable.title" ) ); id = mb.open(); } if ( id == SWT.YES ) { table.removeAll(); new TableItem( table, SWT.NONE ); if ( !readonly ) { parent.getDisplay().asyncExec( new Runnable() { @Override public void run() { edit( 0, 1 ); } } ); } this.setModified(); // timh } }
prev_toy = -1; display = parent.getDisplay(); bg = GUIResource.getInstance().getColorBackground();
prev_toy = -1; display = parent.getDisplay(); bg = GUIResource.getInstance().getColorBackground();
Image oldImage = imageGradient; Display display = composite.getDisplay(); Rectangle rect = composite.getClientArea(); imageGradient = new Image(display, rect.width, rect.height);
public void linkActivated(HyperlinkEvent e) { parent.getDisplay().asyncExec(new Runnable() { public void run() { toggleSearchWordText(); } }); } });
private void scalebyDPI(Composite comp) { Point p = comp.getDisplay().getDPI(); factorX = p.x/standardDPI; factorY = p.y/standardDPI; }
private void updateResultSections() { BusyIndicator.showWhile(container.getDisplay(), new Runnable() { public void run() { for (int i = 0; i < results.size(); i++) { EngineResultSection section = (EngineResultSection) results .get(i); section.updateResults(false); } reflow(); } }); }
private void disposeOldContentAndDisableRedrawOnContentArea() { content.getDisplay().syncExec(new Runnable() { @Override public void run() { // content.setRedraw(false); ExtdocUtils.disposeChildren(content); addCurrentSelectionHeader(); } }); }
Display disp = parent.getDisplay(); TableView.dummyImage = new Image( disp, 1, 1 ); TableView.dummyGC = new GC( TableView.dummyImage );
private void createImageSection(Composite composite) { Image image = composite.getDisplay().getSystemImage(dialogImageType); if (image != null) { Label label = new Label(composite, SWT.NONE); label.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false)); label.setImage(image); } }
public void scheduled(IJobChangeEvent event) { if (!searchInProgress && event.getJob().belongsTo(FederatedSearchJob.FAMILY)) { searchInProgress = true; container.getDisplay().asyncExec(this); } }
@Override protected Composite createPageContainer(Composite parent) { parent = super.createPageContainer(parent); toolkit = createToolkit(parent.getDisplay()); return parent; }
/** * Creates a managed form in the provided parent. Form toolkit and widget * will be created and owned by this object. * * @param parent * the parent widget */ public ManagedForm(Composite parent) { toolkit = new FormToolkit(parent.getDisplay()); ownsToolkit = true; form = toolkit.createScrolledForm(parent); }
@Override public void createControl(Composite parent) { pgComp = new Composite(parent, SWT.NULL); pgComp.setLayout(new FillLayout()); pgComp.setBackground(JFaceColors.getBannerBackground(pgComp.getDisplay())); }
@Override public TableRowCore getTableRowWithCursor() { // TODO: Make work outside SWT? Point pt = cTable.getDisplay().getCursorLocation(); pt = cTable.toControl(pt); return getTableRow(pt.x, pt.y, true); }
private boolean useHeightHint(Composite parent) { int fontHeight= (parent.getFont().getFontData())[0].getHeight(); int displayHeight= parent.getDisplay().getClientArea().height; return (displayHeight / fontHeight) > 50; }
@Override public void createFormPart ( final Composite parent, final ConfigurationEditorInput input ) { this.toolkit = new ConfigurationFormToolkit ( parent.getDisplay () ); this.form = this.toolkit.createScrolledForm ( parent, getTitle ( input ) ); this.form.getBody ().setLayout ( new GridLayout ( getColumnCount (), true ) ); // create populateFormContent ( this.toolkit, this.form, input ); this.toolkit.getDataBindingContext ().updateTargets (); }
@Override protected Control createDialogArea(Composite parent) { final Composite composite= (Composite) super.createDialogArea(parent); LayoutUtil.doDefaultLayout(composite, new DialogField[] { fNameField }, true, SWT.DEFAULT, SWT.DEFAULT); fNameField.postSetFocusOnDialogField(parent.getDisplay()); LayoutUtil.setWidthHint(fNameField.getLabelControl(null), convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH)); Text text= fNameField.getTextControl(null); LayoutUtil.setHorizontalGrabbing(text); TextFieldNavigationHandler.install(text); Dialog.applyDialogFont(composite); return composite; }