Search in sources :

Example 1 with SpellcheckableMessageArea

use of org.eclipse.egit.ui.internal.dialogs.SpellcheckableMessageArea in project egit by eclipse.

the class CommitEditorPage method createMessageArea.

private void createMessageArea(Composite parent, FormToolkit toolkit, int span) {
    Section messageSection = createSection(parent, toolkit, UIText.CommitEditorPage_SectionMessage, span, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
    Composite messageArea = createSectionClient(messageSection, toolkit);
    RevCommit commit = getCommit().getRevCommit();
    String message = commit.getFullMessage();
    SpellcheckableMessageArea textContent = new SpellcheckableMessageArea(messageArea, message, true, toolkit.getBorderStyle()) {

        @Override
        protected IAdaptable getDefaultTarget() {
            return new PlatformObject() {

                @Override
                public Object getAdapter(Class adapter) {
                    return Platform.getAdapterManager().getAdapter(getEditorInput(), adapter);
                }
            };
        }

        @Override
        protected void createMarginPainter() {
        // Disabled intentionally
        }
    };
    if ((toolkit.getBorderStyle() & SWT.BORDER) == 0)
        textContent.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
    StyledText textWidget = textContent.getTextWidget();
    Point size = textWidget.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    int yHint = size.y > 80 ? 80 : SWT.DEFAULT;
    GridDataFactory.fillDefaults().hint(SWT.DEFAULT, yHint).minSize(1, 20).grab(true, true).applyTo(textContent);
    addToFocusTracking(textWidget);
    updateSectionClient(messageSection, messageArea, toolkit);
}
Also used : StyledText(org.eclipse.swt.custom.StyledText) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) SpellcheckableMessageArea(org.eclipse.egit.ui.internal.dialogs.SpellcheckableMessageArea) PlatformObject(org.eclipse.core.runtime.PlatformObject) Point(org.eclipse.swt.graphics.Point) Section(org.eclipse.ui.forms.widgets.Section) Point(org.eclipse.swt.graphics.Point) RevCommit(org.eclipse.jgit.revwalk.RevCommit)

Example 2 with SpellcheckableMessageArea

use of org.eclipse.egit.ui.internal.dialogs.SpellcheckableMessageArea in project egit by eclipse.

the class CommitMessageEditorDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    final Composite composite = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    composite.setLayout(gridLayout);
    setTitle(UIText.RebaseInteractiveHandler_EditMessageDialogTitle);
    setMessage(UIText.RebaseInteractiveHandler_EditMessageDialogText);
    messageArea = new SpellcheckableMessageArea(composite, commitMessage);
    messageArea.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
    Point size = messageArea.getTextWidget().getSize();
    int minHeight = messageArea.getTextWidget().getLineHeight() * 3;
    messageArea.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(size).minSize(size.x, minHeight).align(SWT.FILL, SWT.FILL).create());
    messageArea.setFocus();
    return composite;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) SpellcheckableMessageArea(org.eclipse.egit.ui.internal.dialogs.SpellcheckableMessageArea) Point(org.eclipse.swt.graphics.Point) Point(org.eclipse.swt.graphics.Point)

Aggregations

SpellcheckableMessageArea (org.eclipse.egit.ui.internal.dialogs.SpellcheckableMessageArea)2 Point (org.eclipse.swt.graphics.Point)2 Composite (org.eclipse.swt.widgets.Composite)2 PlatformObject (org.eclipse.core.runtime.PlatformObject)1 RevCommit (org.eclipse.jgit.revwalk.RevCommit)1 StyledText (org.eclipse.swt.custom.StyledText)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)1 Section (org.eclipse.ui.forms.widgets.Section)1