List of usage examples for org.eclipse.jface.resource JFaceResources getTextFont
public static Font getTextFont()
From source file:org.eclipse.m2m.internal.qvt.oml.editor.ui.colorer.QVTColorsConfigurationBlock.java
License:Open Source License
private void hookPreviewUpdater(final SourceViewer viewer, final IPreferenceStore preferenceStore, final QVTColorManager colorManager) { final org.eclipse.jface.util.IPropertyChangeListener fontChangeListener = new org.eclipse.jface.util.IPropertyChangeListener() { /*// w ww . ja va 2 s .c o m * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(JFaceResources.TEXT_FONT)) { Font font = JFaceResources.getTextFont(); viewer.getTextWidget().setFont(font); } } }; final org.eclipse.jface.util.IPropertyChangeListener propertyChangeListener = new org.eclipse.jface.util.IPropertyChangeListener() { /* * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(final PropertyChangeEvent event) { colorManager.propertyChange(event); viewer.invalidateTextPresentation(); } }; viewer.getTextWidget().addDisposeListener(new DisposeListener() { /* * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent) */ public void widgetDisposed(DisposeEvent e) { preferenceStore.removePropertyChangeListener(propertyChangeListener); JFaceResources.getFontRegistry().removeListener(fontChangeListener); } }); JFaceResources.getFontRegistry().addListener(fontChangeListener); preferenceStore.addPropertyChangeListener(propertyChangeListener); }
From source file:org.eclipse.mylyn.internal.jira.ui.JiraTaskEditor.java
License:Open Source License
public void createPartControl(Composite parent) { FormToolkit toolkit = new FormToolkit(getSite().getShell().getDisplay()); Form form = toolkit.createForm(parent); GridLayout formLayout = new GridLayout(1, true); final Composite formBody = form.getBody(); formBody.setLayout(formLayout);//w ww .j a va 2 s. c o m if (issue == null) { form.setText("Error opening task"); toolkit.createLabel(formBody, "Could not download: " + this.input.getTask().getDescription()); toolkit.createLabel(formBody, "\nTry synchronizing the corresponding query"); return; } form.setText(issue.getKey() + ": " + issue.getSummary()); Section summarySection = toolkit.createSection(formBody, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); summarySection.setText("Attributes"); summarySection.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); summarySection.setExpanded(true); Composite summary = toolkit.createComposite(summarySection); summary.setLayout(new GridLayout(6, false)); Label lblCreated = toolkit.createLabel(summary, "Created:"); lblCreated.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); toolkit.createLabel(summary, DATE_FORMAT.format(issue.getCreated())); Label lblUpdated = toolkit.createLabel(summary, "Updated:"); lblUpdated.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); toolkit.createLabel(summary, DATE_FORMAT.format(issue.getUpdated())); if (issue.getDue() != null) { Label lblDue = toolkit.createLabel(summary, "Due:"); lblDue.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); toolkit.createLabel(summary, DATE_FORMAT.format(issue.getDue())); } else { Label spacer = toolkit.createLabel(summary, ""); spacer.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).create()); } Label lblStatus = toolkit.createLabel(summary, "Status:"); lblStatus.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); toolkit.createLabel(summary, issue.getStatus().getName()); Label lblResolution = toolkit.createLabel(summary, "Resolution:"); lblResolution.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); if (issue.getResolution() != null) { Label resolution = toolkit.createLabel(summary, issue.getResolution().getName()); resolution.setToolTipText(issue.getResolution().getDescription()); } else { toolkit.createLabel(summary, "Unresolved"); } Label lblPriority = toolkit.createLabel(summary, "Priority:"); lblPriority.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); if (issue.getPriority() != null) { Label priority = toolkit.createLabel(summary, issue.getPriority().getName()); priority.setToolTipText(issue.getPriority().getDescription()); } else { toolkit.createLabel(summary, "No Priority"); } Label lblReporter = toolkit.createLabel(summary, "Reporter:"); lblReporter.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); toolkit.createLabel(summary, issue.getReporter()); Label lblAssignee = toolkit.createLabel(summary, "Assignee"); lblAssignee.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); toolkit.createLabel(summary, issue.getAssignee()); // spacer Label spacer2 = toolkit.createLabel(summary, ""); spacer2.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).create()); StringBuffer sbComponents = new StringBuffer(); if (issue.getComponents().length > 0) { for (int i = 0; i < issue.getComponents().length; i++) { if (i != 0) { sbComponents.append(", "); } sbComponents.append(issue.getComponents()[i].getName()); } } else { sbComponents.append("None"); } Label lblComponents = toolkit.createLabel(summary, "Components"); lblComponents.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); toolkit.createLabel(summary, sbComponents.toString()); StringBuffer sbAffectsVersions = new StringBuffer(); if (issue.getReportedVersions().length > 0) { for (int i = 0; i < issue.getReportedVersions().length; i++) { if (i != 0) { sbAffectsVersions.append(", "); } sbAffectsVersions.append(issue.getReportedVersions()[i].getName()); } } else { sbAffectsVersions.append("None"); } Label lblAffectsVersion = toolkit.createLabel(summary, "Affects Versions"); lblAffectsVersion.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); toolkit.createLabel(summary, sbAffectsVersions.toString()); StringBuffer sbFixVersions = new StringBuffer(); if (issue.getFixVersions().length > 0) { for (int i = 0; i < issue.getFixVersions().length; i++) { if (i != 0) { sbFixVersions.append(", "); } sbFixVersions.append(issue.getFixVersions()[i].getName()); } } else { sbFixVersions.append("None"); } Label lblFixVersions = toolkit.createLabel(summary, "Fix Versions"); lblFixVersions.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); toolkit.createLabel(summary, sbFixVersions.toString()); summarySection.setClient(summary); // created, updated, due (optional) final Section descriptionSection = toolkit.createSection(formBody, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); descriptionSection.setExpanded(true); descriptionSection.setText("Description"); final GridData dgd = GridDataFactory.fillDefaults().grab(true, false).create(); descriptionSection.setLayoutData(dgd); Composite c = toolkit.createComposite(descriptionSection); GridLayout gl = new GridLayout(1, true); gl.marginHeight = 0; gl.marginWidth = 0; c.setLayout(gl); Text description = toolkit.createText(c, issue.getDescription(), SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); description.setLayoutData( GridDataFactory.fillDefaults().grab(true, false).minSize(200, 80).hint(200, 80).create()); description.setText(issue.getDescription()); description.setEditable(false); description.setFont(JFaceResources.getTextFont()); descriptionSection.setClient(c); commentsSection = toolkit.createSection(formBody, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); commentsSection.setExpanded(true); ImageHyperlink sortOrder = toolkit.createImageHyperlink(commentsSection, SWT.NONE); sortOrder.setText("Direction"); commentsSection.setTextClient(sortOrder); commentsSection.setText("Comments"); commentsSection.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); sc = new ScrolledComposite(commentsSection, SWT.H_SCROLL | SWT.V_SCROLL); sc.setExpandHorizontal(true); sc.setExpandVertical(true); sc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); final Composite c1 = toolkit.createComposite(sc); GridLayout commentsLayout = new GridLayout(1, true); commentsLayout.marginWidth = 0; commentsLayout.marginHeight = 0; c1.setLayout(commentsLayout); for (int i = 0; i < issue.getComments().length; i++) { Comment comment = issue.getComments()[i]; ExpandableComposite expandableComposite = toolkit.createExpandableComposite(c1, ExpandableComposite.TREE_NODE); expandableComposite.setText( "Comment by " + comment.getAuthor() + " [" + DATE_FORMAT.format(comment.getCreated()) + "]"); expandableComposite.setLayout(new FillLayout(SWT.HORIZONTAL)); expandableComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); Text t = toolkit.createText(expandableComposite, comment.getComment(), SWT.MULTI | SWT.WRAP); t.setEditable(false); t.setFont(JFaceResources.getTextFont()); expandableComposite.setClient(t); expandableComposite.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { sc.layout(true, true); } }); commentToControlMap.put(comment, expandableComposite); t.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); if (i == issue.getComments().length - 1) { expandableComposite.setExpanded(true); } } commentsSection.setClient(sc); sc.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent e) { Point size = c1.computeSize(sc.getClientArea().width, SWT.DEFAULT); sc.setMinSize(size); } }); final Section commentSection = toolkit.createSection(formBody, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR); commentSection.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); commentSection.setText("Add Comment"); commentSection.setExpanded(false); commentSection.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { formBody.layout(true); } }); final Composite commentArea = toolkit.createComposite(commentSection); GridLayout commentAreaLayout = new GridLayout(1, false); commentAreaLayout.marginHeight = 0; commentAreaLayout.marginWidth = 0; commentAreaLayout.verticalSpacing = 0; commentAreaLayout.horizontalSpacing = 0; commentArea.setLayout(commentAreaLayout); commentSection.setClient(commentArea); comment = new Text(commentArea, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); comment.setFont(JFaceResources.getTextFont()); final GridData commentGd = new GridData(SWT.FILL, SWT.FILL, true, false); commentGd.heightHint = 80; comment.setLayoutData(commentGd); comment.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { int charCount = comment.getCharCount(); if (charCount > 0) { isDirty = true; // if ((isDirty && charCount == 0) || (!isDirty && charCount > 0)) { firePropertyChange(PROP_DIRTY); } } }); sc.setContent(c1); sc.setMinSize(c1.computeSize(SWT.DEFAULT, SWT.DEFAULT)); }
From source file:org.eclipse.osee.framework.ui.branch.graph.figure.FigureFactory.java
License:Open Source License
private static IFigure createNoteFigure(String shortName, String name, String author, Date date, String comment) {/*from www .j av a 2 s .com*/ FrameFigure contents = new FrameFigure(); contents.setLayoutManager(new GridLayout(2, false)); contents.setBackgroundColor(GraphColorConstants.BGCOLOR); Font labelFont = JFaceResources.getTextFont(); Font textFont = JFaceResources.getDefaultFont(); contents.setLabel(" " + shortName + " "); contents.setLabelFont(JFaceResources.getTextFont()); contents.setFont(textFont); contents.add(createLabel("Branch", labelFont, GraphColorConstants.FONT_COLOR)); contents.add(createLabel(name, textFont)); contents.add(createLabel("Author", labelFont, GraphColorConstants.FONT_COLOR)); contents.add(createLabel(author, textFont)); contents.add(createLabel("Date", labelFont, GraphColorConstants.FONT_COLOR)); contents.add(createLabel(GraphTextFormat.formatDate(date), textFont)); contents.add(createLabel("Message", labelFont, GraphColorConstants.FONT_COLOR)); contents.add(createLabel(comment, textFont)); contents.setPreferredSize(contents.getPreferredSize()); return contents; }
From source file:org.eclipse.pde.emfforms.internal.editor.SimpleSourcePage.java
License:Open Source License
@Override public SourceViewer createSourceViewer(Composite parent) { SourceViewer sourceViewer = new SourceViewer(parent, new VerticalRuler(VERTICAL_RULER_WIDTH), SWT.V_SCROLL | SWT.WRAP);/*from w w w. ja va 2 s . co m*/ sourceViewer.getTextWidget().setFont(JFaceResources.getTextFont()); sourceViewer.configure(new TextSourceViewerConfiguration()); sourceViewer.setDocument(new Document()); sourceViewer.setEditable(false); return sourceViewer; }
From source file:org.eclipse.pde.internal.ui.editor.feature.InfoSection.java
License:Open Source License
/** * @param toolkit/*from www .j a v a 2 s . com*/ * @param parent */ private Control createInfoPage(FormToolkit toolkit, Composite parent) { Composite page = toolkit.createComposite(parent); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginWidth = 2; layout.marginHeight = 5; layout.verticalSpacing = 8; page.setLayout(layout); GridData gd; Label label = toolkit.createLabel(page, PDEUIMessages.FeatureEditor_InfoSection_url); label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); fUrlText = toolkit.createText(page, null, SWT.SINGLE); fUrlText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { infoModified(); } }); gd = new GridData(GridData.FILL_HORIZONTAL); fUrlText.setLayoutData(gd); label = toolkit.createLabel(page, PDEUIMessages.FeatureEditor_InfoSection_text); label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); label.setLayoutData(gd); int styles = SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL; fSourceViewer = new SourceViewer(page, null, styles); fSourceViewer.configure(fSourceConfiguration); fSourceViewer.setDocument(fDocument); fSourceViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { updateSelection(event.getSelection()); } }); StyledText styledText = fSourceViewer.getTextWidget(); styledText.setFont(JFaceResources.getTextFont()); styledText.setMenu(getPage().getPDEEditor().getContextMenu()); styledText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); // if (SWT.getPlatform().equals("motif") == false) //$NON-NLS-1$ toolkit.paintBordersFor(page); Control[] children = page.getChildren(); Control control = children[children.length - 1]; gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL); gd.widthHint = 50; gd.heightHint = 50; control.setLayoutData(gd); return page; }
From source file:org.eclipse.pde.internal.ui.editor.feature.LicenseFeatureSection.java
License:Open Source License
/** * Creates the UI in the given section using the provided toolkit * @param toolkit/*from w w w . j a v a2s . co m*/ * @param parent */ public void createClient(Section section, FormToolkit toolkit) { Composite page = toolkit.createComposite(section); final StackLayout stackLayout = new StackLayout(); GridLayout layout = FormLayoutFactory.createClearGridLayout(false, 2); layout.horizontalSpacing = 8; page.setLayout(layout); fSharedLicenseButton = toolkit.createButton(page, PDEUIMessages.FeatureEditor_licenseFeatureSection_sharedButton, SWT.RADIO); fLocalLicenseButton = toolkit.createButton(page, PDEUIMessages.FeatureEditor_licenseFeatureSection_localButton, SWT.RADIO); GridData gd = new GridData(); gd.horizontalIndent = 5; fLocalLicenseButton.setLayoutData(gd); final Composite sectionsComposite = toolkit.createComposite(page); gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 2; sectionsComposite.setLayoutData(gd); sectionsComposite.setLayout(stackLayout); // Shared Section final Composite licenseFeatureComposite = toolkit.createComposite(sectionsComposite); gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 2; licenseFeatureComposite.setLayoutData(gd); layout = new GridLayout(); layout.numColumns = 3; layout.marginWidth = 2; layout.marginHeight = 5; layout.verticalSpacing = 8; licenseFeatureComposite.setLayout(layout); Label label = toolkit.createLabel(licenseFeatureComposite, PDEUIMessages.FeatureEditor_licenseFeatureSection_featureID); label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); fLicenseFeatureIDText = toolkit.createText(licenseFeatureComposite, null, SWT.SINGLE); fLicenseFeatureIDText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { infoModified(); } }); fLicenseFeatureIDText.setEditable(true); gd = new GridData(GridData.FILL_HORIZONTAL); fLicenseFeatureIDText.setLayoutData(gd); fLicenseButton = toolkit.createButton(licenseFeatureComposite, PDEUIMessages.FeatureEditor_licenseFeatureSection_browse, SWT.PUSH); fLicenseButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleSelect(); } }); label = toolkit.createLabel(licenseFeatureComposite, PDEUIMessages.FeatureEditor_licenseFeatureSection_featureVersion); label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); fLicenseFeatureVersionText = toolkit.createText(licenseFeatureComposite, null, SWT.SINGLE); fLicenseFeatureVersionText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { infoModified(); } }); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; fLicenseFeatureVersionText.setLayoutData(gd); // Local Section final Composite localLicenseComposite = toolkit.createComposite(sectionsComposite); gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 2; localLicenseComposite.setLayoutData(gd); layout = new GridLayout(); layout.numColumns = 2; layout.marginWidth = 2; layout.marginHeight = 5; layout.verticalSpacing = 8; localLicenseComposite.setLayout(layout); label = toolkit.createLabel(localLicenseComposite, PDEUIMessages.FeatureEditor_InfoSection_url); label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); fUrlText = toolkit.createText(localLicenseComposite, null, SWT.SINGLE); fUrlText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { infoModified(); } }); gd = new GridData(GridData.FILL_HORIZONTAL); fUrlText.setLayoutData(gd); label = toolkit.createLabel(localLicenseComposite, PDEUIMessages.FeatureEditor_InfoSection_text); label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); label.setLayoutData(gd); int styles = SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL; fSourceViewer = new SourceViewer(localLicenseComposite, null, styles); fSourceViewer.configure(fSourceConfiguration); fSourceViewer.setDocument(fDocument); fSourceViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { updateSelection(event.getSelection()); } }); StyledText styledText = fSourceViewer.getTextWidget(); styledText.setFont(JFaceResources.getTextFont()); styledText.setMenu(getPage().getPDEEditor().getContextMenu()); styledText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); fDocument.addDocumentListener(new IDocumentListener() { public void documentChanged(DocumentEvent e) { infoModified(); } public void documentAboutToBeChanged(DocumentEvent e) { } }); if (SWT.getPlatform().equals("motif") == false) { //$NON-NLS-1$ toolkit.paintBordersFor(localLicenseComposite); } gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL); gd.widthHint = 50; gd.heightHint = 50; styledText.setLayoutData(gd); fSharedLicenseButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (((Button) e.widget).getSelection()) { stackLayout.topControl = licenseFeatureComposite; sectionsComposite.layout(); } } }); fLocalLicenseButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (((Button) e.widget).getSelection()) { stackLayout.topControl = localLicenseComposite; sectionsComposite.layout(); } } }); section.setClient(page); IFeatureModel model = (IFeatureModel) getPage().getModel(); IFeature feature = model.getFeature(); if (feature.getLicenseFeatureID() == null || feature.getLicenseFeatureID().length() == 0) { fLocalLicenseButton.setSelection(true); fSharedLicenseButton.setSelection(false); stackLayout.topControl = localLicenseComposite; } else { fLocalLicenseButton.setSelection(false); fSharedLicenseButton.setSelection(true); stackLayout.topControl = licenseFeatureComposite; } model.addModelChangedListener(this); toolkit.paintBordersFor(licenseFeatureComposite); }
From source file:org.eclipse.pde.internal.ui.editor.schema.DocSection.java
License:Open Source License
public void createClient(Section section, FormToolkit toolkit) { Composite container = toolkit.createComposite(section); container.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 1)); GridData data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 2;/*from w w w. j av a 2 s . c o m*/ section.setLayoutData(data); fTabFolder = new CTabFolder(container, SWT.FLAT | SWT.TOP); toolkit.adapt(fTabFolder, true, true); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.heightHint = 2; fTabFolder.setLayoutData(gd); toolkit.getColors().initializeSectionToolBarColors(); Color selectedColor = toolkit.getColors().getColor(IFormColors.TB_BG); fTabFolder.setSelectionBackground(new Color[] { selectedColor, toolkit.getColors().getBackground() }, new int[] { 100 }, true); fTabFolder.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateTabSelection(); } }); int styles = SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL; fSourceViewer = new SourceViewer(container, null, styles); fSourceViewer.configure(fSourceConfiguration); fSourceViewer.setDocument(fDocument); fSourceViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { updateSelection(event.getSelection()); } }); StyledText styledText = fSourceViewer.getTextWidget(); styledText.setFont(JFaceResources.getTextFont()); styledText.setMenu(getPage().getPDEEditor().getContextMenu()); styledText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); styledText.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent e) { getPage().getPDEEditor().getContributor().updateSelectableActions(null); } }); if (SWT.getPlatform().equals("motif") == false) //$NON-NLS-1$ toolkit.paintBordersFor(container); Control[] children = container.getChildren(); Control control = children[children.length - 1]; gd = new GridData(GridData.FILL_BOTH); gd.widthHint = 50; gd.heightHint = 50; control.setLayoutData(gd); createTabs(); section.setClient(container); initialize(); if (fTabFolder.getItemCount() > 0) { fTabFolder.setSelection(0); updateTabSelection(); } }
From source file:org.eclipse.pde.internal.ui.nls.ExternalizeStringsWizardPage.java
License:Open Source License
private void createSourceViewer(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setLayout(new GridLayout()); Label label = new Label(composite, SWT.NONE); label.setText(PDEUIMessages.ExternalizeStringsWizardPage_sourceLabel); label.setLayoutData(new GridData()); fSourceViewer = new SourceViewer(composite, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); fSourceViewer.setEditable(false);// www . ja v a2 s . c o m fSourceViewer.getTextWidget().setFont(JFaceResources.getTextFont()); fSourceViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); fEmptyDoc = new Document(); fSourceViewer.setDocument(fEmptyDoc); }
From source file:org.eclipse.photran.internal.ui.browser.AnnotationsTab.java
License:Open Source License
private void createStyledText() { styledText = new StyledText(annotationsSash, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY); GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.FILL; gridData.grabExcessVerticalSpace = true; gridData.grabExcessHorizontalSpace = true; gridData.horizontalSpan = 3;//from w w w.ja va 2s. c o m gridData.verticalSpan = 1; styledText.setLayoutData(gridData); styledText.setFont(JFaceResources.getTextFont()); styledText.addPaintListener(new RectanglePainter(styledText)); styledText.addCaretListener(new ShowEdgeCaretListener()); }
From source file:org.eclipse.photran.internal.ui.browser.EdgesTab.java
License:Open Source License
private void createStyledText() { styledText = new StyledText(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY); GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.FILL; gridData.grabExcessVerticalSpace = true; gridData.grabExcessHorizontalSpace = true; gridData.horizontalSpan = 3;//from w w w .j ava 2 s . c o m gridData.verticalSpan = 1; styledText.setLayoutData(gridData); styledText.setFont(JFaceResources.getTextFont()); styledText.addPaintListener(new EdgePainter(styledText)); styledText.addCaretListener(new ShowEdgeCaretListener()); }