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.liferay.ide.server.ui.wizard.LiferayRuntimeStubComposite.java

License:Open Source License

protected void createControl() {
    setLayout(new GridLayout(2, false));
    setLayoutData(new GridData(GridData.FILL_BOTH));

    Label lblName = new Label(this, SWT.NONE);
    lblName.setText(Msgs.name);//from w  w w.  j a va 2  s .com

    new Label(this, SWT.NONE);

    textName = new Text(this, SWT.BORDER);
    textName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    textName.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            runtimeWC.setName(textName.getText());
            validate();
        }
    });

    createSpacer();

    Label lblRuntimeStubType = new Label(this, SWT.NONE);
    lblRuntimeStubType.setText(Msgs.liferayBundleType);

    createSpacer();

    comboRuntimeStubType = new Combo(this, SWT.READ_ONLY);
    comboRuntimeStubType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    createSpacer();

    final Label lblInstall = new Label(this, SWT.WRAP);
    lblInstall.setText(Msgs.liferayBundleDirectory);

    new Label(this, SWT.NONE);

    textInstallDir = new Text(this, SWT.BORDER);
    textInstallDir.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    comboRuntimeStubType.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            int index = comboRuntimeStubType.getSelectionIndex();
            ILiferayRuntimeStub selectedStub = LiferayServerCore.getRuntimeStubs()[index];
            LiferayRuntimeStubDelegate delegate = getStubDelegate();
            delegate.setRuntimeStubTypeId(selectedStub.getRuntimeStubTypeId());

            String stubTypeId = selectedStub.getRuntimeStubTypeId();
            IRuntimeType runtimeType = ServerCore.findRuntimeType(stubTypeId);

            for (IRuntime runtime : ServerCore.getRuntimes()) {
                if (runtime.getRuntimeType().equals(runtimeType)) {
                    textInstallDir.setText(runtime.getLocation().toOSString());
                }
            }

            validate();
        }
    });

    textInstallDir.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            textInstallDirChanged(textInstallDir.getText());
        }
    });

    Button btnBrowse = new Button(this, SWT.NONE);
    btnBrowse.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    btnBrowse.setText(Msgs.browse);
    btnBrowse.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent se) {
            DirectoryDialog dialog = new DirectoryDialog(LiferayRuntimeStubComposite.this.getShell());
            dialog.setMessage(Msgs.selectRuntimeStubDirectory);
            dialog.setFilterPath(textInstallDir.getText());
            String selectedDirectory = dialog.open();

            if (selectedDirectory != null) {
                textInstallDir.setText(selectedDirectory);
            }
        }
    });

    new Label(this, SWT.NONE);

    Dialog.applyDialogFont(this);

    textName.forceFocus();
}

From source file:com.mansfield.pde.api.tools.internal.ui.preferencepages.TargetBaselinePreferencePage.java

License:Open Source License

public Control createContents(Composite parent) {
    Composite contentArea = SWTFactory.createComposite(parent);
    GridLayoutFactory.swtDefaults().margins(0, 0).applyTo(contentArea);

    createTargetProfilesGroup(contentArea);

    Dialog.applyDialogFont(contentArea);

    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
            IHelpContextIds.TARGET_PLATFORM_PREFERENCE_PAGE);

    return contentArea;
}

From source file:com.matlab.eclipse.meditor.AbstractMatlabenginePrefsPage.java

License:Open Source License

protected Control createContents(Composite parent) {

    fOverlayStore.load();/*from  w ww. j  av  a 2s  . c  o  m*/
    fOverlayStore.start();

    Control control = createAppearancePage(parent);

    initialize();
    Dialog.applyDialogFont(control);
    return control;
}

From source file:com.mercatis.lighthouse3.base.ui.wizards.AbstractWizardParentSelectionPage.java

License:Apache License

public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    initializeDialogUnits(parent);/*from w w w .  j a va2  s. co m*/

    composite.setLayout(new GridLayout(3, false));

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

From source file:com.mercatis.lighthouse3.security.ui.wizards.pages.WizardNewLighthouseDomainSecurityPage.java

License:Apache License

public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    initializeDialogUnits(parent);//w  w  w. j  ava2  s.  c  o m

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

    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = SIZING_TEXT_FIELD_WIDTH;

    Group urlGroup = new Group(composite, SWT.NONE);
    urlGroup.setText("Security settings");
    GridLayout urlLayout = new GridLayout();
    urlLayout.numColumns = 2;
    urlGroup.setLayout(urlLayout);
    urlGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label urlLabel = new Label(urlGroup, SWT.NONE);
    urlLabel.setText("URL");
    urlLabel.setFont(parent.getFont());

    urlText = new Text(urlGroup, SWT.BORDER);
    urlText.setText(urlTextValue != null ? urlTextValue : "http://localhost:8081");
    urlText.setLayoutData(data);
    urlText.setFont(parent.getFont());
    urlText.addListener(SWT.Modify, modifyListener);
    urlText.setFocus();

    Button testB = new Button(composite, SWT.PUSH);
    testB.setText("Test Connection");
    testB.setLayoutData(new GridData(SWT.END, SWT.TOP, true, false));
    testB.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            BufferedReader in = null;
            try {
                String txt = urlText.getText();
                StringBuilder sb = new StringBuilder(txt);
                if (!txt.endsWith("/"))
                    sb.append('/');
                sb.append("Version");
                URL url = new URL(sb.toString());
                URLConnection conn = url.openConnection();
                in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                String inputLine = in.readLine();
                Pattern p = Pattern.compile("^\\d.\\d.\\d(?:-SNAPSHOT)?$");
                Matcher m = p.matcher(inputLine);
                if (m.matches())
                    MessageDialog.openInformation(getShell(), "Connection Test",
                            "Connection test successful!\n\nLighthouse Server v" + inputLine + " was found.");
                else
                    MessageDialog.openWarning(getShell(), "Connection Test",
                            "Connection test failed!\n\nThere was a reply but it could not be validated.");
            } catch (Exception e1) {
                MessageDialog.openError(getShell(), "Connection Test",
                        "Connection test failed!\n\n" + e1.getMessage());
            } finally {
                if (in != null)
                    try {
                        in.close();
                    } catch (IOException e1) {
                        /* ignore */ }
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            /* ignore */ }
    });

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

From source file:com.mercatis.lighthouse3.status.ui.wizards.pages.WizardNewLighthouseDomainStatusPage.java

License:Apache License

public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    initializeDialogUnits(parent);//from w  ww  .j  a  v a2 s  .c om

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

    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = SIZING_TEXT_FIELD_WIDTH;

    Group jmsGroup = new Group(composite, SWT.NONE);
    jmsGroup.setText("JMS settings");
    GridLayout jmsLayout = new GridLayout();
    jmsLayout.numColumns = 2;
    jmsGroup.setLayout(jmsLayout);
    jmsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label jmsTopicLabel = new Label(jmsGroup, SWT.NONE);
    jmsTopicLabel.setText("Status Change Topic");
    jmsTopicLabel.setFont(parent.getFont());

    jmsTopic = new Text(jmsGroup, SWT.BORDER);
    jmsTopic.setLayoutData(data);
    jmsTopic.setFont(parent.getFont());
    jmsTopic.setText(jmsTopicValue != null ? jmsTopicValue
            : "com.mercatis.lighthouse3.service.statusmonitor.statuschanges");
    jmsTopic.addListener(SWT.Modify, modifyListener);
    jmsTopic.setFocus();

    Group notificationGroup = new Group(composite, SWT.NONE);
    notificationGroup.setText("Status template settings");
    GridLayout templateLayout = new GridLayout();
    templateLayout.numColumns = 3;
    notificationGroup.setLayout(templateLayout);
    notificationGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label statusTemplateLabel = new Label(notificationGroup, SWT.NONE);
    statusTemplateLabel.setText("EMail Notification template folder");
    statusTemplateLabel.setFont(parent.getFont());

    notificationTemplateFolder = new Text(notificationGroup, SWT.BORDER);
    notificationTemplateFolder.setLayoutData(data);
    notificationTemplateFolder.setFont(parent.getFont());
    notificationTemplateFolder.setText(notificationTemplateFolderValue != null ? notificationTemplateFolderValue
            : CommonBaseActivator.getPlugin().getDefaultTemplateDir().getAbsolutePath());
    notificationTemplateFolder.addListener(SWT.Modify, modifyListener);

    Button selectDirectory = new Button(notificationGroup, SWT.PUSH);
    selectDirectory.setText("Browse...");
    selectDirectory.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            DirectoryDialog directoryDialog = new DirectoryDialog(
                    PlatformUI.getWorkbench().getDisplay().getActiveShell());
            directoryDialog.setMessage("Please select a directory for templates.");
            directoryDialog.setText("Select directory");
            directoryDialog.setFilterPath(notificationTemplateFolder.getText());
            String directory = directoryDialog.open();
            if (directory != null) {
                notificationTemplateFolder.setText(directory);
            }
        }
    });

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

From source file:com.mercatis.lighthouse3.ui.environment.wizards.pages.WizardNewProjectLighthouseConnectionPage.java

License:Apache License

public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    initializeDialogUnits(parent);//from   w w w.  j  ava  2s. c om

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

    createLighthouseLocationGroup(composite);
    setValues();

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

From source file:com.mercatis.lighthouse3.ui.operations.ui.wizards.pages.WizardNewLighthouseDomainOperationPage.java

License:Apache License

public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    initializeDialogUnits(parent);// w  w  w  .  j av  a 2 s  . co  m

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

    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = SIZING_TEXT_FIELD_WIDTH;

    Group urlGroup = new Group(composite, SWT.NONE);
    urlGroup.setText("Operations URL");
    GridLayout urlLayout = new GridLayout();
    urlLayout.numColumns = 2;
    urlGroup.setLayout(urlLayout);
    urlGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label urlLabel = new Label(urlGroup, SWT.NONE);
    urlLabel.setText("URL:");
    urlLabel.setFont(parent.getFont());

    urlText = new Text(urlGroup, SWT.BORDER);
    urlText.setLayoutData(data);
    urlText.setFont(parent.getFont());
    urlText.setText(urlTextValue != null ? urlTextValue : "http://localhost:8085");
    urlText.addListener(SWT.Modify, modifyListener);
    urlText.setFocus();

    Button testB = new Button(composite, SWT.PUSH);
    testB.setText("Test Connection");
    testB.setLayoutData(new GridData(SWT.END, SWT.TOP, true, false));
    testB.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            BufferedReader in = null;
            try {
                String txt = urlText.getText();
                StringBuilder sb = new StringBuilder(txt);
                if (!txt.endsWith("/"))
                    sb.append('/');
                sb.append("Operation");
                URL url = new URL(sb.toString());
                URLConnection conn = url.openConnection();
                in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                String inputLine = in.readLine();

                Pattern p = Pattern.compile(
                        "^<\\?xml version=\"[\\d\\.]+\"(?: \\w+=\"[\\w\\-]+\")*\\?>(?:<list>(?:<code>\\w+</code>)*</list>)?");
                Matcher m = p.matcher(inputLine);
                if (m.matches())
                    MessageDialog.openInformation(getShell(), "Connection Test", "Connection test successful!");
                else
                    MessageDialog.openWarning(getShell(), "Connection Test",
                            "Connection test failed!\n\nThere was a reply but it could not be validated.");
            } catch (Exception e1) {
                MessageDialog.openError(getShell(), "Connection Test",
                        "Connection test failed!\n\n" + e1.getMessage());
            } finally {
                if (in != null)
                    try {
                        in.close();
                    } catch (IOException e1) {
                        /* ignore */ }
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            /* ignore */ }
    });

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

From source file:com.mobilesorcery.sdk.importproject.MoSyncWizardProjectsImportPage.java

License:Open Source License

@Override
public void createControl(Composite parent) {

    initializeDialogUnits(parent);//from  w w  w . j  ava 2  s.c  o  m

    Composite workArea = new Composite(parent, SWT.NONE);
    setControl(workArea);

    workArea.setLayout(new GridLayout());
    workArea.setLayoutData(
            new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));

    createProjectsRoot(workArea);
    createProjectsList(workArea);
    createOptionsArea(workArea);
    createWorkingSetGroup(workArea);
    restoreWidgetValues();
    Dialog.applyDialogFont(workArea);

}

From source file:com.mobilesorcery.sdk.importproject.MoSyncWizardProjectsImportPage.java

License:Open Source License

/**
 * Create the selection buttons in the listComposite.
 *
 * @param listComposite// w  w w. jav a  2  s .c om
 */
private void createSelectionButtons(Composite listComposite) {
    Composite buttonsComposite = new Composite(listComposite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    buttonsComposite.setLayout(layout);

    buttonsComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));

    Button selectAll = new Button(buttonsComposite, SWT.PUSH);
    selectAll.setText(DataTransferMessages.DataTransfer_selectAll);
    selectAll.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            for (int i = 0; i < selectedProjects.length; i++) {
                if (selectedProjects[i].hasConflicts)
                    projectsList.setChecked(selectedProjects[i], false);
                else
                    projectsList.setChecked(selectedProjects[i], true);
            }
            setPageComplete(projectsList.getCheckedElements().length > 0);
        }
    });
    Dialog.applyDialogFont(selectAll);
    setButtonLayoutData(selectAll);

    Button deselectAll = new Button(buttonsComposite, SWT.PUSH);
    deselectAll.setText(DataTransferMessages.DataTransfer_deselectAll);
    deselectAll.addSelectionListener(new SelectionAdapter() {
        /*
         * (non-Javadoc)
         *
         * @see
         * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
         * .swt.events.SelectionEvent)
         */
        @Override
        public void widgetSelected(SelectionEvent e) {

            projectsList.setCheckedElements(new Object[0]);
            setPageComplete(false);
        }
    });
    Dialog.applyDialogFont(deselectAll);
    setButtonLayoutData(deselectAll);

    Button refresh = new Button(buttonsComposite, SWT.PUSH);
    refresh.setText(DataTransferMessages.DataTransfer_refresh);
    refresh.addSelectionListener(new SelectionAdapter() {
        /*
         * (non-Javadoc)
         *
         * @see
         * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
         * .swt.events.SelectionEvent)
         */
        @Override
        public void widgetSelected(SelectionEvent e) {
            if (projectFromDirectoryRadio.getSelection()) {
                updateProjectsList(directoryPathField.getText().trim());
            } else {
                updateProjectsList(archivePathField.getText().trim());
            }
        }
    });
    Dialog.applyDialogFont(refresh);
    setButtonLayoutData(refresh);
}