Search in sources :

Example 56 with IAction

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

the class AbstractTextSearchViewPage method removeFilterActionsFromViewMenu.

private void removeFilterActionsFromViewMenu(IAction[] filterActions) {
    IActionBars bars = getSite().getActionBars();
    IMenuManager menu = bars.getMenuManager();
    if (filterActions != null) {
        for (IAction filterAction : filterActions) {
            menu.remove(filterAction.getId());
        }
    }
    menu.remove(MatchFilterSelectionAction.ACTION_ID);
}
Also used : IAction(org.eclipse.jface.action.IAction) IMenuManager(org.eclipse.jface.action.IMenuManager) IActionBars(org.eclipse.ui.IActionBars)

Example 57 with IAction

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

the class AbstractTextEditor method editorContextMenuAboutToShow.

/**
 * Sets up this editor's context menu before it is made visible.
 * <p>
 * Subclasses may extend to add other actions.</p>
 *
 * @param menu the menu
 */
protected void editorContextMenuAboutToShow(IMenuManager menu) {
    menu.add(new Separator(ITextEditorActionConstants.GROUP_UNDO));
    menu.add(new GroupMarker(ITextEditorActionConstants.GROUP_SAVE));
    menu.add(new Separator(ITextEditorActionConstants.GROUP_COPY));
    menu.add(new Separator(ITextEditorActionConstants.GROUP_PRINT));
    menu.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
    menu.add(new Separator(ITextEditorActionConstants.GROUP_FIND));
    menu.add(new Separator(IWorkbenchActionConstants.GROUP_ADD));
    menu.add(new Separator(ITextEditorActionConstants.GROUP_REST));
    menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    if (isEditable()) {
        addAction(menu, ITextEditorActionConstants.GROUP_UNDO, ITextEditorActionConstants.UNDO);
        addAction(menu, ITextEditorActionConstants.GROUP_UNDO, ITextEditorActionConstants.REVERT_TO_SAVED);
        addAction(menu, ITextEditorActionConstants.GROUP_SAVE, ITextEditorActionConstants.SAVE);
        addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.CUT);
        addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.COPY);
        addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.PASTE);
        IAction action = getAction(ITextEditorActionConstants.QUICK_ASSIST);
        if (action != null && action.isEnabled())
            addAction(menu, ITextEditorActionConstants.GROUP_EDIT, ITextEditorActionConstants.QUICK_ASSIST);
    } else {
        addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.COPY);
    }
}
Also used : IAction(org.eclipse.jface.action.IAction) GroupMarker(org.eclipse.jface.action.GroupMarker) Separator(org.eclipse.jface.action.Separator)

Example 58 with IAction

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

the class AbstractTextEditor method getAction.

@Override
public IAction getAction(String actionID) {
    Assert.isNotNull(actionID);
    IAction action = fActions.get(actionID);
    if (action == null) {
        action = findContributedAction(actionID);
        if (action != null)
            setAction(actionID, action);
    }
    return action;
}
Also used : IAction(org.eclipse.jface.action.IAction)

Example 59 with IAction

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

the class AbstractTextEditor method updateInsertModeAction.

private void updateInsertModeAction() {
    // drop out in this case.
    if (getSite() == null)
        return;
    IAction action = getAction(ITextEditorActionConstants.TOGGLE_INSERT_MODE);
    if (action != null) {
        action.setEnabled(!fIsOverwriting);
        action.setChecked(fInsertMode == SMART_INSERT);
    }
}
Also used : IAction(org.eclipse.jface.action.IAction)

Example 60 with IAction

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

the class AbstractTextEditor method handlePreferenceStoreChanged.

/**
 * Handles a property change event describing a change of the editor's
 * preference store and updates the preference related editor properties.
 * <p>
 * Subclasses may extend.
 * </p>
 *
 * @param event the property change event
 */
protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
    if (fSourceViewer == null)
        return;
    String property = event.getProperty();
    if (getFontPropertyPreferenceKey().equals(property))
        // There is a separate handler for font preference changes
        return;
    if (PREFERENCE_COLOR_FOREGROUND.equals(property) || PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT.equals(property) || PREFERENCE_COLOR_BACKGROUND.equals(property) || PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT.equals(property) || PREFERENCE_COLOR_SELECTION_FOREGROUND.equals(property) || PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT.equals(property) || PREFERENCE_COLOR_SELECTION_BACKGROUND.equals(property) || PREFERENCE_COLOR_SELECTION_BACKGROUND_SYSTEM_DEFAULT.equals(property)) {
        initializeViewerColors(fSourceViewer);
    } else if (PREFERENCE_COLOR_FIND_SCOPE.equals(property)) {
        initializeFindScopeColor(fSourceViewer);
    } else if (PREFERENCE_USE_CUSTOM_CARETS.equals(property)) {
        updateCaret();
    } else if (PREFERENCE_WIDE_CARET.equals(property)) {
        updateCaret();
    }
    if (affectsTextPresentation(event))
        fSourceViewer.invalidateTextPresentation();
    if (PREFERENCE_HYPERLINKS_ENABLED.equals(property)) {
        if (fSourceViewer instanceof ITextViewerExtension6) {
            IHyperlinkDetector[] detectors = getSourceViewerConfiguration().getHyperlinkDetectors(fSourceViewer);
            int stateMask = getSourceViewerConfiguration().getHyperlinkStateMask(fSourceViewer);
            ITextViewerExtension6 textViewer6 = (ITextViewerExtension6) fSourceViewer;
            textViewer6.setHyperlinkDetectors(detectors, stateMask);
        }
        return;
    }
    if (PREFERENCE_HYPERLINK_KEY_MODIFIER.equals(property)) {
        if (fSourceViewer instanceof ITextViewerExtension6) {
            ITextViewerExtension6 textViewer6 = (ITextViewerExtension6) fSourceViewer;
            IHyperlinkDetector[] detectors = getSourceViewerConfiguration().getHyperlinkDetectors(fSourceViewer);
            int stateMask = getSourceViewerConfiguration().getHyperlinkStateMask(fSourceViewer);
            textViewer6.setHyperlinkDetectors(detectors, stateMask);
        }
        return;
    }
    if (PREFERENCE_RULER_CONTRIBUTIONS.equals(property)) {
        String[] difference = StringSetSerializer.getDifference((String) event.getOldValue(), (String) event.getNewValue());
        IColumnSupport support = getAdapter(IColumnSupport.class);
        for (int i = 0; i < difference.length; i++) {
            RulerColumnDescriptor desc = RulerColumnRegistry.getDefault().getColumnDescriptor(difference[i]);
            if (desc != null && support.isColumnSupported(desc)) {
                boolean newState = !support.isColumnVisible(desc);
                support.setColumnVisible(desc, newState);
            }
        }
        return;
    }
    if (PREFERENCE_SHOW_WHITESPACE_CHARACTERS.equals(property) || PREFERENCE_SHOW_LEADING_SPACES.equals(property) || PREFERENCE_SHOW_ENCLOSED_SPACES.equals(property) || PREFERENCE_SHOW_TRAILING_SPACES.equals(property) || PREFERENCE_SHOW_LEADING_IDEOGRAPHIC_SPACES.equals(property) || PREFERENCE_SHOW_ENCLOSED_IDEOGRAPHIC_SPACES.equals(property) || PREFERENCE_SHOW_TRAILING_IDEOGRAPHIC_SPACES.equals(property) || PREFERENCE_SHOW_LEADING_TABS.equals(property) || PREFERENCE_SHOW_ENCLOSED_TABS.equals(property) || PREFERENCE_SHOW_TRAILING_TABS.equals(property) || PREFERENCE_SHOW_CARRIAGE_RETURN.equals(property) || PREFERENCE_SHOW_LINE_FEED.equals(property) || PREFERENCE_WHITESPACE_CHARACTER_ALPHA_VALUE.equals(property)) {
        IAction action = getAction(ITextEditorActionConstants.SHOW_WHITESPACE_CHARACTERS);
        if (action instanceof IUpdate)
            ((IUpdate) action).update();
        return;
    }
    if (PREFERENCE_TEXT_DRAG_AND_DROP_ENABLED.equals(property)) {
        IPreferenceStore store = getPreferenceStore();
        if (store != null && store.getBoolean(PREFERENCE_TEXT_DRAG_AND_DROP_ENABLED))
            installTextDragAndDrop(getSourceViewer());
        else
            uninstallTextDragAndDrop(getSourceViewer());
        return;
    }
    if (PREFERENCE_HOVER_ENRICH_MODE.equals(property)) {
        if (fSourceViewer instanceof ITextViewerExtension8) {
            IPreferenceStore store = getPreferenceStore();
            if (store != null) {
                ((ITextViewerExtension8) fSourceViewer).setHoverEnrichMode(convertEnrichModePreference(store.getInt(PREFERENCE_HOVER_ENRICH_MODE)));
            }
        }
        return;
    }
}
Also used : IHyperlinkDetector(org.eclipse.jface.text.hyperlink.IHyperlinkDetector) IAction(org.eclipse.jface.action.IAction) ITextViewerExtension6(org.eclipse.jface.text.ITextViewerExtension6) Point(org.eclipse.swt.graphics.Point) RulerColumnDescriptor(org.eclipse.ui.texteditor.rulers.RulerColumnDescriptor) ITextViewerExtension8(org.eclipse.jface.text.ITextViewerExtension8) IColumnSupport(org.eclipse.ui.texteditor.rulers.IColumnSupport) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Aggregations

IAction (org.eclipse.jface.action.IAction)387 Action (org.eclipse.jface.action.Action)147 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)79 IWorkbenchAction (org.eclipse.ui.actions.ActionFactory.IWorkbenchAction)57 Separator (org.eclipse.jface.action.Separator)55 WebLaunchAction (com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction)50 MenuManager (org.eclipse.jface.action.MenuManager)39 IMenuManager (org.eclipse.jface.action.IMenuManager)37 ArrayList (java.util.ArrayList)36 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)35 IContributionItem (org.eclipse.jface.action.IContributionItem)31 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)26 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)22 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)18 ActionRegistry (org.eclipse.gef.ui.actions.ActionRegistry)16 IToolBarManager (org.eclipse.jface.action.IToolBarManager)16 IEditorPart (org.eclipse.ui.IEditorPart)15 Point (org.eclipse.swt.graphics.Point)14 Iterator (java.util.Iterator)13 Menu (org.eclipse.swt.widgets.Menu)13