Example usage for org.eclipse.jface.dialogs Dialog applyDialogFont

List of usage examples for org.eclipse.jface.dialogs Dialog applyDialogFont

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs Dialog applyDialogFont.

Prototype

public static void applyDialogFont(Control control) 

Source Link

Document

Applies the dialog font to all controls that currently have the default font.

Usage

From source file:ar.com.comunidadesfera.observatorio.jdt.PaginaAsistenteCrearClaseJava.java

License:Open Source License

@Override
public void createControl(Composite parent) {
    initializeDialogUnits(parent);// w ww  .  j  a v a2s  .c  o  m

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setFont(parent.getFont());

    int nColumns = 4;

    GridLayout layout = new GridLayout();
    layout.numColumns = nColumns;
    composite.setLayout(layout);

    createPackageControls(composite, nColumns);
    createSeparator(composite, nColumns);
    createTypeNameControls(composite, nColumns);
    enableCommentControl(false);

    setControl(composite);
    Dialog.applyDialogFont(composite);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJavaHelpContextIds.NEW_CLASS_WIZARD_PAGE);
}

From source file:ar.com.tadp.xml.rinzo.core.refactors.rename.RenameTagInputPage.java

License:Open Source License

private Composite createRootComposite(final Composite parent) {
    Composite result = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginWidth = 10;/*from   w  ww  .  ja v a  2  s .c  o  m*/
    gridLayout.marginHeight = 10;
    result.setLayout(gridLayout);
    initializeDialogUnits(result);
    Dialog.applyDialogFont(result);
    return result;
}

From source file:at.bestsolution.efxclipse.tooling.pde.e4.project.PluginContentPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(new GridLayout());

    createPluginPropertiesGroup(container);
    createPluginClassGroup(container);/*from  w w  w  .j a  v  a  2 s.co  m*/

    Dialog.applyDialogFont(container);
    setControl(container);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.NEW_PROJECT_REQUIRED_DATA);
}

From source file:au.gov.ga.earthsci.discovery.csw.CSWURLSelectionDialog.java

License:Apache License

@Override
protected Control createDialogArea(Composite parent) {
    Composite comp = new Composite(parent, SWT.NONE);
    comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    initializeDialogUnits(comp);//  w w  w.  java  2 s. com
    GridLayout layout = new GridLayout();
    layout.marginTop = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);

    urlList = new org.eclipse.swt.widgets.List(comp, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    urlList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    int maxCountOfWms = 0;
    int selectedIndex = -1;
    for (int i = 0; i < urls.size(); i++) {
        URL url = urls.get(i);
        String urlString = url.toString();
        urlList.add(urlString);
        int countOfWms = countStringOccurences(urlString.toLowerCase(), "wms"); //$NON-NLS-1$
        if (countOfWms > maxCountOfWms) {
            maxCountOfWms = countOfWms;
            selectedIndex = i;
        }
    }
    if (selectedIndex < 0 && !urls.isEmpty()) {
        selectedIndex = 0;
    }
    if (selectedUrl != null) {
        int indexOfSelectedUrl = urls.indexOf(selectedUrl);
        selectedIndex = indexOfSelectedUrl >= 0 ? indexOfSelectedUrl : selectedIndex;
    }
    if (selectedIndex >= 0) {
        urlList.select(selectedIndex);
    }
    urlList.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            validate();
        }
    });

    getCapabilitiesButton = new Button(comp, SWT.CHECK);
    getCapabilitiesButton.setText(Messages.CSWURLSelectionDialog_GetCapabilitiesButtonText);
    getCapabilitiesButton.setSelection(true);
    getCapabilitiesButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            validate();
        }
    });

    finalUrlLabel = new Label(comp, SWT.NONE);
    finalUrlLabel.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));

    comp.setLayout(layout);

    Dialog.applyDialogFont(comp);
    return comp;
}

From source file:au.gov.ga.earthsci.discovery.darwin.DarwinURLSelectionDialog.java

License:Apache License

@Override
protected Control createDialogArea(Composite parent) {
    Composite comp = new Composite(parent, SWT.NONE);
    comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    GridLayout layout = new GridLayout();
    layout.marginTop = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    comp.setLayout(layout);//w  ww  .j  ava2  s . c  o m
    initializeDialogUnits(comp);

    viewer = new TableViewer(comp, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    //set max size (actual size is calculated below):
    gd.widthHint = 600;
    gd.heightHint = 400;
    viewer.getTable().setLayoutData(gd);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new LabelProvider());
    viewer.setInput(urls);

    DarwinDiscoveryResultURL longestUrl = urlWithLongestName(urls);
    if (longestUrl != null) {
        GC gc = new GC(viewer.getTable());
        Point point = gc.textExtent(longestUrl.getName());
        gc.dispose();
        gd.widthHint = Math.min(gd.widthHint, point.x);
    }
    int height = viewer.getTable().getItemHeight() * urls.size() + viewer.getTable().getHeaderHeight();
    if (height < gd.heightHint) {
        //if height of all rows is less than the max height, then use the default height:
        gd.heightHint = SWT.DEFAULT;
    }

    //keep the column width in sync with the table width
    final TableColumn resultsColumn = new TableColumn(viewer.getTable(), SWT.LEFT);
    Listener resizeListener = new Listener() {
        @Override
        public void handleEvent(Event event) {
            resultsColumn.setWidth(viewer.getTable().getClientArea().width);
        }
    };
    viewer.getControl().addListener(SWT.Resize, resizeListener);
    viewer.getControl().addListener(SWT.Paint, resizeListener);

    if (selected != null) {
        viewer.setSelection(new StructuredSelection(selected));
    } else if (urls.size() == 1) {
        viewer.getTable().select(0);
    } else {
        //if there is a WMS url, select it by default
        for (DarwinDiscoveryResultURL url : urls) {
            if (url.getProtocol().toLowerCase().contains("wms")) //$NON-NLS-1$
            {
                viewer.setSelection(new StructuredSelection(url));
                break;
            }
        }
    }

    viewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            validate();
        }
    });

    ColumnViewerToolTipSupport.enableFor(viewer);

    urlLabel = new CLabel(comp, SWT.NONE);
    urlLabel.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));

    Dialog.applyDialogFont(comp);
    return comp;
}

From source file:au.gov.ga.earthsci.discovery.ui.preferences.EditDiscoveryServiceDialog.java

License:Apache License

@Override
protected Control createDialogArea(Composite parent) {
    Composite comp = new Composite(parent, SWT.NONE);
    initializeDialogUnits(comp);/*from   w w w .  ja  va2 s  .co m*/
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginTop = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);

    createTypeCombo(comp);
    createNameField(comp);
    createLocationField(comp);
    createProviderPropertyControls(comp, false);

    comp.setLayout(layout);
    GridData data = new GridData();
    comp.setLayoutData(data);

    Dialog.applyDialogFont(comp);
    return comp;
}

From source file:au.gov.ga.earthsci.eclipse.extras.ide.ChooseWorkspaceDialog.java

License:Open Source License

/**
 * Creates and returns the contents of the upper part of this dialog (above
 * the button bar)./*from  ww w . j  a v  a2 s .c om*/
 * <p>
 * The <code>Dialog</code> implementation of this framework method creates
 * and returns a new <code>Composite</code> with no margins and spacing.
 * </p>
 *
 * @param parent the parent composite to contain the dialog area
 * @return the dialog area control
 */
protected Control createDialogArea(Composite parent) {
    String productName = getWindowTitle();

    Composite composite = (Composite) super.createDialogArea(parent);
    setTitle(IDEWorkbenchMessages.ChooseWorkspaceDialog_dialogTitle);
    setMessage(NLS.bind(IDEWorkbenchMessages.ChooseWorkspaceDialog_dialogMessage, productName));

    // bug 59934: load title image for sizing, but set it non-visible so the
    //            white background is displayed
    if (getTitleImageLabel() != null) {
        getTitleImageLabel().setVisible(false);
    }

    createWorkspaceBrowseRow(composite);
    if (!suppressAskAgain) {
        createShowDialogButton(composite);
    }

    // look for the eclipse.gcj property.  
    // If true, then we dont need any warning messages.
    // someone is asserting that we're okay on GCJ
    boolean gcj = Boolean.getBoolean("eclipse.gcj"); //$NON-NLS-1$
    String vmName = System.getProperty("java.vm.name");//$NON-NLS-1$
    if (!gcj && vmName != null && vmName.indexOf("libgcj") != -1) { //$NON-NLS-1$
        composite.getDisplay().asyncExec(new Runnable() {
            public void run() {
                // set this via an async - if we set it directly the dialog
                // will
                // be huge. See bug 223532
                setMessage(IDEWorkbenchMessages.UnsupportedVM_message, IMessageProvider.WARNING);
            }
        });
    }

    Dialog.applyDialogFont(composite);
    return composite;
}

From source file:br.ufam.ezrealtime.cde.ui.forms.DependenciesPage.java

License:Open Source License

@Override
protected void createFormContent(IManagedForm managedForm) {
    ScrolledForm form = managedForm.getForm();
    FormToolkit toolkit = managedForm.getToolkit();
    form.setText("Title for the second page");
    // form.setBackgroundImage(ExamplesPlugin.getDefault().getImage(
    // ExamplesPlugin.IMG_FORM_BG));
    GridLayout layout = new GridLayout();
    layout.makeColumnsEqualWidth = true;
    layout.numColumns = 2;//from  w ww. jav a 2s .c o  m
    form.getBody().setLayout(layout);
    // This call is needed because the section will compute
    // the bold version based on the parent.
    Dialog.applyDialogFont(form.getBody());
    Section s1 = createTableSection(form, toolkit, "First Table Section", true);
    Section s2 = createTableSection(form, toolkit, "Second Table Section", false);
    // This call is needed for all the children
    Dialog.applyDialogFont(form.getBody());
    s2.descriptionVerticalSpacing = s1.getTextClientHeightDifference();
    form.reflow(true);
}

From source file:ca.ecliptical.pde.internal.ds.DSAnnotationPropertyPage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;//from  w  ww  .ja v  a 2  s .  c  o m
    layout.marginWidth = 0;
    composite.setLayout(layout);
    composite.setFont(parent.getFont());

    configBlockControl = createPreferenceContent(composite);
    configBlockControl.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));

    if (isProjectPreferencePage()) {
        boolean useProjectSettings = hasProjectSpecificOptions(getProject());
        enableProjectSpecificSettings(useProjectSettings);
    }

    refreshWidgets();

    Dialog.applyDialogFont(composite);
    return composite;
}

From source file:ca.ecliptical.pde.internal.ds.DSAnnotationPropertyPage.java

License:Open Source License

private Control createPreferenceContent(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 0;/* w ww .  j av  a  2  s .c o m*/
    layout.marginWidth = 0;
    composite.setLayout(layout);
    composite.setFont(parent.getFont());

    enableCheckbox = new Button(composite, SWT.CHECK);
    enableCheckbox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    enableCheckbox.setText(Messages.DSAnnotationPropertyPage_enableCheckbox_text);

    Label pathLabel = new Label(composite, SWT.RIGHT);
    pathLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
    pathLabel.setText(Messages.DSAnnotationPropertyPage_pathLabel_text);

    pathText = new Text(composite, SWT.BORDER | SWT.SINGLE);
    pathText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    Label errorLevelLabel = new Label(composite, SWT.RIGHT);
    errorLevelLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
    errorLevelLabel.setText(Messages.DSAnnotationPropertyPage_errorLevelLabel_text);

    errorLevelCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
    errorLevelCombo.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
    errorLevelCombo.add(Messages.DSAnnotationPropertyPage_errorLevelError);
    errorLevelCombo.add(Messages.DSAnnotationPropertyPage_errorLevelWarning);
    errorLevelCombo.add(Messages.DSAnnotationPropertyPage_errorLevelNone);
    errorLevelCombo.select(0);

    Dialog.applyDialogFont(composite);
    return composite;
}