1 11 package org.eclipse.jdt.internal.ui.javaeditor.selectionactions; 12 13 import org.eclipse.ui.PlatformUI; 14 15 import org.eclipse.jdt.core.ISourceRange; 16 import org.eclipse.jdt.core.ISourceReference; 17 import org.eclipse.jdt.core.JavaModelException; 18 import org.eclipse.jdt.core.dom.ASTNode; 19 20 import org.eclipse.jdt.internal.corext.dom.SelectionAnalyzer; 21 22 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; 23 import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; 24 25 public class StructureSelectEnclosingAction extends StructureSelectionAction { 26 27 public StructureSelectEnclosingAction(JavaEditor editor, SelectionHistory history) { 28 super(SelectionActionMessages.StructureSelectEnclosing_label, editor, history); 29 setToolTipText(SelectionActionMessages.StructureSelectEnclosing_tooltip); 30 setDescription(SelectionActionMessages.StructureSelectEnclosing_description); 31 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.STRUCTURED_SELECT_ENCLOSING_ACTION); 32 } 33 34 37 public StructureSelectEnclosingAction() { 38 } 39 40 43 ISourceRange internalGetNewSelectionRange(ISourceRange oldSourceRange, ISourceReference sr, SelectionAnalyzer selAnalyzer) throws JavaModelException{ 44 ASTNode first= selAnalyzer.getFirstSelectedNode(); 45 if (first == null || first.getParent() == null) 46 return getLastCoveringNodeRange(oldSourceRange, sr, selAnalyzer); 47 48 return getSelectedNodeSourceRange(sr, first.getParent()); 49 } 50 } 51 | Popular Tags |