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:ca.edchipman.silverstripepdt.wizards.NewSilverStripeTemplatesWizardPage.java

License:Open Source License

public void createControl(Composite ancestor) {
    SilverStripeTemplateFileCreationWizard wizard = (SilverStripeTemplateFileCreationWizard) getWizard();
    ssVersion = CorePreferencesSupport.getInstance().getProjectSpecificPreferencesValue("silverstripe_version",
            SilverStripeVersion.SS3_1, wizard.getCurrentProject());

    Composite parent = new Composite(ancestor, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;//www .j av  a2s .  c  o  m
    parent.setLayout(layout);

    // create checkbox for user to use HTML Template
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);

    // create composite for Templates table
    Composite innerParent = new Composite(parent, SWT.NONE);
    GridLayout innerLayout = new GridLayout();
    innerLayout.numColumns = 2;
    innerLayout.marginHeight = 0;
    innerLayout.marginWidth = 0;
    innerParent.setLayout(innerLayout);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
    innerParent.setLayoutData(gd);

    Label label = new Label(innerParent, SWT.NONE);
    label.setText(HTMLUIMessages.NewHTMLTemplatesWizardPage_7);
    data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
    label.setLayoutData(data);

    // create table that displays templates
    Table table = new Table(innerParent, SWT.BORDER | SWT.FULL_SELECTION);

    data = new GridData(GridData.FILL_BOTH);
    data.widthHint = convertWidthInCharsToPixels(2);
    data.heightHint = convertHeightInCharsToPixels(10);
    data.horizontalSpan = 2;
    table.setLayoutData(data);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    TableLayout tableLayout = new TableLayout();
    table.setLayout(tableLayout);

    TableColumn column1 = new TableColumn(table, SWT.NONE);
    column1.setText(HTMLUIMessages.NewHTMLTemplatesWizardPage_2);

    TableColumn column2 = new TableColumn(table, SWT.NONE);
    column2.setText(HTMLUIMessages.NewHTMLTemplatesWizardPage_3);

    fTableViewer = new TableViewer(table);
    fTableViewer.setLabelProvider(new TemplateLabelProvider());
    fTableViewer.setContentProvider(new TemplateContentProvider());

    fTableViewer.setSorter(new ViewerSorter() {
        public int compare(Viewer viewer, Object object1, Object object2) {
            if ((object1 instanceof Template) && (object2 instanceof Template)) {
                Template left = (Template) object1;
                Template right = (Template) object2;
                int result = left.getName().compareToIgnoreCase(right.getName());
                if (result != 0)
                    return result;
                return left.getDescription().compareToIgnoreCase(right.getDescription());
            }
            return super.compare(viewer, object1, object2);
        }

        public boolean isSorterProperty(Object element, String property) {
            return true;
        }
    });

    fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent e) {
            updateViewerInput();
        }
    });

    // create viewer that displays currently selected template's contents
    fPatternViewer = doCreateViewer(parent);

    fTemplateStore = SilverStripePDTPlugin.getDefault().getTemplateStore();
    fTableViewer.setInput(fTemplateStore);

    // Create linked text to just to templates preference page
    Link link = new Link(parent, SWT.NONE);
    link.setText(getTemplatesLocationMessage());
    data = new GridData(SWT.END, SWT.FILL, true, false, 2, 1);
    link.setLayoutData(data);
    link.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            preferenceLinkClicked();
        }
    });

    configureTableResizing(innerParent, table, column1, column2);
    loadLastSavedPreferences();

    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpContextIds.HTML_NEWWIZARD_TEMPLATE_HELPID);
    Dialog.applyDialogFont(parent);
    setControl(parent);
}

From source file:carisma.ui.eclipse.editors.AdfEditorCheckSelectionDialog.java

License:Open Source License

/**
 * Creates the dialog area.//from  w ww .  j a  va  2s. co  m
 * 
 * @param parent the Composite
 * @return Control
 */
@Override
protected final Control createDialogArea(final Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    parent.getShell().setMinimumSize(450, 450);

    initializeDialogUnits(composite);

    createMessageArea(composite);

    this.listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
    data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
    this.listViewer.getTable().setLayoutData(data);

    this.listViewer.setLabelProvider(this.labelProvider);
    this.listViewer.setContentProvider(this.contentProvider);

    addSelectionButtons(composite);

    initializeViewer();

    if (this.recommendedChecksButton.getSelection()
            && (this.recommendedChecks != null && this.recommendedChecks.size() > 0)) {
        setInitialSelections(this.recommendedChecks.toArray());
    }
    if (!getInitialElementSelections().isEmpty()) {
        checkInitialSelections();
    }
    Dialog.applyDialogFont(composite);

    this.listViewer.addDoubleClickListener(new IDoubleClickListener() {
        @Override
        public void doubleClick(final DoubleClickEvent event) {
            Object selection = ((IStructuredSelection) AdfEditorCheckSelectionDialog.this.listViewer
                    .getSelection()).getFirstElement();
            if (selection != null) {
                boolean state = AdfEditorCheckSelectionDialog.this.listViewer.getChecked(selection);
                state = state ^ true; // XOR swaps
                AdfEditorCheckSelectionDialog.this.listViewer.setChecked(selection, state);
                AdfEditorCheckSelectionDialog.this.listViewer.refresh();
            }
        }
    });

    return composite;
}

From source file:ccw.preferences.HoverPreferencePage.java

License:Open Source License

/**
 * Creates page for hover preferences.//from w  w w . j  a va  2 s.co m
 *
 * @param parent
 *            the parent composite
 * @return the control for the preference page
 */
public Control createContents(Composite parent) {

    ScrolledPageContent scrolled = new ScrolledPageContent(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    scrolled.setExpandHorizontal(true);
    scrolled.setExpandVertical(true);

    Composite cointainerComposite = new Composite(scrolled, SWT.NONE);
    FillLayout fillLayout = new FillLayout(SWT.VERTICAL);
    cointainerComposite.setLayout(fillLayout);

    // Hover Table
    Composite hoverComposite = new Composite(cointainerComposite, SWT.NONE);

    fHoverTableViewer = CheckboxTableViewer.newCheckList(hoverComposite,
            SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.CHECK);
    ColumnViewerToolTipSupport.enableFor(fHoverTableViewer, ToolTip.NO_RECREATE);

    // Cell Editor
    fHoverModifierStringTextCellEditor = new TextCellEditor(fHoverTableViewer.getTable());

    // Setup
    fHoverTableViewer.setUseHashlookup(true);
    fHoverTableViewer.getTable().setHeaderVisible(true);
    fHoverTableViewer.getTable().setLinesVisible(true);

    TableColumnLayout layout = new TableColumnLayout();
    hoverComposite.setLayout(layout);

    TableViewerColumn viewerColumn = new TableViewerColumn(fHoverTableViewer, SWT.NONE);
    TableColumn column = viewerColumn.getColumn();
    column.setText(Messages.HoverPreferencePage_labelColumnTitle);
    column.setResizable(true);
    column.setMoveable(true);
    column.setResizable(true);
    layout.setColumnData(column, new ColumnWeightData(35, true));

    fModifierTableViewerColumn = new TableViewerColumn(fHoverTableViewer, SWT.NONE);
    column = fModifierTableViewerColumn.getColumn();
    column.setText(Messages.HoverPreferencePage_modifierColumnTitle);
    column.setResizable(true);
    column.setMoveable(true);
    layout.setColumnData(column, new ColumnWeightData(25, true));

    viewerColumn = new TableViewerColumn(fHoverTableViewer, SWT.NONE);
    column = viewerColumn.getColumn();
    column.setText(Messages.HoverPreferencePage_descriptionColumnTitle);
    column.setResizable(true);
    column.setMoveable(true);
    layout.setColumnData(column, new ColumnWeightData(40, true));

    // Summary
    Composite summaryComposite = new Composite(cointainerComposite, SWT.NONE);
    summaryComposite.setLayout(new FillLayout(SWT.HORIZONTAL));

    fGrpSummary = new Group(summaryComposite, SWT.NONE);
    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginLeft = 4;
    gridLayout.marginRight = 4;
    gridLayout.horizontalSpacing = 8;
    gridLayout.verticalSpacing = 8;
    gridLayout.marginTop = 4;
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    fGrpSummary.setLayout(gridLayout);

    // Summary Label
    fSummaryHoverNameLabel = new Label(fGrpSummary, SWT.HORIZONTAL);
    GridData fieldLayoutData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    fieldLayoutData.widthHint = 120;
    fSummaryHoverNameLabel.setLayoutData(fieldLayoutData);

    // Summary Modifier String
    fSummaryHoverModifierStringText = new Text(fGrpSummary, SWT.BORDER);
    fieldLayoutData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    fieldLayoutData.widthHint = 120;
    fSummaryHoverModifierStringText.setLayoutData(fieldLayoutData);

    // Summary Description
    fSummaryHoverDescriptionLabel = new Label(fGrpSummary, SWT.BORDER | SWT.WRAP);
    fieldLayoutData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
    fieldLayoutData.heightHint = 100;
    fieldLayoutData.horizontalSpan = 2;
    fSummaryHoverDescriptionLabel.setLayoutData(fieldLayoutData);

    summaryComposite.pack();

    // End Summary

    scrolled.setContent(cointainerComposite);
    final Point size = cointainerComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    scrolled.setMinSize(size.x, size.y);

    Dialog.applyDialogFont(scrolled);

    initDataBindings();

    return scrolled;
}

From source file:ch.netcetera.eclipse.workspaceconfig.ui.RemotePreferencesImportPage.java

License:Open Source License

/** {@inheritDoc} */
@Override// w  ww  .j  av a  2 s .  c om
public void createControl(Composite parent) {
    initializeDialogUnits(parent);
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));

    // first option: direct URL input
    Button directImportRadioButton = new Button(composite, SWT.RADIO);
    directImportRadioButton.setText(this.textAccessor.getText("import.wizard.fromurl"));
    directImportRadioButton.addSelectionListener(new SelectionAdapter() {

        /** {@inheritDoc} */
        @Override
        public void widgetSelected(SelectionEvent e) {
            super.widgetSelected(e);
            RemotePreferencesImportPage.this.table.setEnabled(false);
            RemotePreferencesImportPage.this.urlText.setEnabled(true);
            validateUrl();
        }
    });

    this.urlText = new Text(composite, SWT.BORDER);
    this.urlText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
    this.urlText.setEnabled(false);
    this.urlText.addKeyListener(new KeyAdapter() {

        /** {@inheritDoc} */
        @Override
        public void keyReleased(KeyEvent e) {
            super.keyReleased(e);
            validateUrl();
        }
    });

    // second option: list of configured URLs
    Button importConfiguredRadioButton = new Button(composite, SWT.RADIO);
    importConfiguredRadioButton.setText(this.textAccessor.getText("import.wizard.fromlist"));
    importConfiguredRadioButton.setSelection(true);
    importConfiguredRadioButton.addSelectionListener(new SelectionAdapter() {

        /** {@inheritDoc} */
        @Override
        public void widgetSelected(SelectionEvent e) {
            super.widgetSelected(e);
            RemotePreferencesImportPage.this.table.setEnabled(true);
            RemotePreferencesImportPage.this.urlText.setEnabled(false);
            validateTableSelection();
        }
    });

    this.table = new Table(composite, SWT.BORDER | SWT.CHECK);
    GridData tgd = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH);
    tgd.heightHint = 200;
    this.table.setLayoutData(tgd);
    this.table.addSelectionListener(new SelectionAdapter() {

        /** {@inheritDoc} */
        @Override
        public void widgetSelected(SelectionEvent e) {
            super.widgetSelected(e);
            validateTableSelection();
        }
    });

    tableColumn = new TableColumn(this.table, SWT.LEFT);
    table.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            resiseTableColumnWidth();
        }
    });

    loadTableItems();
    setControl(composite);
    Dialog.applyDialogFont(composite);
    calculatePageComplete();
}

From source file:cn.dockerfoundry.ide.eclipse.server.ui.internal.wizards.CloudUrlWizardPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, true).hint(400, SWT.DEFAULT).applyTo(composite);
    GridLayoutFactory.fillDefaults().margins(10, 10).numColumns(2).applyTo(composite);

    messageLabel = new Label(composite, SWT.NONE);
    messageLabel.setText(Messages.CloudUrlWizardPage_LABEL_CLOUD_URL_NAME);
    GridDataFactory.fillDefaults().span(2, 1).applyTo(messageLabel);

    Label nameLabel = new Label(composite, SWT.NONE);
    nameLabel.setText(Messages.COMMONTXT_NAME_WITH_COLON);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(nameLabel);

    final Text nameText = new Text(composite, SWT.BORDER);
    nameText.setEditable(true);/*  ww  w.jav  a 2 s.co  m*/
    if (name != null) {
        nameText.setText(name);
    }
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(nameText);
    nameText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            name = nameText.getText();
            update();
        }
    });

    Label urlLabel = new Label(composite, SWT.NONE);
    urlLabel.setText(Messages.COMMONTXT_URL);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(urlLabel);

    final Text urlText = new Text(composite, SWT.BORDER);
    urlText.setEditable(true);
    if (url != null) {
        urlText.setText(url);
    }
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(urlText);
    urlText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            url = urlText.getText();
            // remove leading and trailing whitespaces
            if (url != null) {
                url = url.trim();
            }
            update();
        }
    });

    Dialog.applyDialogFont(composite);
    setControl(composite);

    // If url information is pre-populated, force a refresh
    if (name != null || url != null) {
        update();
    }
}

From source file:cn.dockerfoundry.ide.eclipse.server.ui.internal.wizards.MappedURLsWizardPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayoutFactory.fillDefaults().numColumns(2).spacing(10, LayoutConstants.getSpacing().y)
            .applyTo(composite);/* w ww  .java 2  s.c  o  m*/

    Label label = new Label(composite, SWT.NONE);
    label.setText(Messages.MappedURLsWizardPage_LABEL_APP_URI);
    GridDataFactory.fillDefaults().span(2, 1).applyTo(label);

    Table table = new Table(composite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(table);

    viewer = new TableViewer(table);
    viewer.setContentProvider(new URIsContentProvider());
    viewer.setInput(urls);
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            ISelection selection = event.getSelection();
            removeButton.setEnabled(!selection.isEmpty());
            editButton.setEnabled(!selection.isEmpty() && selection instanceof IStructuredSelection
                    && ((IStructuredSelection) selection).toArray().length == 1);
        }
    });

    Composite buttonComposite = new Composite(composite, SWT.NONE);
    GridLayoutFactory.fillDefaults().margins(0, 0).applyTo(buttonComposite);
    GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.FILL).applyTo(buttonComposite);

    addButton = new Button(buttonComposite, SWT.PUSH);
    addButton.setText(Messages.COMMONTXT_ADD);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(false, false).applyTo(addButton);
    addButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            ApplicationURLWizard wizard = new ApplicationURLWizard(cloudServer, null);
            WizardDialog dialog = new WizardDialog(addButton.getShell(), wizard);
            if (dialog.open() == Dialog.OK) {
                String newURI = wizard.getUrl();
                urls.add(newURI);
                update();
            }
        }
    });

    editButton = new Button(buttonComposite, SWT.PUSH);
    editButton.setText(Messages.COMMONTXT_EDIT);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(false, false).applyTo(editButton);
    editButton.setEnabled(false);
    editButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
            String url = (String) selection.getFirstElement();

            ApplicationURLWizard wizard = new ApplicationURLWizard(cloudServer, url);
            WizardDialog dialog = new WizardDialog(addButton.getShell(), wizard);
            if (dialog.open() == Dialog.OK) {
                String newURI = wizard.getUrl();
                urls.remove(url);
                urls.add(newURI);
                update();
            }
        }
    });

    removeButton = new Button(buttonComposite, SWT.PUSH);
    removeButton.setText(Messages.COMMONTXT_REMOVE);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(false, false).applyTo(addButton);
    removeButton.setEnabled(false);
    removeButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
            Object[] selectedURLs = selection.toArray();
            for (Object selectedURL : selectedURLs) {
                urls.remove(selectedURL);
                update();
            }
        }
    });

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

From source file:cn.ieclipse.adt.ext.wizards.NewComponentWizardPage.java

License:Apache License

public void createControl(Composite parent) {
    initializeDialogUnits(parent);//w  w w.  jav a2 s  .  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);

    // pick component
    createComponent(composite, nColumns);
    // pick & choose the wanted UI components
    createContainerControls(composite, nColumns);
    createPackageControls(composite, nColumns);
    createSeparator(composite, nColumns);
    createTypeNameControls(composite, nColumns);

    // setTypeName("Activity", true);
    createSuperClassControls(composite, nColumns);

    createSuperInterfacesControls(composite, nColumns);

    createOtherControls(composite, nColumns);

    // createCommentControls(composite, nColumns);
    setAddComments(true, false);
    enableCommentControl(true);

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

From source file:cn.ieclipse.aorm.eclipse.wizards.EditActivityWizardPage.java

License:Apache License

public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    container.setFont(parent.getFont());
    int nColumns = 1;
    GridLayout layout = new GridLayout();
    layout.numColumns = nColumns;/* www .j  av  a 2s .  co m*/
    createIntentActionsControl(container, 1, helper.getActions());
    createIntentCategoriesControl(container, 1, helper.getCategories());
    container.setLayout(layout);

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

From source file:cn.ieclipse.aorm.eclipse.wizards.EditComponentWizardPage.java

License:Apache License

public void createControl(Composite parent) {

    GC gc = new GC(parent);
    gc.setFont(parent.getFont());//from  w w w  . j  av a2 s. com
    fontMetrics = gc.getFontMetrics();
    gc.dispose();
    Composite fixPane = new Composite(parent, SWT.NONE);
    fixPane.setLayout(new GridLayout(1, false));
    ScrolledComposite page = new ScrolledComposite(fixPane, SWT.NONE | SWT.V_SCROLL);
    page.setExpandVertical(true);
    page.setExpandHorizontal(true);
    GridData data = new GridData();
    data.heightHint = 300;
    page.setLayoutData(data);
    page.setLayout(new GridLayout(1, false));

    Composite container = new Composite(page, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 4;
    layout.makeColumnsEqualWidth = false;
    container.setLayout(layout);
    for (ComponentAttribute attr : attributes) {
        createAttrFiled(container, layout.numColumns, attr);
    }
    container.setLayoutData(new GridData(GridData.FILL_BOTH));
    page.setContent(container);
    Point p = container.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    page.setMinSize(p);

    setControl(fixPane);

    Dialog.applyDialogFont(fixPane);
}

From source file:com.amazonaws.eclipse.identitymanagement.group.ShowGroupPolicyDialog.java

License:Apache License

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

    composite.setLayout(new GridLayout());
    policyText = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);

    try {/*from w ww.j  av a2s  . co m*/
        policyText.setText(getPolicy(policyName));
    } catch (Exception e) {
        setErrorMessage(e.getMessage());
    }

    policyText.setLayoutData(new GridData(GridData.FILL_BOTH));
    if (!edittable) {
        policyText.setEditable(false);
    }
    Dialog.applyDialogFont(parent);

    return composite;
}