1 19 20 package org.netbeans.modules.j2ee.earproject.ui; 21 22 import java.util.Collections ; 23 import java.util.List ; 24 import org.netbeans.api.project.FileOwnerQuery; 25 import org.netbeans.api.project.Project; 26 import org.netbeans.modules.j2ee.earproject.EarProject; 27 import org.netbeans.modules.j2ee.earproject.UpdateHelper; 28 import org.netbeans.modules.j2ee.earproject.ui.actions.AddModuleAction; 29 import org.netbeans.spi.project.support.ant.AntBasedProjectType; 30 import org.netbeans.spi.project.support.ant.PropertyEvaluator; 31 import org.netbeans.spi.project.support.ant.ReferenceHelper; 32 import org.openide.filesystems.FileObject; 33 import org.openide.nodes.Children; 34 import org.openide.nodes.Node; 35 import org.openide.util.actions.SystemAction; 36 37 42 public final class LogicalViewProvider extends J2eeArchiveLogicalViewProvider { 43 44 private final EarProject earProject; 45 private final static List <? extends SystemAction> specialActions = 46 Collections.singletonList(SystemAction.get(AddModuleAction.class)); 47 48 49 public LogicalViewProvider(EarProject earProject, UpdateHelper helper, 50 PropertyEvaluator evaluator, ReferenceHelper resolver, 51 AntBasedProjectType abpt) { 52 super(earProject, helper, evaluator, resolver, specialActions, abpt); 53 this.earProject = earProject; 54 } 55 56 public Node createLogicalView() { 57 Node retVal = super.createLogicalView(); 58 Children kids = retVal.getChildren(); 59 kids.add(new Node[] { new LogicalViewNode(helper.getAntProjectHelper()) }); 60 return retVal; 61 } 62 63 public Node findPath(Node root, Object target) { 64 FileObject pd = earProject.getProjectDirectory(); 67 if (pd.equals(target)) { 68 return root; 69 } 70 Node retVal = super.findPath(root, target); 71 if (null != retVal) { 72 return retVal; 73 } 74 if (!(target instanceof FileObject)) { 75 return retVal; 76 } 77 78 Project p = FileOwnerQuery.getOwner((FileObject) target); 80 if (null == p) { 81 return retVal; 82 } 83 return retVal; 90 } 91 92 } 93 | Popular Tags |