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:net.certiv.fluentmark.preferences.AbstractConfigurationBlockPreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    fOverlayStore.load();/*from   w  w w. j  a va  2 s .  c  o m*/
    fOverlayStore.start();
    Control content = fConfigurationBlock.createControl(parent);
    initialize();
    Dialog.applyDialogFont(content);
    return content;
}

From source file:net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog.java

License:Open Source License

/**
 * Re-layout the labels for the new message.
 * //from  w w w.jav a2 s . c  o  m
 * @param forceLayout
 *            <code>true</code> to force a layout of the shell
 */
private void layoutForNewMessage(boolean forceLayout) {
    int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    // If there are no images then layout as normal
    if (errorMessage == null && messageImage == null) {
        setImageLabelVisible(false);
        setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing);
    } else {
        messageImageLabel.setVisible(true);
        bottomFillerLabel.setVisible(true);
        leftFillerLabel.setVisible(true);
        /**
         * Note that we do not use horizontalSpacing here as when the
         * background of the messages changes there will be gaps between the
         * icon label and the message that are the background color of the
         * shell. We add a leading space elsewhere to compendate for this.
         */
        FormData data = new FormData();
        data.left = new FormAttachment(0, H_GAP_IMAGE);
        data.top = new FormAttachment(titleLabel, verticalSpacing);
        messageImageLabel.setLayoutData(data);
        data = new FormData();
        data.top = new FormAttachment(messageImageLabel, 0);
        data.left = new FormAttachment(0, 0);
        data.bottom = new FormAttachment(messageLabel, 0, SWT.BOTTOM);
        data.right = new FormAttachment(messageImageLabel, 0, SWT.RIGHT);
        bottomFillerLabel.setLayoutData(data);
        data = new FormData();
        data.top = new FormAttachment(messageImageLabel, 0, SWT.TOP);
        data.left = new FormAttachment(0, 0);
        data.bottom = new FormAttachment(messageImageLabel, 0, SWT.BOTTOM);
        data.right = new FormAttachment(messageImageLabel, 0);
        leftFillerLabel.setLayoutData(data);
        FormData messageLabelData = new FormData();
        messageLabelData.top = new FormAttachment(titleLabel, verticalSpacing);
        messageLabelData.right = new FormAttachment(titleImageLabel);
        messageLabelData.left = new FormAttachment(messageImageLabel, 0);
        messageLabelData.height = messageLabelHeight;
        if (titleImageLargest)
            messageLabelData.bottom = new FormAttachment(titleImageLabel, 0, SWT.BOTTOM);
        messageLabel.setLayoutData(messageLabelData);
    }

    if (forceLayout) {
        getShell().layout();
    } else {
        // Do not layout before the dialog area has been created
        // to avoid incomplete calculations.
        if (dialogArea != null)
            workArea.getParent().layout(true);
    }

    int messageLabelUnclippedHeight = messageLabel.computeSize(messageLabel.getSize().x - xTrim, SWT.DEFAULT,
            true).y;
    boolean messageLabelClipped = messageLabelUnclippedHeight > messageLabel.getSize().y - yTrim;
    if (messageLabel.getData() instanceof ToolTip) {
        ToolTip toolTip = (ToolTip) messageLabel.getData();
        toolTip.hide();
        toolTip.deactivate();
        messageLabel.setData(null);
    }
    if (messageLabelClipped) {
        ToolTip tooltip = new ToolTip(messageLabel, ToolTip.NO_RECREATE, false) {

            protected Composite createToolTipContentArea(Event event, Composite parent) {
                Composite result = new Composite(parent, SWT.NONE);
                result.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
                result.setLayout(new GridLayout());
                Text text = new Text(result, SWT.WRAP);
                text.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
                text.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
                text.setText(messageLabel.getText());
                GridData gridData = new GridData();
                gridData.widthHint = messageLabel.getSize().x;
                text.setLayoutData(gridData);
                Dialog.applyDialogFont(result);
                return result;
            }

            public Point getLocation(Point tipSize, Event event) {
                return messageLabel.getShell().toDisplay(messageLabel.getLocation());
            }
        };
        messageLabel.setData(tooltip);
        tooltip.setPopupDelay(0);
        tooltip.activate();
    }
}

From source file:net.karlmartens.ui.dialog.ConfigureColumnsDialog.java

License:Apache License

protected Control createDialogArea(Composite parent) {
    final Composite parentComposite = (Composite) super.createDialogArea(parent);

    final Composite contents = new Composite(parentComposite, SWT.NONE);
    contents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    setTitle(_headerTitle);/*from w  w w  .j av a 2  s  .  co  m*/
    setMessage(_message);

    _columns = new GridChooser(contents);
    _columns.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    final GridChooserColumn column = new GridChooserColumn(_columns, SWT.NONE);
    column.setWidth(100);

    final int[] originalIndices = new int[_table.getColumnCount()];
    int index = 0;
    for (int i = 0; i < originalIndices.length; i++) {
        final TableColumn c = _table.getColumn(i);
        if (!c.isMoveable() || !c.isHideable())
            continue;

        originalIndices[index++] = i;

        final GridChooserItem item = new GridChooserItem(_columns, SWT.NONE);
        item.setText(c.getText());
        item.setSelected(c.isVisible());
        item.setData(c);
    }

    _originalIndices = Arrays.copyOf(originalIndices, index);

    Dialog.applyDialogFont(parentComposite);

    final Point defaultMargins = LayoutConstants.getMargins();

    GridLayoutFactory//
            .fillDefaults()//
            .numColumns(1)//
            .margins(defaultMargins.x, defaultMargins.y)//
            .generateLayout(contents);

    return contents;
}

From source file:net.openchrom.xxd.processor.supplier.rscripting.ui.editor.RenamePropertyInputPage.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;//  w  ww .j  av  a 2  s.c om
    gridLayout.marginHeight = 10;
    result.setLayout(gridLayout);
    initializeDialogUnits(result);
    Dialog.applyDialogFont(result);
    return result;
}

From source file:net.ostis.scpdev.wizards.RepositoryProjectNewWizardPage.java

License:Open Source License

public void createControl(Composite parent) {
    super.createControl(parent);
    existingRepositoryGroup = new ExistingRepositoryGroup(getErrorReporter(), (Composite) getControl(), true);
    Dialog.applyDialogFont(getControl());
}

From source file:net.resheim.eclipse.launcher.macosx.LaunchOptionsDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    setTitle(Messages.LaunchOptionsDialog_6);
    setMessage(Messages.LaunchOptionsDialog_7);

    if (getTitleImageLabel() != null) {
        getTitleImageLabel().setVisible(false);
    }//from   w w w  .j a  v a 2 s .com

    createInterface(composite);
    Dialog.applyDialogFont(composite);
    populateWorkspaceList();
    workspaceCombo.setFocus();
    return composite;
}

From source file:net.rim.ejde.internal.model.ui.BlackBerryVMInstallPage.java

License:Open Source License

public void createControl(Composite p) {
    // create a composite with standard margins and spacing
    Composite composite = new Composite(p, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;/*from w ww  .ja  v a  2 s  .  com*/
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    // VM location
    SWTFactory.createLabel(composite, JREMessages.EEVMPage_1, 1);
    _eeFile = SWTFactory.createSingleText(composite, 1);
    Button folders = SWTFactory.createPushButton(composite, JREMessages.EEVMPage_2, null);
    GridData data = (GridData) folders.getLayoutData();
    data.horizontalAlignment = GridData.END;
    // VM name
    SWTFactory.createLabel(composite, JREMessages.addVMDialog_jreName, 1);
    _vmName = SWTFactory.createSingleText(composite, 2);
    // VM arguments
    Label label = SWTFactory.createLabel(composite, JREMessages.AddVMDialog_23, 2);
    GridData gd = (GridData) label.getLayoutData();
    gd.verticalAlignment = SWT.BEGINNING;
    _vmArgs = SWTFactory.createText(composite, SWT.BORDER | SWT.V_SCROLL | SWT.WRAP, 3, ""); //$NON-NLS-1$
    gd = (GridData) _vmArgs.getLayoutData();
    gd.widthHint = 200;
    gd.heightHint = 75;
    // VM libraries block
    SWTFactory.createLabel(composite, JREMessages.AddVMDialog_JRE_system_libraries__1, 3);
    _libraryBlock = new VMLibraryBlock();
    _libraryBlock.setWizard(getWizard());
    _libraryBlock.createControl(composite);
    Control libControl = _libraryBlock.getControl();
    gd = new GridData(GridData.FILL_BOTH);
    gd.horizontalSpan = 3;
    libControl.setLayoutData(gd);

    initializeFields();
    // add the listeners now to prevent them from monkeying with initialized settings
    _vmName.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (!_ignoreCallbacks) {
                validateVMName();
            }
        }
    });
    _eeFile.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (!_ignoreCallbacks) {
                if (validateDefinitionFile().isOK()) {
                    reloadDefinitionFile();
                }
            }
        }
    });
    folders.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(getShell());
            dialog.setFilterExtensions(new String[] { "*.ee" }); //$NON-NLS-1$
            File file = getDefinitionFile();
            String text = _eeFile.getText();
            if ((file != null) && file.isFile()) {
                text = file.getParentFile().getAbsolutePath();
            }
            dialog.setFileName(text);
            String newPath = dialog.open();
            if (newPath != null) {
                _eeFile.setText(newPath);
            }
        }
    });
    Dialog.applyDialogFont(composite);
    setControl(composite);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
            IJavaDebugHelpContextIds.EDIT_JRE_EE_FILE_WIZARD_PAGE);
}

From source file:net.rim.ejde.internal.ui.wizards.BlackBerryProjectWizardPageOne.java

License:Open Source License

protected void setControl(Control newControl) {
    Dialog.applyDialogFont(newControl);

    PlatformUI.getWorkbench().getHelpSystem().setHelp(newControl,
            IJavaHelpContextIds.NEW_JAVAPROJECT_WIZARD_PAGE);

    super.setControl(newControl);
}

From source file:net.rim.ejde.internal.ui.wizards.NewScreenWizardPage.java

License:Open Source License

public void createControl(Composite parent) {

    initializeDialogUnits(parent);/*from  www .  java2s.co  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);

    // pick & choose the wanted UI components

    createContainerControls(composite, nColumns);
    createPackageControls(composite, nColumns);
    createTypeNameControls(composite, nColumns);
    createSeparator(composite, nColumns);

    Composite screenTypeComposite = new Composite(composite, SWT.NONE);
    screenTypeComposite.setLayout(new GridLayout());
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalSpan = 4;
    screenTypeComposite.setLayoutData(gridData);

    Label screenTypeLabel = new Label(screenTypeComposite, SWT.NONE | SWT.WRAP);
    screenTypeLabel.setText(Messages.NewScreenWizardPage_screenType);

    _screenTypeCombo = new Combo(screenTypeComposite, SWT.READ_ONLY | SWT.DROP_DOWN);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    _screenTypeCombo.setLayoutData(gridData);
    _screenTypeCombo.setItems(new String[] { "Main Screen", "Full Screen", "Popup Screen" });
    _screenTypeCombo.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            setScreenDescription(_screenTypeCombo.getSelectionIndex());
        }
    });

    Label descriptionLabel = new Label(screenTypeComposite, SWT.NONE | SWT.WRAP);
    descriptionLabel.setText(Messages.NewScreenWizardPage_screenTypeDesc);

    _descriptionText = new Text(screenTypeComposite, SWT.WRAP | SWT.READ_ONLY | SWT.BORDER);
    _descriptionText.setLayoutData(new GridData(GridData.FILL_BOTH));

    setControl(composite);

    Dialog.applyDialogFont(composite);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, NEW_SCREEN_WIZARD_PAGE);

    // set screen type
    int screenType = MAIN_SCREEN;
    IDialogSettings dialogSettings = getDialogSettings();
    if (dialogSettings != null) {
        IDialogSettings section = dialogSettings.getSection(PAGE_NAME);
        if (section != null) {
            if (section.get(SETTINGS_SCREENTYPE) != null) {
                screenType = section.getInt(SETTINGS_SCREENTYPE);
            }
        }
    }
    setInitialScreenType(screenType);
    setScreenDescription(screenType);
}

From source file:net.rim.ejde.internal.ui.wizards.templates.BBTemplateSelectionPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = 10;/*from  w w w .ja v a2 s . c om*/
    container.setLayout(layout);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    createAbove(container, 1);
    Label label = new Label(container, SWT.NONE);
    label.setText(getLabel());
    GridData gd = new GridData();
    label.setLayoutData(gd);

    SashForm sashForm = new SashForm(container, SWT.HORIZONTAL);
    gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = 300;
    sashForm.setLayoutData(gd);

    wizardSelectionViewer = new TableViewer(sashForm, SWT.BORDER);
    wizardSelectionViewer.setContentProvider(new ListContentProvider());
    wizardSelectionViewer.setLabelProvider(ListUtil.TABLE_LABEL_PROVIDER);
    // don't sort the template list
    // wizardSelectionViewer.setComparator( ListUtil.NAME_COMPARATOR );
    wizardSelectionViewer.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            doubleClickAction.run();
        }
    });
    createDescriptionIn(sashForm);
    createBelow(container, 1);
    initializeViewer();
    wizardSelectionViewer.setInput(wizardElements);
    wizardSelectionViewer.addSelectionChangedListener(this);
    Dialog.applyDialogFont(container);
    setControl(container);

    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.NEW_PROJECT_CODE_GEN_PAGE);
}