Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Fix ContentAssist broke when we move to 2.1

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/ChangeLog,v
retrieving revision 1.80
diff -u -r1.80 ChangeLog
--- ChangeLog	3 Apr 2003 04:29:16 -0000	1.80
+++ ChangeLog	4 Apr 2003 20:32:37 -0000
@@ -1,3 +1,22 @@
+2003-04-04 Alain Magloire
+
+	The way to register actions change from 2.0 to 2.1
+	Action must have an ID.  This fixes the editor to
+	be activate on Ctrl+space.
+	
+	* src/org/eclipse/internal/ui/editor/CEditor.java:
+	* src/org/eclipse/internal/ui/ICEditorActionDefinitionIds.java:
+
+2003-04-04 Alain Magloire
+
+	Remove on some warnings now that we move to 2.1
+	
+	* src/org/eclipse/internal/ui/dialogs/SelectionStatusDialog.java:
+	* src/org/eclipse/internal/ui/editor/DocumentAdapter.java:
+	* src/org/eclipse/internal/ui/preferences/CEditroPreference.java:
+	* src/org/eclipse/internal/ui/CElementImageProvider.java:
+	* src/org/eclipse/cdt/ui/CUIPlugin.java
+
 2003-04-02 Alain Magloire
 
 	Show LibraryReference in the  CViewer.
Index: src/org/eclipse/cdt/internal/ui/CElementImageProvider.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CElementImageProvider.java,v
retrieving revision 1.12
diff -u -r1.12 CElementImageProvider.java
--- src/org/eclipse/cdt/internal/ui/CElementImageProvider.java	3 Apr 2003 15:38:35 -0000	1.12
+++ src/org/eclipse/cdt/internal/ui/CElementImageProvider.java	4 Apr 2003 20:32:37 -0000
@@ -97,9 +97,6 @@
 		if (element instanceof ICElement) {
 			descriptor= getCImageDescriptor((ICElement) element, flags);
 		}
-//		if (descriptor == null && element instanceof ICFile) {
-//			element = ((ICFile)element).getFile();
-//		}
 		if (descriptor == null && element instanceof IAdaptable) {
 			descriptor= getWorkbenchImageDescriptor((IAdaptable) element, flags);
 		}
@@ -113,9 +110,9 @@
 		return (flags & OVERLAY_ICONS) != 0;
 	}
 	
-	private boolean useLightIcons(int flags) {
-		return (flags & LIGHT_TYPE_ICONS) != 0;
-	}
+//	private boolean useLightIcons(int flags) {
+//		return (flags & LIGHT_TYPE_ICONS) != 0;
+//	}
 	
 	private boolean useSmallSize(int flags) {
 		return (flags & SMALL_ICONS) != 0;
@@ -313,4 +310,3 @@
 	}
 	
 }
-
Index: src/org/eclipse/cdt/internal/ui/dialogs/SelectionStatusDialog.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/dialogs/SelectionStatusDialog.java,v
retrieving revision 1.3
diff -u -r1.3 SelectionStatusDialog.java
--- src/org/eclipse/cdt/internal/ui/dialogs/SelectionStatusDialog.java	7 Feb 2003 14:38:34 -0000	1.3
+++ src/org/eclipse/cdt/internal/ui/dialogs/SelectionStatusDialog.java	4 Apr 2003 20:32:37 -0000
@@ -86,7 +86,7 @@
 	 * @return the first element of the initial selection.
 	 */
 	protected Object getPrimaryInitialSelection() {
-		List result= getInitialSelections();
+		List result= getInitialElementSelections();
 		if (result == null || result.size() == 0)
 			return null;
 		return result.get(0);	
@@ -124,7 +124,7 @@
 		fImage= image;
 	}
 	protected void setInitialSelection(int position, Object element) {
-		List l= getInitialSelections();
+		List l= getInitialElementSelections();
 		l.set(position, element);
 		fInitialSelectionSet= true;
 	}
Index: src/org/eclipse/cdt/internal/ui/editor/CEditor.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java,v
retrieving revision 1.18
diff -u -r1.18 CEditor.java
--- src/org/eclipse/cdt/internal/ui/editor/CEditor.java	2 Apr 2003 05:02:14 -0000	1.18
+++ src/org/eclipse/cdt/internal/ui/editor/CEditor.java	4 Apr 2003 20:32:38 -0000
@@ -29,6 +29,7 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.IStatusLineManager;
 import org.eclipse.jface.action.MenuManager;
@@ -94,6 +95,7 @@
 import org.eclipse.ui.editors.text.TextEditor;
 import org.eclipse.ui.part.EditorActionBarContributor;
 import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.ContentAssistAction;
 import org.eclipse.ui.texteditor.DefaultRangeIndicator;
 import org.eclipse.ui.texteditor.ITextEditorActionConstants;
 import org.eclipse.ui.texteditor.MarkerAnnotation;
@@ -654,10 +656,31 @@
 		super.createActions();
 			
 		// 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$
-		setAction("Format", new TextOperationAction(CEditorMessages.getResourceBundle(), "Format.", this, ISourceViewer.FORMAT)); //$NON-NLS-1$ //$NON-NLS-2$
-		setAction("ContentAssistProposal", new TextOperationAction(CEditorMessages.getResourceBundle(), "ContentAssistProposal.", this, ISourceViewer.CONTENTASSIST_PROPOSALS));		//$NON-NLS
+
+		IAction action= new TextOperationAction(CEditorMessages.getResourceBundle(), "Comment.", this, ITextOperationTarget.PREFIX); //$NON-NLS-1$
+		action.setActionDefinitionId(ICEditorActionDefinitionIds.COMMENT);		
+		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("OpenOnSelection", new OpenOnSelectionAction(this));
Index: src/org/eclipse/cdt/internal/ui/editor/DocumentAdapter.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/DocumentAdapter.java,v
retrieving revision 1.2
diff -u -r1.2 DocumentAdapter.java
--- src/org/eclipse/cdt/internal/ui/editor/DocumentAdapter.java	27 Mar 2003 16:12:17 -0000	1.2
+++ src/org/eclipse/cdt/internal/ui/editor/DocumentAdapter.java	4 Apr 2003 20:32:38 -0000
@@ -164,7 +164,7 @@
 	};
 
 	private IOpenable fOwner;
-	private IDocument fDocument;
+	IDocument fDocument;
 	private DocumentSetCommand fSetCmd= new DocumentSetCommand();
 	private DocumentReplaceCommand fReplaceCmd= new DocumentReplaceCommand();
 	
Index: src/org/eclipse/cdt/internal/ui/editor/ICEditorActionDefinitionIds.java
===================================================================
RCS file: src/org/eclipse/cdt/internal/ui/editor/ICEditorActionDefinitionIds.java
diff -N src/org/eclipse/cdt/internal/ui/editor/ICEditorActionDefinitionIds.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/internal/ui/editor/ICEditorActionDefinitionIds.java	4 Apr 2003 20:32:38 -0000
@@ -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$
+
+}
Index: src/org/eclipse/cdt/internal/ui/preferences/CEditorPreferencePage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorPreferencePage.java,v
retrieving revision 1.7
diff -u -r1.7 CEditorPreferencePage.java
--- src/org/eclipse/cdt/internal/ui/preferences/CEditorPreferencePage.java	4 Feb 2003 20:00:46 -0000	1.7
+++ src/org/eclipse/cdt/internal/ui/preferences/CEditorPreferencePage.java	4 Apr 2003 20:32:38 -0000
@@ -579,7 +579,7 @@
 		
 		
 		String label= "Text &font:";
-		addTextFontEditor(behaviorComposite, label, CEditor.PREFERENCE_FONT);
+		addTextFontEditor(behaviorComposite, label, JFaceResources.TEXT_FONT);
 		
 		label= "Displayed &tab width:";
 		addTextField(behaviorComposite, label, CSourceViewerConfiguration.PREFERENCE_TAB_WIDTH, 2, 0, true);
Index: src/org/eclipse/cdt/ui/CUIPlugin.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java,v
retrieving revision 1.10
diff -u -r1.10 CUIPlugin.java
--- src/org/eclipse/cdt/ui/CUIPlugin.java	2 Apr 2003 21:30:23 -0000	1.10
+++ src/org/eclipse/cdt/ui/CUIPlugin.java	4 Apr 2003 20:32:38 -0000
@@ -9,7 +9,6 @@
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
-import org.eclipse.cdt.core.CCorePlugin;
 import org.eclipse.cdt.core.model.CoreModel;
 import org.eclipse.cdt.core.model.ICElement;
 import org.eclipse.cdt.internal.ui.BuildConsoleManager;



Back to the top