Search in sources :

Example 66 with IAction

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

the class JavaEditor method createActions.

/**
 * The <code>JavaEditor</code> implementation of this
 * <code>AbstractTextEditor</code> method extend the
 * actions to add those specific to the receiver
 */
@Override
protected void createActions() {
    super.createActions();
    // $NON-NLS-1$
    IAction a = new DefineFoldingRegionAction(JavaEditorMessages.getResourceBundle(), "DefineFoldingRegion.", this);
    // $NON-NLS-1$
    setAction("DefineFoldingRegion", a);
}
Also used : IAction(org.eclipse.jface.action.IAction)

Example 67 with IAction

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

the class AbstractDecoratedTextEditor method addRulerContributionActions.

/**
 * Adds "show" actions for all contributed rulers that support it.
 *
 * @param menu the ruler context menu
 * @since 3.3
 */
private void addRulerContributionActions(IMenuManager menu) {
    // store directly in generic editor preferences
    final IColumnSupport support = getAdapter(IColumnSupport.class);
    IPreferenceStore store = EditorsUI.getPreferenceStore();
    final RulerColumnPreferenceAdapter adapter = new RulerColumnPreferenceAdapter(store, AbstractTextEditor.PREFERENCE_RULER_CONTRIBUTIONS);
    List<RulerColumnDescriptor> descriptors = RulerColumnRegistry.getDefault().getColumnDescriptors();
    for (Iterator<RulerColumnDescriptor> t = descriptors.iterator(); t.hasNext(); ) {
        final RulerColumnDescriptor descriptor = t.next();
        if (!descriptor.isIncludedInMenu() || !support.isColumnSupported(descriptor))
            continue;
        final boolean isVisible = support.isColumnVisible(descriptor);
        IAction action = new Action(MessageFormat.format(TextEditorMessages.AbstractDecoratedTextEditor_show_ruler_label, new Object[] { descriptor.getName() }), IAction.AS_CHECK_BOX) {

            @Override
            public void run() {
                if (descriptor.isGlobal())
                    // column state is modified via preference listener of AbstractTextEditor
                    adapter.setEnabled(descriptor, !isVisible);
                else
                    // directly modify column for this editor instance
                    support.setColumnVisible(descriptor, !isVisible);
            }
        };
        action.setChecked(isVisible);
        action.setImageDescriptor(descriptor.getIcon());
        menu.appendToGroup(ITextEditorActionConstants.GROUP_RULERS, action);
    }
}
Also used : RevertLineAction(org.eclipse.ui.internal.editors.quickdiff.RevertLineAction) RevertBlockAction(org.eclipse.ui.internal.editors.quickdiff.RevertBlockAction) BooleanPreferenceToggleAction(org.eclipse.ui.internal.texteditor.BooleanPreferenceToggleAction) RevertSelectionAction(org.eclipse.ui.internal.editors.quickdiff.RevertSelectionAction) CompositeRevertAction(org.eclipse.ui.internal.editors.quickdiff.CompositeRevertAction) RestoreAction(org.eclipse.ui.internal.editors.quickdiff.RestoreAction) IAction(org.eclipse.jface.action.IAction) RefreshEditorAction(org.eclipse.ui.internal.editors.text.RefreshEditorAction) Action(org.eclipse.jface.action.Action) IAction(org.eclipse.jface.action.IAction) RulerColumnDescriptor(org.eclipse.ui.texteditor.rulers.RulerColumnDescriptor) IColumnSupport(org.eclipse.ui.texteditor.rulers.IColumnSupport) RulerColumnPreferenceAdapter(org.eclipse.ui.texteditor.rulers.RulerColumnPreferenceAdapter) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 68 with IAction

use of org.eclipse.jface.action.IAction in project xtext-xtend by eclipse.

the class ShowWhitespaceCharactersActionContributor method contributeActions.

@Override
public void contributeActions(XtextEditor editor) {
    IToolBarManager toolBarManager = editor.getEditorSite().getActionBars().getToolBarManager();
    IAction action = editor.getAction(ITextEditorActionConstants.SHOW_WHITESPACE_CHARACTERS);
    action.setImageDescriptor(imageHelper.getImageDescriptor("full/etool16/show_whitespace_chars.gif"));
    action.setDisabledImageDescriptor(imageHelper.getImageDescriptor("full/dtool16/show_whitespace_chars.gif"));
    if (toolBarManager.find(action.getId()) == null) {
        toolBarManager.add(new ActionContributionItemExtension(action));
    // toolBarManager.add(action);
    }
}
Also used : IAction(org.eclipse.jface.action.IAction) IToolBarManager(org.eclipse.jface.action.IToolBarManager)

Example 69 with IAction

use of org.eclipse.jface.action.IAction in project xtext-xtend by eclipse.

the class ShowWhitespaceCharactersActionContributor method editorDisposed.

@Override
public void editorDisposed(XtextEditor editor) {
    IToolBarManager toolBarManager = editor.getEditorSite().getActionBars().getToolBarManager();
    IContributionItem i = toolBarManager.remove(ITextEditorActionConstants.SHOW_WHITESPACE_CHARACTERS);
    if (i instanceof ActionContributionItem) {
        IAction action = ((ActionContributionItem) i).getAction();
        if (action instanceof ShowWhitespaceCharactersAction) {
            ((ShowWhitespaceCharactersAction) action).setEditor(null);
        }
    }
}
Also used : ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) IAction(org.eclipse.jface.action.IAction) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ShowWhitespaceCharactersAction(org.eclipse.ui.texteditor.ShowWhitespaceCharactersAction) IContributionItem(org.eclipse.jface.action.IContributionItem)

Example 70 with IAction

use of org.eclipse.jface.action.IAction in project linuxtools by eclipse.

the class ContentAssistTests method getResults.

protected ICompletionProposal[] getResults(IFile file, int offset) throws Exception {
    disableContributions();
    // call the ContentAssistProcessor
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    FileEditorInput editorInput = new FileEditorInput(file);
    IEditorPart editorPart = page.openEditor(editorInput, "org.eclipse.cdt.ui.editor.CEditor");
    CEditor editor = (CEditor) editorPart;
    @SuppressWarnings("unused") IAction completionAction = editor.getAction("ContentAssistProposal");
    String contentType = editor.getViewer().getDocument().getContentType(offset);
    ContentAssistant assistant = new ContentAssistant();
    CContentAssistProcessor processor = new CContentAssistProcessor(editor, assistant, contentType);
    return processor.computeCompletionProposals(editor.getViewer(), offset);
}
Also used : CEditor(org.eclipse.cdt.internal.ui.editor.CEditor) IAction(org.eclipse.jface.action.IAction) CContentAssistProcessor(org.eclipse.cdt.internal.ui.text.contentassist.CContentAssistProcessor) FileEditorInput(org.eclipse.ui.part.FileEditorInput) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart) ContentAssistant(org.eclipse.jface.text.contentassist.ContentAssistant)

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