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.asakusafw.shafu.internal.ui.wizards.SelectGradleProjectsPage.java

License:Apache License

@Override
public void createControl(Composite parent) {
    initializeDialogUnits(parent);/*from w  ww  .j  a v a  2s .com*/
    Composite pane = new Composite(parent, SWT.NONE);
    pane.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    setControl(pane);

    pane.setLayout(new GridLayout(1, false));

    Label descriptionLabel = new Label(pane, SWT.NONE);
    descriptionLabel.setText(Messages.SelectGradleProjectsPage_targetLabel);
    descriptionLabel.setLayoutData(GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.BEGINNING).create());

    this.viewer = CheckboxTableViewer.newCheckList(pane, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    viewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    viewer.setContentProvider(ArrayContentProvider.getInstance());
    viewer.setLabelProvider(new ProjectLabelProvider());
    viewer.getTable().setEnabled(false);
    viewer.getTable().addMouseListener(new MouseAdapter() {
        @Override
        public void mouseDown(MouseEvent e) {
            Table tree = (Table) e.getSource();
            Point point = new Point(e.x, e.y);
            TableItem item = tree.getItem(point);
            if (item == null) {
                return;
            }
            ProjectEntry entry = (ProjectEntry) item.getData();
            if (item.getBounds().contains(point) && entry.isEnabled()) {
                boolean checked = !item.getChecked();
                item.setChecked(checked);
                refreshSelection();
            }
        }
    });

    createGradleSettings(pane);
    createWorkingSetSettings(pane);
    createConsoleButton(pane);

    Dialog.applyDialogFont(pane);
    setPageComplete(false);
}

From source file:com.asakusafw.shafu.internal.ui.wizards.SelectProjectDirectoryPage.java

License:Apache License

@Override
public void createControl(Composite parent) {
    initializeDialogUnits(parent);//from w ww . j a va 2s  . c  om
    Composite pane = new Composite(parent, SWT.NONE);
    pane.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    setControl(pane);

    pane.setLayout(new GridLayout(1, false));

    Label descriptionLabel = new Label(pane, SWT.NONE);
    descriptionLabel.setText(Messages.SelectProjectDirectoryPage_fieldLabel);
    descriptionLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));

    Composite field = new Composite(pane, SWT.NONE);
    field.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    field.setLayout(new GridLayout(2, false));

    this.fileField = new Text(field, SWT.BORDER);
    fileField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    fileField.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            refreshText(((Text) e.getSource()).getText());
        }
    });

    Button fileButton = new Button(field, SWT.PUSH);
    fileButton.setText(Messages.SelectProjectDirectoryPage_fieldButton);
    fileButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
    fileButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dialog = new DirectoryDialog(getShell());
            dialog.setText(Messages.SelectProjectDirectoryPage_directoryDialogTitle);
            String current = fileField.getText();
            if (current.isEmpty() == false) {
                dialog.setFilterPath(current);
            }
            String result = dialog.open();
            if (result != null) {
                fileField.setText(result);
            }
        }
    });

    Dialog.applyDialogFont(pane);

    IDialogSettings settings = Activator.getDialogSettings(getClass().getSimpleName());
    String defaultPath = settings.get(KEY_DIALOG_PATH);
    if (defaultPath != null && defaultPath.isEmpty() == false) {
        fileField.setText(defaultPath);
    } else {
        setPageComplete(false);
    }
}

From source file:com.atlassian.connector.eclipse.internal.crucible.ui.wizards.CrucibleAddPatchPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite//  w ww .  j  av a  2 s .c o  m
            .setLayout(GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).margins(5, 5).create());

    final Button includePatchButton = new Button(composite, SWT.CHECK);
    includePatchButton.setText("Include this Patch from the clipboard in the review:");
    GridDataFactory.fillDefaults().span(2, 1).applyTo(includePatchButton);
    includePatchButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            includePatch = includePatchButton.getSelection();
            if (includePatch) {
                //copy content from clipboard, only if not already done
                Clipboard clipboard = new Clipboard(Display.getDefault());
                Object patch = clipboard.getContents(TextTransfer.getInstance());
                if (patch != null && patch instanceof String && !patchPasted) {
                    patchText.setText((String) patch);
                    patchPasted = true;
                }
                if (cachedRepositories == null) {
                    cachedRepositories = CrucibleUiUtil.getCachedRepositories(taskRepository);
                }
                comboViewer.setInput(cachedRepositories);
            }

            validatePage();
        }
    });

    patchText = new Text(composite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
    GridDataFactory.fillDefaults().span(2, 1).hint(SWT.DEFAULT, 220).grab(true, true).applyTo(patchText);
    patchText.setEditable(false);

    Label label = new Label(composite, SWT.NONE);
    label.setText("Select the repository on Crucible:");
    GridDataFactory.fillDefaults().grab(false, false).applyTo(label);
    comboViewer = new ComboViewer(composite);
    comboViewer.getCombo().setText("Select Repository");
    comboViewer.setContentProvider(new ArrayContentProvider());
    comboViewer.setLabelProvider(new CrucibleRepositoriesLabelProvider());
    comboViewer.setSorter(new ViewerSorter());
    comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            if (comboViewer.getSelection() instanceof IStructuredSelection) {
                Object selected = ((IStructuredSelection) comboViewer.getSelection()).getFirstElement();
                if (cachedRepositories.contains(selected)) {
                    selectedRepository = ((Repository) selected).getName();
                }
            }
            validatePage();
        }
    });
    GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).grab(true, false).hint(100, SWT.DEFAULT)
            .applyTo(comboViewer.getCombo());

    Button updateData = new Button(composite, SWT.PUSH);
    updateData.setText("Update Repository Data");
    GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(updateData);
    updateData.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
        }
    });

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

From source file:com.atlassian.connector.eclipse.internal.crucible.ui.wizards.CrucibleReviewDetailsPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(6).margins(5, 5).create());

    new Label(composite, SWT.NONE).setText("Title:");
    titleText = new Text(composite, SWT.BORDER);
    titleText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            getContainer().updateButtons();
        }/* w  ww  .j  a va2  s.  co  m*/
    });
    GridDataFactory.fillDefaults().span(5, 1).grab(true, false).applyTo(titleText);

    new Label(composite, SWT.NONE).setText("Project:");
    projectsComboViewer = new ComboViewer(composite);
    projectsComboViewer.setLabelProvider(new CrucibleProjectsLabelProvider());
    projectsComboViewer.setContentProvider(new ArrayContentProvider());
    projectsComboViewer.setSorter(new ViewerSorter());
    projectsComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            updateReviewersControl();
        }
    });
    GridDataFactory.fillDefaults().grab(true, false).applyTo(projectsComboViewer.getCombo());

    new Label(composite, SWT.NONE).setText("Moderator:");
    moderatorComboViewer = new ComboViewer(composite);
    moderatorComboViewer.setLabelProvider(new CrucibleUserLabelProvider());
    moderatorComboViewer.setContentProvider(new ArrayContentProvider());
    moderatorComboViewer.setComparator(new ViewerComparator());
    moderatorComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            Object firstElement = ((IStructuredSelection) event.getSelection()).getFirstElement();
            if (firstElement != null) {
                getWizard().getContainer().updateButtons();
            }
        }
    });
    GridDataFactory.fillDefaults().grab(true, false).applyTo(moderatorComboViewer.getCombo());

    new Label(composite, SWT.NONE).setText("Author:");
    authorComboViewer = new ComboViewer(composite);
    authorComboViewer.setLabelProvider(new CrucibleUserLabelProvider());
    authorComboViewer.setContentProvider(new ArrayContentProvider());
    authorComboViewer.setComparator(new ViewerComparator());
    authorComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            Object firstElement = ((IStructuredSelection) event.getSelection()).getFirstElement();
            if (firstElement != null) {
                getWizard().getContainer().updateButtons();
            }
        }
    });
    GridDataFactory.fillDefaults().grab(true, false).applyTo(authorComboViewer.getCombo());

    Label label = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
    GridDataFactory.fillDefaults().grab(true, false).span(6, 1).applyTo(label);

    label = new Label(composite, SWT.NONE);
    label.setText("Objectives:");

    GridDataFactory.fillDefaults().span(4, 1).applyTo(label);

    label = new Label(composite, SWT.NONE);
    label.setText("Reviewers:");
    GridDataFactory.fillDefaults().span(2, 1).indent(5, SWT.DEFAULT).applyTo(label);

    Composite textAreacomposite = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginLeft = 0;
    layout.marginTop = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 10;
    textAreacomposite.setLayout(layout);
    GridData gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
    gd.horizontalIndent = 0;
    textAreacomposite.setLayoutData(gd);
    GridDataFactory.fillDefaults().grab(true, true).hint(480, 200).span(4, 1).applyTo(textAreacomposite);

    objectivesText = new Text(textAreacomposite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
    GridDataFactory.fillDefaults().grab(true, true).hint(480, 200).applyTo(objectivesText);

    if (addComment) {
        label = new Label(textAreacomposite, SWT.NONE);
        label.setText("Selection Comment:");
        GridDataFactory.fillDefaults().applyTo(label);
        commentText = new Text(textAreacomposite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
        GridDataFactory.fillDefaults().grab(true, true).hint(480, 200).applyTo(commentText);
    }

    reviewersSelectionTreePart = new ReviewersSelectionTreePart(Collections.<User>emptySet(),
            Collections.<User>emptyList());
    Composite reviewersComp = reviewersSelectionTreePart.createControl(composite);
    GridDataFactory.fillDefaults().grab(true, true).span(2, 1).hint(SWT.DEFAULT, 150).applyTo(reviewersComp);
    reviewersSelectionTreePart.setCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent event) {
            getWizard().getContainer().updateButtons();
        }
    });

    Button updateData = new Button(composite, SWT.PUSH);
    updateData.setText("Update Repository Data");
    GridDataFactory.fillDefaults().span(4, 2).align(SWT.BEGINNING, SWT.BEGINNING).applyTo(updateData);
    updateData.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            CrucibleUiUtil.updateTaskRepositoryCache(taskRepository, getContainer(),
                    CrucibleReviewDetailsPage.this);
            updateInputAndRestoreSelections();
        }
    });

    anyoneCanJoin = new Button(composite, SWT.CHECK);
    anyoneCanJoin.setText("Allow anyone to join");
    GridDataFactory.fillDefaults().indent(5, SWT.DEFAULT).span(2, 1).applyTo(anyoneCanJoin);

    startReview = new Button(composite, SWT.CHECK);
    startReview.setText("Start review immediately (if permitted)");
    GridDataFactory.fillDefaults().span(2, 1).align(SWT.BEGINNING, SWT.BEGINNING).indent(5, SWT.DEFAULT)
            .applyTo(startReview);

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

From source file:com.atlassian.connector.eclipse.internal.crucible.ui.wizards.DefineRepositoryMappingsPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).margins(5, 5).create());

    Composite repositoryMappingViewer = createRepositoryMappingComposite(composite, 700);
    GridDataFactory.fillDefaults().span(3, 1).align(SWT.FILL, SWT.FILL).grab(true, true)
            .applyTo(repositoryMappingViewer);
    repositoryMappingViewer.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create());

    Dialog.applyDialogFont(composite);
    setControl(composite);/*from  w w  w  .  jav a 2s. com*/
}

From source file:com.atlassian.connector.eclipse.internal.crucible.ui.wizards.ResourceSelectionPage.java

License:Open Source License

/**
 * Allow the user to chose to save the patch to the workspace or outside of the workspace.
 *//* w ww . j av  a  2  s  . co  m*/
public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite
            .setLayout(GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).margins(5, 5).create());
    GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);

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

    Label label = new Label(composite, SWT.NONE);
    label.setText("Include resources:");

    resourceSelectionTree = new ResourceSelectionTree(composite, "", resourcesToShow, null,
            new ITreeViewModeSettingProvider() {

                public void setTreeViewMode(TreeViewMode mode) {
                    CrucibleUiPlugin.getDefault().setResourcesTreeViewMode(mode);
                }

                public TreeViewMode getTreeViewMode() {
                    return CrucibleUiPlugin.getDefault().getResourcesTreeViewMode();
                }
            });

    resourceSelectionTree.getTreeViewer().addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent event) {
            validatePage();
        }
    });

    GridDataFactory.fillDefaults().span(2, 1).hint(SWT.DEFAULT, 220).grab(true, true)
            .applyTo(resourceSelectionTree);

    resourceSelectionTree.getTreeViewer().getTree().setToolTipText("");
    final CustomToolTip toolTip = new CustomToolTip(resourceSelectionTree.getTreeViewer().getControl());
    toolTip.setInfoProvider(DecoratedResourceInfoProvider.getInstance());

    resourceSelectionTree.getTreeViewer().getTree().addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            toolTip.hide();
        }
    });

    mappingButtonFactory = new DefineRepositoryMappingButton(this, composite, taskRepository);
    Control buttonControl = mappingButtonFactory.getControl();
    GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(buttonControl);

    populateResourcesTree();

    validatePage();
}

From source file:com.atlassian.connector.eclipse.internal.crucible.ui.wizards.SelectChangesetsFromCruciblePage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).margins(5, 5).create());

    Label label = new Label(composite, SWT.NONE);
    label.setText("Select changesets from your repositories:");
    GridDataFactory.fillDefaults().span(2, 1).applyTo(label);

    new Label(composite, SWT.NONE).setText("Changesets selected for the review:");

    createChangesViewer(composite);//w w w  .j  a  va2  s. c  om

    createButtonComp(composite);

    createSelectedChangesViewer(composite);

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

From source file:com.atlassian.connector.eclipse.internal.crucible.ui.wizards.SelectScmChangesetsPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).margins(5, 5).create());

    Label label = new Label(composite, SWT.NONE);
    label.setText("Select changesets from your repositories:");
    GridDataFactory.fillDefaults().span(2, 1).applyTo(label);

    new Label(composite, SWT.NONE).setText("Changesets selected for the review:");

    createLeftViewer(composite);//from www. j av  a2 s  .  c o m

    createButtonComp(composite);

    createRightViewer(composite);

    mappingButton = new DefineRepositoryMappingButton(this, composite, getTaskRepository());

    Control button = mappingButton.getControl();
    GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(button);

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

From source file:com.axmor.eclipse.typescript.editor.rename.RenameInputPage.java

License:Open Source License

/**
 * Creates a root composite.//  w ww . j  a v  a  2  s.  co m
 * 
 * @param parent
 *            parent composite
 * @return composite
 */
private Composite createRootComposite(final Composite parent) {
    Composite result = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginWidth = 10;
    gridLayout.marginHeight = 10;
    result.setLayout(gridLayout);
    initializeDialogUnits(result);
    Dialog.applyDialogFont(result);
    return result;
}

From source file:com.bdaum.zoom.ui.internal.preferences.FileExtensionDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite parentComposite = (Composite) super.createDialogArea(parent);
    Composite contents = new Composite(parentComposite, SWT.NONE);
    contents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    setTitle(headerTitle);//from   w  w w .  jav a  2  s .c o  m
    setMessage(message);
    new Label(contents, SWT.LEFT).setText(label);
    filenameField = new Text(contents, SWT.SINGLE | SWT.BORDER);
    if (initialValue != null)
        filenameField.setText(initialValue);
    filenameField.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent event) {
            if (event.widget == filenameField) {
                filename = filenameField.getText().trim();
                okButton.setEnabled(validateFileType());
            }
        }
    });
    filenameField.setFocus();

    Button browseButton = new Button(contents, SWT.PUSH);
    browseButton.setText(Messages.getString("FileExtensionDialog.Browse")); //$NON-NLS-1$
    browseButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            ListDialog dialog = new ZListDialog(getShell(), SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
            dialog.setTitle(Messages.getString("FileExtensionDialog.registered_file_types"));//$NON-NLS-1$
            dialog.setContentProvider(ArrayContentProvider.getInstance());
            dialog.setLabelProvider(ZColumnLabelProvider.getDefaultInstance());
            String[] extensions = Program.getExtensions();
            List<String> list = new ArrayList<String>(extensions.length);
            for (String s : extensions)
                if (s.indexOf(' ') < 0)
                    list.add(s);
            extensions = list.toArray(new String[list.size()]);
            dialog.setInput(extensions);
            dialog.setMessage(Messages.getString("FileExtensionDialog.Select_registered_file_types")); //$NON-NLS-1$
            if (dialog.open() == Window.OK) {
                Object[] result = dialog.getResult();
                if (result != null && result.length > 0) {
                    StringBuilder sb = new StringBuilder(filenameField.getText());
                    for (Object object : result) {
                        if (sb.length() > 0)
                            sb.append(';');
                        sb.append('*').append(object);
                    }
                    filenameField.setText(sb.toString());
                }
            }
        }
    });

    Dialog.applyDialogFont(parentComposite);
    Point defaultMargins = LayoutConstants.getMargins();
    GridLayoutFactory.fillDefaults().numColumns(3).margins(defaultMargins.x, defaultMargins.y)
            .generateLayout(contents);
    return contents;
}