Some refactoring of the model and of command handling.
[lgpl/argeo-commons.git] / server / plugins / org.argeo.jcr.ui.explorer / plugin.xml
index 27a5d3d2cd5cd89b51d19372c75acd8f625ee7f0..358d5590d3dbd88bc7745eae73fc8b1ddd6e432a 100644 (file)
@@ -78,7 +78,7 @@
          <command
                defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
                id="org.argeo.jcr.ui.explorer.addFolderNode"
-               name="Create folder">
+               name="Create the new folder">
          </command>
          <command
                defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
                name="Open current file">
          </command>
     </extension>
+
+    <!-- Menus --> 
        <extension point="org.eclipse.ui.menus">
                <menuContribution
-                locationURI="menu:org.argeo.jcr.ui.explorer.browserView">
-                <command
-                      commandId="org.argeo.jcr.ui.explorer.openGenericJcrQueryEditor"
-                      icon="icons/query.png"
-                      style="push">
-                </command>
-          </menuContribution>
+                       locationURI="menu:org.argeo.jcr.ui.explorer.browserView">
+            <command
+               commandId="org.argeo.jcr.ui.explorer.openGenericJcrQueryEditor"
+                icon="icons/query.png"
+                style="push">
+            </command>
+        </menuContribution>
                <menuContribution
-                locationURI="menu:org.argeo.jcr.ui.explorer.browserView">
-                <command
-                      commandId="org.argeo.jcr.ui.explorer.addRemoteRepository"
-                      icon="icons/addRepo.gif"
-                      style="push">
-                </command>
-          </menuContribution>
-  <menuContribution
-        locationURI="popup:org.argeo.jcr.ui.explorer.browserView">
-     <command
-           commandId="org.argeo.jcr.ui.explorer.refresh"
-           icon="icons/refresh.png"
-           style="push">
-     </command>
-     <command
-           commandId="org.argeo.jcr.ui.explorer.addFolderNode"
-           icon="icons/addFolder.gif"
-           style="push">
-     </command>
+                       locationURI="menu:org.argeo.jcr.ui.explorer.browserView">
+            <command
+               commandId="org.argeo.jcr.ui.explorer.addRemoteRepository"
+                icon="icons/addRepo.gif"
+                style="push">
+            </command>
+               </menuContribution>
+               <menuContribution
+                       locationURI="popup:org.argeo.jcr.ui.explorer.browserView">
+                       <command
+                               commandId="org.argeo.jcr.ui.explorer.refresh"
+                               icon="icons/refresh.png"
+                               style="push">
+                       </command>
+                       <command
+         commandId="org.argeo.jcr.ui.explorer.addFolderNode"
+         icon="icons/addFolder.gif"
+         label="%addNewFolderCmdLbl"
+         style="push">
+                               <visibleWhen>
+                                       <iterate>
+                                     <and>
+                                        <or>
+                                           <instanceof
+                                                 value="org.argeo.jcr.ui.explorer.model.SingleJcrNode">
+                                           </instanceof>
+                                           <instanceof
+                                                 value="org.argeo.jcr.ui.explorer.model.WorkspaceNode">
+                                           </instanceof>
+                                        </or>
+             <reference
+                   definitionId="expression.onlyOneItemSelected">
+             </reference>
+                                     </and>
+                                       </iterate>
+                               </visibleWhen>
+                       </command>
      <command
            commandId="org.argeo.jcr.ui.explorer.deleteNodes"
            icon="icons/remove.gif"
            style="push">
+        <visibleWhen>
+           <iterate>
+              <or>
+                 <instanceof
+                       value="org.argeo.jcr.ui.explorer.model.SingleJcrNode">
+                 </instanceof>
+                 <instanceof
+                       value="org.argeo.jcr.ui.explorer.model.WorkspaceNode">
+                 </instanceof>
+              </or>
+           </iterate>
+        </visibleWhen>
      </command>
      <command
            commandId="org.argeo.jcr.ui.explorer.importFileSystem"
            icon="icons/import_fs.png"
            style="push"
            tooltip="Import files from the files sytem to the repository">
+        <visibleWhen>
+           <iterate>
+              <and>
+                 <or>
+                    <instanceof
+                          value="org.argeo.jcr.ui.explorer.model.SingleJcrNode">
+                    </instanceof>
+                    <instanceof
+                          value="org.argeo.jcr.ui.explorer.model.WorkspaceNode">
+                    </instanceof>
+                 </or>
+                 <with
+                     variable="activeMenuSelection">
+                  <count
+                        value="1">
+                  </count>
+               </with>
+              </and>
+           </iterate>
+        </visibleWhen>
      </command>
      <command
            commandId="org.argeo.jcr.ui.explorer.addRemoteRepository"
            icon="icons/addRepo.gif"
            style="push">
+        <visibleWhen>
+           <iterate> 
+                               <or>
+                       <instanceof
+                       value="org.argeo.jcr.ui.explorer.model.RepositoriesNode">
+                                       </instanceof>
+                                       <instanceof
+                                               value="org.argeo.jcr.ui.explorer.model.RepositoryNode">
+                                       </instanceof>
+                               </or> 
+           </iterate>
+        </visibleWhen>
      </command>
      <command
            commandId="org.argeo.jcr.ui.explorer.getNodeSize"
            icon="icons/getSize.gif"
            style="push">
+        <visibleWhen>
+           <iterate>
+              <or>
+                 <instanceof
+                       value="org.argeo.jcr.ui.explorer.model.SingleJcrNode">
+                 </instanceof>
+                 <instanceof
+                       value="org.argeo.jcr.ui.explorer.model.WorkspaceNode">
+                 </instanceof>
+              </or>
+           </iterate>
+        </visibleWhen>
      </command>
   </menuContribution>
        </extension>
+       
+       <!-- Core expression definition --> 
+       
+       <extension
+         point="org.eclipse.core.expressions.definitions">
+      <definition
+            id="expression.onlyOneItemSelected">
+         <with
+               variable="activeMenuSelection">
+            <count
+                  value="1">
+            </count>
+         </with>
+      </definition>
+   </extension>
+       
   <extension
            point="org.eclipse.ui.activities">
         <activity