Example usage for org.eclipse.jface.resource JFaceResources getDialogFont

List of usage examples for org.eclipse.jface.resource JFaceResources getDialogFont

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources getDialogFont.

Prototype

public static Font getDialogFont() 

Source Link

Document

Returns the JFace's dialog font.

Usage

From source file:ext.org.eclipse.jdt.internal.ui.refactoring.reorg.CreateTargetQueries.java

License:Open Source License

private IWizardPage[] openNewElementWizard(IWorkbenchWizard wizard, Shell shell, Object selection) {
    wizard.init(JavaPlugin.getDefault().getWorkbench(), new StructuredSelection(selection));

    WizardDialog dialog = new WizardDialog(shell, wizard);
    PixelConverter converter = new PixelConverter(JFaceResources.getDialogFont());
    dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70),
            converter.convertHeightInCharsToPixels(20));
    dialog.create();//from   w  ww .  j a v  a 2 s.  com
    dialog.open();
    IWizardPage[] pages = wizard.getPages();
    return pages;
}

From source file:ext.org.eclipse.jdt.internal.ui.text.correction.proposals.NewCUUsingWizardProposal.java

License:Open Source License

@Override
public void apply(IDocument document) {
    StructuredSelection selection = new StructuredSelection(fCompilationUnit);
    NewElementWizard wizard = createWizard(selection);
    wizard.init(JavaPlugin.getDefault().getWorkbench(), selection);

    IType createdType = null;/*  ww w.  java2 s.c  o m*/

    if (fShowDialog) {
        Shell shell = JavaPlugin.getActiveWorkbenchShell();
        WizardDialog dialog = new WizardDialog(shell, wizard);

        PixelConverter converter = new PixelConverter(JFaceResources.getDialogFont());
        dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70),
                converter.convertHeightInCharsToPixels(20));
        dialog.create();
        dialog.getShell().setText(CorrectionMessages.NewCUCompletionUsingWizardProposal_dialogtitle);

        if (dialog.open() == Window.OK) {
            createdType = (IType) wizard.getCreatedElement();
        }
    } else {
        wizard.addPages();
        try {
            NewTypeWizardPage page = getPage(wizard);
            page.createType(null);
            createdType = page.getCreatedType();
        } catch (CoreException e) {
            JavaPlugin.log(e);
        } catch (InterruptedException e) {
        }
    }

    if (createdType != null) {
        IJavaElement container = createdType.getParent();
        if (container instanceof ICompilationUnit) {
            container = container.getParent();
        }
        if (!container.equals(fTypeContainer)) {
            // add import
            try {
                ImportRewrite rewrite = StubUtility.createImportRewrite(fCompilationUnit, true);
                rewrite.addImport(createdType.getFullyQualifiedName('.'));
                JavaModelUtil.applyEdit(fCompilationUnit, rewrite.rewriteImports(null), false, null);
            } catch (CoreException e) {
            }
        }
        fCreatedType = createdType;
    }

}

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

License:Open Source License

public static int openWizard(Shell shell, ClasspathContainerWizard wizard) {
    WizardDialog dialog = new WizardDialog(shell, wizard);
    PixelConverter converter = new PixelConverter(JFaceResources.getDialogFont());
    dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70),
            converter.convertHeightInCharsToPixels(20));
    dialog.create();/* w w  w .j a  v  a 2 s .  c om*/
    return dialog.open();
}

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

License:Open Source License

@Override
public void run() {
    Shell shell = getShell();//from  ww  w  .  java 2s  .c  om

    try {
        IJavaProject javaProject = (IJavaProject) getSelectedElements().get(0);

        CPListElement newEntrie = new CPListElement(javaProject, IClasspathEntry.CPE_SOURCE);
        CPListElement[] existing = CPListElement.createFromExisting(javaProject);
        boolean isProjectSrcFolder = CPListElement.isProjectSourceFolder(existing, javaProject);

        AddSourceFolderWizard wizard = new AddSourceFolderWizard(existing, newEntrie,
                getOutputLocation(javaProject), true, false, false, isProjectSrcFolder, isProjectSrcFolder);
        wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(javaProject));

        WizardDialog dialog = new WizardDialog(shell, wizard);
        PixelConverter converter = new PixelConverter(JFaceResources.getDialogFont());
        dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70),
                converter.convertHeightInCharsToPixels(20));
        dialog.create();
        int res = dialog.open();
        if (res == Window.OK) {

            BuildpathDelta delta = new BuildpathDelta(getToolTipText());

            ArrayList<CPListElement> newEntries = wizard.getExistingEntries();
            delta.setNewEntries(newEntries.toArray(new CPListElement[newEntries.size()]));

            IResource resource = wizard.getCreatedElement().getCorrespondingResource();
            delta.addCreatedResource(resource);

            delta.setDefaultOutputLocation(wizard.getOutputLocation());

            informListeners(delta);

            selectAndReveal(new StructuredSelection(wizard.getCreatedElement()));
        }

        notifyResult(res == Window.OK);
    } catch (CoreException e) {
        String title = NewWizardMessages.AbstractOpenWizardAction_createerror_title;
        String message = NewWizardMessages.AbstractOpenWizardAction_createerror_message;
        ExceptionHandler.handle(e, shell, title, message);
    }
}

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

License:Open Source License

@Override
public void run() {
    Shell shell = getShell();// w w  w.jav  a2s  . com

    try {
        IJavaProject javaProject = (IJavaProject) getSelectedElements().get(0);

        CPListElement newEntrie = new CPListElement(javaProject, IClasspathEntry.CPE_SOURCE);
        CPListElement[] existing = CPListElement.createFromExisting(javaProject);
        boolean isProjectSrcFolder = CPListElement.isProjectSourceFolder(existing, javaProject);

        AddSourceFolderWizard wizard = new AddSourceFolderWizard(existing, newEntrie,
                getOutputLocation(javaProject), false, false, false, isProjectSrcFolder, isProjectSrcFolder);
        wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(javaProject));

        WizardDialog dialog = new WizardDialog(shell, wizard);
        PixelConverter converter = new PixelConverter(JFaceResources.getDialogFont());
        dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70),
                converter.convertHeightInCharsToPixels(20));
        dialog.create();
        int res = dialog.open();
        if (res == Window.OK) {
            BuildpathDelta delta = new BuildpathDelta(getToolTipText());

            ArrayList<CPListElement> newEntries = wizard.getExistingEntries();
            delta.setNewEntries(newEntries.toArray(new CPListElement[newEntries.size()]));

            IResource resource = wizard.getCreatedElement().getCorrespondingResource();
            delta.addCreatedResource(resource);

            delta.setDefaultOutputLocation(wizard.getOutputLocation());

            informListeners(delta);

            selectAndReveal(new StructuredSelection(wizard.getCreatedElement()));
        }

        notifyResult(res == Window.OK);
    } catch (CoreException e) {
        String title = NewWizardMessages.AbstractOpenWizardAction_createerror_title;
        String message = NewWizardMessages.AbstractOpenWizardAction_createerror_message;
        ExceptionHandler.handle(e, shell, title, message);
    }
}

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

License:Open Source License

@Override
public void run() {
    Shell shell = getShell();//from w  w  w  .  j  a  va 2 s  .  c om

    try {
        EditFilterWizard wizard = createWizard();
        wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(getSelectedElements().get(0)));

        WizardDialog dialog = new WizardDialog(shell, wizard);
        PixelConverter converter = new PixelConverter(JFaceResources.getDialogFont());
        dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70),
                converter.convertHeightInCharsToPixels(20));
        dialog.create();
        int res = dialog.open();
        if (res == Window.OK) {
            BuildpathDelta delta = new BuildpathDelta(getToolTipText());

            ArrayList<CPListElement> newEntries = wizard.getExistingEntries();
            delta.setNewEntries(newEntries.toArray(new CPListElement[newEntries.size()]));

            IResource resource = wizard.getCreatedElement().getCorrespondingResource();
            delta.addCreatedResource(resource);

            delta.setDefaultOutputLocation(wizard.getOutputLocation());

            informListeners(delta);

            selectAndReveal(new StructuredSelection(wizard.getCreatedElement()));
        }

        notifyResult(res == Window.OK);
    } catch (CoreException e) {
        String title = NewWizardMessages.AbstractOpenWizardAction_createerror_title;
        String message = NewWizardMessages.AbstractOpenWizardAction_createerror_message;
        ExceptionHandler.handle(e, shell, title, message);
    }
}

From source file:gov.redhawk.ui.util.SWTUtil.java

License:Open Source License

/**
 * Returns a width hint for a button control.
 * /*from   w ww. java2s  .  c o  m*/
 * @param button the button
 * @return the button width hint
 */
public static int getButtonWidthHint(final Button button) {
    if (button.getFont().equals(JFaceResources.getDefaultFont())) {
        button.setFont(JFaceResources.getDialogFont());
    }
    final PixelConverter converter = new PixelConverter(button);
    final int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}

From source file:jasima_gui.editors.ReferenceEditor.java

License:Open Source License

public void createNewClass() {
    StructuredSelection projectSel = new StructuredSelection(topLevelEditor.getJavaProject());

    NewClassWizardPage page = new NewClassWizardPage();
    page.init(projectSel);//from   w  w w. ja va  2 s  .  com

    Class<?> type = TypeUtil.toClass(property.getType());
    if (type.isInterface()) {
        page.addSuperInterface(type.getName());
    } else {
        page.setSuperClass(type.getName(), true);
    }

    NewClassCreationWizard wizard = new NewClassCreationWizard(page, true);
    wizard.init(PlatformUI.getWorkbench(), projectSel);

    WizardDialog dlg = new WizardDialog(getShell(), wizard);
    PixelConverter converter = new PixelConverter(JFaceResources.getDialogFont());
    dlg.setMinimumPageSize(converter.convertWidthInCharsToPixels(70),
            converter.convertHeightInCharsToPixels(20));
    dlg.create();
    dlg.open();
}

From source file:lumina.ui.dialogs.ControlPanelActionEditorDialog.java

/**
 * Creates buttons OK and Cancel. When OK is pressed the contents of the
 * temporary actions are saved in the original panel actions object. Cancel
 * discards any changes that might have occurred.
 * //from  ww  w.jav a  2 s  . c  om
 * @param parent
 *            the parent composite
 * @param id
 *            the id of the button (see IDialogConstants.*_ID constants for
 *            standard dialog button ids)
 * @param label
 *            the label of the button
 * @param defaultButton
 *            true if the button is to be the default button, and false
 *            otherwise
 * @return the button
 */
@Override
protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
    Button button = new Button(parent, SWT.PUSH);
    button.setText(label);
    button.setFont(JFaceResources.getDialogFont());
    button.setData(Integer.valueOf(id));
    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            int buttonID = ((Integer) event.widget.getData()).intValue();
            switch (buttonID) {
            case IDialogConstants.OK_ID:
                setPanelActions(actionsCurrentlyBeeingEdited);
                buttonPressed(buttonID);
                break;
            case IDialogConstants.CANCEL_ID:
                actionsCurrentlyBeeingEdited.clear();
                buttonPressed(buttonID);
                break;
            default:
                break;
            }
        }
    });
    if (defaultButton) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(button);
        }
    }
    // buttons.put(new Integer(id), button);
    setButtonLayoutData(button);
    return button;
}

From source file:mbtarranger.editors.GenericInformationControl.java

License:Open Source License

@Override
protected void createContent(Composite parent) {
    //      fText= new StyledText(parent, SWT.MULTI | SWT.READ_ONLY | fAdditionalTextStyles);
    //      fText.setForeground(parent.getForeground());
    //      fText.setBackground(parent.getBackground());
    //      fText.setFont(JFaceResources.getDialogFont());
    fBrowser = new Browser(parent, SWT.NONE);
    fBrowser.setSize(parent.getSize());/* w w w  .  j  ava 2s  . c  o  m*/
    fBrowser.setForeground(parent.getForeground());
    fBrowser.setBackground(parent.getBackground());
    fBrowser.setFont(JFaceResources.getDialogFont());
    //      FillLayout layout= (FillLayout)parent.getLayout();
    //      if (fText.getWordWrap()) {
    //         // indent does not work for wrapping StyledText, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=56342 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=115432
    //         layout.marginHeight= INNER_BORDER;
    //         layout.marginWidth= INNER_BORDER;
    //      } else {
    //         fText.setIndent(INNER_BORDER);
    //      }

}