summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManju Mathew2013-04-05 06:29:13 (EDT)
committerDani Megert2013-04-05 06:29:13 (EDT)
commit8715274aefc5cc4622fa79612694ce83063f2fad (patch)
treefcd3e5c82516bb871fe6f67fe61d68fa87b42f1f
parent6b94ad09afd349d4a8a1fc03e60acfb3d312948a (diff)
downloadeclipse.jdt.ui-8715274aefc5cc4622fa79612694ce83063f2fad.zip
eclipse.jdt.ui-8715274aefc5cc4622fa79612694ce83063f2fad.tar.gz
eclipse.jdt.ui-8715274aefc5cc4622fa79612694ce83063f2fad.tar.bz2
Fixed bug 335657: [call hierarchy] Refresh does not bring back removed roots
-rw-r--r--org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/callhierarchy/RemoveFromViewAction.java46
1 files changed, 6 insertions, 40 deletions
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/callhierarchy/RemoveFromViewAction.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/callhierarchy/RemoveFromViewAction.java
index b4d143f..0b69dc6 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/callhierarchy/RemoveFromViewAction.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/callhierarchy/RemoveFromViewAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 IBM Corporation and others.
+ * Copyright (c) 2009, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,10 +8,7 @@
*******************************************************************************/
package org.eclipse.jdt.internal.ui.callhierarchy;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Iterator;
-import java.util.List;
import org.eclipse.swt.widgets.TreeItem;
@@ -22,8 +19,6 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.jdt.core.IMember;
-
import org.eclipse.jdt.internal.corext.callhierarchy.MethodWrapper;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
@@ -68,50 +63,21 @@ class RemoveFromViewAction extends Action{
setHoverImageDescriptor(workbenchImages.getImageDescriptor(ISharedImages.IMG_ELCL_REMOVE));
}
- /* (non-Javadoc)
+ /**
+ * Removes the selected nodes from the view with out modifying the underlying view input. Thus
+ * on refresh of the view the removed nodes are also brought back to the view.
+ *
* @see org.eclipse.jface.action.Action#run()
+ * @since 3.9
*/
@Override
public void run() {
- IMember[] inputElements= fPart.getInputElements();
- List<IMember> inputList= new ArrayList<IMember>(Arrays.asList(inputElements));
- IMember[] selection= getSelectedElements();
- for (int i= 0; i < selection.length; i++) {
- if (inputList.contains(selection[i]))
- inputList.remove(selection[i]);
- }
- if (inputList.size() > 0) {
- fPart.updateInputHistoryAndDescription(inputElements, inputList.toArray(new IMember[inputList.size()]));
- }
TreeItem[] items= fCallHierarchyViewer.getTree().getSelection();
for (int i= 0; i < items.length; i++)
items[i].dispose();
}
/**
- * Gets the elements selected in the call hierarchy view part.
- *
- * @return the elements
- * @since 3.7
- */
- private IMember[] getSelectedElements() {
- ISelection selection= getSelection();
- if (selection instanceof IStructuredSelection) {
- List<IMember> members= new ArrayList<IMember>();
- List<?> elements= ((IStructuredSelection)selection).toList();
- for (Iterator<?> iter= elements.iterator(); iter.hasNext();) {
- Object obj= iter.next();
- if (obj instanceof MethodWrapper) {
- MethodWrapper wrapper= (MethodWrapper)obj;
- members.add((wrapper).getMember());
- }
- }
- return members.toArray(new IMember[members.size()]);
- }
- return null;
- }
-
- /**
* Gets the selection from the call hierarchy view part.
*
* @return the current selection