Cleanup of static usage
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / view / bookmark / BookmarkViewActionGroup.java
index 2cd661c..ad120a6 100644 (file)
@@ -17,6 +17,7 @@ import com.quantum.actions.RemoveFromQuickListAction;
 import com.quantum.actions.ViewTableAction;
 import com.quantum.actions.ViewTableDetailsAction;
 import com.quantum.model.Bookmark;
+import com.quantum.model.Entity;
 import com.quantum.util.versioning.VersioningHelper;
 
 import org.eclipse.jface.action.Action;
@@ -38,6 +39,7 @@ import org.eclipse.ui.IViewPart;
 import org.eclipse.ui.IWorkbenchActionConstants;
 import org.eclipse.ui.actions.ActionGroup;
 import org.eclipse.ui.actions.ExportResourcesAction;
+import org.eclipse.ui.actions.ImportResourcesAction;
 import org.eclipse.ui.actions.SelectionListenerAction;
 import org.eclipse.ui.actions.SelectionProviderAction;
 import org.eclipse.ui.dialogs.PropertyDialogAction;
@@ -111,6 +113,7 @@ public class BookmarkViewActionGroup extends ActionGroup
     private SelectionListenerAction renameAction;
 
     private ExportResourcesAction exportAction;
+    private ImportResourcesAction importAction;
 
     
     private SelectionProviderAction propertiesAction;
@@ -152,6 +155,9 @@ public class BookmarkViewActionGroup extends ActionGroup
         this.exportAction = VersioningHelper.createExportResourcesAction(
                        this.viewPart.getViewSite().getWorkbenchWindow());
         this.exportAction.setImageDescriptor(ImageStore.getImageDescriptor(ImageStore.EXPORT));
+        this.importAction = VersioningHelper.createImportResourcesAction(
+                       this.viewPart.getViewSite().getWorkbenchWindow());
+        this.importAction.setImageDescriptor(ImageStore.getImageDescriptor(ImageStore.IMPORT));
         
         this.dropAction = new DropEntityAction(this.viewPart);
         
@@ -199,11 +205,12 @@ public class BookmarkViewActionGroup extends ActionGroup
                this.exportAction.selectionChanged(getStructuredSelection());
                menu.add(this.exportAction);
         }
-
-        if (getStructuredSelection().size() == 1 && 
-            isEverySelectionInstanceof(BookmarkNode.class)) {
+        if (this.importAction != null) {
+               this.importAction.selectionChanged(getStructuredSelection());
+                       menu.add(this.importAction);
         }
 
+        
         if (isEverySelectionInstanceof(QueryNode.class)) {
             if (getStructuredSelection().size() == 1) {
                 addToMenu(menu, this.openQueryAction);
@@ -285,6 +292,38 @@ public class BookmarkViewActionGroup extends ActionGroup
         
         return result;
     }
+    private boolean isEverySelectedGroupOfType(String type) {
+        boolean result = true;
+        IStructuredSelection selection = getStructuredSelection();
+        for (Iterator i = selection.iterator(); result && i.hasNext(); ) {
+            Object object = i.next();
+            result &= (( object instanceof GroupNode ) && 
+                               ((GroupNode)object).getType().equals(type));
+        }
+        
+        return result;
+    }
+    private boolean isEverySelectedEntityTable() {
+        boolean result = true;
+        IStructuredSelection selection = getStructuredSelection();
+        for (Iterator i = selection.iterator(); result && i.hasNext(); ) {
+            Object object = i.next();
+            result &= (( object instanceof EntityNode ) && 
+                               ((EntityNode)object).isTable());
+        }
+        
+        return result;
+    }
+    private boolean isEverySelectedEntityView() {
+        boolean result = true;
+        IStructuredSelection selection = getStructuredSelection();
+        for (Iterator i = selection.iterator(); result && i.hasNext(); ) {
+            Object object = i.next();
+            result &= (( object instanceof EntityNode ) && 
+                               ((EntityNode)object).isView());
+        }
+        return result;
+    }
     
     public IAction getOpenAction() {
         if (isEverySelectionInstanceof(BookmarkNode.class)) {