Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Allow editing a Make View tag (ui patch)

This ui patch updates the MakeView.java class to update the right click menu
items
to be more conformant with Eclipse UI guidelines and to provide a new action
to
allow editing of an existing make target after it has been created.  This
patch requires
that the core patch for MakeUtil be applied first.

For the ChangeLog:
- Update the MakeView class to match UI standards and to contain a new
action
   to support editing of an existing make target.



Index: src/org/eclipse/cdt/internal/ui/makeview/MakeView.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/makeview/MakeView.java,v
retrieving revision 1.2
diff -u -r1.2 MakeView.java
--- src/org/eclipse/cdt/internal/ui/makeview/MakeView.java	16 Oct 2002 20:13:49 -0000	1.2
+++ src/org/eclipse/cdt/internal/ui/makeview/MakeView.java	8 Jul 2003 13:20:28 -0000
@@ -67,7 +67,7 @@
 		Object element = selection.getFirstElement ();
 		if (element instanceof MakeTarget) {
 			final MakeTarget ta = (MakeTarget)element;
-			Action add = new Action ("Add") {
+			Action add = new Action ("Add...") {
 				public void run() {
 					InputDialog dialog = new InputDialog(getViewSite().getShell(),
 								"Target Dialog: ", "Enter Target(s): ", null, null);
@@ -83,6 +83,24 @@
 					}
 				}
 			};
+			Action edit = new Action ("Edit...") {
+				public void run() {
+					String oldtarget = ta.toString();
+					InputDialog dialog = new InputDialog(getViewSite().getShell(),
+								"Target Dialog: ", "Enter Target(s): ", oldtarget, null);
+					dialog.open ();
+					String value = dialog.getValue ();
+					if (value != null && value.length() > 0 && !value.equals(oldtarget)) {
+						IResource res = ta.getResource();
+						MakeUtil.replacePersistentTarget(res, oldtarget, value);
+						viewer.getControl().setRedraw(false);
+						viewer.refresh ();
+						viewer.getControl().setRedraw(true);
+						viewer.expandToLevel(ta, 2);
+					}
+				}
+			};
+
 			Action del = new Action ("Delete") {
 				public void run() {
 					String target = ta.toString();
@@ -102,7 +120,9 @@
 					viewer.refresh ();
 				}
 			};
+			
 			menu.add (add);
+			menu.add (edit);
 			menu.add (del);
 			//menu.add (new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
 			menu.add (build);
@@ -110,6 +130,7 @@
 			if (ta.isLeaf()) {
 				add.setEnabled(false);
 			} else {
+				edit.setEnabled(false);
 				del.setEnabled(false);
 			}
 		}

Back to the top