List of usage examples for org.eclipse.jface.resource JFaceResources getDialogFont
public static Font getDialogFont()
From source file:org.reuseware.sokan.ui.internal.dialogs.NewStoreDialog.java
License:Open Source License
protected Button createOkButton(Composite parent, int id, String label, boolean defaultButton) { // increment the number of columns in the button bar ((GridLayout) parent.getLayout()).numColumns++; Button button = new Button(parent, SWT.PUSH); button.setText(label);/*from www . jav a 2 s . c o m*/ button.setFont(JFaceResources.getDialogFont()); button.setData(new Integer(id)); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { if (btnEnding.getSelection()) { if (endBtns.length < 1) { setMessage("There are no files in the store yet.", IMessageProvider.ERROR); return; } boolean nothingSelected = true; for (Button btn : endBtns) { if (btn.getSelection()) { nothingSelected = false; break; } } if (nothingSelected) { setMessage("Please select at least one file extension.", IMessageProvider.ERROR); return; } } if (btnCustom.getSelection() && txtCustom.getText().length() == 0) { setMessage("Please specify a filter pattern", IMessageProvider.ERROR); return; } createStore(); buttonPressed(((Integer) event.widget.getData()).intValue()); } }); if (defaultButton) { Shell shell = parent.getShell(); if (shell != null) { shell.setDefaultButton(button); } } setButtonLayoutData(button); return button; }
From source file:org.robovm.eclipse.internal.TemplateChooser.java
License:Open Source License
public TemplateChooser(Composite parent, TargetType targetType) { templates = new ArrayList<>(); for (int i = 0; i < TEMPLATES.length; i++) { if (targetType == TEMPLATES[i].targetType) { templates.add(TEMPLATES[i]); }/*w w w.jav a 2s.com*/ } GC gc = new GC(parent); gc.setFont(JFaceResources.getDialogFont()); fontMetrics = gc.getFontMetrics(); gc.dispose(); Group group = new Group(parent, SWT.NONE); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); group.setFont(parent.getFont()); group.setLayout(initGridLayout(new GridLayout(2, false))); group.setText("Template Selection"); createControls(group); }
From source file:org.rssowl.ui.internal.dialogs.bookmark.FeedDefinitionPage.java
License:Open Source License
public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NONE); container.setLayout(new GridLayout(1, false)); /* 1) Feed by Link */ if (!StringUtils.isSet(fInitialLink)) fInitialLink = loadInitialLinkFromClipboard(); boolean loadTitleFromFeed = fGlobalScope.getBoolean(DefaultPreferences.BM_LOAD_TITLE_FROM_FEED); fFeedByLinkButton = new Button(container, SWT.RADIO); fFeedByLinkButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); fFeedByLinkButton.setText(loadTitleFromFeed ? Messages.FeedDefinitionPage_CREATE_FEED : Messages.FeedDefinitionPage_CREATE_FEED_DIRECT); fFeedByLinkButton.setSelection(true); fFeedByLinkButton.addSelectionListener(new SelectionAdapter() { @Override//from w w w. j a v a 2 s .c o m public void widgetSelected(SelectionEvent e) { fFeedLinkInput.setEnabled(fFeedByLinkButton.getSelection()); fLoadTitleFromFeedButton.setEnabled(fFeedByLinkButton.getSelection()); fFeedLinkInput.setFocus(); getContainer().updateButtons(); } }); Composite textIndent = new Composite(container, SWT.NONE); textIndent.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); textIndent.setLayout(new GridLayout(1, false)); ((GridLayout) textIndent.getLayout()).marginLeft = 10; ((GridLayout) textIndent.getLayout()).marginBottom = 10; fFeedLinkInput = new Text(textIndent, SWT.BORDER); fFeedLinkInput.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); OwlUI.makeAccessible(fFeedLinkInput, fFeedByLinkButton); GC gc = new GC(fFeedLinkInput); gc.setFont(JFaceResources.getDialogFont()); FontMetrics fontMetrics = gc.getFontMetrics(); int entryFieldWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.ENTRY_FIELD_WIDTH); gc.dispose(); ((GridData) fFeedLinkInput.getLayoutData()).widthHint = entryFieldWidth; //Required to avoid large spanning dialog for long Links fFeedLinkInput.setFocus(); if (StringUtils.isSet(fInitialLink) && !fInitialLink.equals(URIUtils.HTTP)) { fFeedLinkInput.setText(fInitialLink); fFeedLinkInput.selectAll(); onLinkChange(); } else { fFeedLinkInput.setText(URIUtils.HTTP); fFeedLinkInput.setSelection(URIUtils.HTTP.length()); } fFeedLinkInput.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { getContainer().updateButtons(); onLinkChange(); } }); fLoadTitleFromFeedButton = new Button(textIndent, SWT.CHECK); fLoadTitleFromFeedButton.setText(Messages.FeedDefinitionPage_USE_TITLE_OF_FEED); fLoadTitleFromFeedButton.setSelection(loadTitleFromFeed); fLoadTitleFromFeedButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { getContainer().updateButtons(); } }); /* 2) Feed by Keyword */ fFeedByKeywordButton = new Button(container, SWT.RADIO); fFeedByKeywordButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); fFeedByKeywordButton.setText(Messages.FeedDefinitionPage_CREATE_KEYWORD_FEED); fFeedByKeywordButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { fKeywordInput.setEnabled(fFeedByKeywordButton.getSelection()); if (fKeywordInput.isEnabled()) hookKeywordAutocomplete(); fKeywordInput.setFocus(); getContainer().updateButtons(); } }); textIndent = new Composite(container, SWT.NONE); textIndent.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); textIndent.setLayout(new GridLayout(1, false)); ((GridLayout) textIndent.getLayout()).marginLeft = 10; fKeywordInput = new Text(textIndent, SWT.BORDER); OwlUI.makeAccessible(fKeywordInput, fFeedByKeywordButton); fKeywordInput.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); fKeywordInput.setEnabled(false); fKeywordInput.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { getContainer().updateButtons(); } }); /* Info Container */ Composite infoContainer = new Composite(container, SWT.None); infoContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); infoContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 5)); Label infoImg = new Label(infoContainer, SWT.NONE); infoImg.setImage(OwlUI.getImage(infoImg, "icons/obj16/info.gif")); //$NON-NLS-1$ infoImg.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); Link infoLink = new Link(infoContainer, SWT.NONE); infoLink.setText(Messages.FeedDefinitionPage_IMPORT_WIZARD_TIP); infoLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); infoLink.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { new ImportAction().openWizardForKeywordSearch(getShell()); } }); Dialog.applyDialogFont(container); setControl(container); }
From source file:org.rssowl.ui.internal.dialogs.NewsFilterDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { /* Separator */ new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL) .setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); /* Title *///from w w w .j a va2 s . co m setTitle(Messages.NewsFilterDialog_NEWS_FILTER); /* Title Image */ setTitleImage(OwlUI.getImage(fResources, "icons/wizban/filter_wiz.png")); //$NON-NLS-1$ /* Title Message */ setMessage(Messages.NewsFilterDialog_DEFINE_SEARCH); /* Name Input Filed */ Composite container = new Composite(parent, SWT.None); container.setLayout(LayoutUtils.createGridLayout(2, 10, 5, 0, 5, false)); container.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); Label nameLabel = new Label(container, SWT.NONE); nameLabel.setText(Messages.NewsFilterDialog_NAME); Composite nameContainer = new Composite(container, SWT.BORDER); nameContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); nameContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0)); nameContainer.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); fNameInput = new Text(nameContainer, SWT.SINGLE); OwlUI.makeAccessible(fNameInput, nameLabel); fNameInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true)); if (fEditedFilter != null) { fNameInput.setText(fEditedFilter.getName()); fNameInput.selectAll(); } fNameInput.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { setErrorMessage(null); } }); GC gc = new GC(fNameInput); gc.setFont(JFaceResources.getDialogFont()); FontMetrics fontMetrics = gc.getFontMetrics(); int entryFieldWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.ENTRY_FIELD_WIDTH); gc.dispose(); ((GridData) fNameInput.getLayoutData()).widthHint = entryFieldWidth; //Required to avoid large spanning dialog for long Links ToolBar generateTitleBar = new ToolBar(nameContainer, SWT.FLAT); OwlUI.makeAccessible(generateTitleBar, Messages.NewsFilterDialog_CREATE_NAME_FROM_CONDITIONS); generateTitleBar.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); ToolItem generateTitleItem = new ToolItem(generateTitleBar, SWT.PUSH); generateTitleItem.setImage(OwlUI.getImage(fResources, "icons/etool16/info.gif")); //$NON-NLS-1$ generateTitleItem.setToolTipText(Messages.NewsFilterDialog_CREATE_NAME_FROM_CONDITIONS); generateTitleItem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onGenerateName(); } }); /* Sashform dividing search definition from actions */ SashForm sashForm = new SashForm(parent, SWT.VERTICAL | SWT.SMOOTH); sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); /* Top Sash */ Composite topSash = new Composite(sashForm, SWT.NONE); topSash.setLayout(LayoutUtils.createGridLayout(2, 0, 0, 0, 0, false)); createConditionControls(topSash); /* Bottom Sash */ Composite bottomSash = new Composite(sashForm, SWT.NONE); bottomSash.setLayout(LayoutUtils.createGridLayout(1, 0, 0, 0, 0, false)); /* Label in between */ Composite labelContainer = new Composite(bottomSash, SWT.NONE); labelContainer.setLayout(LayoutUtils.createGridLayout(1, 10, 3, 0, 0, false)); ((GridLayout) labelContainer.getLayout()).marginBottom = 2; labelContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); Label explanationLabel = new Label(labelContainer, SWT.NONE); explanationLabel.setText(Messages.NewsFilterDialog_PERFORM_ACTIONS); /* Action Controls */ createActionControls(bottomSash); /* Separator */ new Label(bottomSash, SWT.SEPARATOR | SWT.HORIZONTAL) .setLayoutData(new GridData(SWT.FILL, SWT.END, true, false)); /* Set weights to even */ sashForm.setWeights(new int[] { 50, 50 }); applyDialogFont(parent); return parent; }
From source file:org.rssowl.ui.internal.dialogs.StartupProgressDialog.java
License:Open Source License
private void createTitleArea(Composite parent) { Composite messageContainer = new Composite(parent, SWT.NONE); messageContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); messageContainer.setLayout(LayoutUtils.createGridLayout(1)); messageContainer.setBackground(parent.getBackground()); /* Title Message */ Label titleMessage = new Label(messageContainer, SWT.NONE); titleMessage.setFont(JFaceResources.getBannerFont()); titleMessage.setText(Messages.StartupProgressDialog_PROGRESS_INFO); titleMessage.setBackground(parent.getBackground()); /* Title Footer */ Label titleFooter = new Label(messageContainer, SWT.NONE); titleFooter.setText(Messages.StartupProgressDialog_PROGRESS_MESSAGE); titleFooter.setFont(JFaceResources.getDialogFont()); titleFooter.setBackground(parent.getBackground()); GridData data = new GridData(SWT.FILL, SWT.BEGINNING, true, false); data.horizontalIndent = 10;/*from www . j a v a2s .co m*/ data.verticalIndent = 5; titleFooter.setLayoutData(data); /* RSSOwl Logo */ Label imageLabel = new Label(parent, SWT.None); imageLabel.setImage(OwlUI.getImage(fResources, "icons/wizban/welcome_wiz.gif")); //$NON-NLS-1$ imageLabel.setBackground(parent.getBackground()); /* Separator */ Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); separator.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1)); separator.setBackground(parent.getBackground()); }
From source file:org.rssowl.ui.internal.util.NewsColumnSelectionControl.java
License:Open Source License
private void initMetrics() { GC gc = new GC(this); gc.setFont(JFaceResources.getDialogFont()); fFontMetrics = gc.getFontMetrics(); gc.dispose(); }
From source file:org.rubypeople.rdt.internal.ui.preferences.AppearancePreferencePage.java
License:Open Source License
protected Control createContents(Composite parent) { initializeDialogUnits(parent);// w w w . j av a2 s .c o m int nColumns = 1; Composite result = new Composite(parent, SWT.NONE); result.setFont(parent.getFont()); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = 0; layout.numColumns = nColumns; result.setLayout(layout); fShowMethodParameterNames.doFillIntoGrid(result, nColumns); new Separator().doFillIntoGrid(result, nColumns); fStackBrowsingViewsVertically.doFillIntoGrid(result, nColumns); String noteTitle = PreferencesMessages.AppearancePreferencePage_note; String noteMessage = PreferencesMessages.AppearancePreferencePage_preferenceOnlyEffectiveForNewPerspectives; Composite noteControl = createNoteComposite(JFaceResources.getDialogFont(), result, noteTitle, noteMessage); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 2; noteControl.setLayoutData(gd); initFields(); Dialog.applyDialogFont(result); return result; }
From source file:org.sf.feeling.sanguo.patch.widget.TabbedPropertyTitle.java
License:Open Source License
/** * Constructor for TabbedPropertyTitle./*from ww w . j a v a 2s. c o m*/ * * @param parent * the parent composite. * @param factory * the widget factory for the tabbed property sheet */ public TabbedPropertyTitle(Composite parent, FormWidgetFactory factory) { super(parent, SWT.NO_FOCUS); this.factory = factory; this.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { if (image == null && (text == null || text.equals(BLANK))) { label.setVisible(false); } else { label.setVisible(true); drawTitleBackground(e); } } }); factory.getColors().initializeSectionToolBarColors(); setBackground(factory.getColors().getBackground()); setForeground(factory.getColors().getForeground()); FormLayout layout = new FormLayout(); layout.marginWidth = ITabbedPropertyConstants.HSPACE + 6; layout.marginHeight = 5; setLayout(layout); label = factory.createCLabel(this, BLANK); label.setBackground(new Color[] { factory.getColors().getColor(FormColors.TB_BG), factory.getColors().getColor(FormColors.TB_GBG) }, new int[] { 100 }, true); if (!JFaceResources.getFontRegistry().hasValueFor("Custom Bold")) { Font dialogFont = JFaceResources.getDialogFont(); FontData[] fonts = dialogFont.getFontData(); fonts[0].setStyle(SWT.BOLD); JFaceResources.getFontRegistry().put("Custom Bold", new FontData[] { fonts[0] }); } Font font = JFaceResources.getFontRegistry().get("Custom Bold"); ; label.setFont(font); FormData data = new FormData(); data.left = new FormAttachment(0, 0); data.top = new FormAttachment(0, 0); data.right = new FormAttachment(100, 0); data.bottom = new FormAttachment(100, 0); label.setLayoutData(data); /* * setImage(PlatformUI.getWorkbench().getSharedImages().getImage( * ISharedImages.IMG_OBJ_ELEMENT)); */ }
From source file:org.sonar.ide.eclipse.ui.internal.properties.SonarExtraArgumentsPreferenceAndPropertyPage.java
License:Open Source License
protected Control createContents(final Composite ancestor) { loadProperties();/*from w w w . j a va2 s .c o m*/ Composite parent = new Composite(ancestor, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = 0; layout.marginWidth = 0; parent.setLayout(layout); if (!isGlobal()) { createLinkToGlobal(ancestor, parent); } Composite innerParent = new Composite(parent, SWT.NONE); GridLayout innerLayout = new GridLayout(); innerLayout.numColumns = 2; innerLayout.marginHeight = 0; innerLayout.marginWidth = 0; innerParent.setLayout(innerLayout); GridData gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 2; innerParent.setLayoutData(gd); Composite tableComposite = new Composite(innerParent, SWT.NONE); GridData data = new GridData(GridData.FILL_BOTH); data.widthHint = 360; data.heightHint = convertHeightInCharsToPixels(10); tableComposite.setLayoutData(data); TableColumnLayout columnLayout = new TableColumnLayout(); tableComposite.setLayout(columnLayout); Table table = new Table(tableComposite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); table.setHeaderVisible(true); table.setLinesVisible(true); GC gc = new GC(getShell()); gc.setFont(JFaceResources.getDialogFont()); TableColumn propertyNameColumn = new TableColumn(table, SWT.NONE); propertyNameColumn.setText("Name"); int minWidth = computeMinimumColumnWidth(gc, "Name"); columnLayout.setColumnData(propertyNameColumn, new ColumnWeightData(1, minWidth, true)); TableColumn propertyValueColumn = new TableColumn(table, SWT.NONE); propertyValueColumn.setText(VALUE); minWidth = computeMinimumColumnWidth(gc, VALUE); columnLayout.setColumnData(propertyValueColumn, new ColumnWeightData(1, minWidth, true)); gc.dispose(); fTableViewer = new TableViewer(table); fTableViewer.setLabelProvider(new SonarPropertiesLabelProvider()); fTableViewer.setContentProvider(new SonarPropertiesContentProvider()); fTableViewer.setComparator(null); fTableViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent e) { edit(); } }); fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent e) { updateButtons(); } }); createButtons(innerParent); fTableViewer.setInput(sonarProperties); updateButtons(); Dialog.applyDialogFont(parent); innerParent.layout(); return parent; }
From source file:org.sonar.ide.eclipse.ui.internal.views.issues.AssigneeConfigurationArea.java
License:Open Source License
/** * Create the group for the description filter. * * @param parent//from ww w.j a v a 2s . c o m */ private void createDescriptionGroup(Composite parent) { Composite descriptionComposite = new Composite(parent, SWT.NONE); descriptionComposite.setLayout(new GridLayout(3, false)); descriptionComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label descriptionLabel = new Label(descriptionComposite, SWT.NONE); descriptionLabel.setText("Login:"); descriptionCombo = new Combo(descriptionComposite, SWT.READ_ONLY); descriptionCombo.add("contains"); descriptionCombo.add("doesn't contains"); // Prevent Esc and Return from closing the dialog when the combo is // active. descriptionCombo.addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN) { e.doit = false; } } }); GC gc = new GC(descriptionComposite); gc.setFont(JFaceResources.getDialogFont()); FontMetrics fontMetrics = gc.getFontMetrics(); gc.dispose(); descriptionText = new Text(descriptionComposite, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); data.widthHint = Dialog.convertWidthInCharsToPixels(fontMetrics, 25); descriptionText.setLayoutData(data); }