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:io.usethesource.impulse.preferences.PreferencesUtilities.java

License:Open Source License

public Control[] createDefaultAndApplyButtons(Composite parent, final PreferencesTab buttonHolder) {
    Composite buttonBar = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 0;/*  w ww . j  a v a  2  s  .c  om*/
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.makeColumnsEqualWidth = false;
    buttonBar.setLayout(layout);

    GridData bbgd = new GridData(SWT.END);
    buttonBar.setLayoutData(bbgd);

    //contributeButtons(buttonBar);
    boolean createDefaultAndApplyButton = true;
    if (createDefaultAndApplyButton) {
        layout.numColumns = layout.numColumns + 2;
        String[] labels = JFaceResources.getStrings(new String[] { "defaults", "apply" }); //$NON-NLS-2$//$NON-NLS-1$
        //int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
        Button defaultsButton = new Button(buttonBar, SWT.PUSH);
        defaultsButton.setText(labels[0]);
        Dialog.applyDialogFont(defaultsButton);
        //GridData 
        GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
        defaultsButton.setLayoutData(data);
        defaultsButton.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                buttonHolder.performDefaults();
            }
        });

        Button applyButton = new Button(buttonBar, SWT.PUSH);
        applyButton.setText(labels[1]);
        Dialog.applyDialogFont(applyButton);
        data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
        applyButton.setLayoutData(data);
        applyButton.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                buttonHolder.performApply();
            }
        });
        //applyButton.setEnabled(true);      //isValid());
        Dialog.applyDialogFont(buttonBar);
    } else {
        /* Check if there are any other buttons on the button bar.
         * If not, throw away the button bar composite.  Otherwise
         * there is an unusually large button bar.
         */
        if (buttonBar.getChildren().length < 1)
            buttonBar.dispose();
    }
    return buttonBar.getChildren();
}

From source file:io.usethesource.impulse.preferences.TabbedPreferencesPage.java

License:Open Source License

protected Control createContents(Composite parent) {

    // Create a tab folder to put onto the page
    final TabFolder tabFolder = new TabFolder(parent, SWT.NONE);
    final GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gd.widthHint = 0;/*from  w w w.  j a  v a2 s  .  c o  m*/
    gd.heightHint = SWT.DEFAULT;
    gd.horizontalSpan = 1;
    tabFolder.setLayoutData(gd);

    // Create the tabs that go into the tab folder   
    tabs = createTabs(prefService, this, tabFolder);
    setInitialStateForTabs();

    // The validity of the page depends on the validity of its tabs,
    // so refresh the valid state of the page now that all of the
    // tabs have been created
    notifyState(true);

    // Set the font on the page
    Dialog.applyDialogFont(parent);

    // If there's more than 1 tab, start out by selecting the 2nd tab
    // (usually the "Workspace" tab), rather than the "Project" tab,
    // which doesn't even show values until the user selects a project.
    if (tabs.length > 1) {
        int idx = -1;
        for (int i = 0; i < tabs.length; i++) {
            if (tabs[i].getLevel().equals(IPreferencesService.INSTANCE_LEVEL)) {
                idx = i;
            }
        }
        if (idx > 0) {
            tabFolder.setSelection(idx);
        }
    }
    return tabFolder;
}

From source file:it.scoppelletti.sdk.ide.ui.DependenciesContainerPage.java

License:Apache License

/**
 * Crea il controllo.//from w  w w .j  a  v a 2  s  . co m
 * 
 * @param parent Controllo parent.
 */
public void createControl(Composite parent) {
    // Devo impostare almeno un controllo con il metodo setControl,
    // altrimenti non funziona correttamente il wizard "Build Path|Add
    // Libraries" del progetto.
    // Gli elementi che risolvono il container vengono comunque esposti
    // nell'explorer del progetto.
    Label label;

    label = new Label(parent, SWT.NULL);
    label.setText(DependenciesContainer.NAME);
    setControl(label);
    Dialog.applyDialogFont(label);
}

From source file:it.scoppelletti.sdk.ide.ui.NewProjectPage.java

License:Apache License

/**
 * Crea i controlli./*from   w w  w.jav  a2  s.c o  m*/
 * 
 * @param parent Controllo parent.
 */
@Override
public void createControl(Composite parent) {
    Composite control;

    super.createControl(parent);

    control = (Composite) getControl();
    control.setLayout(new GridLayout());
    create(control);

    Dialog.applyDialogFont(control);
    setControl(control);
}

From source file:it.wallgren.android.platform.gui.AndroidRepoPage.java

License:Apache License

@Override
public void createControl(Composite parent) {
    initializeDialogUnits(parent);/*w w  w.j a  v a 2s  .  c  o m*/
    composite = new AndroidRepoComposite(parent, SWT.NULL);
    composite.addListener(new CompositeListener() {
        @Override
        public void onCompositeChanged() {
            setPageComplete(validatePage());
        }
    });

    setPageComplete(validatePage());
    setErrorMessage(null);
    setMessage(null);
    setControl(composite);
    Dialog.applyDialogFont(composite);
}

From source file:it.wallgren.android.platform.gui.ProjectSelectionPage.java

License:Apache License

@Override
public void createControl(Composite parent) {
    composite = new ProjectSelectionComposite(parent, SWT.NULL);

    composite.addListener(new CompositeListener() {
        @Override//from   w  ww.  j a  va 2  s . co  m
        public void onCompositeChanged() {
            setPageComplete(validatePage());
        }
    });

    initializeDialogUnits(parent);
    setPageComplete(validatePage());

    // Show description on opening
    setErrorMessage(null);
    setMessage(null);
    setControl(composite);
    Dialog.applyDialogFont(composite);
}

From source file:jp.sourceforge.pdt_tools.jsbeautifier.preferences.ProjectSelectionDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    // page group
    Composite composite = (Composite) super.createDialogArea(parent);

    Font font = parent.getFont();
    composite.setFont(font);/*from  ww  w  . ja  v  a  2 s  . c om*/

    createMessageArea(composite);

    fTableViewer = new TableViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            doSelectionChanged(((IStructuredSelection) event.getSelection()).toArray());
        }
    });
    fTableViewer.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            okPressed();
        }
    });
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
    data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
    data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
    fTableViewer.getTable().setLayoutData(data);

    fTableViewer.setLabelProvider(new WorkbenchLabelProvider());
    fTableViewer.setContentProvider(new ContentProvider());
    fTableViewer.getControl().setFont(font);

    Button checkbox = new Button(composite, SWT.CHECK);
    checkbox.setText(Messages.ProjectSelectionDialog_filter);
    checkbox.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false));
    checkbox.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            updateFilter(((Button) e.widget).getSelection());
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            updateFilter(((Button) e.widget).getSelection());
        }
    });
    IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings();
    boolean doFilter = !dialogSettings.getBoolean(DIALOG_SETTINGS_SHOW_ALL)
            && !fProjectsWithSpecifics.isEmpty();
    checkbox.setSelection(doFilter);
    updateFilter(doFilter);

    fTableViewer.setInput(ResourcesPlugin.getWorkspace().getRoot());

    doSelectionChanged(new Object[0]);
    Dialog.applyDialogFont(composite);
    return composite;
}

From source file:me.dollyn.goide.ui.wizards.NewGoProjectWizard.java

License:Open Source License

@Override
public void addPages() {
    mainPage = new WizardNewProjectCreationPage("basicNewProjectPage") { //$NON-NLS-1$
        /*/* w ww  .ja va  2s .  c  om*/
         * (non-Javadoc)
         * 
         * @see org.eclipse.ui.dialogs.WizardNewProjectCreationPage#createControl(org.eclipse.swt.widgets.Composite)
         */
        public void createControl(Composite parent) {
            super.createControl(parent);
            createWorkingSetGroup((Composite) getControl(), selection,
                    new String[] { "org.eclipse.ui.resourceWorkingSetPage" }); //$NON-NLS-1$
            Dialog.applyDialogFont(getControl());
        }
    };
    mainPage.setTitle(ResourceMessages.NewGoProjectWizard_NewGoProjectTitle);
    mainPage.setDescription(ResourceMessages.NewGoProjectWizard_NewGoProjectDescription);
    this.addPage(mainPage);
}

From source file:melnorme.lang.ide.ui.build.AbstractDebugSelectionDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    initializeDialogUnits(parent);// w  w w. jav a2s  . co  m
    Composite comp = (Composite) super.createDialogArea(parent);
    addCustomHeaderControls(comp);
    String label = getMessage();
    if (label != null && !EMPTY_STRING.equals(label)) {
        SWTFactory.createWrapLabel(comp, label, 1);
    }
    label = getViewerLabel();
    if (label != null && !EMPTY_STRING.equals(label)) {
        SWTFactory.createLabel(comp, label, 1);
    }
    fViewer = createViewer(comp);
    fViewer.setLabelProvider(getLabelProvider());
    fViewer.setContentProvider(getContentProvider());
    fViewer.setInput(getViewerInput());
    List<?> selectedElements = getInitialElementSelections();
    if (selectedElements != null && !selectedElements.isEmpty()) {
        fViewer.setSelection(new StructuredSelection(selectedElements));
    }
    addViewerListeners(fViewer);
    addCustomFooterControls(comp);
    Dialog.applyDialogFont(comp);
    String help = getHelpContextId();
    if (help != null) {
        PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, help);
    }
    return comp;
}

From source file:melnorme.lang.ide.ui.dialogs.LangProjectWizardFirstPage.java

License:Open Source License

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

    Composite topControl = new Composite(parent, SWT.NULL);
    topControl.setLayoutData(new GridData(GridData.FILL_BOTH));

    topControl.setLayout(new GridLayout(1, false));
    createContents(topControl);

    setControl(topControl);
    Dialog.applyDialogFont(topControl);
}