Search in sources :

Example 1 with IUpdate

use of org.eclipse.ui.texteditor.IUpdate in project eclipse.platform.text by eclipse.

the class TextEditor method handlePreferenceStoreChanged.

@Override
protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
    if (event.getProperty().equals(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
        ISourceViewer viewer = getSourceViewer();
        if (!(viewer instanceof ISourceViewerExtension2))
            // cannot unconfigure - do nothing
            return;
        // XXX: this is pretty heavy-weight
        ((ISourceViewerExtension2) viewer).unconfigure();
        viewer.configure(getSourceViewerConfiguration());
        if (Boolean.FALSE.equals(event.getNewValue()))
            SpellingProblem.removeAll(getSourceViewer(), null);
        IAction quickAssistAction = getAction(ITextEditorActionConstants.QUICK_ASSIST);
        if (quickAssistAction instanceof IUpdate)
            ((IUpdate) quickAssistAction).update();
        return;
    }
    super.handlePreferenceStoreChanged(event);
}
Also used : IAction(org.eclipse.jface.action.IAction) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) IUpdate(org.eclipse.ui.texteditor.IUpdate) ISourceViewerExtension2(org.eclipse.jface.text.source.ISourceViewerExtension2)

Example 2 with IUpdate

use of org.eclipse.ui.texteditor.IUpdate in project eclipse.platform.text by eclipse.

the class CompositeRevertAction method update.

@Override
public void update() {
    for (int i = 0; i < fActions.length; i++) {
        if (fActions[i] instanceof IUpdate)
            ((IUpdate) fActions[i]).update();
    }
    IAction action = getEnabledAction();
    setEnabled(getEnabledAction() != null);
    if (action == null)
        return;
    setText(action.getText());
    setToolTipText(action.getToolTipText());
}
Also used : IAction(org.eclipse.jface.action.IAction) IUpdate(org.eclipse.ui.texteditor.IUpdate)

Example 3 with IUpdate

use of org.eclipse.ui.texteditor.IUpdate in project eclipse.platform.text by eclipse.

the class EncodingActionGroup method update.

/**
 * Updates all actions of this action group.
 */
public void update() {
    if (fTextEditor == null)
        return;
    IAction a = fTextEditor.getAction(IEncodingActionsConstants.SYSTEM);
    if (a instanceof IUpdate)
        ((IUpdate) a).update();
    for (int i = 0; i < ENCODINGS.length; i++) {
        a = fTextEditor.getAction(ENCODINGS[i][0]);
        if (a instanceof IUpdate)
            ((IUpdate) a).update();
    }
    a = fTextEditor.getAction(IEncodingActionsConstants.CUSTOM);
    if (a instanceof IUpdate)
        ((IUpdate) a).update();
}
Also used : IAction(org.eclipse.jface.action.IAction) IUpdate(org.eclipse.ui.texteditor.IUpdate)

Aggregations

IAction (org.eclipse.jface.action.IAction)3 IUpdate (org.eclipse.ui.texteditor.IUpdate)3 ISourceViewer (org.eclipse.jface.text.source.ISourceViewer)1 ISourceViewerExtension2 (org.eclipse.jface.text.source.ISourceViewerExtension2)1