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("");
}
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);
}
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);
}
}
}
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;
}
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);
}
}
}
Aggregations