List of usage examples for org.eclipse.jface.resource JFaceResources getDialogFont
public static Font getDialogFont()
From source file:au.gov.ga.earthsci.jface.extras.information.html.BrowserInformationControl.java
License:Open Source License
public Point computeSizeConstraints(int widthInChars, int heightInChars) { if (fSymbolicFontName == null) return null; GC gc = new GC(fBrowser); Font font = fSymbolicFontName == null ? JFaceResources.getDialogFont() : JFaceResources.getFont(fSymbolicFontName); gc.setFont(font);//w ww. j a va 2s . com int width = gc.getFontMetrics().getAverageCharWidth(); int height = gc.getFontMetrics().getHeight(); gc.dispose(); return new Point(widthInChars * width, heightInChars * height); }
From source file:ca.usask.cs.srlab.simclipse.ui.SWTUtil.java
License:Open Source License
/** * Returns a width hint for a button control. * @param button The button to calculate the width for * @return The width of the button//w w w .j a v a2 s . c o m */ public static int getButtonWidthHint(Button button) { button.setFont(JFaceResources.getDialogFont()); PixelConverter converter = new PixelConverter(button); int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); }
From source file:ca.usask.cs.srlab.simclipse.ui.SWTUtil.java
License:Open Source License
public static int getTableHeightHint(Table table, int rows) { if (table.getFont().equals(JFaceResources.getDefaultFont())) table.setFont(JFaceResources.getDialogFont()); int result = table.getItemHeight() * rows + table.getHeaderHeight(); if (table.getLinesVisible()) result += table.getGridLineWidth() * (rows - 1); return result; }
From source file:cc.warlock.scribe.ui.views.ScriptControlView.java
License:Open Source License
private void updateScriptComposite(boolean create) { if (create) { scriptComposite = new Composite(main, SWT.NONE); GridLayout scriptLayout = new GridLayout(3, false); scriptLayout.marginHeight = scriptLayout.marginWidth = 0; scriptComposite.setLayout(scriptLayout); scriptComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); scriptNameLabel = new Label(scriptComposite, SWT.NONE); scriptNameLabel.setFont(JFaceResources.getDialogFont()); buttonsToolbar = new ToolBar(scriptComposite, SWT.RIGHT | SWT.FLAT); pause = new ToolItem(buttonsToolbar, SWT.PUSH); stop = new ToolItem(buttonsToolbar, SWT.PUSH); durationLabel = new Label(scriptComposite, SWT.NONE); pause.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (pause.getImage().equals(ScribeSharedImages.getImage(ScribeSharedImages.IMG_RESUME))) { resumePressed();//from w w w. ja v a2 s . co m currentScript.resume(); } else { pausePressed(); currentScript.suspend(); } } }); stop.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { currentScript.stop(); stopPressed(); } }); } resetControls(); if (create) main.layout(); }
From source file:ccw.preferences.SyntaxColoringPreferencePage.java
License:Open Source License
/** * Initializes the computation of horizontal and vertical dialog units based * on the size of current font./*from ww w .j a v a2s.c o m*/ * <p> * This method must be called before any of the dialog unit based conversion * methods are called. * </p> * * @param testControl * a control from which to obtain the current font */ protected void initializeDialogUnits(Control testControl) { // Compute and store a font metric GC gc = new GC(testControl); gc.setFont(JFaceResources.getDialogFont()); fFontMetrics = gc.getFontMetrics(); gc.dispose(); }
From source file:com.amazonaws.eclipse.core.ui.overview.OverviewResources.java
License:Apache License
/** Initializes font resources */ private void initializeFonts() { managedFonts.put("big-header", newFont(new FontData[] { new FontData("Verdana", 16, SWT.BOLD), new FontData("Arial", 16, SWT.BOLD), new FontData("Helvetica", 16, SWT.BOLD), })); managedFonts.put("resources-header", newFont(new FontData[] { new FontData("Verdana", 18, SWT.NORMAL), new FontData("Arial", 18, SWT.NORMAL), new FontData("Helvetica", 18, SWT.NORMAL), })); managedFonts.put("module-header", newFont(new FontData[] { new FontData("Verdana", 12, SWT.BOLD), new FontData("Arial", 12, SWT.BOLD), new FontData("Helvetica", 12, SWT.BOLD), })); managedFonts.put("module-subheader", newFont(new FontData[] { new FontData("Verdana", 11, SWT.BOLD), new FontData("Arial", 11, SWT.BOLD), new FontData("Helvetica", 11, SWT.BOLD), })); sharedFonts.put("text", JFaceResources.getDialogFont()); }
From source file:com.aptana.deploy.engineyard.ui.wizard.EngineYardDeployWizardPage.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 a v a2s. c o m*/ initializeDialogUnits(parent); // Actual contents Composite appSettings = new Composite(composite, SWT.NULL); appSettings.setLayout(new GridLayout(2, false)); Label label = new Label(appSettings, SWT.NONE); label.setText(Messages.EngineYardDeployWizardPage_ApplicationNameLabel); Label note = new Label(composite, SWT.WRAP); 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(); } } }); note.setLayoutData(new GridData(400, SWT.DEFAULT)); note.setText(Messages.EngineYardDeployWizardPage_ApplicationNoteLabel); // Link to Engine Yard dashbaord Link link = new Link(composite, SWT.NONE); link.setText(Messages.EngineYardDeployWizardPage_ApplicationLinkLabel); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { try { final String BROWSER_ID = "EngineYard-login"; //$NON-NLS-1$ final URL url = new URL("https://cloud.engineyard.com/dashboard"); //$NON-NLS-1$ final int style = IWorkbenchBrowserSupport.NAVIGATION_BAR | IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.STATUS; IWorkbenchBrowserSupport workbenchBrowserSupport = PlatformUI.getWorkbench() .getBrowserSupport(); if (workbenchBrowserSupport.isInternalWebBrowserAvailable()) { IWebBrowser webBrowser = workbenchBrowserSupport.createBrowser(style, BROWSER_ID, null, null); if (webBrowser != null) webBrowser.openURL(url); } } catch (Exception e) { IdeLog.logError(EngineYardPlugin.getDefault(), e); } } }); // close the wizard when the user clicks on the dashboard link ((WizardDialog) getContainer()).close(); } }); Dialog.applyDialogFont(composite); }
From source file:com.aptana.deploy.engineyard.ui.wizard.EngineYardSignupPage.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 . java 2s. c o m initializeDialogUnits(parent); // Actual contents Label label = new Label(composite, SWT.NONE); label.setText(Messages.EngineYardSignupPage_EnterCredentialsLabel); Composite credentials = new Composite(composite, SWT.NONE); credentials.setLayout(new GridLayout(2, false)); Label userIdLabel = new Label(credentials, SWT.NONE); userIdLabel.setText(Messages.EngineYardSignupPage_EmailAddressLabel); userId = new Text(credentials, SWT.SINGLE | SWT.BORDER); userId.setMessage(Messages.EngineYardSignupPage_EmailAddressExample); 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); 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.EngineYardSignupPage_SignupNote); // Add signup button Button signup = new Button(composite, SWT.PUSH); signup.setText(Messages.EngineYardSignupPage_SignupButtonLabel); signup.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { //check if email address is valid if (!isEmailValid(userId.getText())) { MessageDialog.openError(getShell(), "Error", //$NON-NLS-1$ Messages.EngineYardSignupPage_InvalidEmail_Message); return; } // basically just perform finish! if (getWizard().performFinish()) { ((WizardDialog) getContainer()).close(); } } }); Dialog.applyDialogFont(composite); }
From source file:com.aptana.deploy.heroku.ui.wizard.HerokuDeployWizardPage.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 www. ja va 2s . c o m*/ initializeDialogUnits(parent); // Actual contents Composite appSettings = new Composite(composite, SWT.NULL); appSettings.setLayout(new GridLayout(2, false)); Label label = new Label(appSettings, SWT.NONE); label.setText(Messages.HerokuDeployWizardPage_ApplicationNameLabel); appName = new Text(appSettings, SWT.SINGLE | SWT.BORDER); appName.setLayoutData(new GridData(250, SWT.DEFAULT)); // Set default name to project name appName.setText(getProjectName()); appName.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { getContainer().updateButtons(); } }); publishButton = new Button(composite, SWT.CHECK); publishButton.setText(Messages.HerokuDeployWizardPage_PublishApplicationLabel); publishButton.setSelection(Platform.getPreferencesService().getBoolean(HerokuPlugin.getPluginIdentifier(), IPreferenceConstants.HEROKU_AUTO_PUBLISH, true, null)); if (doesntHaveGitRepo()) { 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(); } } }); note.setLayoutData(new GridData(400, SWT.DEFAULT)); note.setText(Messages.HerokuDeployWizardPage_NoGitRepoNote); } Dialog.applyDialogFont(composite); }
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 va2 s . c o m 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); }