hdt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rsha...@apache.org
Subject [2/6] git commit: - HDT-52 : changing menu of ClusterView - shows three options for MR cluster - shows delete option for MR job
Date Fri, 23 May 2014 03:21:09 GMT
- HDT-52 : changing menu of ClusterView - shows three options for MR cluster - shows delete
option for MR job


Project: http://git-wip-us.apache.org/repos/asf/incubator-hdt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hdt/commit/45147711
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hdt/tree/45147711
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hdt/diff/45147711

Branch: refs/heads/hadoop-eclipse-merge-development
Commit: 45147711746b3189de4ef32fba8f3952c55b3353
Parents: 00646ae
Author: Rahul Sharma <rsharma@apache.org>
Authored: Wed May 14 14:34:59 2014 +0530
Committer: Rahul Sharma <rsharma@apache.org>
Committed: Fri May 23 08:45:39 2014 +0530

----------------------------------------------------------------------
 .../apache/hdt/ui/internal/mr/ClusterView.java  | 53 ++++----------------
 1 file changed, 9 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/45147711/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/mr/ClusterView.java
----------------------------------------------------------------------
diff --git a/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/mr/ClusterView.java b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/mr/ClusterView.java
index 9952904..7ac0582 100644
--- a/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/mr/ClusterView.java
+++ b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/mr/ClusterView.java
@@ -176,45 +176,9 @@ public class ClusterView extends ViewPart implements ITreeContentProvider,
ITabl
 		getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteAction);
 		getViewSite().getActionBars().getToolBarManager().add(editServerAction);
 		getViewSite().getActionBars().getToolBarManager().add(newLocationAction);
-
-		createActions();
 		createContextMenu();
 	}
 
-	/**
-	 * Actions
-	 */
-	private void createActions() {
-		/*
-		 * addItemAction = new Action("Add...") { public void run() { addItem();
-		 * } }; addItemAction.setImageDescriptor(ImageLibrary
-		 * .get("server.view.location.new"));
-		 */
-		/*
-		 * deleteItemAction = new Action("Delete") { public void run() {
-		 * deleteItem(); } };
-		 * deleteItemAction.setImageDescriptor(getImageDescriptor
-		 * ("delete.gif"));
-		 * 
-		 * selectAllAction = new Action("Select All") { public void run() {
-		 * selectAll(); } };
-		 */
-		// Add selection listener.
-		viewer.addSelectionChangedListener(new ISelectionChangedListener() {
-			public void selectionChanged(SelectionChangedEvent event) {
-				updateActionEnablement();
-			}
-		});
-	}
-
-	private void addItem() {
-		System.out.printf("ADD ITEM\n");
-	}
-
-	private void updateActionEnablement() {
-		IStructuredSelection sel = (IStructuredSelection) viewer.getSelection();
-		// deleteItemAction.setEnabled(sel.size() > 0);
-	}
 
 	/**
 	 * Contextual menu
@@ -238,14 +202,15 @@ public class ClusterView extends ViewPart implements ITreeContentProvider,
ITabl
 	}
 
 	private void fillContextMenu(IMenuManager mgr) {
-		mgr.add(newLocationAction);
-		mgr.add(editServerAction);
-		mgr.add(deleteAction);
-		/*
-		 * mgr.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
-		 * mgr.add(deleteItemAction); mgr.add(new Separator());
-		 * mgr.add(selectAllAction);
-		 */
+		IStructuredSelection sel = (IStructuredSelection) viewer.getSelection();
+		Object firstElement = sel.getFirstElement();
+		if(firstElement instanceof IHadoopJob){
+			mgr.add(deleteAction);
+		}else{
+			mgr.add(newLocationAction);
+			mgr.add(editServerAction);
+			mgr.add(deleteAction);
+		}
 	}
 
 	/* @inheritDoc */


Mime
View raw message