Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] CView actions update

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/ChangeLog,v
retrieving revision 1.10
diff -u -r1.10 ChangeLog
--- ChangeLog	25 Oct 2002 17:36:52 -0000	1.10
+++ ChangeLog	28 Oct 2002 14:42:21 -0000
@@ -1,3 +1,8 @@
+2002-10-28 David Inglis	
+	
+	* /src/.../ui/cview/CView.java
+	Hookup actions to global actions in Projects menu, (build actions and close project).
+
 2002-10-25 Judy N. Green
 	Removed a redundant "Eclipse Platform" from the plugin.properties file.
 	It was resulting in weird looking titles.
Index: src/org/eclipse/cdt/internal/ui/cview/CView.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java,v
retrieving revision 1.5
diff -u -r1.5 CView.java
--- src/org/eclipse/cdt/internal/ui/cview/CView.java	23 Oct 2002 13:26:39 -0000	1.5
+++ src/org/eclipse/cdt/internal/ui/cview/CView.java	28 Oct 2002 14:42:21 -0000
@@ -8,11 +8,35 @@
 import java.util.ArrayList;
 import java.util.List;

+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.IArchive;
+import org.eclipse.cdt.core.model.IArchiveContainer;
+import org.eclipse.cdt.core.model.IBinary;
+import org.eclipse.cdt.core.model.IBinaryContainer;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICFile;
+import org.eclipse.cdt.core.model.ICRoot;
+import org.eclipse.cdt.core.model.IParent;
+import org.eclipse.cdt.core.resources.MakeUtil;
+import org.eclipse.cdt.internal.ui.CContentProvider;
+import org.eclipse.cdt.internal.ui.CPlugin;
+import org.eclipse.cdt.internal.ui.StandardCElementLabelProvider;
+import org.eclipse.cdt.internal.ui.editor.CEditor;
+import org.eclipse.cdt.internal.ui.editor.OpenIncludeAction;
+import org.eclipse.cdt.internal.ui.makeview.MakeAction;
+import org.eclipse.cdt.internal.ui.makeview.MakeTarget;
+import org.eclipse.cdt.internal.ui.makeview.MakeTargetAction;
+import org.eclipse.cdt.internal.ui.preferences.CPluginPreferencePage;
+import org.eclipse.cdt.internal.ui.util.EditorUtility;
+import org.eclipse.cdt.internal.ui.util.ProblemTreeViewer;
 import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
@@ -63,6 +87,7 @@
 import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.actions.AddBookmarkAction;
+import org.eclipse.ui.actions.BuildAction;
 import org.eclipse.ui.actions.CloseResourceAction;
 import org.eclipse.ui.actions.CopyResourceAction;
 import org.eclipse.ui.actions.CreateFileAction;
@@ -73,6 +98,7 @@
 import org.eclipse.ui.actions.NewWizardMenu;
 import org.eclipse.ui.actions.OpenFileAction;
 import org.eclipse.ui.actions.OpenPerspectiveMenu;
+import org.eclipse.ui.actions.OpenResourceAction;
 import org.eclipse.ui.actions.OpenSystemEditorAction;
 import org.eclipse.ui.actions.OpenWithMenu;
 import org.eclipse.ui.actions.RefreshAction;
@@ -88,28 +114,6 @@
 import org.eclipse.ui.views.framelist.GoIntoAction;
 import org.eclipse.ui.views.framelist.UpAction;

-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.IArchive;
-import org.eclipse.cdt.core.model.IArchiveContainer;
-import org.eclipse.cdt.core.model.IBinary;
-import org.eclipse.cdt.core.model.IBinaryContainer;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICFile;
-import org.eclipse.cdt.core.model.ICRoot;
-import org.eclipse.cdt.core.model.IParent;
-import org.eclipse.cdt.core.resources.MakeUtil;
-import org.eclipse.cdt.internal.ui.CContentProvider;
-import org.eclipse.cdt.internal.ui.CPlugin;
-import org.eclipse.cdt.internal.ui.StandardCElementLabelProvider;
-import org.eclipse.cdt.internal.ui.editor.CEditor;
-import org.eclipse.cdt.internal.ui.editor.OpenIncludeAction;
-import org.eclipse.cdt.internal.ui.makeview.MakeAction;
-import org.eclipse.cdt.internal.ui.makeview.MakeTarget;
-import org.eclipse.cdt.internal.ui.makeview.MakeTargetAction;
-import org.eclipse.cdt.internal.ui.preferences.CPluginPreferencePage;
-import org.eclipse.cdt.internal.ui.util.EditorUtility;
-import org.eclipse.cdt.internal.ui.util.ProblemTreeViewer;
-



@@ -135,7 +139,11 @@
 	CreateFileAction createFileAction;
 	CreateFolderAction createFolderAction;
 	NewWizardAction newWizardAction;
-	CloseResourceAction closeResourceAction;
+
+	CloseResourceAction closeProjectAction;
+	OpenResourceAction openProjectAction;
+	BuildAction buildAction;
+	BuildAction rebuildAction;

 	// CElement action
 	OpenIncludeAction openIncludeAction;
@@ -350,6 +358,7 @@
 	void handleSelectionChanged(SelectionChangedEvent event) {
 		IStructuredSelection sel = (IStructuredSelection) event.getSelection();
 		updateStatusLine(sel);
+		updateActions(sel);
 		updateGlobalActions(sel);
 		goIntoAction.update();
 		linkToEditor(sel);
@@ -438,6 +447,9 @@
 			viewer.removeTreeListener(expansionListener);
 			CPlugin.getDefault().getProblemMarkerManager().removeListener(viewer);
 		}
+		IWorkspace workspace = CPlugin.getWorkspace();
+		workspace.removeResourceChangeListener(closeProjectAction);
+		workspace.removeResourceChangeListener(openProjectAction);
 		super.dispose();
 	}

@@ -492,8 +504,9 @@
 		openFileAction = new OpenFileAction(getSite().getPage());
 		openSystemEditorAction = new OpenSystemEditorAction(getSite().getPage());
 		refreshAction = new RefreshAction(shell);
-		//buildAction = new BuildAction(shell, IncrementalProjectBuilder.INCREMENTAL_BUILD);
-		//rebuildAction = new BuildAction(shell, IncrementalProjectBuilder.FULL_BUILD);
+		buildAction =
+			new BuildAction(shell, IncrementalProjectBuilder.INCREMENTAL_BUILD);
+		rebuildAction = new BuildAction(shell, IncrementalProjectBuilder.FULL_BUILD);
 		makeTargetAction = new MakeTargetAction(shell);
 		moveResourceAction = new MoveResourceAction (shell);
 		copyResourceAction = new CopyResourceAction(shell);
@@ -512,7 +525,12 @@
 		
 		
 		newWizardAction = new NewWizardAction();
-		closeResourceAction = new CloseResourceAction(shell);
+		IWorkspace workspace = CPlugin.getWorkspace();
+
+		openProjectAction = new OpenResourceAction(shell);
+		workspace.addResourceChangeListener(openProjectAction, IResourceChangeEvent.POST_CHANGE);
+		closeProjectAction = new CloseResourceAction(shell);
+		workspace.addResourceChangeListener(closeProjectAction, IResourceChangeEvent.POST_CHANGE);

 		//sortByNameAction = new SortViewAction(this, false);
 		//sortByTypeAction = new SortViewAction(this, true);
@@ -546,6 +564,21 @@
 		IActionBars actionBars = getViewSite().getActionBars();
 		actionBars.setGlobalActionHandler(IWorkbenchActionConstants.DELETE, deleteResourceAction);
 		actionBars.setGlobalActionHandler(IWorkbenchActionConstants.BOOKMARK, addBookmarkAction);
+		actionBars.setGlobalActionHandler(
+			IWorkbenchActionConstants.REFRESH,
+			refreshAction);
+		actionBars.setGlobalActionHandler(
+			IWorkbenchActionConstants.BUILD_PROJECT,
+			buildAction);
+		actionBars.setGlobalActionHandler(
+			IWorkbenchActionConstants.REBUILD_PROJECT,
+			rebuildAction);
+		actionBars.setGlobalActionHandler(
+			IWorkbenchActionConstants.OPEN_PROJECT,
+			openProjectAction);
+		actionBars.setGlobalActionHandler(
+			IWorkbenchActionConstants.CLOSE_PROJECT,
+			closeProjectAction);

 	}

@@ -556,8 +589,6 @@
 	 * E.g. A project was opened or closed.
 	 */
 	void updateActions(IStructuredSelection selection) {
-		//buildAction.selectionChanged(selection);
-		//rebuildAction.selectionChanged(selection);
 		makeTargetAction.selectionChanged(selection);
 		copyResourceAction.selectionChanged(selection);
 		refreshAction.selectionChanged(selection);
@@ -566,7 +597,6 @@
 		openSystemEditorAction.selectionChanged(selection);
 		propertyDialogAction.selectionChanged(selection);
 		renameResourceAction.selectionChanged(selection);
-		closeResourceAction.selectionChanged(selection);
 		//sortByTypeAction.selectionChanged(selection);
 		//sortByNameAction.selectionChanged(selection);
 		updateGlobalActions(selection);
@@ -590,6 +620,13 @@
 		actionBars.setGlobalActionHandler(IWorkbenchActionConstants.COPY, copyResourceAction);
 		actionBars.updateActionBars();
 		renameResourceAction.selectionChanged(selection);
+		
+		refreshAction.selectionChanged(selection);
+		buildAction.selectionChanged(selection);
+		rebuildAction.selectionChanged(selection);
+		openProjectAction.selectionChanged(selection);
+		closeProjectAction.selectionChanged(selection);
+
 	}


@@ -770,7 +807,7 @@
 		menu.add(new Separator ());

 		if (resource instanceof IProject) {
-			menu.add(closeResourceAction);
+			menu.add(closeProjectAction);
 		}

 		if (resource instanceof IFile || resource instanceof IFolder) {



Back to the top