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:ext.org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathsBlock.java

License:Open Source License

public Control createControl(Composite parent) {
    fSWTWidget = parent;// w  w  w .  j  a  v  a  2  s.c o m

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setFont(parent.getFont());

    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.numColumns = 1;
    composite.setLayout(layout);

    TabFolder folder = new TabFolder(composite, SWT.NONE);
    folder.setLayoutData(new GridData(GridData.FILL_BOTH));
    folder.setFont(composite.getFont());

    TabItem item;
    item = new TabItem(folder, SWT.NONE);
    item.setText(NewWizardMessages.BuildPathsBlock_tab_source);
    item.setImage(JavaPluginImages.get(JavaPluginImages.IMG_OBJS_PACKFRAG_ROOT));

    if (fUseNewPage) {
        fSourceContainerPage = new NewSourceContainerWorkbookPage(fClassPathList, fBuildPathDialogField,
                fRunnableContext, this);
    } else {
        fSourceContainerPage = new SourceContainerWorkbookPage(fClassPathList, fBuildPathDialogField);
    }
    item.setData(fSourceContainerPage);
    item.setControl(fSourceContainerPage.getControl(folder));

    IWorkbench workbench = JavaPlugin.getDefault().getWorkbench();
    Image projectImage = workbench.getSharedImages().getImage(IDE.SharedImages.IMG_OBJ_PROJECT);

    fProjectsPage = new ProjectsWorkbookPage(fClassPathList, fPageContainer);
    item = new TabItem(folder, SWT.NONE);
    item.setText(NewWizardMessages.BuildPathsBlock_tab_projects);
    item.setImage(projectImage);
    item.setData(fProjectsPage);
    item.setControl(fProjectsPage.getControl(folder));

    fLibrariesPage = new LibrariesWorkbookPage(fClassPathList, fPageContainer);
    item = new TabItem(folder, SWT.NONE);
    item.setText(NewWizardMessages.BuildPathsBlock_tab_libraries);
    item.setImage(JavaPluginImages.get(JavaPluginImages.IMG_OBJS_LIBRARY));
    item.setData(fLibrariesPage);
    item.setControl(fLibrariesPage.getControl(folder));

    // a non shared image
    Image cpoImage = JavaPluginImages.DESC_TOOL_CLASSPATH_ORDER.createImage();
    composite.addDisposeListener(new ImageDisposer(cpoImage));

    ClasspathOrderingWorkbookPage ordpage = new ClasspathOrderingWorkbookPage(fClassPathList);
    item = new TabItem(folder, SWT.NONE);
    item.setText(NewWizardMessages.BuildPathsBlock_tab_order);
    item.setImage(cpoImage);
    item.setData(ordpage);
    item.setControl(ordpage.getControl(folder));

    if (fCurrJProject != null) {
        fSourceContainerPage.init(fCurrJProject);
        fLibrariesPage.init(fCurrJProject);
        fProjectsPage.init(fCurrJProject);
    }

    folder.setSelection(fPageIndex);
    fCurrPage = (BuildPathBasePage) folder.getItem(fPageIndex).getData();
    folder.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            tabChanged(e.item);
        }
    });
    fTabFolder = folder;

    Dialog.applyDialogFont(composite);
    return composite;
}

From source file:ext.org.eclipse.jdt.internal.ui.wizards.buildpaths.ClasspathContainerSelectionPage.java

License:Open Source License

public void createControl(Composite parent) {
    fListViewer = new ListViewer(parent, SWT.SINGLE | SWT.BORDER);
    fListViewer.setLabelProvider(new ClasspathContainerLabelProvider());
    fListViewer.setContentProvider(new ArrayContentProvider());
    fListViewer.setComparator(new ViewerComparator());
    fListViewer.setInput(Arrays.asList(fContainers));
    fListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            validatePage();/*from   w  w w .j  av  a 2  s  . c o  m*/
        }
    });
    fListViewer.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            doDoubleClick();
        }
    });

    int selectionIndex = fDialogSettings.getInt(DIALOGSTORE_CONTAINER_IDX);
    if (selectionIndex >= fContainers.length) {
        selectionIndex = 0;
    }
    fListViewer.getList().select(selectionIndex);
    validatePage();
    setControl(fListViewer.getList());
    Dialog.applyDialogFont(fListViewer.getList());

    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
            IJavaHelpContextIds.BP_SELECT_CLASSPATH_CONTAINER);
}

From source file:ext.org.eclipse.jdt.internal.ui.wizards.buildpaths.ClasspathFixSelectionDialog.java

License:Open Source License

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

    ListenerMix listener = new ListenerMix();

    int count = fClasspathFixProposals.length;
    if (count == 0) {
        Link link = createLink(composite, listener);
        String[] args = { BasicElementLabels.getJavaElementName(fMissingType),
                BasicElementLabels.getJavaElementName(fProject.getElementName()) };
        link.setText(Messages.format(NewWizardMessages.ClasspathFixSelectionDialog_no_proposals_message, args));
        updateStatus(new StatusInfo(IStatus.ERROR, new String()));
    } else {/*from   w ww  .  j  a  va2  s.c om*/
        Label label = new Label(composite, SWT.WRAP);
        GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, false, false);
        layoutData.widthHint = convertWidthInCharsToPixels(80);
        label.setLayoutData(layoutData);

        String[] args = { BasicElementLabels.getJavaElementName(fMissingType) };
        label.setText(Messages.format(NewWizardMessages.ClasspathFixSelectionDialog_proposals_message, args));

        fFixSelectionTable = new TableViewer(composite, SWT.SINGLE | SWT.BORDER);
        fFixSelectionTable.setContentProvider(new ArrayContentProvider());
        fFixSelectionTable.setLabelProvider(new ClasspathFixLabelProvider());
        fFixSelectionTable.setComparator(new ViewerComparator() {
            @Override
            public int category(Object element) {
                return -((ClasspathFixProposal) element).getRelevance();
            }
        });
        fFixSelectionTable.addDoubleClickListener(listener);
        fFixSelectionTable.setInput(fClasspathFixProposals);
        Table table = fFixSelectionTable.getTable();
        table.select(0);
        fFixSelectionTable.addSelectionChangedListener(listener);

        Dialog.applyDialogFont(table);

        GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
        gridData.heightHint = table.getItemHeight() * Math.max(4, Math.min(10, count));
        gridData.widthHint = convertWidthInCharsToPixels(50);
        table.setLayoutData(gridData);

        Link link = createLink(composite, listener);
        link.setText(
                Messages.format(NewWizardMessages.ClasspathFixSelectionDialog_open_buld_path_dialog_message,
                        BasicElementLabels.getJavaElementName(fProject.getElementName())));

        performSelectionChanged();
    }

    Dialog.applyDialogFont(composite);

    return composite;
}

From source file:ext.org.eclipse.jdt.internal.ui.wizards.buildpaths.SourceAttachmentBlock.java

License:Open Source License

/**
 * Creates the control/*from   ww  w . j a  v a  2  s  .  c o  m*/
 * @param parent the parent
 * @return the created control
 */
public Control createControl(Composite parent) {
    PixelConverter converter = new PixelConverter(parent);

    fSWTWidget = parent;

    Composite composite = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 4;
    composite.setLayout(layout);

    if (isVariableEntry()) {
        int widthHint = converter.convertWidthInCharsToPixels(40);
        int labelWidthHint = widthHint * 2;

        Label message = new Label(composite, SWT.WRAP);
        GridData gd = new GridData(GridData.FILL, GridData.BEGINNING, false, false, 4, 1);
        message.setLayoutData(gd);
        message.setText(Messages.format(NewWizardMessages.SourceAttachmentBlock_message,
                BasicElementLabels.getResourceName(fEntry.getPath().lastSegment())));

        //DialogField.createEmptySpace(composite, 1);

        Label desc = new Label(composite, SWT.WRAP);
        gd = new GridData(GridData.FILL, GridData.BEGINNING, false, false, 4, 1);
        gd.widthHint = labelWidthHint;
        desc.setLayoutData(gd);
        desc.setText(NewWizardMessages.SourceAttachmentBlock_filename_description);

        fFileNameField.doFillIntoGrid(composite, 4);
        LayoutUtil.setWidthHint(fFileNameField.getTextControl(null), widthHint);

        // label that shows the resolved path for variable jars
        //DialogField.createEmptySpace(composite, 1);
        fFullPathResolvedLabel = new Label(composite, SWT.WRAP);
        fFullPathResolvedLabel.setText(getResolvedLabelString());
        gd = new GridData(GridData.FILL, GridData.BEGINNING, false, false, 4, 1);
        gd.widthHint = labelWidthHint;
        fFullPathResolvedLabel.setLayoutData(gd);

        LayoutUtil.setHorizontalGrabbing(fFileNameField.getTextControl(null));
    } else {
        int widthHint = converter.convertWidthInCharsToPixels(60);

        GridData gd = new GridData(GridData.FILL, GridData.BEGINNING, false, false, 3, 1);
        gd.widthHint = converter.convertWidthInCharsToPixels(50);

        Label message = new Label(composite, SWT.LEFT + SWT.WRAP);
        message.setLayoutData(gd);
        message.setText(Messages.format(NewWizardMessages.SourceAttachmentBlock_message,
                BasicElementLabels.getResourceName(fEntry.getPath().lastSegment())));

        fWorkspaceButton.doFillIntoGrid(composite, 1);
        ((GridData) fWorkspaceButton.getSelectionButton(null).getLayoutData()).verticalAlignment = SWT.END;

        // archive name field
        fFileNameField.doFillIntoGrid(composite, 4);
        LayoutUtil.setWidthHint(fFileNameField.getTextControl(null), widthHint);
        LayoutUtil.setHorizontalGrabbing(fFileNameField.getTextControl(null));

        // Additional 'browse workspace' button for normal jars
        DialogField.createEmptySpace(composite, 3);

        fExternalFolderButton.doFillIntoGrid(composite, 1);
    }

    fFileNameField.postSetFocusOnDialogField(parent.getDisplay());

    Dialog.applyDialogFont(composite);

    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJavaHelpContextIds.SOURCE_ATTACHMENT_BLOCK);
    return composite;
}

From source file:ext.org.eclipse.jdt.internal.ui.wizards.buildpaths.UserLibraryWizardPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setFont(parent.getFont());

    LayoutUtil.doDefaultLayout(composite, new DialogField[] { fLibrarySelector }, true, SWT.DEFAULT,
            SWT.DEFAULT);//  w w w . j a v  a  2 s .  com
    LayoutUtil.setHorizontalGrabbing(fLibrarySelector.getListControl(null));
    Dialog.applyDialogFont(composite);
    setControl(composite);
}

From source file:ext.org.eclipse.jdt.internal.ui.workingsets.AbstractWorkingSetWizardPage.java

License:Open Source License

public void createControl(Composite parent) {
    initializeDialogUnits(parent);/*from  w  ww.  ja  v  a 2 s  .c  om*/

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    setControl(composite);

    Label label = new Label(composite, SWT.WRAP);
    label.setText(WorkingSetMessages.JavaWorkingSetPage_workingSet_name);
    GridData gd = new GridData(
            GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    label.setLayoutData(gd);

    fWorkingSetName = new Text(composite, SWT.SINGLE | SWT.BORDER);
    fWorkingSetName.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    fWorkingSetName.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });

    Composite leftCenterRightComposite = new Composite(composite, SWT.NONE);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    gridData.heightHint = convertHeightInCharsToPixels(20);
    leftCenterRightComposite.setLayoutData(gridData);
    GridLayout gridLayout = new GridLayout(3, false);
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    leftCenterRightComposite.setLayout(gridLayout);

    Composite leftComposite = new Composite(leftCenterRightComposite, SWT.NONE);
    gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    gridData.widthHint = convertWidthInCharsToPixels(40);
    leftComposite.setLayoutData(gridData);
    gridLayout = new GridLayout(1, false);
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    leftComposite.setLayout(gridLayout);

    Composite centerComposite = new Composite(leftCenterRightComposite, SWT.NONE);
    gridLayout = new GridLayout(1, false);
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    centerComposite.setLayout(gridLayout);
    centerComposite.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, false, false));

    Composite rightComposite = new Composite(leftCenterRightComposite, SWT.NONE);
    gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    gridData.widthHint = convertWidthInCharsToPixels(40);
    rightComposite.setLayoutData(gridData);
    gridLayout = new GridLayout(1, false);
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    rightComposite.setLayout(gridLayout);

    createTree(leftComposite);
    createTable(rightComposite);

    if (fWorkingSet != null)
        fWorkingSetName.setText(fWorkingSet.getName());

    initializeSelectedElements();
    validateInput();

    fTable.setInput(fSelectedElements);
    fTable.refresh(true);
    fTree.refresh(true);

    createButtonBar(centerComposite);

    fWorkingSetName.setFocus();
    fWorkingSetName.setSelection(0, fWorkingSetName.getText().length());

    Dialog.applyDialogFont(composite);
}

From source file:fede.workspace.eclipse.java.fields.JavaSourceViewerField.java

License:Apache License

@Override
public void createControl(Composite parent, int hspan) {

    fInputArea = new Composite((Composite) parent, SWT.NONE);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalSpan = hspan;//from www. jav  a 2s.c o m

    fInputArea.setLayoutData(gridData);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    fInputArea.setLayout(layout);
    Dialog.applyDialogFont(fInputArea);

    fVerticalRuler = createVerticalRuler();

    int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION;
    fSourceViewer = createSourceViewer(fInputArea, fVerticalRuler, styles);

    configureSourceViewer();

    ((JavaSourceViewer) fSourceViewer).doOperation(ITextOperationTarget.SELECT_ALL);

}

From source file:fr.inria.diverse.commons.eclipse.pde.wizards.pages.pde.ui.templates.OptionTemplateWizardPage.java

License:Open Source License

/**
 * Creates the page control by creating individual options in the order
 * subject to their position in the list.'
 * //from w w  w .jav a 2  s.  c  o m
 * @param composite
 */
public void createControl(Composite composite) {
    Composite container = new Composite(composite, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    layout.verticalSpacing = 9;
    container.setLayout(layout);

    for (int i = 0; i < options.size(); i++) {
        TemplateOption option = (TemplateOption) options.get(i);
        option.createControl(container, 3);
    }
    if (helpContextId != null)
        PlatformUI.getWorkbench().getHelpSystem().setHelp(container, helpContextId);
    setControl(container);
    Dialog.applyDialogFont(container);
    container.forceFocus();
}

From source file:fr.inria.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewerPage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    GridLayout gl = new GridLayout();
    gl.marginHeight = 0;/*from  w w  w .  j av  a  2s . c  om*/
    gl.marginWidth = 0;
    parent.setLayout(gl);
    Composite page = new Composite(parent, SWT.NONE);
    GridLayout pageLayout = new GridLayout();
    pageLayout.numColumns = 2;
    GridData pageLayoutdata = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL
            | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    page.setLayoutData(pageLayoutdata);
    page.setLayout(pageLayout);

    fTooltip = new BooleanFieldEditor(ISDPreferences.PREF_TOOLTIP, Messages.SequenceDiagram_ShowTooltips, page);
    fTooltip.setPreferenceStore(fPreferences.getPreferenceStore());
    fTooltip.load();

    // link font with zoom pref
    fLink = new BooleanFieldEditor(ISDPreferences.PREF_LINK_FONT,
            Messages.SequenceDiagram_IncreaseFontSizeWhenZooming, page);
    fLink.setPreferenceStore(fPreferences.getPreferenceStore());
    fLink.load();

    fNoExternalTime = new BooleanFieldEditor(ISDPreferences.PREF_EXCLUDE_EXTERNAL_TIME,
            Messages.SequenceDiagram_ExcludeExternalTime, page);
    fNoExternalTime.setPreferenceStore(fPreferences.getPreferenceStore());
    fNoExternalTime.load();

    // use gradient color pref
    fUseGrad = new BooleanFieldEditor(ISDPreferences.PREF_USE_GRADIENT,
            Messages.SequenceDiagram_UseGradientColor, page);
    fUseGrad.setPreferenceStore(fPreferences.getPreferenceStore());
    fUseGrad.load();

    Label separator = new Label(page, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);
    GridData sepData = new GridData(
            GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
    separator.setLayoutData(sepData);

    Composite prefPage = new Composite(page, SWT.NONE);
    GridLayout prefPageLayout = new GridLayout();
    prefPage.setLayoutData(pageLayoutdata);
    prefPageLayout.numColumns = 1;
    prefPage.setLayout(prefPageLayout);

    // swimLane width pref
    fLifelineWidth = new IntegerFieldEditor(ISDPreferences.PREF_LIFELINE_WIDTH,
            Messages.SequenceDiagram_LifelineWidth, prefPage);
    fLifelineWidth.setPreferenceStore(fPreferences.getPreferenceStore());
    fLifelineWidth.setValidRange(119, 500);
    fLifelineWidth.load();

    // not very nice
    new Label(prefPage, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);
    new Label(prefPage, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);

    // Font list pref
    fClassItemList = new List(prefPage, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    GridData tabItemLayoutdata = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL
            | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    fClassItemList.setLayoutData(tabItemLayoutdata);

    String[] fontList2 = SDViewPref.getFontList2();
    for (int i = 0; i < fontList2.length; i++) {
        fClassItemList.add(fontList2[i]);
    }
    fClassItemList.setSelection(0);
    fClassItemList.addSelectionListener(this);
    fButtonArea = new Composite(prefPage, SWT.NONE);
    GridData tabItemLayoutdata2 = new GridData(GridData.HORIZONTAL_ALIGN_FILL
            /* |GridData.GRAB_HORIZONTAL */ | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    fButtonArea.setLayoutData(tabItemLayoutdata2);
    GridLayout buttonAreaLayout = new GridLayout();
    buttonAreaLayout.numColumns = 1;
    fButtonArea.setLayout(buttonAreaLayout);

    // font selector initialise for the lifeline font pref
    String[] fontList = SDViewPref.getFontList();
    fFont = new FontFieldEditor(fontList[0], "", //$NON-NLS-1$
            Messages.SequenceDiagram_AaBbYyZz, fButtonArea);
    fFont.getPreviewControl().setSize(500, 500);
    fFont.setPreferenceStore(fPreferences.getPreferenceStore());
    fFont.load();

    fBackGroundColor = new ColorFieldEditor(fontList[0] + SDViewPref.BACK_COLOR_POSTFIX,
            Messages.SequenceDiagram_Background, fButtonArea);
    fBackGroundColor.setPreferenceStore(fPreferences.getPreferenceStore());
    fBackGroundColor.load();

    fLineColor = new ColorFieldEditor(fontList[0] + SDViewPref.FORE_COLOR_POSTFIX,
            Messages.SequenceDiagram_Lines, fButtonArea);
    fLineColor.setPreferenceStore(fPreferences.getPreferenceStore());
    fLineColor.load();

    fTextColor = new ColorFieldEditor(fontList[0] + SDViewPref.TEXT_COLOR_POSTFIX,
            Messages.SequenceDiagram_Text, fButtonArea);
    fTextColor.setPreferenceStore(fPreferences.getPreferenceStore());
    fTextColor.load();
    swapPref(true);
    Dialog.applyDialogFont(page);

    return page;
}

From source file:fr.irisa.triskell.kermeta.tools.wizards.Kermeta2EcoreResolveWizardPage.java

/**
 * @see WizardPage#createControl//w ww  . ja  v a  2s. com
 */
public void createControl(Composite parent) {
    // init util
    topLevel = new Composite(parent, SWT.NONE);
    topLevel.setFont(parent.getFont());

    int nColumns = 4;
    GridLayout layout = new GridLayout(nColumns, false);
    topLevel.setLayout(layout);
    // FIXME for the moment GridData causes problems when WizardPage is updated in Eclipse source code
    // (ClassCastException)
    /*      topLevel.setLayoutData(new GridData(
    GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));*/
    topLevel.setFont(parent.getFont());

    // Create the dialog field where user choose an output directory for resource ecore dependencies)
    createContainerControls(topLevel, nColumns);

    // Create an esthetic separator
    createSeparator(topLevel, nColumns);

    // Create the ecore list where user 
    createRequiredEcoreFileList(topLevel, nColumns);

    setControl(topLevel);

    // Initialize the WizardPage state
    initControlState();

    Dialog.applyDialogFont(topLevel);

    validatePage();
}