List of usage examples for org.eclipse.jface.resource JFaceResources getTextFont
public static Font getTextFont()
From source file:org.eclipse.help.ui.internal.views.ContextHelpPart.java
License:Open Source License
/** * @param parent//from w ww .ja v a 2s . c o m * @param toolkit * @param style */ public ContextHelpPart(Composite parent, FormToolkit toolkit) { super(parent, toolkit, getSectionStyle()); Section section = getSection(); section.marginWidth = 5; section.setText(Messages.ContextHelpPart_about); Composite container = toolkit.createComposite(section); section.setClient(container); section.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { if (e.getState()) { updateText(savedDescription); } } }); TableWrapLayout layout = new TableWrapLayout(); layout.topMargin = layout.bottomMargin = 0; layout.leftMargin = layout.rightMargin = 0; layout.verticalSpacing = 10; container.setLayout(layout); text = toolkit.createFormText(container, false); text.setWhitespaceNormalized(false); text.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB)); text.setColor(IFormColors.TITLE, toolkit.getColors().getColor(IFormColors.TITLE)); codeFont = createCodeFont(parent.getDisplay(), parent.getFont(), JFaceResources.getTextFont()); text.setFont("code", codeFont); //$NON-NLS-1$ String key = IHelpUIConstants.IMAGE_FILE_F1TOPIC; text.setImage(key, HelpUIResources.getImage(key)); key = IHelpUIConstants.IMAGE_COMMAND_F1TOPIC; text.setImage(key, HelpUIResources.getImage(key)); String searchKey = IHelpUIConstants.IMAGE_HELP_SEARCH; text.setImage(searchKey, HelpUIResources.getImage(searchKey)); text.addHyperlinkListener(new IHyperlinkListener() { public void linkActivated(HyperlinkEvent e) { String href = (String) e.getHref(); if (href.startsWith(MORE_HREF)) { doMore(href.substring(MORE_HREF.length())); } else { doOpenLink(e.getHref()); } } public void linkEntered(HyperlinkEvent e) { ContextHelpPart.this.parent.handleLinkEntered(e); } public void linkExited(HyperlinkEvent e) { ContextHelpPart.this.parent.handleLinkExited(e); } }); text.setText(defaultText, false, false); text.getAccessible().addAccessibleListener(new AccessibleAdapter() { public void getName(AccessibleEvent e) { if (e.childID == ACC.CHILDID_SELF) { String currentName = e.result; e.result = Messages.ReusableHelpPart_contextHelpPage_name + ' ' + getSection().getText() + ' ' + currentName; } } }); }
From source file:org.eclipse.jdt.internal.debug.ui.actions.ExpressionInputDialog.java
License:Open Source License
/** * Initializes the source viewer. This method is based on code in BreakpointConditionEditor. *//*from w ww.j a v a 2 s . c om*/ private void configureSourceViewer() { JavaTextTools tools = JDIDebugUIPlugin.getDefault().getJavaTextTools(); IDocument document = new Document(); tools.setupJavaDocumentPartitioner(document, IJavaPartitions.JAVA_PARTITIONING); fSourceViewer.configure(new DisplayViewerConfiguration() { @Override public IContentAssistProcessor getContentAssistantProcessor() { return getCompletionProcessor(); } }); fSourceViewer.setEditable(true); fSourceViewer.setDocument(document); final IUndoManager undoManager = new TextViewerUndoManager(10); fSourceViewer.setUndoManager(undoManager); undoManager.connect(fSourceViewer); fSourceViewer.getTextWidget().setFont(JFaceResources.getTextFont()); Control control = fSourceViewer.getControl(); GridData gd = new GridData(GridData.FILL_BOTH); control.setLayoutData(gd); gd = (GridData) fSourceViewer.getControl().getLayoutData(); gd.heightHint = convertHeightInCharsToPixels(10); gd.widthHint = convertWidthInCharsToPixels(40); document.set(getInitialText(fVariable)); fDocumentListener = new IDocumentListener() { public void documentAboutToBeChanged(DocumentEvent event) { } public void documentChanged(DocumentEvent event) { refreshValidState(fSourceViewer); } }; fSourceViewer.getDocument().addDocumentListener(fDocumentListener); activateHandler(); }
From source file:org.eclipse.koneki.ldt.debug.ui.internal.launchconfiguration.attach.LuaAttachMainTab.java
License:Open Source License
private Font getInformationFont() { Font textFont = JFaceResources.getTextFont(); if (textFont == null) return JFaceResources.getDefaultFont(); if (textFont.getFontData().length > 0) { Font italic = JFaceResources.getFontRegistry().getItalic(textFont.getFontData()[0].getName()); if (italic != null) return italic; }/*from w ww . ja v a 2s . c o m*/ return textFont; }
From source file:org.eclipse.libra.framework.editor.ui.console.ServerConsoleEditorPage.java
License:Open Source License
@Override protected void createBundleContent(Composite parent) { mform = new ManagedForm(parent); setManagedForm(mform);/* ww w. j ava 2 s. co m*/ sform = mform.getForm(); FormToolkit toolkit = mform.getToolkit(); sform.setText("Server Console"); sform.setImage(ServerUICore.getLabelProvider().getImage(getServer())); sform.setExpandHorizontal(true); sform.setExpandVertical(true); toolkit.decorateFormHeading(sform.getForm()); Composite body = sform.getBody(); GridLayout layout = new GridLayout(1, false); layout.marginLeft = 6; layout.marginTop = 6; layout.marginRight = 6; body.setLayout(layout); Section manifestSection = toolkit.createSection(sform.getBody(), ExpandableComposite.TITLE_BAR | Section.DESCRIPTION); manifestSection.setText("Commands"); manifestSection.setDescription("Execute commands on server."); layout = new GridLayout(); manifestSection.setLayout(layout); manifestSection.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite manifestComposite = toolkit.createComposite(manifestSection); layout = new GridLayout(); layout.marginLeft = 6; layout.marginTop = 6; layout.numColumns = 3; manifestComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); manifestComposite.setLayout(layout); manifestSection.setClient(manifestComposite); Label commandLabel = toolkit.createLabel(manifestComposite, "Command:"); commandLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(commandLabel); commandText = toolkit.createText(manifestComposite, "", SWT.CANCEL | SWT.SEARCH); GridDataFactory.fillDefaults().grab(true, false).applyTo(commandText); commandText.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { if (e.character == SWT.CR || e.character == SWT.LF) { history.add(commandText.getText()); String cmdLine = commandText.getText(); executeCommand(cmdLine); } else if (e.keyCode == SWT.ARROW_UP) { String command = history.back(); commandText.setText(command); commandText.setSelection(command.length()); e.doit = false; } else if (e.keyCode == SWT.ARROW_DOWN) { String command = history.forward(); commandText.setText(command); commandText.setSelection(command.length()); e.doit = false; } } public void keyReleased(KeyEvent e) { } }); Button commandButton = toolkit.createButton(manifestComposite, "Execute", SWT.PUSH); commandButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { history.add(commandText.getText()); String cmdLine = commandText.getText(); executeCommand(cmdLine); } }); Button clearButton = toolkit.createButton(manifestComposite, "Clear", SWT.PUSH); clearButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { manifestText.setText(""); } }); manifestText = new StyledText(manifestComposite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); manifestText.setWordWrap(false); manifestText.setFont(JFaceResources.getTextFont()); GridData data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 3; manifestText.setLayoutData(data); Label helpLabel = toolkit.createLabel(manifestComposite, "Type 'help' to get a list of supported commands."); GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(helpLabel); toolBarManager = sform.getToolBarManager(); backAction = new Action("Back") { @Override public void run() { commandText.setText(history.back()); String cmdLine = commandText.getText(); executeCommand(cmdLine); } }; backAction.setImageDescriptor(ImageResource .getImageDescriptor(org.eclipse.ui.internal.browser.ImageResource.IMG_ELCL_NAV_BACKWARD)); backAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_NAV_BACKWARD)); backAction .setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_NAV_BACKWARD)); backAction.setEnabled(false); toolBarManager.add(backAction); forwardAction = new Action("Forward") { @Override public void run() { commandText.setText(history.forward()); String cmdLine = commandText.getText(); executeCommand(cmdLine); } }; forwardAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_NAV_FORWARD)); forwardAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_NAV_FORWARD)); forwardAction .setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_NAV_FORWARD)); forwardAction.setEnabled(false); toolBarManager.add(forwardAction); refreshAction = new Action("Refresh from server", ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_NAV_REFRESH)) { @Override public void run() { String cmdLine = history.current(); if (cmdLine != null) { executeCommand(cmdLine); } } }; toolBarManager.add(refreshAction); sform.updateToolBar(); }
From source file:org.eclipse.libra.framework.editor.ui.internal.overview.BundleInformationDetailsPart.java
License:Open Source License
public void createContents(Composite parent) { FormToolkit toolkit = getManagedForm().getToolkit(); GridLayout layout = new GridLayout(); layout.marginTop = -5;//from ww w. java 2s .co m layout.marginLeft = 6; parent.setLayout(layout); GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); Section detailsSection = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE); detailsSection.setText("Bundle Details"); detailsSection.setDescription("Details about the selected bundle."); detailsSection.setLayoutData(data); createSectionToolbar(detailsSection, toolkit, new Action("Show dependency graph for bundle", PDEPluginImages.DESC_COMGROUP_OBJ) { @Override public void run() { masterDetailsBlock.openDependencyPage(bundle.getSymbolicName(), bundle.getVersion()); } }); Composite detailsComposite = toolkit.createComposite(detailsSection); layout = new GridLayout(); layout.numColumns = 4; detailsComposite.setLayout(layout); data = new GridData(GridData.FILL_BOTH); data.minimumHeight = 100; data.heightHint = 100; detailsComposite.setLayoutData(data); toolkit.paintBordersFor(detailsComposite); detailsSection.setClient(detailsComposite); Label idLabel = toolkit.createLabel(detailsComposite, "Id:"); idLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); idText = toolkit.createText(detailsComposite, ""); idText.setEditable(false); idText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING)); Label stateLabel = toolkit.createLabel(detailsComposite, "State:"); stateLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); stateText = toolkit.createText(detailsComposite, "", SWT.NONE); stateText.setEditable(false); stateText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING)); Label bundleSymbolicNameLabel = toolkit.createLabel(detailsComposite, "Symbolic-Name:"); bundleSymbolicNameLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); bundleSymbolicNameText = toolkit.createText(detailsComposite, "", SWT.NONE); bundleSymbolicNameText.setEditable(false); bundleSymbolicNameText .setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING)); GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(bundleSymbolicNameText); Label versionLabel = toolkit.createLabel(detailsComposite, "Version:"); versionLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); versionText = toolkit.createText(detailsComposite, ""); versionText.setEditable(false); versionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING)); Label providerLabel = toolkit.createLabel(detailsComposite, "Provider:"); providerLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); providerText = toolkit.createText(detailsComposite, "", SWT.NONE); providerText.setEditable(false); providerText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING)); Label locationLabel = toolkit.createLabel(detailsComposite, "Location:"); locationLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); locationText = toolkit.createText(detailsComposite, "", SWT.NONE); locationText.setEditable(false); locationText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING)); GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(locationText); Link openDependenciesText = new Link(detailsComposite, SWT.NONE); openDependenciesText.setText("<a href=\"open\">Show dependency graph for bundle</a>"); openDependenciesText.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { masterDetailsBlock.openDependencyPage(bundle.getSymbolicName(), bundle.getVersion()); } }); GridDataFactory.fillDefaults().grab(true, false).span(4, 1).applyTo(openDependenciesText); Section manifestSection = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE); manifestSection.setText("Manifest"); manifestSection.setDescription("Displays the bundle manifest."); manifestSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING)); Composite manifestComposite = toolkit.createComposite(manifestSection); layout = new GridLayout(); layout.numColumns = 1; manifestComposite.setLayout(layout); manifestComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); toolkit.paintBordersFor(manifestComposite); manifestSection.setClient(manifestComposite); createSectionToolbar(manifestSection, toolkit, new Action("Open MANIFEST.MF in editor", PDEPluginImages.DESC_TOC_LEAFTOPIC_OBJ) { @Override public void run() { openBundleEditor(bundle); } }); manifestText = toolkit.createText(manifestComposite, "", SWT.MULTI | SWT.WRAP); manifestText.setEditable(false); manifestText.setFont(JFaceResources.getTextFont()); GC gc = new GC(manifestText); FontMetrics fm = gc.getFontMetrics(); int height = 10 * fm.getHeight(); gc.dispose(); data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = manifestText.computeSize(SWT.DEFAULT, height).y; manifestText.setLayoutData(data); Link openManifestText = new Link(manifestComposite, SWT.NONE); openManifestText.setText("<a href=\"open\">Open MANIFEST.MF in editor</a>"); openManifestText.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { openBundleEditor(bundle); } }); Section importsSection = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE); importsSection.setText("Package Imports"); importsSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING)); importsSection.setDescription("Information about visible packages and consumers of those packages."); Composite importsComposite = toolkit.createComposite(importsSection); layout = new GridLayout(); layout.numColumns = 1; importsComposite.setLayout(layout); importsComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); toolkit.paintBordersFor(importsComposite); importsSection.setClient(importsComposite); ImageDescriptor collapseAllImageDescriptor = PlatformUI.getWorkbench().getSharedImages() .getImageDescriptor(ISharedImages.IMG_ELCL_COLLAPSEALL); createSectionToolbar(importsSection, toolkit, new Action("Collapse All", collapseAllImageDescriptor) { @Override public void run() { importsTableViewer.collapseAll(); } }); importsTable = new FilteredTree(importsComposite, SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER, new PatternFilter()); data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = 200; importsTable.getViewer().getControl().setLayoutData(data); importsTableViewer = importsTable.getViewer(); importsTableViewer.setContentProvider(new PackageImportContentProvider()); importsTableViewer.setLabelProvider(new PackageLabelProvider()); importsTableViewer.setAutoExpandLevel(2); Section exportsSection = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE); exportsSection.setText("Package Exports"); exportsSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING)); exportsSection.setDescription("Information about exported packages and bundles that use these packages."); Composite exportsComposite = toolkit.createComposite(exportsSection); layout = new GridLayout(); layout.numColumns = 1; exportsComposite.setLayout(layout); exportsComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); toolkit.paintBordersFor(exportsComposite); exportsSection.setClient(exportsComposite); createSectionToolbar(exportsSection, toolkit, new Action("Collapse All", collapseAllImageDescriptor) { @Override public void run() { exportsTableViewer.collapseAll(); } }); exportsTable = new FilteredTree(exportsComposite, SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER, new PatternFilter()); data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = 200; exportsTable.getViewer().getControl().setLayoutData(data); exportsTableViewer = exportsTable.getViewer(); exportsTableViewer.setContentProvider(new PackageExportContentProvider()); exportsTableViewer.setLabelProvider(new PackageLabelProvider()); exportsTableViewer.setAutoExpandLevel(2); Section servicesSection = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE); servicesSection.setText("Services"); servicesSection.setDescription("Details about registered and in-use services."); servicesSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING)); Composite servicesComposite = toolkit.createComposite(servicesSection); layout = new GridLayout(); layout.numColumns = 1; servicesComposite.setLayout(layout); servicesComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); toolkit.paintBordersFor(servicesComposite); servicesSection.setClient(servicesComposite); createSectionToolbar(servicesSection, toolkit, new Action("Collapse All", collapseAllImageDescriptor) { @Override public void run() { servicesTableViewer.collapseAll(); } }); servicesTable = new FilteredTree(servicesComposite, SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER, new PatternFilter()); data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = 200; servicesTable.getViewer().getControl().setLayoutData(data); servicesTableViewer = servicesTable.getViewer(); servicesTableViewer.setContentProvider(new ServicesContentProvider()); servicesTableViewer.setLabelProvider(new ServicesLabelProvider()); servicesTableViewer.setAutoExpandLevel(2); servicesTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { servicePropertiesTableViewer .setInput(((IStructuredSelection) event.getSelection()).getFirstElement()); } }); Label servicePropertiesLabel = toolkit.createLabel(servicesComposite, "Service Properties:"); servicePropertiesLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); servicePropertiesTable = toolkit.createTable(servicesComposite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = 100; servicePropertiesTable.setLayoutData(data); servicePropertiesTable.setLinesVisible(true); TableColumn keyColumn = new TableColumn(servicePropertiesTable, SWT.LEFT); keyColumn.setText("Key"); keyColumn.setWidth(150); TableColumn valueColumn = new TableColumn(servicePropertiesTable, SWT.LEFT); valueColumn.setText("Value"); valueColumn.setWidth(450); servicePropertiesTable.setHeaderVisible(true); servicePropertiesTableViewer = new TableViewer(servicePropertiesTable); servicePropertiesTableViewer.setContentProvider(new ServicePropertyContentProvider()); servicePropertiesTableViewer.setLabelProvider(new ServicePropertyLabelProvider()); servicePropertiesTableViewer.setComparator(new ServicePropertyComparator()); }
From source file:org.eclipse.linuxtools.dataviewers.dialogs.STDataViewersExportToCSVDialog.java
License:Open Source License
private void createCSVConfigArea(Composite composite) { Group configGroup = new Group(composite, SWT.NONE); configGroup.setText("CSV Configuration"); GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); configGroup.setLayoutData(layoutData); GridLayout layout = new GridLayout(2, false); configGroup.setLayout(layout);// w w w . ja va 2s .c o m Label separatorLabel = new Label(configGroup, SWT.NONE); separatorLabel.setText("CSV Separator:"); layoutData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); separatorLabel.setLayoutData(layoutData); separatorText = new Text(configGroup, SWT.BORDER); separatorText.setFont(JFaceResources.getTextFont()); separatorText.addModifyListener(updatePreviewModifyListener); layoutData = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); separatorText.setLayoutData(layoutData); if (exporter.isTreeViewerExporter()) { expandAllButton = new Button(configGroup, SWT.CHECK); expandAllButton.setText("Expand All"); layoutData = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1); expandAllButton.setLayoutData(layoutData); } else { new Label(configGroup, SWT.NONE).setText(" "); } showHiddenColumnsButton = new Button(configGroup, SWT.CHECK); showHiddenColumnsButton.setText("Export Hidden Columns"); layoutData = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1); showHiddenColumnsButton.setLayoutData(layoutData); }
From source file:org.eclipse.linuxtools.dataviewers.dialogs.STDataViewersExportToCSVDialog.java
License:Open Source License
private void createTreePrefixConfigArea(Composite composite) { Group prefixConfigGroup = new Group(composite, SWT.NONE); prefixConfigGroup.setText("Tree ascii-art drawing"); GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); prefixConfigGroup.setLayoutData(layoutData); GridLayout layout = new GridLayout(5, false); prefixConfigGroup.setLayout(layout); exportTreePrefixButton = new Button(prefixConfigGroup, SWT.CHECK); exportTreePrefixButton.setText("Export ascii-art tree"); exportTreePrefixButton.addSelectionListener(updatePreviewSelectionListener); exportTreePrefixButton.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e);/*from w ww . ja v a 2 s.c o m*/ } public void widgetSelected(SelectionEvent e) { boolean enabled = exportTreePrefixButton.getSelection(); enableTreePrefixText(enabled); } }); layoutData = new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1); exportTreePrefixButton.setLayoutData(layoutData); Label blankLabel = new Label(prefixConfigGroup, SWT.NONE); blankLabel.setText(""); layoutData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1); blankLabel.setLayoutData(layoutData); childLinkLabel = new Label(prefixConfigGroup, SWT.NONE); childLinkLabel.setText("Child Link:"); layoutData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); childLinkLabel.setLayoutData(layoutData); childLinkText = new Text(prefixConfigGroup, SWT.BORDER); childLinkText.setFont(JFaceResources.getTextFont()); childLinkText.addModifyListener(updatePreviewModifyListener); layoutData = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); childLinkText.setLayoutData(layoutData); Label separator = new Label(prefixConfigGroup, SWT.SEPARATOR | SWT.VERTICAL); layoutData = new GridData(SWT.CENTER, SWT.FILL, false, true, 1, 3); separator.setLayoutData(layoutData); noChildLinkLabel = new Label(prefixConfigGroup, SWT.NONE); noChildLinkLabel.setText("No-child Link:"); layoutData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); noChildLinkLabel.setLayoutData(layoutData); noChildLinkText = new Text(prefixConfigGroup, SWT.BORDER); noChildLinkText.setFont(JFaceResources.getTextFont()); noChildLinkText.addModifyListener(updatePreviewModifyListener); layoutData = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); noChildLinkText.setLayoutData(layoutData); childMarkerLabel = new Label(prefixConfigGroup, SWT.NONE); childMarkerLabel.setText("Child Marker:"); layoutData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); childMarkerLabel.setLayoutData(layoutData); childMarkerText = new Text(prefixConfigGroup, SWT.BORDER); childMarkerText.setFont(JFaceResources.getTextFont()); childMarkerText.addModifyListener(updatePreviewModifyListener); layoutData = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); childMarkerText.setLayoutData(layoutData); lastChildMarkerLabel = new Label(prefixConfigGroup, SWT.NONE); lastChildMarkerLabel.setText("Last child Marker:"); layoutData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); lastChildMarkerLabel.setLayoutData(layoutData); lastChildMarkerText = new Text(prefixConfigGroup, SWT.BORDER); lastChildMarkerText.setFont(JFaceResources.getTextFont()); lastChildMarkerText.addModifyListener(updatePreviewModifyListener); layoutData = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); lastChildMarkerText.setLayoutData(layoutData); leafMarkerLabel = new Label(prefixConfigGroup, SWT.NONE); leafMarkerLabel.setText("Leaf Marker:"); layoutData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); leafMarkerLabel.setLayoutData(layoutData); leafMarkerText = new Text(prefixConfigGroup, SWT.BORDER); leafMarkerText.setFont(JFaceResources.getTextFont()); leafMarkerText.addModifyListener(updatePreviewModifyListener); layoutData = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); leafMarkerText.setLayoutData(layoutData); nodeMarkerLabel = new Label(prefixConfigGroup, SWT.NONE); nodeMarkerLabel.setText("Non-leaf Marker:"); layoutData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); nodeMarkerLabel.setLayoutData(layoutData); nodeMarkerText = new Text(prefixConfigGroup, SWT.BORDER); nodeMarkerText.setFont(JFaceResources.getTextFont()); nodeMarkerText.addModifyListener(updatePreviewModifyListener); layoutData = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); nodeMarkerText.setLayoutData(layoutData); }
From source file:org.eclipse.linuxtools.dataviewers.dialogs.STDataViewersExportToCSVDialog.java
License:Open Source License
private void createCSVPreviewArea(Composite composite) { Group previewGroup = new Group(composite, SWT.NONE); previewGroup.setText("Preview"); GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); previewGroup.setLayoutData(layoutData); GridLayout layout = new GridLayout(1, false); previewGroup.setLayout(layout);/*from www. j a v a 2 s . com*/ previewText = new Text(previewGroup, SWT.MULTI | SWT.READ_ONLY | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); previewText.setBackground(new Color(Display.getCurrent(), 255, 255, 255)); previewText.setFont(JFaceResources.getTextFont()); layoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 8); previewText.setLayoutData(layoutData); }
From source file:org.eclipse.m2m.atl.adt.ui.preferences.AtlPreview.java
License:Open Source License
public AtlPreview(Map<String, String> workingValues, Composite parent) { AtlTextTools tools = AtlUIPlugin.getDefault().getTextTools(); document = new Document(); AtlEditor editor = new AtlEditor(); fViewerConfiguration = new AtlSourceViewerConfiguration(tools, editor); fWorkingValues = workingValues;/*from w w w . ja va 2 s . c om*/ int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION; fSourceViewer = new SourceViewer(parent, null, null, false, styles); fSourceViewer.configure(fViewerConfiguration); fSourceViewer.setEditable(false); Cursor arrowCursor = fSourceViewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW); fSourceViewer.getTextWidget().setCursor(arrowCursor); fSourceViewer.getTextWidget().setCaret(null); fSourceViewer.getTextWidget().setFont(JFaceResources.getTextFont()); fSourceViewer.setDocument(document); fPreferenceStore = fViewerConfiguration.getPreferenceStore(); // The margin painter (comment to hide) fMarginPainter = new MarginPainter(fSourceViewer); final RGB rgb = PreferenceConverter.getColor(fPreferenceStore, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR); fMarginPainter.setMarginRulerColor(tools.getColorManager().getColor(rgb)); fSourceViewer.addPainter(fMarginPainter); }
From source file:org.eclipse.m2m.internal.qvt.oml.editor.ui.colorer.QVTColorsConfigurationBlock.java
License:Open Source License
private Control createPreviewer(Composite parent) { IPreferenceStore store = new ChainedPreferenceStore(new IPreferenceStore[] { getPreferenceStore(), Activator.getDefault().getPreferenceStore(), EditorsUI.getPreferenceStore() }); fPreviewViewer = new QvtEditor.SrcViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); QvtConfiguration configuration = new QvtConfiguration(fQVTColorManager, store); fPreviewViewer.configure(configuration); fPreviewViewer.getTextWidget().setFont(JFaceResources.getTextFont()); fPreviewViewer.setEditable(false);/*from ww w.ja va2 s .c o m*/ fPreviewViewer.getTextWidget() .setCursor(fPreviewViewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW)); fPreviewViewer.getTextWidget().setCaret(null); URI uri = URI.createPlatformPluginURI( "/org.eclipse.m2m.qvt.oml.editor.ui/preview/ColorSettingPreviewCode.qvto", true); //$NON-NLS-1$ IDocument document = createPreviewDocument(uri); new QvtDocumentSetupParticipant().setup(document); fPreviewViewer.configure(configuration); fPreviewViewer.setDocument(document); final UnitProxy findUnit = new EclipseUnitResolverFactory().findUnit(uri); assert findUnit != null; try { // TODO - log error on compilation errors QVTOCompiler compiler = new QVTOCompiler(findUnit.getResolver(), new MetamodelRegistryProvider()); final CompiledUnit compiledPreviewUnit = compiler.compile(findUnit, new QvtCompilerOptions(), new BasicMonitor()); final SemanticHighlightingManager semanticHighlightingManager = new SemanticHighlightingManager() { @Override protected SemanticHighlightingReconciler createReconciler() { return new SemanticHighlightingReconciler() { @Override protected CompiledUnit getModel() { return compiledPreviewUnit; } }; } }; semanticHighlightingManager.install(fPreviewViewer, fQVTColorManager, store); semanticHighlightingManager.getReconciler().reconciled(compiledPreviewUnit, new NullProgressMonitor()); fPreviewViewer.invalidateTextPresentation(); hookPreviewUpdater(fPreviewViewer, store, fQVTColorManager); } catch (MdaException e) { Activator.log(e); } return fPreviewViewer.getControl(); }