List of usage examples for org.eclipse.jface.resource JFaceResources DEFAULT_FONT
String DEFAULT_FONT
To view the source code for org.eclipse.jface.resource JFaceResources DEFAULT_FONT.
Click Source Link
"org.eclipse.jface.defaultfont"
). From source file:net.sf.eclipsensis.dialogs.ColorEditor.java
License:Open Source License
protected Point calculateSize(Control window) { GC gc = new GC(window); Font old = gc.getFont();/*ww w . j a va 2 s . c om*/ Font f = JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT); gc.setFont(f); int height = gc.getFontMetrics().getHeight(); gc.setFont(old); gc.dispose(); Point p = new Point(height * 3 - 6, height); return p; }
From source file:net.sf.solareclipse.ui.ColorEditor.java
License:Open Source License
protected Point computeImageSize(Control control) { Font f = JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT); GC gc = new GC(control); gc.setFont(f);// w w w .j av a2 s . co m int height = gc.getFontMetrics().getHeight(); gc.dispose(); return new Point(height * 3 - 6, height); }
From source file:networkadministrator.View.java
License:Open Source License
public void createPartControl(Composite parent) { Composite top = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0;//from ww w .jav a2s . c o m layout.marginWidth = 0; top.setLayout(layout); // top banner Composite banner = new Composite(top, SWT.NONE); banner.setLayoutData( new GridData(GridData.HORIZONTAL_ALIGN_FILL, GridData.VERTICAL_ALIGN_BEGINNING, true, false)); layout = new GridLayout(); layout.marginHeight = 5; layout.marginWidth = 10; layout.numColumns = 2; banner.setLayout(layout); // setup bold font Font boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); Label l = new Label(banner, SWT.WRAP); l.setText("Subject:"); l.setFont(boldFont); l = new Label(banner, SWT.WRAP); l.setText("This is a message about the cool Eclipse RCP!"); l = new Label(banner, SWT.WRAP); l.setText("From:"); l.setFont(boldFont); final Link link = new Link(banner, SWT.NONE); link.setText("<a>nicole@mail.org</a>"); link.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { MessageDialog.openInformation(getSite().getShell(), "Not Implemented", "Imagine the address book or a new message being created now."); } }); l = new Label(banner, SWT.WRAP); l.setText("Date:"); l.setFont(boldFont); l = new Label(banner, SWT.WRAP); l.setText("10:34 am"); // message contents Text text = new Text(top, SWT.MULTI | SWT.WRAP); text.setText( "This RAP Application was generated from the PDE Plug-in Project wizard. This sample shows how to:\n" + "- add a top-level menu and toolbar with actions\n" + "- create views that can't be closed and\n" + " multiple instances of the same view\n" + "- perspectives with placeholders for new views\n" + "- use the default about dialog\n"); text.setLayoutData(new GridData(GridData.FILL_BOTH)); }
From source file:no.itpr.parser.handlers.TimeZoneLabelProvider.java
License:Open Source License
public Font getFont(Object element) { Font italic = fr.getItalic(JFaceResources.DEFAULT_FONT); return italic; }
From source file:org.apache.directory.studio.templateeditor.view.preferences.TemplatesLabelProvider.java
License:Apache License
/** * {@inheritDoc}//from ww w . j av a2 s.com */ public Font getFont(Object element, int columnIndex) { // Object class presentation if (isObjectClassPresentation()) { if (element instanceof Template) { if (manager.isDefaultTemplate((Template) element)) { // Get the default Bold Font return JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); } } } return null; }
From source file:org.apache.sling.ide.eclipse.ui.views.JcrPropertiesView.java
License:Apache License
/** * This is a callback that will allow us * to create the viewer and initialize it. *//*from ww w. ja v a 2 s . co m*/ public void createPartControl(Composite parent) { SyncDirManager.registerUpdateListener(new UpdateHandler() { @Override public void syncDirUpdated(SyncDir syncDir) { refreshContent(); } }); mainControl = new Composite(parent, SWT.NONE); final GridLayout gridLayout = new GridLayout(1, true); mainControl.setLayout(gridLayout); if (getViewSite() != null) { titleLabel = new Label(mainControl, SWT.WRAP); titleLabel.setText(""); GridData data = new GridData(GridData.FILL_HORIZONTAL); titleLabel.setLayoutData(data); Label horizontalLine = new Label(mainControl, SWT.SEPARATOR | SWT.HORIZONTAL); data = new GridData(GridData.FILL_HORIZONTAL); horizontalLine.setLayoutData(data); } Font font; if (!JFaceResources.getFontRegistry().hasValueFor(TITLE_FONT)) { FontData[] fontData = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT) .getFontData(); /* title font is 2pt larger than that used in the tabs. */ fontData[0].setHeight(fontData[0].getHeight() + 2); JFaceResources.getFontRegistry().put(TITLE_FONT, fontData); } font = JFaceResources.getFont(TITLE_FONT); if (titleLabel != null) { titleLabel.setFont(font); } Composite tableParent = new Composite(mainControl, SWT.NONE); // tableParent.setBackground(new Color(Display.getDefault(), 100,20,180)); GridData tableLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); tableLayoutData.widthHint = 1; // shrink to min - table settings will resize to correct ratios tableLayoutData.heightHint = SWT.DEFAULT; tableParent.setLayoutData(tableLayoutData); TableColumnLayout tableLayout = new TableColumnLayout() { @Override protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) { Point p = super.computeSize(composite, wHint, hHint, flushCache); return new Point(p.x, p.y); } }; tableParent.setLayout(tableLayout); viewer = new TableViewer(tableParent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.HIDE_SELECTION | SWT.FULL_SELECTION); TableViewerFocusCellManager focusCellManager = new TableViewerFocusCellManager(viewer, new FocusCellOwnerDrawHighlighter(viewer), new CellNavigationStrategy()); ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(viewer) { @Override protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { resetLastValueEdited(); return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.CR) || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC; } }; int features = ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | ColumnViewerEditor.TABBING_VERTICAL | ColumnViewerEditor.KEYBOARD_ACTIVATION | ColumnViewerEditor.KEEP_EDITOR_ON_DOUBLE_CLICK; TableViewerEditor.create(viewer, focusCellManager, actSupport, features); viewer.getTable().setLinesVisible(true); viewer.getTable().setHeaderVisible(true); viewer.setContentProvider(new ViewContentProvider()); viewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { final ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection iss = (IStructuredSelection) selection; if (iss.isEmpty()) { deleteAction.setEnabled(false); } else { deleteAction.setEnabled(true); } } else { deleteAction.setEnabled(false); } } }); CellLabelProvider clp = new JcrCellLabelProvider(viewer); TableViewerColumn column0 = new TableViewerColumn(viewer, SWT.NONE); column0.getColumn().setText("Name"); column0.getColumn().setResizable(true); column0.getColumn().setWidth(200); tableLayout.setColumnData(column0.getColumn(), new ColumnWeightData(30, 140)); final TableViewerColumn column1 = new TableViewerColumn(viewer, SWT.NONE); column1.getColumn().setText("Type"); column1.getColumn().setResizable(true); column1.getColumn().setWidth(300); column1.setLabelProvider(clp); tableLayout.setColumnData(column1.getColumn(), new ColumnWeightData(10, 80)); final TableViewerColumn column2 = new TableViewerColumn(viewer, SWT.NONE); column2.getColumn().setText("Value"); column2.getColumn().setResizable(true); column2.getColumn().setWidth(300); tableLayout.setColumnData(column2.getColumn(), new ColumnWeightData(70, 220)); final TableViewerColumn column3 = new TableViewerColumn(viewer, SWT.NONE); column3.getColumn().setText("Protected"); column3.getColumn().setResizable(true); column3.getColumn().setWidth(300); column3.setLabelProvider(clp); tableLayout.setColumnData(column3.getColumn(), new ColumnWeightData(5, 57)); final TableViewerColumn column4 = new TableViewerColumn(viewer, SWT.NONE); column4.getColumn().setText("Mandatory"); column4.getColumn().setResizable(true); column4.getColumn().setWidth(300); column4.setLabelProvider(clp); tableLayout.setColumnData(column4.getColumn(), new ColumnWeightData(5, 62)); final TableViewerColumn column5 = new TableViewerColumn(viewer, SWT.NONE); column5.getColumn().setText("Multiple"); column5.getColumn().setResizable(true); column5.getColumn().setWidth(300); column5.setLabelProvider(clp); tableLayout.setColumnData(column5.getColumn(), new ColumnWeightData(5, 82)); final TableViewerColumn column6 = new TableViewerColumn(viewer, SWT.NONE); column6.getColumn().setText("Auto Created"); column6.getColumn().setResizable(true); column6.getColumn().setWidth(300); column6.setLabelProvider(clp); tableLayout.setColumnData(column6.getColumn(), new ColumnWeightData(5, 77)); column0.setLabelProvider(clp); column0.setEditingSupport(new JcrEditingSupport(this, viewer, ColumnId.NAME)); column1.setLabelProvider(clp); column1.setEditingSupport(new JcrEditingSupport(this, viewer, ColumnId.TYPE)); column2.setLabelProvider(clp); column2.setEditingSupport(new JcrEditingSupport(this, viewer, ColumnId.VALUE)); column5.setEditingSupport(new JcrEditingSupport(this, viewer, ColumnId.MULTIPLE)); // Create the help context id for the viewer's control PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "org.apache.sling.ide.eclipse-ui.viewer"); makeActions(); hookContextMenu(); hookDoubleClickAction(); contributeToActionBars(); listener = new ISelectionListener() { @Override public void selectionChanged(IWorkbenchPart part, ISelection selection) { if (selection instanceof IStructuredSelection) { IStructuredSelection iss = (IStructuredSelection) selection; Object firstElem = iss.getFirstElement(); if (firstElem instanceof JcrNode) { JcrNode jcrNode = (JcrNode) firstElem; setInput(jcrNode); return; } } } }; if (getViewSite() != null) { getViewSite().getPage().addSelectionListener(listener); final ISelection selection = getViewSite().getPage().getSelection(); Display.getCurrent().asyncExec(new Runnable() { @Override public void run() { listener.selectionChanged(null, selection); } }); } }
From source file:org.archicontribs.database.DBSelectModel.java
License:Open Source License
private void createContents() { DBPlugin.debug(DebugLevel.MainMethod, "+Entering DBSelectModel.createContents()"); dialog = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); dialog.setText(DBPlugin.pluginTitle); dialog.setSize(840, 470);//from ww w . j a va 2 s . co m dialog.setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - dialog.getSize().x) / 4, (Toolkit.getDefaultToolkit().getScreenSize().height - dialog.getSize().y) / 4); dialog.setLayout(null); dialog.addListener(SWT.Paint, setInitialValuesListener); /* ***************************** */ /* * Selection of the database * */ /* ***************************** */ DBPlugin.createLabel(dialog, 10, 10, 60, 20, "Database :", SWT.NONE); database = new CCombo(dialog, SWT.BORDER); database.setBounds(70, 8, 340, 20); database.addSelectionListener(databaseModifyListener); try { Field field = CCombo.class.getDeclaredField("text"); field.setAccessible(true); databaseTextArea = (Text) field.get(database); field.setAccessible(false); } catch (Exception err) { databaseTextArea = null; } DBPlugin.createButton(dialog, 420, 5, 130, 25, "Set Preferences ...", SWT.PUSH, setPreferencesButtonCallback); /* ***************************** */ /* * Table with ids and names * */ /* ***************************** */ Composite compositeId = DBPlugin.createComposite(dialog, 10, 60, 103, 18, SWT.BORDER); lblId = DBPlugin.createLabel(compositeId, 0, 0, 103, 18, "ID :", SWT.CENTER); lblId.addMouseListener(sortColumnsAdapter); id = DBPlugin.createText(dialog, 10, 40, 103, 21, "", SWT.BORDER); id.setTextLimit(8); id.addListener(SWT.Verify, verifyIdListener); Composite compositeName = DBPlugin.createComposite(dialog, 112, 60, 298, 18, SWT.BORDER); lblName = DBPlugin.createLabel(compositeName, 0, 0, 298, 18, "Name :", SWT.CENTER); lblName.addMouseListener(sortColumnsAdapter); name = DBPlugin.createText(dialog, 112, 40, 298, 21, "", SWT.BORDER); name.setTextLimit(255); ScrolledComposite compositeTblId = DBPlugin.createScrolledComposite(dialog, 10, 77, 400, 320, SWT.BORDER | SWT.V_SCROLL); TableViewer tableViewerId = new TableViewer(compositeTblId, SWT.FULL_SELECTION); tblId = tableViewerId.getTable(); tblId.setLinesVisible(true); tblId.addListener(SWT.Selection, selectModelListener); // if Action is Import, then the double click is equivalent to the OK button if (action == Action.Import) tblId.addListener(SWT.MouseDoubleClick, new Listener() { public void handleEvent(Event event) { btnOK.notifyListeners(SWT.Selection, new Event()); } }); compositeTblId.setContent(tblId); compositeTblId.setMinSize(tblId.computeSize(SWT.DEFAULT, SWT.DEFAULT)); columnId = new TableColumn(tblId, SWT.NONE); columnId.setResizable(false); columnId.setMoveable(true); columnId.setWidth(100); columnId.setText("ID"); columnId.setData(new Label[] { lblId, lblName }); // used by the sort callback columnName = new TableColumn(tblId, SWT.NONE); columnName.setResizable(false); columnName.setWidth(280); columnName.setText("Name"); columnName.setData(new Label[] { lblName, lblId }); // used by the scroll callback /* ********************************** */ /* * versions : * */ /* * if import --> table * */ /* * if export --> radio buttons * */ /* ********************************** */ DBPlugin.createLabel(dialog, 420, 40, 55, 15, "Version :", SWT.NONE); if (action == Action.Import) { compositeVersion = DBPlugin.createScrolledComposite(dialog, 520, 40, 305, 92, SWT.BORDER | SWT.V_SCROLL); TableViewer tableViewerVersion = new TableViewer(compositeVersion, SWT.FULL_SELECTION); tblVersion = tableViewerVersion.getTable(); tblVersion.setLinesVisible(true); tblVersion.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { TableItem tableItem = tblVersion.getSelection()[0]; name.setText(tableItem.getData("name") == null ? "" : (String) tableItem.getData("name")); purpose.setText( tableItem.getData("purpose") == null ? "" : (String) tableItem.getData("purpose")); owner.setText(tableItem.getData("owner") == null ? "" : (String) tableItem.getData("owner")); note.setText(tableItem.getData("note") == null ? "" : (String) tableItem.getData("note")); } }); TableColumn columnVersion = new TableColumn(tblVersion, SWT.NONE); columnVersion.setResizable(false); columnVersion.setWidth(95); columnVersion.setText("Version"); TableColumn columnDate = new TableColumn(tblVersion, SWT.NONE); columnDate.setResizable(false); columnDate.setWidth(190); columnDate.setText("Date"); compositeVersion.setContent(tblVersion); compositeVersion.setMinSize(tblVersion.computeSize(SWT.DEFAULT, SWT.DEFAULT)); } else { // if action == Action.Export versionGrp = DBPlugin.createGroup(dialog, 520, 35, 205, 102, SWT.NONE); checkActual = DBPlugin.createButton(versionGrp, 6, 18, 96, 16, "actual version :", SWT.RADIO, null); checkMinor = DBPlugin.createButton(versionGrp, 6, 37, 101, 16, "minor change :", SWT.RADIO, null); checkMajor = DBPlugin.createButton(versionGrp, 6, 56, 100, 16, "major change :", SWT.RADIO, null); checkCustom = DBPlugin.createButton(versionGrp, 6, 75, 111, 16, "custom version :", SWT.RADIO, null); actualVersion = DBPlugin.createText(versionGrp, 120, 18, 68, 15, "", SWT.None); minorVersion = DBPlugin.createText(versionGrp, 120, 37, 68, 15, "", SWT.None); majorVersion = DBPlugin.createText(versionGrp, 120, 56, 68, 15, "", SWT.None); customVersion = DBPlugin.createText(versionGrp, 120, 75, 68, 15, "", SWT.None); customVersion.addListener(SWT.Verify, validateCustomVersionListener); } /* ******************************** */ /* * Release note, owner, purpose * */ /* ******************************** */ note = DBPlugin.createLabelledText(dialog, 426, 143, 89, 15, "Release note :", 305, 15, "", SWT.BORDER); owner = DBPlugin.createLabelledText(dialog, 426, 168, 89, 15, "Owner :", 150, 15, "", SWT.BORDER); purpose = DBPlugin.createLabelledText(dialog, 426, 193, 89, 15, "Purpose :", 305, 130, "", SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL); /* ******************************** */ /* * Import and Export groups * */ /* ******************************** */ if (action == Action.Import) { DBPlugin.createLabel(dialog, 426, 335, 80, 15, "Import mode :", SWT.NONE); grpMode = DBPlugin.createGroup(dialog, 521, 325, 305, 30, SWT.NONE); btnStandalone = DBPlugin.createButton(grpMode, 6, 10, 96, 16, "Standalone", SWT.RADIO, null); btnStandalone.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { lblAutoDepth.setVisible(false); lblDepth.setVisible(false); scaleDepth.setVisible(false); } }); btnShared = DBPlugin.createButton(grpMode, 150, 10, 96, 16, "Shared", SWT.RADIO, null); btnShared.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { lblAutoDepth.setVisible(true); lblDepth.setVisible(true); scaleDepth.setVisible(true); } }); lblAutoDepth = DBPlugin.createLabel(dialog, 426, 375, 89, 15, "Auto depth :", SWT.NONE); lblDepth = DBPlugin.createLabel(dialog, 520, 375, 55, 15, "Infinite", SWT.NONE); scaleDepth = new Scale(dialog, SWT.NONE); scaleDepth.setSelection(100); scaleDepth.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (scaleDepth.getSelection() == 0) lblDepth.setText("None"); else if (scaleDepth.getSelection() == 100) lblDepth.setText("Infinite"); else lblDepth.setText(Integer.toString(scaleDepth.getSelection())); } }); scaleDepth.setBounds(581, 361, 244, 40); } else { DBPlugin.createLabel(dialog, 426, 335, 80, 15, "Export :", SWT.NONE); grpMode = DBPlugin.createGroup(dialog, 521, 325, 305, 30, SWT.NONE); btnExport = DBPlugin.createButton(grpMode, 6, 10, 96, 16, "Export", SWT.RADIO, null); btnDoNotExport = DBPlugin.createButton(grpMode, 150, 10, 96, 16, "Do not export", SWT.RADIO, null); btnExport.setSelection(true); } /* ******************************** */ /* * action buttons * */ /* ******************************** */ btnDelete = DBPlugin.createButton(dialog, 10, 409, 75, 25, "Delete", SWT.NONE, deleteButtonCallback); btnChangeId = DBPlugin.createButton(dialog, 100, 409, 75, 25, "Change ID", SWT.NONE, null); btnApplyFilter = DBPlugin.createButton(dialog, 190, 409, 75, 25, "Filter", SWT.NONE, applyFilterButtonCallback); btnOK = DBPlugin.createButton(dialog, 668, 409, 75, 25, action == Action.Import ? "Import" : "Export", SWT.PUSH, okButtonCallback); btnCancel = DBPlugin.createButton(dialog, 749, 409, 75, 25, "Cancel", SWT.NONE, cancelButtonCallback); /* ******************************** */ /* * filters * */ /* ******************************** */ lblElements = DBPlugin.createLabel(dialog, 10, 446, 80, 15, "Elements :", SWT.NONE); lblElements.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); lblElements.setBackground(GREY_COLOR); lblRelations = DBPlugin.createLabel(dialog, 10, 571, 80, 15, "Relationships :", SWT.NONE); lblRelations.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); lblRelations.setBackground(GREY_COLOR); lblProperties = DBPlugin.createLabel(dialog, 485, 446, 80, 15, "Properties :", SWT.NONE); lblProperties.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); lblProperties.setBackground(GREY_COLOR); Group ElementsGrp = DBPlugin.createGroup(dialog, 10, 455, 465, 107, SWT.NONE); ElementsGrp.setBackground(GREY_COLOR); lblEltLayer = DBPlugin.createLabel(ElementsGrp, 10, 5, 36, 15, "Layer :", SWT.NONE); lblEltLayer.setBackground(GREY_COLOR); DBPlugin.createLabel(ElementsGrp, 140, 5, 36, 15, "Type :", SWT.NONE).setBackground(GREY_COLOR); lblEltName = DBPlugin.createLabel(ElementsGrp, 285, 5, 44, 15, "Name :", SWT.NONE); lblEltName.setBackground(GREY_COLOR); comboEltLayer1 = DBPlugin.createCombo(ElementsGrp, 5, 20, 130, 23, ElementLayers, SWT.NONE); comboEltLayer1.addVerifyListener(new VerifyListener() { public void verifyText(VerifyEvent e) { if (e.character != 0) e.doit = false; if (!e.text.equals(oldComboEltLayer1Text)) { oldComboEltLayer1Text = e.text; comboEltType1.setText(""); switch (e.text) { case "": case "Model": comboEltType1.removeAll(); break; case "Business": comboEltType1.setItems(BusinessLayer); break; case "Application": comboEltType1.setItems(ApplicationLayer); break; case "Technology": comboEltType1.setItems(TechnologyLayer); break; case "Motivation": comboEltType1.setItems(MotivationLayer); break; case "Implementation": comboEltType1.setItems(ImplementationLayer); break; } } } }); comboEltLayer2 = DBPlugin.createCombo(ElementsGrp, 5, 48, 130, 23, ElementLayers, SWT.NONE); comboEltLayer2.addVerifyListener(new VerifyListener() { public void verifyText(VerifyEvent e) { if (e.character != 0) e.doit = false; } }); comboEltLayer3 = DBPlugin.createCombo(ElementsGrp, 5, 76, 130, 23, ElementLayers, SWT.NONE); comboEltLayer3.addVerifyListener(new VerifyListener() { public void verifyText(VerifyEvent e) { if (e.character != 0) e.doit = false; } }); comboEltType1 = DBPlugin.createCombo(ElementsGrp, 140, 20, 140, 23, null, SWT.NONE); comboEltType1.addVerifyListener(new VerifyListener() { public void verifyText(VerifyEvent e) { if (e.character != 0) e.doit = false; } }); comboEltType2 = DBPlugin.createCombo(ElementsGrp, 140, 48, 140, 23, null, SWT.NONE); comboEltType2.addVerifyListener(new VerifyListener() { public void verifyText(VerifyEvent e) { if (e.character != 0) e.doit = false; } }); comboEltType3 = DBPlugin.createCombo(ElementsGrp, 140, 76, 140, 23, null, SWT.NONE); comboEltType3.addVerifyListener(new VerifyListener() { public void verifyText(VerifyEvent e) { if (e.character != 0) e.doit = false; } }); txtEltName1 = DBPlugin.createText(ElementsGrp, 285, 21, 170, 21, "", SWT.BORDER); txtEltName2 = DBPlugin.createText(ElementsGrp, 285, 49, 170, 21, "", SWT.BORDER); txtEltName3 = DBPlugin.createText(ElementsGrp, 285, 77, 170, 21, "", SWT.BORDER); grpProperties = DBPlugin.createGroup(dialog, 485, 455, 338, 107, SWT.NONE); grpProperties.setBackground(GREY_COLOR); lblPropName = DBPlugin.createLabel(grpProperties, 10, 5, 36, 15, "Name :", SWT.NONE); lblPropName.setBackground(GREY_COLOR); lblPropValue = DBPlugin.createLabel(grpProperties, 140, 5, 44, 15, "Value :", SWT.NONE); lblPropValue.setBackground(GREY_COLOR); TxtPropName1 = DBPlugin.createText(grpProperties, 10, 21, 125, 21, "", SWT.BORDER); TxtPropName2 = DBPlugin.createText(grpProperties, 10, 49, 125, 21, "", SWT.BORDER); TxtPropName3 = DBPlugin.createText(grpProperties, 10, 77, 125, 21, "", SWT.BORDER); TxtPropValue1 = DBPlugin.createText(grpProperties, 140, 21, 188, 21, "", SWT.BORDER); TxtPropValue2 = DBPlugin.createText(grpProperties, 140, 49, 188, 21, "", SWT.BORDER); TxtPropValue3 = DBPlugin.createText(grpProperties, 140, 77, 188, 21, "", SWT.BORDER); grpRelations = DBPlugin.createGroup(dialog, 10, 580, 465, 111, SWT.NONE); grpRelations.setBackground(GREY_COLOR); lblRelType = DBPlugin.createLabel(grpRelations, 5, 5, 36, 15, "Type :", SWT.NONE); lblRelType.setBackground(GREY_COLOR); lblRelSource = DBPlugin.createLabel(grpRelations, 180, 5, 44, 15, "Source :", SWT.NONE); lblRelSource.setBackground(GREY_COLOR); lblRelTarget = DBPlugin.createLabel(grpRelations, 320, 5, 44, 15, "Target :", SWT.NONE); lblRelTarget.setBackground(GREY_COLOR); comboRelationship1 = DBPlugin.createCombo(grpRelations, 5, 20, 170, 23, Relationships, SWT.NONE); comboRelationship2 = DBPlugin.createCombo(grpRelations, 5, 48, 170, 23, Relationships, SWT.NONE); comboRelationship3 = DBPlugin.createCombo(grpRelations, 5, 76, 170, 23, Relationships, SWT.NONE); TxtSource1 = DBPlugin.createText(grpRelations, 180, 21, 135, 21, "", SWT.BORDER); TxtSource2 = DBPlugin.createText(grpRelations, 180, 49, 135, 21, "", SWT.BORDER); TxtSource3 = DBPlugin.createText(grpRelations, 180, 77, 135, 21, "", SWT.BORDER); TxtTarget1 = DBPlugin.createText(grpRelations, 320, 21, 135, 21, "", SWT.BORDER); TxtTarget2 = DBPlugin.createText(grpRelations, 320, 49, 135, 21, "", SWT.BORDER); TxtTarget3 = DBPlugin.createText(grpRelations, 320, 77, 135, 21, "", SWT.BORDER); DBPlugin.createLabel(dialog, 485, 550, 250, 50, "The search is not case sensitive.\nYou may use the '%' character as wildcard.", SWT.WRAP); btnResetFilter = DBPlugin.createButton(dialog, 669, 669, 75, 25, "Reset filter", SWT.NONE, ResetFilterListenerButtonCallback); btnCancelFilter = DBPlugin.createButton(dialog, 749, 669, 75, 25, "Cancel filter", SWT.NONE, CancelFilterListenerButtonCallback); //TODO : rework the tab list : the cancellbuttonfilter is not accessible when the filter is hidden !!!!! if (action == Action.Import) { dialog.getShell() .setTabList(new Control[] { id, name, compositeTblId, compositeVersion, note, owner, purpose, grpMode, scaleDepth, btnDelete, btnChangeId, btnApplyFilter, ElementsGrp, grpProperties, grpRelations, btnResetFilter, btnCancelFilter, btnOK, btnCancel }); } else { dialog.getShell().setTabList(new Control[] { id, name, compositeTblId, versionGrp, note, owner, purpose, grpMode, btnDelete, btnChangeId, ElementsGrp, grpProperties, grpRelations, btnOK, btnCancel }); } DBPlugin.debug(DebugLevel.MainMethod, "-Leaving DBSelectModel.createContents()"); }
From source file:org.codehaus.groovy.eclipse.debug.ui.EnsureJUnitFont.java
License:Apache License
public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(PreferenceConstants.GROOVY_JUNIT_MONOSPACE_FONT) || event.getProperty().equals(JFaceResources.TEXT_FONT) || event.getProperty().equals(JFaceResources.DEFAULT_FONT)) { maybeForceMonospaceFont();/*from w w w .j a v a 2 s .c om*/ } }
From source file:org.dafoe.corpuslevel.ui.views.PhraseOccurenceLabelProvider.java
License:Open Source License
@Override protected void paint(Event event, Object element) { // TODO Auto-generated method stub ISentence phrase = (ISentence) element; Display display = view.GetViewer().getControl().getDisplay(); TextLayout layout = new TextLayout(display); layout.setText(phrase.getContent()); TextStyle plain = new TextStyle(JFaceResources.getFont(JFaceResources.DEFAULT_FONT), display.getSystemColor(SWT.COLOR_LIST_FOREGROUND), null); TextStyle italic = new TextStyle(JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT), display.getSystemColor(SWT.COLOR_BLUE), null); Font newFont = new Font(display, "Arial", 9, SWT.BOLD); //$NON-NLS-1$ TextStyle font = new TextStyle(newFont, display.getSystemColor(SWT.COLOR_WHITE), display.getSystemColor(SWT.COLOR_BLUE)); List<ITermOccurrence> occurences = view.GetListOccurence(phrase); if (occurences != null) { for (int i = 0; i < occurences.size(); i++) { ITermOccurrence occ = occurences.get(i); int pos = occ.getPosition(); // int len = occ.getLength(); layout.setStyle(font, pos, pos + len - 1); }/*from w w w. ja va 2 s . c o m*/ } // layout.setStyle(plain, 0, 2); // layout.setStyle(italic, 3, 5); // layout.setStyle(font, 6, phrase.getText().length() - 1); layout.draw(event.gc, event.x, event.y); if (this.columv.getColumn().getWidth() < event.gc.textExtent(phrase.getContent()).x + 10) { this.columv.getColumn().setWidth(event.gc.textExtent(phrase.getContent()).x + 10); } }
From source file:org.eclipse.bpel.ui.editparts.borders.CollapsableBorder.java
License:Open Source License
public CollapsableBorder(boolean isVertical, int arcWidth, IFigure parentFigure, String labelText, Image image) {/* w w w . ja v a 2s . co m*/ super(isVertical, arcWidth); this.parentFigure = parentFigure; this.image = image; this.imageLabel = new ImageFigure(image); this.collapsedImage = BPELUIPlugin.INSTANCE.getImage(IBPELUIConstants.ICON_FIGURE_COLLAPSED); this.expandedImage = BPELUIPlugin.INSTANCE.getImage(IBPELUIConstants.ICON_FIGURE_EXPANDED); this.expandedHeight = expandedImage.getBounds().height; this.expandedWidth = expandedImage.getBounds().width; this.collapsedNameLabel = new Label(labelText); this.collapsedNameLabel.setFont(JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT)); }