List of usage examples for org.eclipse.jface.resource JFaceResources getFontRegistry
public static FontRegistry getFontRegistry()
From source file:net.tourbook.ui.views.tourSegmenter.TourSegmenterView.java
License:Open Source License
@Override public void createPartControl(final Composite parent) { _parent = parent;/*from w ww .j a va2s .c o m*/ _pc = new PixelConverter(parent); _spinnerWidth = _pc.convertWidthInCharsToPixels(_isOSX ? 10 : 5); _boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT); setMaxDistanceSpinner(); // define all columns _columnManager = new ColumnManager(this, _state); _columnManager.setIsCategoryAvailable(true); defineAllColumns(parent); createUI(parent); createActions(); fillToolbar(); addSelectionListener(); addPartListener(); addPrefListener(); addTourEventListener(); // tell the site that this view is a selection provider getSite().setSelectionProvider(_postSelectionProvider = new PostSelectionProvider(ID)); _pageBookUI.showPage(_pageNoData); restoreState(); enableActions(); showTour(); }
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;/* w w w . ja v a 2 s. 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.TimeZoneTreeView.java
License:Open Source License
public void createPartControl(Composite parent) { ResourceManager rm = JFaceResources.getResources(); LocalResourceManager lrm = new LocalResourceManager(rm, parent); ImageRegistry ir = new ImageRegistry(lrm); FontRegistry fr = JFaceResources.getFontRegistry(); URL sample = getClass().getResource("/icons/sample.gif"); ir.put("sample", ImageDescriptor.createFromURL(sample)); treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); treeViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new TimeZoneLabelProvider(ir, fr))); treeViewer.setContentProvider(new TimeZoneContentProvider()); treeViewer.setInput(new Object[] { TimeZoneComparator.getTimeZones() }); treeViewer.setData("REVERSE", Boolean.TRUE); treeViewer.setFilters(new ViewerFilter[] { new TimeZoneViewerFilter("GMT") }); treeViewer.setExpandPreCheckFilters(true); treeViewer.setComparator(new TimeZoneViewerComparator()); treeViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { Viewer viewer = event.getViewer(); Shell shell = viewer.getControl().getShell(); ISelection sel = viewer.getSelection(); Object selectedValue; if (!(sel instanceof IStructuredSelection) || sel.isEmpty()) { selectedValue = null;//w w w .ja v a2 s . com } else { selectedValue = ((IStructuredSelection) sel).getFirstElement(); } if (selectedValue instanceof TimeZone) { TimeZone timeZone = (TimeZone) selectedValue; new TimeZoneDialog(shell, timeZone).open(); } } }); getSite().setSelectionProvider(treeViewer); selectionListener = new TimeZoneSelectionListener(treeViewer, getSite().getPart()); getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(selectionListener); }
From source file:no.resheim.elibrarium.epub.ui.reader.TOCOutlinePage.java
License:Open Source License
@Override public void createControl(Composite parent) { book = EpubUtil.getBook(ops);// w w w . j a va 2s. c om pagebook = new Composite(parent, SWT.NONE); layout = new StackLayout(); pagebook.setLayout(layout); toc = new TreeViewer(pagebook, getTreeStyle()); toc.setContentProvider(new TOCContentProvider()); toc.setLabelProvider(new EpubLabelProvider()); toc.addSelectionChangedListener(this); toc.addDoubleClickListener(this); bookmarks = new TableViewer(pagebook, SWT.NONE); bookmarks.setContentProvider(new BookmarksContentProvider()); bookmarks.setComparator(new BookmarksComparator()); bookmarks.addSelectionChangedListener(this); bookmarks.addDoubleClickListener(this); bookmarks.getTable().setHeaderVisible(false); final TableViewerColumn column = new TableViewerColumn(bookmarks, SWT.LEFT); // Special drawing of bookmarks table installLabelProvider(column); // Automatic layout of bookmarks table installControlAdapter(column); GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); bookmarks.getControl().setLayoutData(data); // Create the context menu for the annotations hookContextMenu(bookmarks.getControl()); // Set the input toc.setInput(ops); toc.expandAll(); bookmarks.setInput(book); // Handles changes in the book and will refresh the bookmarks view. bookAdapter = new AdapterImpl() { @Override public void notifyChanged(Notification notification) { if (!bookmarks.getControl().isDisposed()) { bookmarks.getControl().getDisplay().asyncExec(new Runnable() { @Override public void run() { bookmarks.refresh(true); } }); } } }; book.eAdapters().add(bookAdapter); // Start by showing the table of contents showTOC.setChecked(true); layout.topControl = toc.getControl(); pagebook.layout(); JFaceResources.getFontRegistry().addListener(this); // Activate UI context for o.e.u.meny contributes items activateContext(); }
From source file:org.antlr.eclipse.ui.editor.AntlrOverview.java
License:Open Source License
public AntlrOverview(final Composite aParent) { super(aParent, null, SWT.V_SCROLL | SWT.H_SCROLL); EditorEnvironment.connect();/*from w ww . j av a 2 s . c o m*/ // Configure source viewer configure(new AntlrConfiguration(null)); getTextWidget().setEditable(false); getTextWidget().setFont(JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT)); // Create document with attached partitioner IDocument document = new Document(); IDocumentPartitioner partitioner = new DefaultPartitioner(new PartitionScanner(), PartitionScanner.PARTITION_TYPES); partitioner.connect(document); document.setDocumentPartitioner(partitioner); // Attach document to source viewer AFTER configuring source viewer // Otherwise syntax highlighting will not work setDocument(document); }
From source file:org.apache.directory.studio.apacheds.configuration.editor.ServerConfigurationEditorPage.java
License:Apache License
/** * Set some Label to Bold//from ww w.ja v a 2 s .c o m * * @param label the Label we want to see as Bold * @return a Label with bold text */ protected Label setBold(Label label) { FontData fontData = label.getFont().getFontData()[0]; Font boldFont = JFaceResources.getFontRegistry().getBold(fontData.getName()); label.setFont(boldFont); return label; }
From source file:org.apache.directory.studio.connection.ui.widgets.AuthenticationParameterPage.java
License:Apache License
protected ExpandableComposite createExpandableSection(Composite parent, String label, int nColumns) { ExpandableComposite excomposite = new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); excomposite.setText(label);/*from w w w . j av a 2 s. c o m*/ excomposite.setExpanded(false); excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1)); excomposite.addExpansionListener(new ExpansionAdapter() { /** * {@inheritDoc} */ @Override public void expansionStateChanged(ExpansionEvent event) { ExpandableComposite excomposite = (ExpandableComposite) event.getSource(); excomposite.getParent().setSize(excomposite.getParent().computeSize(SWT.DEFAULT, SWT.DEFAULT)); } }); return excomposite; }
From source file:org.apache.directory.studio.templateeditor.view.preferences.TemplatesLabelProvider.java
License:Apache License
/** * {@inheritDoc}/* www . j av a2 s. co m*/ */ 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 w ww . j a v a2s.c o 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 w w w. j ava 2s .com 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()"); }