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:descent.internal.ui.preferences.SmartTypingConfigurationBlock.java

License:Open Source License

private void createMessage(final Composite composite) {
    // TODO create a link with an argument, so the formatter preference page can open the 
    // current profile automatically.
    String linkTooltip = PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_tooltip;
    String text;//w  w  w.j  a v  a2s.  c  o  m
    String indentMode = JavaPlugin.getDefault().getCombinedPreferenceStore()
            .getString(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR);
    if (JavaCore.TAB.equals(indentMode))
        text = Messages.format(PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_tab_text,
                new String[] { Integer.toString(getTabDisplaySize()) });
    else
        text = Messages.format(PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_others_text,
                new String[] { Integer.toString(getTabDisplaySize()), Integer.toString(getIndentSize()),
                        getIndentMode() });

    final Link link = new Link(composite, SWT.NONE);
    link.setText(text);
    link.setToolTipText(linkTooltip);
    GridData gd = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
    gd.widthHint = 300; // don't get wider initially
    link.setLayoutData(gd);
    link.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            PreferencesUtil.createPreferenceDialogOn(link.getShell(),
                    "descent.ui.preferences.CodeFormatterPreferencePage", null, null); //$NON-NLS-1$
        }
    });

    final IPreferenceStore combinedStore = JavaPlugin.getDefault().getCombinedPreferenceStore();
    final IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener() {
        private boolean fHasRun = false;

        public void propertyChange(PropertyChangeEvent event) {
            if (fHasRun)
                return;
            if (composite.isDisposed())
                return;
            String property = event.getProperty();
            if (DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR.equals(property)
                    || DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE.equals(property)) {
                fHasRun = true;
                link.dispose();
                createMessage(composite);
                Dialog.applyDialogFont(composite);
                composite.redraw();
                composite.layout();
            }
        }
    };
    combinedStore.addPropertyChangeListener(propertyChangeListener);
    link.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e) {
            combinedStore.removePropertyChangeListener(propertyChangeListener);
        }
    });
}

From source file:descent.internal.ui.refactoring.MessageWizardPage.java

License:Open Source License

public void createControl(Composite parent) {
    initializeDialogUnits(parent);//from   w w w.j ava2 s . c  o  m
    Composite result = new Composite(parent, SWT.NONE);
    setControl(result);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN) * 3 / 2;
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING) * 2;
    layout.numColumns = 2;
    result.setLayout(layout);

    Image image = getMessageImage();
    if (image != null) {
        Label label = new Label(result, SWT.NULL);
        image.setBackground(label.getBackground());
        label.setImage(image);
        label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING));
    }

    String message = getMessageString();
    if (message != null) {
        Label messageLabel = new Label(result, SWT.WRAP);
        messageLabel.setText(message);
        GridData data = new GridData(
                GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        messageLabel.setLayoutData(data);
        messageLabel.setFont(result.getFont());
    }
    Dialog.applyDialogFont(result);
}

From source file:descent.internal.ui.refactoring.reorg.ReorgUserInputPage.java

License:Open Source License

public void createControl(Composite parent) {
    initializeDialogUnits(parent);//from  ww  w  .  j a  v a2 s . c  o m
    Composite result = new Composite(parent, SWT.NONE);
    setControl(result);
    result.setLayout(new GridLayout());

    Object initialSelection = getInitiallySelectedElement();
    verifyDestination(initialSelection, true);

    addLabel(result);

    fViewer = createViewer(result);
    fViewer.setSelection(new StructuredSelection(initialSelection), true);
    fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            ReorgUserInputPage.this.viewerSelectionChanged(event);
        }
    });
    Dialog.applyDialogFont(result);
}

From source file:descent.internal.ui.wizards.buildpaths.BuildPathsBlock.java

License:Open Source License

public Control createControl(Composite parent) {
    fSWTWidget = parent;/*www  . ja  va  2 s  .  co  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));

    // Descent: we don't want the Order & Export settings
    //      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() {
        public void widgetSelected(SelectionEvent e) {
            tabChanged(e.item);
        }
    });
    fTabFolder = folder;

    Dialog.applyDialogFont(composite);
    return composite;
}

From source file:descent.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.setSorter(new ClasspathContainerSorter());
    fListViewer.setInput(Arrays.asList(fContainers));
    fListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            validatePage();//  ww  w  .ja v  a2 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:descent.internal.ui.wizards.buildpaths.SetFilterWizardPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite inner = new Composite(parent, SWT.NONE);
    inner.setFont(parent.getFont());/*  w  ww .j  a  v a  2s.com*/

    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    inner.setLayout(layout);
    inner.setLayoutData(new GridData(GridData.FILL_BOTH));

    fInclusionPatternList.doFillIntoGrid(inner, 3);
    LayoutUtil.setHorizontalSpan(fInclusionPatternList.getLabelControl(null), 2);
    LayoutUtil.setHorizontalGrabbing(fInclusionPatternList.getListControl(null));

    fExclusionPatternList.doFillIntoGrid(inner, 3);
    LayoutUtil.setHorizontalSpan(fExclusionPatternList.getLabelControl(null), 2);
    LayoutUtil.setHorizontalGrabbing(fExclusionPatternList.getListControl(null));

    setControl(inner);
    Dialog.applyDialogFont(inner);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(inner,
            IJavaHelpContextIds.INCLUSION_EXCLUSION_WIZARD_PAGE);
}

From source file:descent.internal.ui.wizards.buildpaths.SourceAttachmentBlock.java

License:Open Source License

/**
 * Creates the control/*from w  ww .  ja v a  2  s.co m*/
 */
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(50);

        Label message = new Label(composite, SWT.WRAP);
        GridData gd = new GridData(GridData.FILL, GridData.BEGINNING, false, false, 4, 1);
        gd.widthHint = widthHint;
        message.setLayoutData(gd);
        message.setText(Messages.format(NewWizardMessages.SourceAttachmentBlock_message,
                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 = widthHint;
        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 = widthHint;
        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,
                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));

        // aditional '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:descent.internal.ui.wizards.JavaProjectWizardFirstPage.java

License:Open Source License

public void createControl(Composite parent) {
    initializeDialogUnits(parent);/*from   ww  w.j  av a2 s  .  c o  m*/

    final Composite composite = new Composite(parent, SWT.NULL);
    composite.setFont(parent.getFont());
    composite.setLayout(initGridLayout(new GridLayout(1, false), true));
    composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

    // create UI elements
    fNameGroup = new NameGroup(composite, fInitialName);
    fLocationGroup = new LocationGroup(composite);
    //      fJREGroup= new JREGroup(composite);
    //      fLayoutGroup= new LayoutGroup(composite);
    fDetectGroup = new DetectGroup(composite);

    // establish connections
    fNameGroup.addObserver(fLocationGroup);
    //      fDetectGroup.addObserver(fLayoutGroup);
    //      fDetectGroup.addObserver(fJREGroup);
    fLocationGroup.addObserver(fDetectGroup);

    // initialize all elements
    fNameGroup.notifyObservers();

    // create and connect validator
    fValidator = new Validator();
    fNameGroup.addObserver(fValidator);
    fLocationGroup.addObserver(fValidator);

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

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

From source file:descent.internal.ui.wizards.NewSourceFolderWizardPage.java

License:Open Source License

public void createControl(Composite parent) {
    initializeDialogUnits(parent);/*from  w w  w.j  a v a  2 s.  co  m*/

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

    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    composite.setLayout(layout);

    fProjectField.doFillIntoGrid(composite, 3);
    fRootDialogField.doFillIntoGrid(composite, 3);
    fExcludeInOthersFields.doFillIntoGrid(composite, 3);

    int maxFieldWidth = convertWidthInCharsToPixels(40);
    LayoutUtil.setWidthHint(fProjectField.getTextControl(null), maxFieldWidth);
    LayoutUtil.setHorizontalGrabbing(fProjectField.getTextControl(null));
    LayoutUtil.setWidthHint(fRootDialogField.getTextControl(null), maxFieldWidth);

    setControl(composite);
    Dialog.applyDialogFont(composite);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
            IJavaHelpContextIds.NEW_PACKAGEROOT_WIZARD_PAGE);
}

From source file:descent.internal.unittest.ui.JUnitPreferencePage.java

License:Open Source License

protected Control createContents(Composite parent) {
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IJUnitHelpContextIds.JUNIT_PREFERENCE_PAGE);

    Composite composite = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;//from   ww w. j  a  v a 2  s. c  o  m
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    composite.setLayout(layout);
    GridData data = new GridData();
    data.verticalAlignment = GridData.FILL;
    data.horizontalAlignment = GridData.FILL;
    composite.setLayoutData(data);

    Dialog.applyDialogFont(composite);
    return composite;
}