Search in sources :

Example 41 with IStatusLineManager

use of org.eclipse.jface.action.IStatusLineManager in project eclipse.platform.text by eclipse.

the class FindNextAction method statusClear.

/**
 * Clears the status line.
 */
private void statusClear() {
    IStatusLineManager manager = getStatusLineManager();
    if (manager == null)
        return;
    // $NON-NLS-1$
    manager.setErrorMessage("");
    // $NON-NLS-1$
    manager.setMessage("");
}
Also used : IStatusLineManager(org.eclipse.jface.action.IStatusLineManager)

Example 42 with IStatusLineManager

use of org.eclipse.jface.action.IStatusLineManager in project eclipse.platform.text by eclipse.

the class AbstractTextEditor method getAdapter.

@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> required) {
    if (IEditorStatusLine.class.equals(required)) {
        if (fEditorStatusLine == null) {
            IStatusLineManager statusLineManager = getStatusLineManager();
            ISelectionProvider selectionProvider = getSelectionProvider();
            if (statusLineManager != null && selectionProvider != null)
                fEditorStatusLine = new EditorStatusLine(statusLineManager, selectionProvider);
        }
        return (T) fEditorStatusLine;
    }
    if (IVerticalRulerInfo.class.equals(required)) {
        if (fVerticalRuler != null)
            return (T) fVerticalRuler;
    }
    if (IMarkRegionTarget.class.equals(required)) {
        if (fMarkRegionTarget == null) {
            IStatusLineManager manager = getStatusLineManager();
            if (manager != null)
                fMarkRegionTarget = (fSourceViewer == null ? null : new MarkRegionTarget(fSourceViewer, manager));
        }
        return (T) fMarkRegionTarget;
    }
    if (IDeleteLineTarget.class.equals(required)) {
        if (fDeleteLineTarget == null) {
            fDeleteLineTarget = new TextViewerDeleteLineTarget(fSourceViewer);
        }
        return (T) fDeleteLineTarget;
    }
    if (IncrementalFindTarget.class.equals(required)) {
        if (fIncrementalFindTarget == null) {
            IStatusLineManager manager = getStatusLineManager();
            if (manager != null)
                fIncrementalFindTarget = (fSourceViewer == null ? null : new IncrementalFindTarget(fSourceViewer, manager));
        }
        return (T) fIncrementalFindTarget;
    }
    if (IFindReplaceTarget.class.equals(required)) {
        if (fFindReplaceTarget == null) {
            IFindReplaceTarget target = (fSourceViewer == null ? null : fSourceViewer.getFindReplaceTarget());
            if (target != null) {
                fFindReplaceTarget = new FindReplaceTarget(this, target);
                if (fFindScopeHighlightColor != null)
                    fFindReplaceTarget.setScopeHighlightColor(fFindScopeHighlightColor);
            }
        }
        return (T) fFindReplaceTarget;
    }
    if (ITextOperationTarget.class.equals(required))
        return (fSourceViewer == null ? null : (T) fSourceViewer.getTextOperationTarget());
    if (IRewriteTarget.class.equals(required)) {
        if (fSourceViewer instanceof ITextViewerExtension) {
            ITextViewerExtension extension = (ITextViewerExtension) fSourceViewer;
            return (T) extension.getRewriteTarget();
        }
        return null;
    }
    if (Control.class.equals(required))
        return fSourceViewer != null ? (T) fSourceViewer.getTextWidget() : null;
    if (IColumnSupport.class.equals(required)) {
        if (fColumnSupport == null)
            fColumnSupport = createColumnSupport();
        return (T) fColumnSupport;
    }
    return super.getAdapter(required);
}
Also used : ITextViewerExtension(org.eclipse.jface.text.ITextViewerExtension) ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) SWT(org.eclipse.swt.SWT) ST(org.eclipse.swt.custom.ST) IStatusLineManager(org.eclipse.jface.action.IStatusLineManager) IFindReplaceTarget(org.eclipse.jface.text.IFindReplaceTarget) IFindReplaceTarget(org.eclipse.jface.text.IFindReplaceTarget) IMarkRegionTarget(org.eclipse.jface.text.IMarkRegionTarget)

Example 43 with IStatusLineManager

use of org.eclipse.jface.action.IStatusLineManager in project webtools.sourceediting by eclipse.

the class ActionContributorXML method setActiveEditor.

/**
 * @see org.eclipse.ui.IEditorActionBarContributor#setActiveEditor(IEditorPart)
 */
public void setActiveEditor(IEditorPart activeEditor) {
    if (getActiveEditorPart() == activeEditor) {
        return;
    }
    super.setActiveEditor(activeEditor);
    IActionBars actionBars = getActionBars();
    if (actionBars != null) {
        IStatusLineManager statusLineManager = actionBars.getStatusLineManager();
        if (statusLineManager != null) {
            statusLineManager.setMessage(null);
            statusLineManager.setErrorMessage(null);
        }
    }
    ITextEditor textEditor = getTextEditor(activeEditor);
    fContentAssist.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_CONTENTASSIST_PROPOSALS));
    fCleanupDocument.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT));
    fFormatDocument.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT));
    fFormatActiveElements.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_ACTIVE_ELEMENTS));
    fCleanupDocument.setEnabled((textEditor != null) && textEditor.isEditable());
    fFormatDocument.setEnabled((textEditor != null) && textEditor.isEditable());
    fFormatActiveElements.setEnabled((textEditor != null) && textEditor.isEditable());
    fOpenFileAction.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_OPEN_FILE));
    fFindOccurrences.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_FIND_OCCURRENCES));
    fGoToMatchingTagAction.setEditor(textEditor);
    if (textEditor != null) {
        if (textEditor.getAction(GO_TO_MATCHING_TAG_ID) != fGoToMatchingTagAction) {
            textEditor.setAction(GO_TO_MATCHING_TAG_ID, fGoToMatchingTagAction);
        }
    }
}
Also used : ITextEditor(org.eclipse.ui.texteditor.ITextEditor) IStatusLineManager(org.eclipse.jface.action.IStatusLineManager) IActionBars(org.eclipse.ui.IActionBars)

Example 44 with IStatusLineManager

use of org.eclipse.jface.action.IStatusLineManager in project webtools.sourceediting by eclipse.

the class AbstractSection method getStatusLineManager.

protected static IStatusLineManager getStatusLineManager(IEditorPart editorPart) {
    IStatusLineManager result = null;
    try {
        EditorActionBarContributor contributor = (EditorActionBarContributor) editorPart.getEditorSite().getActionBarContributor();
        result = contributor.getActionBars().getStatusLineManager();
    } catch (Exception e) {
    }
    return result;
}
Also used : IStatusLineManager(org.eclipse.jface.action.IStatusLineManager) EditorActionBarContributor(org.eclipse.ui.part.EditorActionBarContributor)

Example 45 with IStatusLineManager

use of org.eclipse.jface.action.IStatusLineManager in project webtools.sourceediting by eclipse.

the class StructuredTextEditor method updateStatusLine.

void updateStatusLine(ISelection selection) {
    // was caused by go to navigation
    if (fSelectionChangedFromGoto) {
        fSelectionChangedFromGoto = false;
        return;
    }
    IStatusLineManager statusLineManager = getEditorSite().getActionBars().getStatusLineManager();
    if (fStatusLineLabelProvider != null && statusLineManager != null) {
        String text = null;
        Image image = null;
        if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
            Object firstElement = ((IStructuredSelection) selection).getFirstElement();
            if (firstElement != null) {
                text = fStatusLineLabelProvider.getText(firstElement);
                image = fStatusLineLabelProvider.getImage((firstElement));
            }
        }
        if (image == null) {
            statusLineManager.setMessage(text);
        } else {
            statusLineManager.setMessage(image, text);
        }
    }
}
Also used : IStatusLineManager(org.eclipse.jface.action.IStatusLineManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Image(org.eclipse.swt.graphics.Image)

Aggregations

IStatusLineManager (org.eclipse.jface.action.IStatusLineManager)68 IToolBarManager (org.eclipse.jface.action.IToolBarManager)33 IActionBars (org.eclipse.ui.IActionBars)33 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)32 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)31 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)31 AdapterFactoryContentProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider)30 AdapterFactoryLabelProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider)30 IMenuManager (org.eclipse.jface.action.IMenuManager)30 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)30 Composite (org.eclipse.swt.widgets.Composite)30 ContentOutlinePage (org.eclipse.ui.views.contentoutline.ContentOutlinePage)30 IContentOutlinePage (org.eclipse.ui.views.contentoutline.IContentOutlinePage)30 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)7 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)5 ArrayList (java.util.ArrayList)4 IContributionItem (org.eclipse.jface.action.IContributionItem)4 IFile (org.eclipse.core.resources.IFile)3 IAction (org.eclipse.jface.action.IAction)3 StatusLineContributionItem (org.eclipse.jface.action.StatusLineContributionItem)3