List of usage examples for org.eclipse.jface.resource JFaceResources getDialogFont
public static Font getDialogFont()
From source file:org.modelio.app.preferences.ModelioPreferenceDialog.java
License:Open Source License
@objid("30b98bd5-cab0-4393-b635-b2702b1f80ed") private void createTitle(Composite parent) { // image from plugin ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin("org.modelio.app.preferences", "icons/headerleft.png"); Image image = imageDescriptor.createImage(); setTitleLeftImage(image);/*from w w w . j a va2s.c o m*/ // _titleArea = new Composite(parent, SWT.NONE); this._titleArea = new Composite(parent, SWT.NONE); initializeDialogUnits(this._titleArea); GridData titleAreaData = new GridData(SWT.FILL, SWT.TOP, true, false); /* * titleAreaData.top = new FormAttachment(0, 0); titleAreaData.left = new FormAttachment(0, 0); titleAreaData.right = new * FormAttachment(100, 0); */ this._titleArea.setLayoutData(titleAreaData); FormLayout layout = new FormLayout(); this._titleArea.setLayout(layout); this._titleArea.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { if (ModelioPreferenceDialog.this._titleAreaColor != null) ModelioPreferenceDialog.this._titleAreaColor.dispose(); } }); org.eclipse.swt.widgets.Display display = this._titleArea.getDisplay(); Color background; Color foreground; if (this._titleAreaRGB != null) { this._titleAreaColor = new Color(display, this._titleAreaRGB); background = this._titleAreaColor; foreground = null; } else { background = JFaceColors.getBannerBackground(display); foreground = JFaceColors.getBannerForeground(display); } int verticalSpacing = convertVerticalDLUsToPixels(1); int horizontalSpacing = convertHorizontalDLUsToPixels(4); this._titleArea.setBackground(background); this._titleRightImageLabel = new Label(this._titleArea, SWT.NONE); this._titleRightImageLabel.setBackground(background); if (this._titleRightImage != null && !this._titleRightImage.isDisposed()) this._titleRightImageLabel.setImage(this._titleRightImage); this._titleLeftImageLabel = new Label(this._titleArea, SWT.NONE); this._titleLeftImageLabel.setBackground(background); if (this._titleLeftImage == null || this._titleLeftImage.isDisposed()) this._titleLeftImageLabel.setImage(JFaceResources.getImage(DLG_IMG_TITLE_BANNER)); else this._titleLeftImageLabel.setImage(this._titleLeftImage); FormData rightImageData = new FormData(); rightImageData.top = new FormAttachment(0, 0); rightImageData.right = new FormAttachment(100, 0); this._titleRightImageLabel.setLayoutData(rightImageData); FormData leftImageData = new FormData(); leftImageData.top = new FormAttachment(0, 0); leftImageData.left = new FormAttachment(0, 0); this._titleLeftImageLabel.setLayoutData(leftImageData); this._titleLabel = new Label(this._titleArea, SWT.NONE); JFaceColors.setColors(this._titleLabel, foreground, background); this._titleLabel.setFont(JFaceResources.getBannerFont()); this._titleLabel.setText(" "); FormData titleData = new FormData(); titleData.left = new FormAttachment(this._titleLeftImageLabel, 5); titleData.top = new FormAttachment(0, verticalSpacing); titleData.right = new FormAttachment(this._titleRightImageLabel, -5); this._titleLabel.setLayoutData(titleData); this._messageImageLabel = new Label(this._titleArea, SWT.NONE); this._messageImageLabel.setBackground(background); this._messageLabel = new Text(this._titleArea, SWT.READ_ONLY | SWT.MULTI); this._messageLabel.setEnabled(false); this._messageLabel.setEditable(false); JFaceColors.setColors(this._messageLabel, foreground, background); this._messageLabel.setFont(JFaceResources.getDialogFont()); this._messageLabelHeight = this._messageLabel.computeSize(-1, -1).y; this._leftFillerLabel = new Label(this._titleArea, SWT.NONE); this._leftFillerLabel.setBackground(background); setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing); determineTitleImageLargest(); Label titleBarSeparator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); GridData barData = new GridData(768); titleBarSeparator.setLayoutData(barData); }
From source file:org.modelio.core.ui.dialog.ModelioDialog.java
License:Open Source License
@objid("00488a28-4a05-1fe0-bf4c-001ec947cd2a") @Override//from w w w . j a v a 2 s .co m protected Control createContents(Composite parent) { Composite contents = new Composite(parent, 0); contents.setLayoutData(new GridData(1808)); initializeDialogUnits(contents); FormLayout layout = new FormLayout(); contents.setLayout(layout); this.workArea = new Composite(contents, SWT.NONE); GridLayout childLayout = new GridLayout(); childLayout.marginHeight = 0; childLayout.marginWidth = 0; childLayout.verticalSpacing = 0; this.workArea.setLayout(childLayout); Control top = createTitleArea(contents); resetWorkAreaAttachments(top); this.workArea.setFont(JFaceResources.getDialogFont()); initializeDialogUnits(this.workArea); this.dialogArea = createDialogArea(this.workArea); this.buttonBar = createButtonBar(this.workArea); ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin("org.modelio.core.ui", "icons/headerleft.png"); if (imageDescriptor != null) { Image image = imageDescriptor.createImage(); setTitleLeftImage(image); } init(); return contents; }
From source file:org.modelio.core.ui.dialog.ModelioDialog.java
License:Open Source License
@objid("004a0aba-4a05-1fe0-bf4c-001ec947cd2a") private Control createTitleArea(Composite parent) { this.titleArea = new Composite(parent, SWT.NONE); initializeDialogUnits(this.titleArea); FormData titleAreaData = new FormData(); titleAreaData.top = new FormAttachment(0, 0); titleAreaData.left = new FormAttachment(0, 0); titleAreaData.right = new FormAttachment(100, 0); this.titleArea.setLayoutData(titleAreaData); FormLayout layout = new FormLayout(); this.titleArea.setLayout(layout); this.titleArea.addDisposeListener(new DisposeListener() { @Override/* w w w . j ava 2s . co m*/ public void widgetDisposed(DisposeEvent e) { if (ModelioDialog.this.titleAreaColor != null) ModelioDialog.this.titleAreaColor.dispose(); } }); org.eclipse.swt.widgets.Display display = this.titleArea.getDisplay(); Color background; Color foreground; if (this.titleAreaRGB != null) { this.titleAreaColor = new Color(display, this.titleAreaRGB); background = this.titleAreaColor; foreground = null; } else { background = JFaceColors.getBannerBackground(display); foreground = JFaceColors.getBannerForeground(display); } int verticalSpacing = convertVerticalDLUsToPixels(1); int horizontalSpacing = convertHorizontalDLUsToPixels(4); this.titleArea.setBackground(background); this.titleRightImageLabel = new Label(this.titleArea, SWT.NONE); this.titleRightImageLabel.setBackground(background); if (this.titleRightImage != null && !this.titleRightImage.isDisposed()) this.titleRightImageLabel.setImage(this.titleRightImage); this.titleLeftImageLabel = new Label(this.titleArea, SWT.NONE); this.titleLeftImageLabel.setBackground(background); if (this.titleLeftImage == null || this.titleLeftImage.isDisposed()) this.titleLeftImageLabel.setImage(JFaceResources.getImage(DLG_IMG_TITLE_BANNER)); else this.titleLeftImageLabel.setImage(this.titleLeftImage); FormData rightImageData = new FormData(); rightImageData.top = new FormAttachment(0, 0); rightImageData.right = new FormAttachment(100, 0); this.titleRightImageLabel.setLayoutData(rightImageData); FormData leftImageData = new FormData(); leftImageData.top = new FormAttachment(0, 0); leftImageData.left = new FormAttachment(0, 0); this.titleLeftImageLabel.setLayoutData(leftImageData); this.titleLabel = new Label(this.titleArea, SWT.NONE); JFaceColors.setColors(this.titleLabel, foreground, background); this.titleLabel.setFont(JFaceResources.getBannerFont()); this.titleLabel.setText(" "); FormData titleData = new FormData(); titleData.left = new FormAttachment(this.titleLeftImageLabel, 5); titleData.top = new FormAttachment(0, verticalSpacing); titleData.right = new FormAttachment(this.titleRightImageLabel, -5); this.titleLabel.setLayoutData(titleData); this.messageImageLabel = new Label(this.titleArea, SWT.NONE); this.messageImageLabel.setBackground(background); this.messageLabel = new Text(this.titleArea, SWT.READ_ONLY | SWT.MULTI | SWT.WRAP); //this.messageLabel.setEnabled(false); this.messageLabel.setEditable(false); JFaceColors.setColors(this.messageLabel, foreground, background); this.messageLabel.setFont(JFaceResources.getDialogFont()); this.messageLabelHeight = this.messageLabel.computeSize(-1, -1).y; this.leftFillerLabel = new Label(this.titleArea, SWT.NONE); this.leftFillerLabel.setBackground(background); setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing); determineTitleImageLargest(); return this.titleArea; }
From source file:org.nabucco.testautomation.script.ui.rcp.multipage.maintenance.masterdetails.widgetcreators.action.metadata.MetadataTreePickerDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { // increment the number of columns in the button bar ((GridLayout) parent.getLayout()).numColumns++; Button button = new Button(parent, SWT.PUSH); button.setText(I18N.i18n(ID + "." + EDIT)); button.setFont(JFaceResources.getDialogFont()); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { openMetadataForEdit();/* w w w. jav a 2 s . c om*/ } }); setButtonLayoutData(button); super.createButtonsForButtonBar(parent); }
From source file:org.nabucco.testautomation.script.ui.rcp.multipage.maintenance.masterdetails.widgetcreators.folder.FolderTreePickerDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { // increment the number of columns in the button bar ((GridLayout) parent.getLayout()).numColumns++; Button button = new Button(parent, SWT.PUSH); button.setText(I18N.i18n(ID + "." + NEW)); button.setFont(JFaceResources.getDialogFont()); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { addFolder();/*from w w w . j a v a 2 s. c om*/ } }); setButtonLayoutData(button); super.createButtonsForButtonBar(parent); }
From source file:org.netxms.ui.eclipse.console.ServerNameStatusLineItem.java
License:Open Source License
/** * Fill control//from w w w . j a v a 2 s.c o m */ public void fill(Composite parent) { statusLine = parent; FontData fd = JFaceResources.getDialogFont().getFontData()[0]; fd.setStyle(SWT.BOLD); font = new Font(Display.getCurrent(), fd); Label sep = new Label(parent, SWT.SEPARATOR); label = new CLabel(statusLine, SWT.BORDER | SWT.SHADOW_ETCHED_IN | SWT.CENTER); label.setFont(font); label.setText(serverName); setColors(); label.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { font.dispose(); if (bgColor != null) bgColor.dispose(); } }); if (charWidth == CALC_TRUE_WIDTH) { // compute the size of the label to get the width hint for the contribution Point preferredSize = label.computeSize(SWT.DEFAULT, SWT.DEFAULT); widthHint = preferredSize.x; heightHint = preferredSize.y; } else if (widthHint < 0) { // Compute the size base on 'charWidth' average char widths GC gc = new GC(statusLine); gc.setFont(statusLine.getFont()); FontMetrics fm = gc.getFontMetrics(); widthHint = fm.getAverageCharWidth() * charWidth; heightHint = fm.getHeight(); gc.dispose(); } StatusLineLayoutData data = new StatusLineLayoutData(); data.widthHint = widthHint; label.setLayoutData(data); data = new StatusLineLayoutData(); data.heightHint = heightHint; sep.setLayoutData(data); }
From source file:org.nightlabs.eclipse.preferences.ui.SimpleOptionsConfigurationBlock.java
License:Open Source License
protected Button addCheckBox(Composite parent, String label, Key key, String[] values, int indent) { ControlData data = new ControlData(key, values); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 3;//from www.j a va 2 s . c o m if (indent > 0) gd.horizontalIndent = indent; Button checkBox = new Button(parent, SWT.CHECK); checkBox.setFont(JFaceResources.getDialogFont()); checkBox.setText(label); checkBox.setData(data); checkBox.setLayoutData(gd); checkBox.addSelectionListener(getSelectionListener()); makeScrollableCompositeAware(checkBox); String currValue = getValue(key); checkBox.setSelection(data.getSelection(currValue) == 0); fCheckBoxes.add(checkBox); return checkBox; }
From source file:org.nightlabs.eclipse.preferences.ui.SimpleOptionsConfigurationBlock.java
License:Open Source License
protected Combo addComboBox(Composite parent, String label, Key key, String[] values, String[] valueLabels, int indent) { GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 1, 1);//from www. jav a2 s . com gd.horizontalIndent = indent; Label labelControl = new Label(parent, SWT.LEFT); labelControl.setFont(JFaceResources.getDialogFont()); labelControl.setText(label); labelControl.setLayoutData(gd); Combo comboBox = newComboControl(parent, key, values, valueLabels); gd = new GridData(); gd.horizontalSpan = 2; comboBox.setLayoutData(gd); //GridData.HORIZONTAL_ALIGN_FILL)); fLabels.put(comboBox, labelControl); return comboBox; }
From source file:org.nightlabs.eclipse.preferences.ui.SimpleOptionsConfigurationBlock.java
License:Open Source License
/** * Add a text field with a label that is connected to the given * preference key./*from w w w . j a v a 2 s . c o m*/ * @param parent The parent composite * @param label The label text * @param key The preference key * @param indent The horizontal indentation * @param widthHint The text field width hint. 0 not to use a width hint. * @return The text field */ protected Text addTextField(Composite parent, String label, Key key, int indent, int widthHint) { Label labelControl = new Label(parent, SWT.WRAP); labelControl.setText(label); labelControl.setFont(JFaceResources.getDialogFont()); GridData gd = new GridData(); gd.horizontalIndent = indent; labelControl.setLayoutData(gd); Text textBox = new Text(parent, SWT.BORDER | SWT.SINGLE); textBox.setData(key); textBox.setLayoutData(gd); makeScrollableCompositeAware(textBox); fLabels.put(textBox, labelControl); String currValue = getValue(key); if (currValue != null) { textBox.setText(currValue); } textBox.addModifyListener(getTextModifyListener()); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); if (widthHint > 0) { data.widthHint = widthHint; } data.horizontalIndent = 0; data.horizontalSpan = 2; textBox.setLayoutData(data); fTextBoxes.add(textBox); return textBox; }
From source file:org.obeonetwork.angularjs.eclipse.tools.ide.ui.internal.wizards.AngularJSSelectionButtonDialogField.java
License:Open Source License
@Override public Control[] doFillIntoGrid(Composite parent, int nColumns) { assertEnoughColumns(nColumns);/*w w w .j av a2 s . c o m*/ Button button = getSelectionButton(parent); GridData gd = new GridData(); gd.horizontalSpan = nColumns; gd.horizontalAlignment = GridData.FILL; if (this.buttonStyle == SWT.PUSH) { this.button.setFont(JFaceResources.getDialogFont()); PixelConverter converter = new PixelConverter(button); int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); gd.widthHint = widthHint; } button.setLayoutData(gd); return new Control[] { button }; }