mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Fix the ContentAssist, the way action are register
changed in 2.1
This commit is contained in:
parent
0ff98a152c
commit
6e979f08d0
2 changed files with 72 additions and 4 deletions
|
@ -29,6 +29,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.jface.action.IAction;
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
import org.eclipse.jface.action.IStatusLineManager;
|
import org.eclipse.jface.action.IStatusLineManager;
|
||||||
import org.eclipse.jface.action.MenuManager;
|
import org.eclipse.jface.action.MenuManager;
|
||||||
|
@ -94,6 +95,7 @@ import org.eclipse.ui.dialogs.SaveAsDialog;
|
||||||
import org.eclipse.ui.editors.text.TextEditor;
|
import org.eclipse.ui.editors.text.TextEditor;
|
||||||
import org.eclipse.ui.part.EditorActionBarContributor;
|
import org.eclipse.ui.part.EditorActionBarContributor;
|
||||||
import org.eclipse.ui.part.FileEditorInput;
|
import org.eclipse.ui.part.FileEditorInput;
|
||||||
|
import org.eclipse.ui.texteditor.ContentAssistAction;
|
||||||
import org.eclipse.ui.texteditor.DefaultRangeIndicator;
|
import org.eclipse.ui.texteditor.DefaultRangeIndicator;
|
||||||
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
||||||
import org.eclipse.ui.texteditor.MarkerAnnotation;
|
import org.eclipse.ui.texteditor.MarkerAnnotation;
|
||||||
|
@ -654,10 +656,31 @@ public class CEditor extends TextEditor implements ISelectionChangedListener {
|
||||||
super.createActions();
|
super.createActions();
|
||||||
|
|
||||||
// Default text editing menu items
|
// Default text editing menu items
|
||||||
setAction("Comment", new TextOperationAction(CEditorMessages.getResourceBundle(), "Comment.", this, ITextOperationTarget.PREFIX)); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
setAction("Uncomment", new TextOperationAction(CEditorMessages.getResourceBundle(), "Uncomment.", this, ITextOperationTarget.STRIP_PREFIX)); //$NON-NLS-1$ //$NON-NLS-2$
|
IAction action= new TextOperationAction(CEditorMessages.getResourceBundle(), "Comment.", this, ITextOperationTarget.PREFIX); //$NON-NLS-1$
|
||||||
setAction("Format", new TextOperationAction(CEditorMessages.getResourceBundle(), "Format.", this, ISourceViewer.FORMAT)); //$NON-NLS-1$ //$NON-NLS-2$
|
action.setActionDefinitionId(ICEditorActionDefinitionIds.COMMENT);
|
||||||
setAction("ContentAssistProposal", new TextOperationAction(CEditorMessages.getResourceBundle(), "ContentAssistProposal.", this, ISourceViewer.CONTENTASSIST_PROPOSALS)); //$NON-NLS
|
setAction("Comment", action); //$NON-NLS-1$
|
||||||
|
markAsStateDependentAction("Comment", true); //$NON-NLS-1$
|
||||||
|
|
||||||
|
action= new TextOperationAction(CEditorMessages.getResourceBundle(), "Uncomment.", this, ITextOperationTarget.STRIP_PREFIX); //$NON-NLS-1$
|
||||||
|
action.setActionDefinitionId(ICEditorActionDefinitionIds.UNCOMMENT);
|
||||||
|
setAction("Uncomment", action); //$NON-NLS-1$
|
||||||
|
markAsStateDependentAction("Uncomment", true); //$NON-NLS-1$
|
||||||
|
|
||||||
|
action= new TextOperationAction(CEditorMessages.getResourceBundle(), "Format.", this, ISourceViewer.FORMAT); //$NON-NLS-1$
|
||||||
|
action.setActionDefinitionId(ICEditorActionDefinitionIds.FORMAT);
|
||||||
|
setAction("Format", action); //$NON-NLS-1$
|
||||||
|
markAsStateDependentAction("Format", true); //$NON-NLS-1$
|
||||||
|
|
||||||
|
action = new ContentAssistAction(CEditorMessages.getResourceBundle(), "ContentAssistProposal.", this); //$NON-NLS-1$
|
||||||
|
action.setActionDefinitionId(ICEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
|
||||||
|
setAction("ContentAssistProposal", action);
|
||||||
|
markAsStateDependentAction("ContentAssistProposal", true); //$NON-NLS-1$
|
||||||
|
|
||||||
|
action = new TextOperationAction(CEditorMessages.getResourceBundle(), "ContentAssistTip.", this, ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION); //$NON-NLS-1$
|
||||||
|
action.setActionDefinitionId(ICEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
|
||||||
|
setAction("ContentAssistTip", action);
|
||||||
|
|
||||||
|
|
||||||
setAction("AddIncludeOnSelection", new AddIncludeOnSelectionAction(this)); //$NON-NLS-1$
|
setAction("AddIncludeOnSelection", new AddIncludeOnSelectionAction(this)); //$NON-NLS-1$
|
||||||
setAction("OpenOnSelection", new OpenOnSelectionAction(this));
|
setAction("OpenOnSelection", new OpenOnSelectionAction(this));
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* (c) Copyright IBM Corp. 2000, 2001.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.internal.ui.editor;
|
||||||
|
|
||||||
|
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the definition IDs for the C editor actions.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* This interface is not intended to be implemented or extended.
|
||||||
|
* </p>.
|
||||||
|
*
|
||||||
|
* @since 2.1
|
||||||
|
*/
|
||||||
|
public interface ICEditorActionDefinitionIds extends ITextEditorActionDefinitionIds {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action definition ID of the source -> comment action
|
||||||
|
* (value <code>"org.eclipse.cdt.ui.edit.text.c.comment"</code>).
|
||||||
|
*/
|
||||||
|
public static final String COMMENT = "org.eclipse.cdt.ui.edit.text.c.comment"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action definition ID of the source -> uncomment action
|
||||||
|
* (value <code>"org.eclipse.cdt.ui.edit.text.c.uncomment"</code>).
|
||||||
|
*/
|
||||||
|
public static final String UNCOMMENT = "org.eclipse.cdt.ui.edit.text.c.uncomment"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action definition ID of the source -> format action
|
||||||
|
* (value <code>"org.eclipse.cdt.ui.edit.text.c.format"</code>).
|
||||||
|
*/
|
||||||
|
public static final String FORMAT = "org.eclipse.cdt.ui.edit.text.c.format"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action definition ID of the source -> add include action
|
||||||
|
* (value <code>"org.eclipse.cdt.ui.edit.text.c.add.include"</code>).
|
||||||
|
*/
|
||||||
|
public static final String ADD_INCLUDE= "org.eclipse.cdt.ui.edit.text.c.add.include"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue