Example usage for org.eclipse.jface.resource JFaceResources getFont

List of usage examples for org.eclipse.jface.resource JFaceResources getFont

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources getFont.

Prototype

public static Font getFont(String symbolicName) 

Source Link

Document

Returns the font in JFace's font registry with the given symbolic font name.

Usage

From source file:org.eclipse.jst.jsp.ui.internal.preferences.ui.JSPSyntaxColoringPage.java

License:Open Source License

protected Control createContents(final Composite parent) {
    initializeDialogUnits(parent);//from  w w w . j  av  a  2 s .  co m

    fDefaultForeground = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND);
    fDefaultBackground = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
    Composite pageComponent = createComposite(parent, 2);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(pageComponent,
            IHelpContextIds.JSP_PREFWEBX_STYLES_HELPID);

    Link link = new Link(pageComponent, SWT.WRAP);
    link.setText(SSEUIMessages.SyntaxColoring_Link);
    link.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            PreferencesUtil.createPreferenceDialogOn(parent.getShell(), e.text, null, null);
        }
    });

    GridData linkData = new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1);
    linkData.widthHint = 150; // only expand further if anyone else requires it
    link.setLayoutData(linkData);

    new Label(pageComponent, SWT.NONE).setLayoutData(new GridData());
    new Label(pageComponent, SWT.NONE).setLayoutData(new GridData());

    SashForm editor = new SashForm(pageComponent, SWT.VERTICAL);
    GridData gridData2 = new GridData(SWT.FILL, SWT.FILL, true, true);
    gridData2.horizontalSpan = 2;
    editor.setLayoutData(gridData2);
    SashForm top = new SashForm(editor, SWT.HORIZONTAL);
    Composite styleEditor = createComposite(top, 1);
    ((GridLayout) styleEditor.getLayout()).marginRight = 5;
    ((GridLayout) styleEditor.getLayout()).marginLeft = 0;
    createLabel(styleEditor, JSPUIMessages.SyntaxColoringPage_0);
    fStylesViewer = createStylesViewer(styleEditor);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    gridData.horizontalIndent = 0;
    Iterator iterator = fStyleToDescriptionMap.values().iterator();
    while (iterator.hasNext()) {
        gridData.widthHint = Math.max(gridData.widthHint,
                convertWidthInCharsToPixels(iterator.next().toString().length()));
    }
    gridData.heightHint = convertHeightInCharsToPixels(5);
    fStylesViewer.getControl().setLayoutData(gridData);

    Composite editingComposite = createComposite(top, 1);
    ((GridLayout) styleEditor.getLayout()).marginLeft = 5;
    createLabel(editingComposite, ""); //$NON-NLS-1$
    Button enabler = createCheckbox(editingComposite, JSPUIMessages.SyntaxColoringPage_2);
    enabler.setEnabled(false);
    enabler.setSelection(true);
    Composite editControls = createComposite(editingComposite, 2);
    ((GridLayout) editControls.getLayout()).marginLeft = 20;

    fForegroundLabel = createLabel(editControls, SSEUIMessages.Foreground_UI_);
    ((GridData) fForegroundLabel.getLayoutData()).verticalAlignment = SWT.CENTER;
    fForegroundLabel.setEnabled(false);

    fForegroundColorEditor = new ColorSelector(editControls);
    Button fForegroundColor = fForegroundColorEditor.getButton();
    GridData gd = new GridData(SWT.BEGINNING, SWT.FILL, false, false);
    fForegroundColor.setLayoutData(gd);
    fForegroundColorEditor.setEnabled(false);
    fForegroundColorEditor.getButton().getAccessible().addAccessibleListener(new AccessibleAdapter() {
        public void getName(final AccessibleEvent e) {
            e.result = SSEUIMessages.Foreground_Color_Selector_Button;
        }
    });

    fBackgroundLabel = createLabel(editControls, SSEUIMessages.Background_UI_);
    ((GridData) fBackgroundLabel.getLayoutData()).verticalAlignment = SWT.CENTER;
    fBackgroundLabel.setEnabled(false);

    fBackgroundColorEditor = new ColorSelector(editControls);
    Button fBackgroundColor = fBackgroundColorEditor.getButton();
    gd = new GridData(SWT.BEGINNING, SWT.FILL, false, false);
    fBackgroundColor.setLayoutData(gd);
    fBackgroundColorEditor.setEnabled(false);
    fBackgroundColorEditor.getButton().getAccessible().addAccessibleListener(new AccessibleAdapter() {
        public void getName(final AccessibleEvent e) {
            e.result = SSEUIMessages.Background_Color_Selector_Button;
        }
    });

    fBold = createCheckbox(editControls, JSPUIMessages.SyntaxColoringPage_3);
    fBold.setEnabled(false);
    ((GridData) fBold.getLayoutData()).horizontalSpan = 2;
    fItalic = createCheckbox(editControls, JSPUIMessages.SyntaxColoringPage_4);
    fItalic.setEnabled(false);
    ((GridData) fItalic.getLayoutData()).horizontalSpan = 2;
    fStrike = createCheckbox(editControls, JSPUIMessages.SyntaxColoringPage_5);
    fStrike.setEnabled(false);
    ((GridData) fStrike.getLayoutData()).horizontalSpan = 2;
    fUnderline = createCheckbox(editControls, JSPUIMessages.SyntaxColoringPage_6);
    fUnderline.setEnabled(false);
    ((GridData) fUnderline.getLayoutData()).horizontalSpan = 2;
    fClearStyle = new Button(editingComposite, SWT.PUSH);
    fClearStyle.setText(SSEUIMessages.Restore_Default_UI_); //$NON-NLS-1$ = "Restore Default"
    fClearStyle.setLayoutData(new GridData(SWT.BEGINNING));
    ((GridData) fClearStyle.getLayoutData()).horizontalIndent = 20;
    fClearStyle.setEnabled(false);

    Composite sampleArea = createComposite(editor, 1);

    ((GridLayout) sampleArea.getLayout()).marginLeft = 5;
    ((GridLayout) sampleArea.getLayout()).marginTop = 5;
    createLabel(sampleArea, SSEUIMessages.Sample_text__UI_); //$NON-NLS-1$ = "&Sample text:"
    fPreviewViewer = new SourceViewer(sampleArea, null,
            SWT.BORDER | SWT.LEFT_TO_RIGHT | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY);
    fText = fPreviewViewer.getTextWidget();
    GridData gridData3 = new GridData(SWT.FILL, SWT.FILL, true, true);
    gridData3.widthHint = convertWidthInCharsToPixels(20);
    gridData3.heightHint = convertHeightInCharsToPixels(5);
    gridData3.horizontalSpan = 2;
    fText.setLayoutData(gridData3);
    fText.setEditable(false);
    fText.setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
    fText.addKeyListener(getTextKeyListener());
    fText.addSelectionListener(getTextSelectionListener());
    fText.addMouseListener(getTextMouseListener());
    fText.addTraverseListener(getTraverseListener());
    setAccessible(fText, SSEUIMessages.Sample_text__UI_);
    fDocument = StructuredModelManager.getModelManager()
            .createStructuredDocumentFor(ContentTypeIdForJSP.ContentTypeID_JSP);
    fDocument.set(getExampleText());
    initializeSourcePreviewColors(fPreviewViewer);
    fPreviewViewer.setDocument(fDocument);

    top.setWeights(new int[] { 1, 1 });
    editor.setWeights(new int[] { 1, 1 });
    PlatformUI.getWorkbench().getHelpSystem().setHelp(pageComponent,
            IHelpContextIds.JSP_PREFWEBX_STYLES_HELPID);

    fStylesViewer.setInput(getStylePreferenceKeys());

    applyStyles();

    fStylesViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            if (!event.getSelection().isEmpty()) {
                Object o = ((IStructuredSelection) event.getSelection()).getFirstElement();
                String namedStyle = o.toString();
                activate(namedStyle);
                if (namedStyle == null)
                    return;
            }
        }
    });

    fForegroundColorEditor.addListener(new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (event.getProperty().equals(ColorSelector.PROP_COLORCHANGE)) {
                Object o = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement();
                String namedStyle = o.toString();
                String prefString = getOverlayStore().getString(namedStyle);
                String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
                if (stylePrefs != null) {
                    String oldValue = stylePrefs[0];
                    // open color dialog to get new color
                    String newValue = ColorHelper.toRGBString(fForegroundColorEditor.getColorValue());

                    if (!newValue.equals(oldValue)) {
                        stylePrefs[0] = newValue;
                        String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
                        getOverlayStore().setValue(namedStyle, newPrefString);
                        applyStyles();
                        fText.redraw();
                    }
                }
            }
        }
    });

    fBackgroundColorEditor.addListener(new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (event.getProperty().equals(ColorSelector.PROP_COLORCHANGE)) {
                Object o = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement();
                String namedStyle = o.toString();
                String prefString = getOverlayStore().getString(namedStyle);
                String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
                if (stylePrefs != null) {
                    String oldValue = stylePrefs[1];
                    // open color dialog to get new color
                    String newValue = ColorHelper.toRGBString(fBackgroundColorEditor.getColorValue());

                    if (!newValue.equals(oldValue)) {
                        stylePrefs[1] = newValue;
                        String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
                        getOverlayStore().setValue(namedStyle, newPrefString);
                        applyStyles();
                        fText.redraw();
                        activate(namedStyle);
                    }
                }
            }
        }
    });

    fBold.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            super.widgetSelected(e);
            // get current (newly old) style
            Object o = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement();
            String namedStyle = o.toString();
            String prefString = getOverlayStore().getString(namedStyle);
            String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
            if (stylePrefs != null) {
                String oldValue = stylePrefs[2];
                String newValue = String.valueOf(fBold.getSelection());
                if (!newValue.equals(oldValue)) {
                    stylePrefs[2] = newValue;
                    String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
                    getOverlayStore().setValue(namedStyle, newPrefString);
                    applyStyles();
                    fText.redraw();
                }
            }
        }
    });

    fItalic.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            super.widgetSelected(e);
            // get current (newly old) style
            Object o = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement();
            String namedStyle = o.toString();
            String prefString = getOverlayStore().getString(namedStyle);
            String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
            if (stylePrefs != null) {
                String oldValue = stylePrefs[3];
                String newValue = String.valueOf(fItalic.getSelection());
                if (!newValue.equals(oldValue)) {
                    stylePrefs[3] = newValue;
                    String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
                    getOverlayStore().setValue(namedStyle, newPrefString);
                    applyStyles();
                    fText.redraw();
                }
            }
        }
    });

    fStrike.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            super.widgetSelected(e);
            // get current (newly old) style
            Object o = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement();
            String namedStyle = o.toString();
            String prefString = getOverlayStore().getString(namedStyle);
            String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
            if (stylePrefs != null) {
                String oldValue = stylePrefs[4];
                String newValue = String.valueOf(fStrike.getSelection());
                if (!newValue.equals(oldValue)) {
                    stylePrefs[4] = newValue;
                    String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
                    getOverlayStore().setValue(namedStyle, newPrefString);
                    applyStyles();
                    fText.redraw();
                }
            }
        }
    });

    fUnderline.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            super.widgetSelected(e);
            // get current (newly old) style
            Object o = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement();
            String namedStyle = o.toString();
            String prefString = getOverlayStore().getString(namedStyle);
            String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
            if (stylePrefs != null) {
                String oldValue = stylePrefs[5];
                String newValue = String.valueOf(fUnderline.getSelection());
                if (!newValue.equals(oldValue)) {
                    stylePrefs[5] = newValue;
                    String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
                    getOverlayStore().setValue(namedStyle, newPrefString);
                    applyStyles();
                    fText.redraw();
                }
            }
        }
    });

    fClearStyle.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            if (fStylesViewer.getSelection().isEmpty())
                return;
            String namedStyle = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement()
                    .toString();
            getOverlayStore().setToDefault(namedStyle);
            applyStyles();
            fText.redraw();
            activate(namedStyle);
        }
    });

    return pageComponent;
}

From source file:org.eclipse.jst.jsp.ui.internal.preferences.ui.JSPTemplatePreferencePage.java

License:Open Source License

SourceViewer doCreateViewer(Composite parent, SourceViewerConfiguration viewerConfiguration) {
    SourceViewer viewer = null;/*  w w  w.  j  a  v  a2 s. c  om*/
    String contentTypeID = ContentTypeIdForJSP.ContentTypeID_JSP;
    viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
    IStructuredModel scratchModel = StructuredModelManager.getModelManager()
            .createUnManagedStructuredModelFor(contentTypeID);
    IDocument document = scratchModel.getStructuredDocument();
    viewer.configure(viewerConfiguration);
    viewer.setDocument(document);
    return viewer;
}

From source file:org.eclipse.jst.jsp.ui.internal.wizard.NewJSPTemplatesWizardPage.java

License:Open Source License

/**
 * Creates, configures and returns a source viewer to present the template
 * pattern on the preference page. Clients may override to provide a
 * custom source viewer featuring e.g. syntax coloring.
 * /* ww  w .  j a v  a  2  s .c o m*/
 * @param parent
 *            the parent control
 * @return a configured source viewer
 */
private SourceViewer createViewer(Composite parent) {
    SourceViewerConfiguration sourceViewerConfiguration = new StructuredTextViewerConfiguration() {
        StructuredTextViewerConfiguration baseConfiguration = new StructuredTextViewerConfigurationJSP();

        public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
            return baseConfiguration.getConfiguredContentTypes(sourceViewer);
        }

        public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) {
            return baseConfiguration.getLineStyleProviders(sourceViewer, partitionType);
        }
    };
    SourceViewer viewer = new StructuredTextViewer(parent, null, null, false,
            SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
    IStructuredModel scratchModel = StructuredModelManager.getModelManager()
            .createUnManagedStructuredModelFor(ContentTypeIdForJSP.ContentTypeID_JSP);
    IDocument document = scratchModel.getStructuredDocument();
    viewer.configure(sourceViewerConfiguration);
    viewer.setDocument(document);
    return viewer;
}

From source file:org.eclipse.jst.jsp.ui.internal.wizard.NewTagTemplatesWizardPage.java

License:Open Source License

/**
 * Creates, configures and returns a source viewer to present the template
 * pattern on the preference page. Clients may override to provide a
 * custom source viewer featuring e.g. syntax coloring.
 * //from ww  w. j a  va2s  . c o m
 * @param parent
 *            the parent control
 * @return a configured source viewer
 */
private SourceViewer createViewer(Composite parent) {
    SourceViewerConfiguration sourceViewerConfiguration = new StructuredTextViewerConfiguration() {
        StructuredTextViewerConfiguration baseConfiguration = new StructuredTextViewerConfigurationJSP();

        public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
            return baseConfiguration.getConfiguredContentTypes(sourceViewer);
        }

        public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) {
            return baseConfiguration.getLineStyleProviders(sourceViewer, partitionType);
        }
    };
    SourceViewer viewer = new StructuredTextViewer(parent, null, null, false,
            SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
    IStructuredModel scratchModel = StructuredModelManager.getModelManager()
            .createUnManagedStructuredModelFor(ContentTypeIdForJSP.ContentTypeID_JSPTAG);
    IDocument document = scratchModel.getStructuredDocument();
    viewer.configure(sourceViewerConfiguration);
    viewer.setDocument(document);
    return viewer;
}

From source file:org.eclipse.jst.jsp.ui.tests.viewer.ViewerTestJSP.java

License:Open Source License

/**
 * Set up source viewer with any additional preferences it should have Ex:
 * font, tab width/*  w w  w. j a  v a  2  s  . c o  m*/
 */
private void setupViewerPreferences() {
    fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(SSE_EDITOR_FONT));
}

From source file:org.eclipse.linuxtools.internal.oprofile.ui.view.OcountView.java

License:Open Source License

@Override
public void createPartControl(Composite parent) {
    viewer = new TextViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    viewer.setEditable(false);//  w ww. j  av  a  2  s. c  om
    viewer.getTextWidget().setFont(JFaceResources.getFont(IDebugUIConstants.PREF_DETAIL_PANE_FONT));
    Control control = viewer.getControl();
    GridData gd = new GridData(GridData.FILL_BOTH);
    control.setLayoutData(gd);
    Document d = new Document(text);
    viewer.setDocument(d);
    viewer.refresh();
    OprofileUiPlugin.getDefault().setOcountView(this);
    this.parent = parent;
}

From source file:org.eclipse.linuxtools.internal.perf.ui.ReportComparisonView.java

License:Open Source License

/**
 * Set properties for StlyedText widget.
 * @param input String StyledText content.
 *//*  ww  w.j  a  v a  2s.c om*/
private void setStyledText(String input) {
    result.setText(input);
    result.setJustify(true);
    result.setAlignment(SWT.LEFT);

    result.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));

    List<StyleRange> styles = new ArrayList<>();
    int ptr = 0;
    String[] lines = input.split("\n"); //$NON-NLS-1$

    for (String line : lines) {
        if (Pattern.matches(DIFF_ENTRY, line)) {
            Matcher m = Pattern.compile(DIFF_ENTRY).matcher(line);
            if (m.matches() && m.group(1) != null && m.group(3) != null) {
                try {
                    float baseline = Float.parseFloat(m.group(1).trim());
                    float delta = Float.parseFloat(m.group(3).trim());
                    if (baseline > 1 && Math.abs(delta) > 1) {
                        StyleRange curStyleRange;
                        if (delta < 0) {
                            curStyleRange = delta < -5 ? new StyleRange(ptr, line.length(), LIGHT_GREEN, null)
                                    : new StyleRange(ptr, line.length(), GREEN, null);
                        } else {
                            curStyleRange = delta < 5 ? new StyleRange(ptr, line.length(), ORANGE, null)
                                    : new StyleRange(ptr, line.length(), RED, null);
                        }
                        styles.add(curStyleRange);
                    }
                } catch (NumberFormatException e) {
                    // set no StyleRange
                }
            }
        }
        // + 1 to skip over the '\n' at EOL that the tokenizer eats
        ptr += line.length() + 1;
    }

    result.setStyleRanges(styles.toArray(new StyleRange[0]));
}

From source file:org.eclipse.linuxtools.internal.perf.ui.StatComparisonView.java

License:Open Source License

/**
 * Set String input in text display. Adapted from
 * org.eclipse.linuxtools.internal.perf.ui.SourceDisassemblyView.
 *
 * @param input text to display/*from  www .  ja va 2s .  com*/
 */
private void setStyledText(String input) {
    text.setText(input);
    text.setAlignment(SWT.LEFT);
    // set default TextConsole font (monospaced).
    text.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));

    List<StyleRange> styles = new ArrayList<>();
    int ptr = 0;

    String[] lines = input.split("\n"); //$NON-NLS-1$

    for (String line : lines) {
        if (Pattern.matches(OCCURRENCE, line)) {
            Matcher m = Pattern.compile(OCCURRENCE).matcher(line);
            if (m.matches() && m.group(1) != null) {
                try {
                    float occurrence = StatComparisonData.toFloat(m.group(1).trim());
                    if (occurrence > 0) {
                        styles.add(new StyleRange(ptr, line.length(), RED, null));
                    } else if (occurrence < 0) {
                        styles.add(new StyleRange(ptr, line.length(), GREEN, null));
                    }
                } catch (NumberFormatException e) {
                    // set no StyleRange
                }
            }
        }
        // + 1 to skip over the '\n' at EOL that the tokenizer eats
        ptr += line.length() + 1;
    }

    text.setStyleRanges(styles.toArray(new StyleRange[0]));
}

From source file:org.eclipse.linuxtools.internal.perf.ui.StatView.java

License:Open Source License

private void setStyledText(String input) {
    text.setText(input);//from w  w  w. ja  v  a 2 s .  co m

    // the default TextConsole font (we want monospaced)
    text.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
}

From source file:org.eclipse.mat.ui.internal.views.NotesView.java

License:Open Source License

@Override
public void createPartControl(Composite parent) {
    parent.setLayout(new FillLayout());
    // No need for a dispose listener - the SaveablePart will save it

    textViewer = new TextViewer(parent, SWT.MULTI | SWT.V_SCROLL | SWT.LEFT | SWT.H_SCROLL);
    textViewer.setDocument(new Document());
    textViewer.getControl().setEnabled(false);
    textViewer.getTextWidget().setWordWrap(false);
    font = JFaceResources.getFont("org.eclipse.mat.ui.notesfont"); //$NON-NLS-1$
    textViewer.getControl().setFont(font);

    hyperlinkColor = JFaceResources.getColorRegistry().get(JFacePreferences.HYPERLINK_COLOR);

    getSite().getPage().addPartListener(this);

    undoManager = new TextViewerUndoManager(UNDO_LEVEL);
    undoManager.connect(textViewer);/* w  ww.  j  ava  2  s . c  o  m*/
    textViewer.setUndoManager(undoManager);

    textViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            updateActions();
        }
    });

    textViewer.addTextListener(new ITextListener() {
        public void textChanged(TextEvent event) {
            modified = true;
            searchForHyperlinks(textViewer.getDocument().get(), 0);
            firePropertyChange(PROP_DIRTY);
        }
    });

    textViewer.setHyperlinkPresenter(new DefaultHyperlinkPresenter(hyperlinkColor));
    textViewer.setHyperlinkDetectors(new IHyperlinkDetector[] { new ObjectAddressHyperlinkDetector() },
            SWT.MOD1);

    makeActions();
    hookContextMenu();
    showBootstrapPart();
    updateActions();
}