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.aptana.deploy.heroku.ui.wizard.HerokuLoginWizardPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
    setControl(composite);/*from w w w.  j  ava 2  s. c  om*/

    initializeDialogUnits(parent);

    // Actual contents
    Label label = new Label(composite, SWT.NONE);
    label.setText(Messages.HerokuLoginWizardPage_EnterCredentialsLabel);

    Composite credentials = new Composite(composite, SWT.NONE);
    credentials.setLayout(new GridLayout(2, false));

    Label userIdLabel = new Label(credentials, SWT.NONE);
    userIdLabel.setText(Messages.HerokuLoginWizardPage_UserIDLabel);
    userId = new Text(credentials, SWT.SINGLE | SWT.BORDER);
    userId.setMessage(Messages.HerokuLoginWizardPage_UserIDExample);
    GridData gd = new GridData(300, SWT.DEFAULT);
    userId.setLayoutData(gd);
    userId.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            getContainer().updateButtons();
        }
    });

    Label passwordLabel = new Label(credentials, SWT.NONE);
    passwordLabel.setText(Messages.HerokuLoginWizardPage_PasswordLabel);
    password = new Text(credentials, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
    password.setMessage(Messages.HerokuLoginWizardPage_PasswordExample);
    password.setLayoutData(gd);
    password.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            getContainer().updateButtons();
        }
    });

    Button checkAuth = new Button(credentials, SWT.PUSH);
    checkAuth.setText(Messages.HerokuLoginWizardPage_SubmitButtonLabel);
    checkAuth.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            // api.writeCredentials(); // we write them automatically via a page changed listener below...
            if (validateLogin() && isPageComplete()) {
                getContainer().showPage(getNextPage());
            }
        }
    });

    // Signup link
    Link link = new Link(composite, SWT.NONE);
    link.setText(Messages.HerokuLoginWizardPage_SignupLink);
    link.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            // Open the next dialog page where user can begin signup process!
            IWizardPage signupPage = new HerokuSignupPage(userId.getText());
            signupPage.setWizard(getWizard());
            getContainer().showPage(signupPage);
        }
    });

    Dialog.applyDialogFont(composite);

    // Save credentials if user hit Next too!!!
    IWizardContainer container = getWizard().getContainer();
    ((IPageChangeProvider) container).addPageChangedListener(new IPageChangedListener() {

        public void pageChanged(PageChangedEvent event) {
            Object selected = event.getSelectedPage();
            if (selected instanceof HerokuDeployWizardPage) {
                // If user has moved on to deploy page, write their credentials to a file
                HerokuAPI api = new HerokuAPI(userId.getText(), password.getText());
                api.writeCredentials();
            }
        }
    });
}

From source file:com.aptana.deploy.heroku.ui.wizard.HerokuSignupPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
    setControl(composite);//ww w  .  j  a v a 2  s  .  com

    initializeDialogUnits(parent);

    // Actual contents
    Label label = new Label(composite, SWT.NONE);
    label.setText(Messages.HerokuLoginWizardPage_EnterCredentialsLabel);

    Composite credentials = new Composite(composite, SWT.NONE);
    credentials.setLayout(new GridLayout(2, false));

    Label userIdLabel = new Label(credentials, SWT.NONE);
    userIdLabel.setText(Messages.HerokuLoginWizardPage_UserIDLabel);
    userId = new Text(credentials, SWT.SINGLE | SWT.BORDER);
    userId.setMessage(Messages.HerokuLoginWizardPage_UserIDExample);
    if (startingUserId != null && startingUserId.trim().length() > 0) {
        userId.setText(startingUserId);
    }
    GridData gd = new GridData(300, SWT.DEFAULT);
    userId.setLayoutData(gd);

    Label note = new Label(composite, SWT.WRAP);
    // We need this italic, we may need to set a font explicitly here to get it
    Font dialogFont = JFaceResources.getDialogFont();
    FontData[] data = SWTUtils.italicizedFont(JFaceResources.getDialogFont());
    final Font italic = new Font(dialogFont.getDevice(), data);
    note.setFont(italic);
    note.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            if (!italic.isDisposed()) {
                italic.dispose();
            }
        }
    });

    gd = new GridData(400, SWT.DEFAULT);
    note.setLayoutData(gd);
    note.setText(Messages.HerokuSignupPage_SignupNote);

    // Add signup button
    Button signup = new Button(composite, SWT.PUSH);
    signup.setText(Messages.HerokuSignupPage_SignupButtonLabel);
    signup.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            if (!isEmailValid(userId.getText())) {
                MessageDialog.openError(getShell(), "Error", Messages.HerokuSignupPage_InvalidEmail_Message); //$NON-NLS-1$
                return;
            }

            // basically just perform finish!
            if (getWizard().performFinish()) {
                ((WizardDialog) getContainer()).close();
            }
        }
    });

    Dialog.applyDialogFont(composite);
}

From source file:com.aptana.deploy.wizard.DeployWizardPage.java

License:Open Source License

public void createControl(Composite parent) {
    Font font = parent.getFont();

    // create composite for page.
    Composite outerContainer = new Composite(parent, SWT.NONE);
    outerContainer.setLayout(GridLayoutFactory.swtDefaults().spacing(0, 10).create());
    outerContainer.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    outerContainer.setFont(font);//from w  ww. ja v a  2s . c  om

    Composite comp = createTreeViewer(outerContainer);
    Dialog.applyDialogFont(comp);

    descriptionLabel = new Label(comp, SWT.WRAP);
    if (descriptionLabel != null) {
        descriptionLabel
                .setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, 50).create());
        descriptionLabel.setFont(font);
    }

    restoreWidgetValues();

    setControl(outerContainer);

    initialize();
}

From source file:com.aptana.editor.common.internal.scripting.TemplateSelectionPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(GridLayoutFactory.swtDefaults().spacing(10, 10).create());
    container.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    createAbove(container, 1);//from  w w w  . j av  a 2s  .c om
    Label label = new Label(container, SWT.NONE);
    label.setText(Messages.TemplateSelectionPage_available_templates);
    GridData gd = new GridData();
    label.setLayoutData(gd);

    SashForm sashForm = new SashForm(container, SWT.VERTICAL);
    gd = new GridData(GridData.FILL_BOTH);
    // limit the width of the sash form to avoid the wizard
    // opening very wide. This is just preferred size -
    // it can be made bigger by the wizard
    // See bug #83356
    gd.widthHint = 300;
    sashForm.setLayoutData(gd);

    templateSelectionViewer = new TableViewer(sashForm, SWT.BORDER);
    templateSelectionViewer.setContentProvider(new ListContentProvider());
    templateSelectionViewer.setLabelProvider(new ListLabelProvider());
    createPreview(sashForm);
    initializeViewer();
    templateSelectionViewer.setInput(templates);
    templateSelectionViewer.addSelectionChangedListener(this);
    Dialog.applyDialogFont(container);
    setControl(container);
}

From source file:com.aptana.formatter.ui.dialogs.ProjectSelectionDialog.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 *///from ww w  . j  a  va 2 s  .  c o m
protected Control createDialogArea(Composite parent) {
    // page group
    Composite composite = (Composite) super.createDialogArea(parent);

    Font font = parent.getFont();
    composite.setFont(font);

    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(ArrayContentProvider.getInstance());

    fTableViewer.getControl().setFont(font);

    if (natureId != null) {
        fTableViewer.addFilter(new ViewerFilter() {
            public boolean select(Viewer viewer, Object parentElement, Object element) {
                if (element instanceof IProject) {
                    IProject project = (IProject) element;
                    try {
                        return project.hasNature(natureId);
                    } catch (CoreException e) {
                        IdeLog.logError(FormatterUIEplPlugin.getDefault(), e, IDebugScopes.DEBUG);
                        return false;
                    }
                }
                return true;
            }
        });
    }

    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 = FormatterUIEplPlugin.getDefault().getDialogSettings();
    boolean doFilter = !dialogSettings.getBoolean(DIALOG_SETTINGS_SHOW_ALL)
            && !fProjectsWithSpecifics.isEmpty();
    checkbox.setSelection(doFilter);
    updateFilter(doFilter);

    IProject[] input = ResourcesPlugin.getWorkspace().getRoot().getProjects();
    fTableViewer.setInput(input);

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

From source file:com.aptana.formatter.ui.preferences.PropertyAndPreferencePage.java

License:Open Source License

protected Control createContents(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;//from  ww w . j  a  v  a  2s  .co  m
    layout.marginWidth = 0;
    composite.setLayout(layout);
    composite.setFont(parent.getFont());

    GridData data = new GridData(GridData.FILL, GridData.FILL, true, true);

    fConfigurationBlockControl = createPreferenceContent(composite);
    fConfigurationBlockControl.setLayoutData(data);

    if (isProjectPreferencePage()) {
        boolean useProjectSettings = hasProjectSpecificOptions(getProject());
        enableProjectSpecificSettings(useProjectSettings);
    }

    Dialog.applyDialogFont(composite);
    return composite;
}

From source file:com.aptana.ide.core.ui.wizards.WizardFolderImportPage.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
 *//*  ww w.j a v  a 2  s .  c  o m*/
public void createControl(Composite parent) {
    // Collect the existing project names to avoid conflicts.
    IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
    projectsNames = new HashSet<String>();
    for (IProject project : projects) {
        projectsNames.add(project.getName());
    }
    modifyListener = new InputModifyListener();
    initializeDialogUnits(parent);

    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);
    if (directoryPath != null) {
        directoryPathField.setText(directoryPath);
        setProjectName();
        setPageComplete(true);
    }
    Dialog.applyDialogFont(workArea);
    setPageComplete(validate());
}

From source file:com.aptana.ide.debug.internal.ui.preferences.JSDetailFormattersPreferencePage.java

License:Open Source License

protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);//from  www  .ja v a  2  s  .  c o m

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).margins(0, 0).create());

    GridDataFactory.fillDefaults().applyTo(composite);
    composite.setFont(parent.getFont());

    createFormattersList(composite);
    createOptions(composite);

    Dialog.applyDialogFont(composite);
    noDefaultAndApplyButton();

    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
            IDebugHelpContextIds.JS_DETAIL_FORMATTER_PREFERENCE_PAGE);

    return composite;
}

From source file:com.aptana.ide.editors.preferences.CodeAssistExpressionInfoDialog.java

License:Open Source License

/**
 * Creates and returns the contents of the upper part 
 * of the dialog (above the button bar).
 *
 * Subclasses should overide.//from w ww.j a  va2  s . com
 *
 * @param parent the parent composite to contain the dialog area
 * @return the dialog area control
 */
protected Control createDialogArea(Composite parent) {
    // top level composite
    Composite parentComposite = (Composite) super.createDialogArea(parent);

    // create a composite with standard margins and spacing
    Composite contents = new Composite(parentComposite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.numColumns = 2;
    contents.setLayout(layout);
    contents.setLayoutData(new GridData(GridData.FILL_BOTH));
    contents.setFont(parentComposite.getFont());

    setTitle(CodeAssistMessages.CodeAssistExpressionInfoDialog_AddXPathExpression);
    setMessage(CodeAssistMessages.CodeAssistExpressionInfoDialog_AddXPathExpressionToTriggerAttributes);

    // begin the layout

    Label label = new Label(contents, SWT.LEFT);
    label.setText(
            StringUtils.makeFormLabel(CodeAssistMessages.CodeAssistExpressionInfoDialog_AttributeExpression));

    GridData data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    label.setLayoutData(data);
    label.setFont(parent.getFont());

    message = new Text(contents, SWT.SINGLE | SWT.BORDER);
    message.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent event) {
            if (event.widget == message) {
                if (okButton != null) {
                    okButton.setEnabled(validateErrorDescriptor());
                }
            }
        }
    });
    data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    data.grabExcessHorizontalSpace = true;
    message.setLayoutData(data);
    message.setFocus();

    Label labelXPath = new Label(contents, SWT.LEFT);
    labelXPath.setText(
            StringUtils.makeFormLabel(CodeAssistMessages.CodeAssistExpressionInfoDialog_AttributeXPath));

    data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    labelXPath.setLayoutData(data);
    labelXPath.setFont(parent.getFont());

    xPath = new Text(contents, SWT.SINGLE | SWT.BORDER);
    xPath.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent event) {
            if (event.widget == xPath) {
                if (okButton != null) {
                    okButton.setEnabled(validateErrorDescriptor());
                }
            }
        }
    });

    data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    data.grabExcessHorizontalSpace = true;
    xPath.setLayoutData(data);

    Dialog.applyDialogFont(parentComposite);

    if (expression != null) {
        message.setText(expression.getExpression());
        xPath.setText(expression.getXPath());
    }

    return contents;
}

From source file:com.aptana.ide.editors.preferences.ErrorDescriptorInfoDialog.java

License:Open Source License

/**
 * Creates and returns the contents of the upper part 
 * of the dialog (above the button bar).
 *
 * Subclasses should overide.// w  w w . j  a v  a2  s. c  om
 *
 * @param parent the parent composite to contain the dialog area
 * @return the dialog area control
 */
protected Control createDialogArea(Composite parent) {
    // top level composite
    Composite parentComposite = (Composite) super.createDialogArea(parent);

    // create a composite with standard margins and spacing
    Composite contents = new Composite(parentComposite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.numColumns = 2;
    contents.setLayout(layout);
    contents.setLayoutData(new GridData(GridData.FILL_BOTH));
    contents.setFont(parentComposite.getFont());

    setTitle(CodeAssistMessages.ErrorDescriptorInfoDialog_IgnoreWarningError);
    setMessage(CodeAssistMessages.ErrorDescriptorInfoDialog_AddRegEx);

    // begin the layout

    Label label = new Label(contents, SWT.LEFT);
    label.setText(StringUtils.makeFormLabel(CodeAssistMessages.ErrorDescriptorInfoDialog_Message));

    GridData data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    label.setLayoutData(data);
    label.setFont(parent.getFont());

    message = new Text(contents, SWT.SINGLE | SWT.BORDER);
    message.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent event) {
            if (event.widget == message) {
                if (okButton != null) {
                    okButton.setEnabled(validateErrorDescriptor());
                }
            }
        }
    });
    data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    data.grabExcessHorizontalSpace = true;
    message.setLayoutData(data);
    message.setFocus();

    if (error != null) {
        message.setText(error.getMessage());
    }

    Dialog.applyDialogFont(parentComposite);

    return contents;
}