1 24 25 26 package org.netbeans.modules.javadoc.httpfs; 27 28 import org.openide.nodes.Node; 29 import org.openide.util.HelpCtx; 30 import org.openide.loaders.DataObject; 31 import org.openide.filesystems.FileObject; 32 import org.openide.util.NbBundle; 33 34 35 40 class RefreshAction 41 extends org.openide.util.actions.NodeAction { 42 43 48 RefreshAction( 49 ) { 50 } 51 52 53 60 public String getName( 61 ) { 62 63 return NbBundle.getMessage(RefreshAction.class, "RefreshFS" ); 65 } 66 67 77 protected boolean enable( 78 Node[] activatedNodes 79 ) { 80 81 boolean rootFolderSelected; 83 int nodeIndex; 85 DataObject dataObject; 87 FileObject fileObject; 89 90 91 rootFolderSelected = true; 92 nodeIndex = 0; 93 94 while( nodeIndex < activatedNodes.length && rootFolderSelected ) { 96 97 dataObject = (DataObject)activatedNodes[ nodeIndex ].getCookie( DataObject.class ); 99 if( dataObject != null ) { 100 101 fileObject = dataObject.getPrimaryFile( ); 103 104 if( !( fileObject instanceof HTTPRootFileObject ) ) { 106 107 rootFolderSelected = false; 109 110 } 111 112 } else { 113 114 rootFolderSelected = false; 116 117 } 118 nodeIndex++; 119 120 } 121 return rootFolderSelected; 122 123 } 124 125 126 133 public HelpCtx getHelpCtx( 134 ) { 135 136 return HelpCtx.DEFAULT_HELP; 137 138 } 139 140 141 148 protected void performAction( 149 Node[] activatedNodes 150 ) { 151 152 int nodeIndex; 154 DataObject dataObject; 156 HTTPRootFileObject rootFileObject; 158 159 160 for( nodeIndex = 0; nodeIndex < activatedNodes.length; nodeIndex++ ) { 162 163 dataObject = (DataObject)activatedNodes[ nodeIndex ].getCookie( DataObject.class ); 165 rootFileObject = (HTTPRootFileObject)dataObject.getPrimaryFile( ); 166 rootFileObject.triggerRefresh( ); 167 168 } 169 170 } 171 172 } 173 | Popular Tags |