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:com.reprezen.swagedit.editor.outline.QuickOutline.java

License:Open Source License

@Override
protected Control createTitleControl(Composite parent) {
    filterText = new Text(parent, SWT.NONE);
    Dialog.applyDialogFont(filterText);

    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalAlignment = GridData.FILL;
    data.verticalAlignment = GridData.CENTER;
    filterText.setLayoutData(data);//from w w w.j  a  v a 2 s .  co  m

    filterText.addKeyListener(new KeyListener() {
        public void keyPressed(KeyEvent e) {
            if (isInvocationEvent(e)) {
                e.doit = false;
                handleMultiView();
            } else if (e.keyCode == SWT.CR) {
                handleSelection();
                QuickOutline.this.close();
            } else if (e.keyCode == SWT.ARROW_DOWN) {
                treeViewer.getTree().setFocus();
            } else if (e.keyCode == SWT.ARROW_UP) {
                treeViewer.getTree().setFocus();
            } else if (e.character == SWT.ESC) {
                QuickOutline.this.close();
            }
        }

        public void keyReleased(KeyEvent e) {
            // do nothing
        }
    });

    filterText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            // refresh tree to apply filter

            if (filterTimer != null) {
                filterTimer.cancel();
            }
            // reset the timer each time there is a
            // text modification, so that only the last
            // one will be executed.
            filterTimer = new Timer();
            filterTimer.schedule(new TimerTask() {
                @Override
                public void run() {
                    if (filterText.isDisposed()) {
                        return;
                    }

                    // Make sure we access the text in the correct thread.
                    filterText.getDisplay().asyncExec(new Runnable() {
                        @Override
                        public void run() {
                            // refreshing the tree will execute the filter.
                            if (Strings.emptyToNull(filterText.getText()) == null) {
                                treeViewer.refresh();
                                treeViewer.collapseAll();
                            } else {
                                treeViewer.refresh();
                                TreeItem[] items = treeViewer.getTree().getItems();
                                if (items != null && items.length > 0) {
                                    treeViewer.getTree().setSelection(items[0]);
                                    treeViewer.getTree().showItem(items[0]);
                                } else {
                                    treeViewer.setSelection(StructuredSelection.EMPTY);
                                }
                                treeViewer.expandAll();
                            }
                        }
                    });
                }
            }, 500);
        }
    });
    return filterText;
}

From source file:com.salesforce.ide.ui.wizards.components.AbstractTemplateSelectionPage.java

License:Open Source License

@Override
public final void createControl(Composite ancestor) {
    Composite parent = new Composite(ancestor, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;// w  ww  . j  av  a  2 s .  c o  m
    parent.setLayout(layout);

    // create checkbox for user to use Template
    useTemplateButton = new Button(parent, SWT.CHECK);
    useTemplateButton.setSelection(true); // checked by default
    useTemplateButton.setText(NewWizardMessages.WizardPage_3);
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
    useTemplateButton.setLayoutData(data);
    useTemplateButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            enableTemplates();
        }
    });

    // 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(NewWizardMessages.WizardPage_5);
    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(NewWizardMessages.WizardPage_1);

    TableColumn column2 = new TableColumn(table, SWT.NONE);
    column2.setText(NewWizardMessages.WizardPage_2);

    tableViewer = new TableViewer(table);
    tableViewer.setLabelProvider(new TemplateLabelProvider());
    tableViewer.setContentProvider(new TemplateContentProvider(this.contextTypeId));

    tableViewer.setSorter(new ViewerSorter() {
        @Override
        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);
        }

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

    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent e) {
            updateViewerInput();
        }
    });

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

    tableViewer.setInput(this.templateStore);

    // Create linked text to just to templates preference page
    final String linkText = getLinkText();
    if (null != linkText) {
        Link link = new Link(parent, SWT.NONE);
        link.setText(linkText);
        data = new GridData(SWT.END, SWT.FILL, true, false, 2, 1);
        link.setLayoutData(data);
        link.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                linkClicked();
            }
        });
    }

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

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

From source file:com.sap.netweaver.porta.ide.eclipse.server.ui.wizard.SapNWRuntimeComposite.java

License:Open Source License

private void createControl() {
    setLayout(new GridLayout(2, false));
    setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    // TODO/*from  w w w.ja  v a2  s. co m*/
    //      PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ContextIds.RUNTIME_COMPOSITE);

    Label label = new Label(this, SWT.NONE);
    label.setText("Na&me:");
    label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));

    name = new Text(this, SWT.BORDER);
    name.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    name.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            runtime.setName(name.getText());
            validate();
        }
    });

    // spacer
    new Label(this, SWT.NONE);

    Group jarsGroup = new Group(this, SWT.NONE);
    jarsGroup.setLayout(new GridLayout(3, false));
    jarsGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 0));
    jarsGroup.setText("Java EE classpath JARs");

    label = new Label(jarsGroup, SWT.NONE);
    label.setText("Java instance &home:");
    label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));

    installDir = new Text(jarsGroup, SWT.BORDER);
    installDir.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    installDir.setEditable(false);
    installDir.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            runtime.setLocation(new Path(installDir.getText()));
            validate();
        }
    });

    Button browse = new Button(jarsGroup, SWT.PUSH);
    browse.setText("B&rowse...");
    browse.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    browse.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dialog = new DirectoryDialog(getShell());
            dialog.setMessage("Select the root directory of a Java instance: ");
            dialog.setFilterPath(installDir.getText());
            String selectedDirectory = dialog.open();
            if (selectedDirectory != null)
                installDir.setText(selectedDirectory);
        }
    });

    Label installDirDesc = new Label(jarsGroup, SWT.WRAP);
    installDirDesc.setText(
            "This is the root location of the Java instance on the filesystem, e.g. /usr/sap/C01/J00. It could be a directory on the local filesystem or on a remote share. The runtime looks up the given location for the Java EE JARs to include in the classpath. ");
    GridData gd = new GridData(SWT.FILL, SWT.BEGINNING, false, false, 3, 0);
    gd.widthHint = 400;
    installDirDesc.setLayoutData(gd);

    // spacer
    new Label(jarsGroup, SWT.NONE);

    cacheJars = new Button(jarsGroup, SWT.CHECK);
    cacheJars.setText("&Copy classpath JARs into workspace");
    cacheJars.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 0));
    cacheJars.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            sapRuntime.setCacheJars(cacheJars.getSelection());
        }
    });

    Label cacheJarsDesc = new Label(jarsGroup, SWT.WRAP);
    cacheJarsDesc.setText(
            "Enabling this option optimizes the classpath computing when the Java instance is on a remote system in slow network environment. ");
    gd = new GridData(SWT.FILL, SWT.BEGINNING, false, false, 3, 0);
    gd.widthHint = 400;
    cacheJarsDesc.setLayoutData(gd);

    init();
    validate();

    Dialog.applyDialogFont(this);

    name.forceFocus();
}

From source file:com.sap.netweaver.porta.ide.eclipse.server.ui.wizard.SapNWServerComposite.java

License:Open Source License

private void createControl() {
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;//from  ww  w  .  j  ava 2 s.  co  m
    setLayout(layout);
    setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // TODO
    //      PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ContextIds.SERVER_COMPOSITE);

    Label label = new Label(this, SWT.NONE);
    label.setText("&Host name:");

    hostName = new Text(this, SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    hostName.setLayoutData(data);
    hostName.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            pinged = false;
            server.setHost(hostName.getText());
            validate();
        }
    });

    label = new Label(this, SWT.NONE);
    label.setText("&Instance number:");

    instanceNumber = new Text(this, SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    instanceNumber.setLayoutData(data);
    instanceNumber.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            try {
                pinged = false;
                sapServer.setInstanceNumber(Integer.parseInt(instanceNumber.getText()));
            } catch (NumberFormatException exc) {
                // do nothing - the validation will catch this
            }
            validate();
        }
    });

    new Label(this, SWT.NONE);

    pingServer = new Button(this, SWT.PUSH);
    pingServer.setText("&Ping Server");
    data = new GridData(GridData.END, 0, false, false);
    pingServer.setLayoutData(data);
    pingServer.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
                public void run() {
                    try {
                        sapServer.getServerCore().ping();
                        pinged = true;
                        validate();
                        MessageDialog.openInformation(getShell(), "Ping Successful",
                                "Successfully connected to the specified server instance. ");
                    } catch (CoreException exc) {
                        SapNWPlugin.logError("Ping failed", exc);
                        MessageDialog.openError(getShell(), "Ping Failed",
                                "Cannot connect to the specified server instance. ");
                    }
                }
            });
        }
    });

    Label note = new Label(this, SWT.WRAP);
    note.setText("Note: It is valid the server's host to differ from the host of the runtime location. ");
    GridData gd = new GridData(SWT.FILL, SWT.BEGINNING, false, false, 3, 0);
    gd.widthHint = 400;
    note.setLayoutData(gd);

    init();

    Dialog.applyDialogFont(this);

    hostName.forceFocus();
}

From source file:com.sas.seleniumplus.projects.SampleProjectPageWizard.java

License:Open Source License

/** (non-Javadoc)
  * Method declared on IDialogPage.//from w  ww  .  j a v a2  s  .  com
  */
public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);

    initializeDialogUnits(parent);

    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IIDEHelpContextIds.NEW_PROJECT_WIZARD_PAGE);

    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    //createProjectNameGroup(composite);
    locationArea = new ProjectContentsLocationArea(getErrorReporter(), composite);
    if (initialProjectFieldValue != null) {
        locationArea.updateProjectName(initialProjectFieldValue);
    }

    // Scale the button based on the rest of the dialog
    setButtonLayoutData(locationArea.getBrowseButton());

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

From source file:com.simplifide.core.ui.views.quick.AbstractQuickViewTop.java

License:Open Source License

protected Text createFilterText(Composite parent) {
    fFilterText = new Text(parent, SWT.NONE);
    Dialog.applyDialogFont(fFilterText);

    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalAlignment = GridData.FILL;
    data.verticalAlignment = GridData.CENTER;
    fFilterText.setLayoutData(data);//from   w ww .  j  a  v a2  s .  co m

    fFilterText.addKeyListener(new KeyListener() {
        public void keyPressed(KeyEvent e) {
            if (e.keyCode == 0x0D) // return
                gotoSelectedElement();
            if (e.keyCode == SWT.ARROW_DOWN)
                getfTreeViewer().getTree().setFocus();
            if (e.keyCode == SWT.ARROW_UP)
                getfTreeViewer().getTree().setFocus();
            if (e.character == 0x1B) // ESC
                dispose();
        }

        public void keyReleased(KeyEvent e) {
            // do nothing
        }
    });

    return fFilterText;
}

From source file:com.siteview.mde.internal.ui.editor.feature.PortabilityChoicesDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;/*from   www.  ja  va 2 s  . c o m*/
    layout.marginWidth = layout.marginHeight = 9;
    container.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_BOTH);
    container.setLayoutData(gd);

    checkboxTablePart.createControl(container);
    choiceViewer = checkboxTablePart.getTableViewer();
    choiceViewer.setContentProvider(new ContentProvider());
    choiceViewer.setLabelProvider(new ChoiceLabelProvider());

    gd = (GridData) checkboxTablePart.getControl().getLayoutData();
    gd.widthHint = 300;
    gd.heightHint = 350;

    Dialog.applyDialogFont(parent);
    initialize();
    PlatformUI.getWorkbench().getHelpSystem().setHelp(container, IHelpContextIds.FEATURE_PORTABILITY_WIZARD);
    return container;
}

From source file:com.siteview.mde.internal.ui.editor.feature.SynchronizeVersionsWizardPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    container.setLayout(layout);//from ww  w  .  j a v  a  2s.  c  om

    Group group = new Group(container, SWT.SHADOW_ETCHED_IN);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    layout = new GridLayout();
    group.setLayout(layout);
    group.setLayoutData(gd);
    group.setText(MDEUIMessages.VersionSyncWizard_group);

    fUsePluginsAtBuildButton = new Button(group, SWT.RADIO);
    fUsePluginsAtBuildButton.setText(MDEUIMessages.VersionSyncWizard_usePluginsAtBuild);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    fUsePluginsAtBuildButton.setLayoutData(gd);

    fUsePluginsButton = new Button(group, SWT.RADIO);
    fUsePluginsButton.setText(MDEUIMessages.VersionSyncWizard_usePlugins);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    fUsePluginsButton.setLayoutData(gd);

    fUseComponentButton = new Button(group, SWT.RADIO);
    fUseComponentButton.setText(MDEUIMessages.VersionSyncWizard_useComponent);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    fUseComponentButton.setLayoutData(gd);

    setControl(container);
    Dialog.applyDialogFont(container);
    loadSettings();
    PlatformUI.getWorkbench().getHelpSystem().setHelp(container, IHelpContextIds.FEATURE_SYNCHRONIZE_VERSIONS);
}

From source file:com.siteview.mde.internal.ui.editor.site.NewArchiveDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;/*ww  w .  j  ava  2 s .co  m*/
    layout.marginHeight = layout.marginWidth = 10;
    container.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_BOTH);
    container.setLayoutData(gd);

    createEntries(container);

    ModifyListener listener = new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    };
    fPathText.addModifyListener(listener);
    fUrlText.addModifyListener(listener);
    setTitle(MDEUIMessages.SiteEditor_NewArchiveDialog_title);
    Dialog.applyDialogFont(container);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(container, IHelpContextIds.NEW_ARCHIVE_DIALOG);
    return container;
}

From source file:com.siteview.mde.internal.ui.editor.site.SynchronizePropertiesWizardPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    container.setLayout(layout);/*  w  ww.  j  av  a  2  s  .  co  m*/

    Group group = new Group(container, SWT.SHADOW_ETCHED_IN);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    layout = new GridLayout();
    group.setLayout(layout);
    group.setLayoutData(gd);
    group.setText(MDEUIMessages.SynchronizePropertiesWizardPage_group);

    fSelectedFeaturesButton = new Button(group, SWT.RADIO);
    fSelectedFeaturesButton.setText(MDEUIMessages.SynchronizePropertiesWizardPage_selectedFeatures);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    fSelectedFeaturesButton.setLayoutData(gd);

    fAllFeaturesButton = new Button(group, SWT.RADIO);
    fAllFeaturesButton.setText(MDEUIMessages.SynchronizePropertiesWizardPage_allFeatures);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    fAllFeaturesButton.setLayoutData(gd);

    setControl(container);
    Dialog.applyDialogFont(container);
    loadSettings();
    // TODO add own F1 context
    PlatformUI.getWorkbench().getHelpSystem().setHelp(container, IHelpContextIds.FEATURE_SYNCHRONIZE_VERSIONS);
}