List of usage examples for org.eclipse.jface.dialogs IDialogConstants MINIMUM_MESSAGE_AREA_WIDTH
int MINIMUM_MESSAGE_AREA_WIDTH
To view the source code for org.eclipse.jface.dialogs IDialogConstants MINIMUM_MESSAGE_AREA_WIDTH.
Click Source Link
From source file:webpifier.DialogWithUrls.java
License:Open Source License
/** * Create the area the message will be shown in. * <p>//from w w w. j a v a 2s . c o m * The parent composite is assumed to use GridLayout as its layout manager, * since the parent is typically the composite created in * {@link Dialog#createDialogArea}. * </p> * <p> * <strong>Note:</strong> Clients are expected to call this method, * otherwise neither the icon nor the message will appear. * </p> * * @param composite * The composite to parent from. * @return Control */ @Override protected Control createMessageArea(Composite composite) { // create composite // create image Image image = getImage(); if (image != null) { imageLabel = new Label(composite, SWT.NULL); image.setBackground(imageLabel.getBackground()); imageLabel.setImage(image); // addAccessibleListeners(imageLabel, image); GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(imageLabel); } // create message if (message != null) { linkLabel = new Link(composite, getMessageLabelStyle()); linkLabel.setText(message); linkLabel.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // System.out.println("You have selected: " + e.text); try { // Open default external browser Desktop d = Desktop.getDesktop(); // Browse a URL, say google.com d.browse(new URI(e.text)); // PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new // URL(e.text)); // } catch (PartInitException ex) { // TODO Auto-generated catch block // ex.printStackTrace(); } catch (MalformedURLException ex) { // TODO Auto-generated catch block ex.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (URISyntaxException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false) .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT) .applyTo(linkLabel); } return composite; }
From source file:x10dt.ui.launch.core.dialogs.ErrorAndLogDialog.java
License:Open Source License
private void createMessageArea(final Composite parent) { final Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(2, false)); composite.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); composite.setFont(parent.getFont()); final Label imageLabel = new Label(composite, SWT.NONE); imageLabel.setLayoutData(new GridData(SWT.LEFT, SWT.NONE, false, false)); imageLabel.setImage(this.fImage); final Label messageLabel = new Label(composite, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false) .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT) .applyTo(messageLabel);/*from ww w . j a v a2 s. c o m*/ messageLabel.setText(this.fTopMessage); }