directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r526280 - in /directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui: actions/ wizards/
Date Fri, 06 Apr 2007 21:08:22 GMT
Author: seelmann
Date: Fri Apr  6 14:08:21 2007
New Revision: 526280

URL: http://svn.apache.org/viewvc?view=rev&rev=526280
Log:
Enabled actions independent from the current selection (DIRSTUDIO-74).

Modified:
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/NewBookmarkAction.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/NewEntryAction.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/NewSearchAction.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewBookmarkWizard.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryObjectclassWizardPage.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryWizard.java

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/NewBookmarkAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/NewBookmarkAction.java?view=diff&rev=526280&r1=526279&r2=526280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/NewBookmarkAction.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/NewBookmarkAction.java
Fri Apr  6 14:08:21 2007
@@ -21,11 +21,9 @@
 package org.apache.directory.ldapstudio.browser.ui.actions;
 
 
-import org.apache.directory.ldapstudio.browser.core.model.IEntry;
 import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
 import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
 import org.apache.directory.ldapstudio.browser.ui.wizards.NewBookmarkWizard;
-
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.WizardDialog;
@@ -65,37 +63,6 @@
 
 
     /**
-     * Gets the entry associated with the Bookmark
-     *
-     * @return
-     *      the entry associated with the Bookmark
-     */
-    private IEntry getEntry()
-    {
-        if ( this.getSelectedEntries().length + this.getSelectedSearchResults().length
-            + this.getSelectedBookmarks().length != 1 )
-        {
-            return null;
-        }
-
-        if ( getSelectedEntries().length == 1 )
-        {
-            return getSelectedEntries()[0];
-        }
-        else if ( getSelectedSearchResults().length == 1 )
-        {
-            return getSelectedSearchResults()[0].getEntry();
-        }
-        else if ( getSelectedBookmarks().length == 1 )
-        {
-            return getSelectedBookmarks()[0].getEntry();
-        }
-
-        return null;
-    }
-
-
-    /**
      * {@inheritDoc}
      */
     public String getText()
@@ -127,6 +94,6 @@
      */
     public boolean isEnabled()
     {
-        return getEntry() != null && getEntry().getConnection() != null &&
getEntry().getConnection().isOpened();
+        return true;
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/NewEntryAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/NewEntryAction.java?view=diff&rev=526280&r1=526279&r2=526280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/NewEntryAction.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/NewEntryAction.java
Fri Apr  6 14:08:21 2007
@@ -130,8 +130,6 @@
      */
     public boolean isEnabled()
     {
-        return this.getSelectedEntries().length + this.getSelectedSearchResults().length
-            + this.getSelectedBookmarks().length == 1;
-        // return getSelectedEntries().length == 1;
+        return true;
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/NewSearchAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/NewSearchAction.java?view=diff&rev=526280&r1=526279&r2=526280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/NewSearchAction.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/NewSearchAction.java
Fri Apr  6 14:08:21 2007
@@ -87,8 +87,6 @@
      */
     public boolean isEnabled()
     {
-        return getSelectedEntries().length + getSelectedSearchResults().length + getSelectedSearches().length
-            + getSelectedBookmarks().length + getSelectedConnections().length + getSelectedAttributes().length
-            + getSelectedAttributeHierarchies().length + getSelectedValues().length >
0;
+        return true;
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewBookmarkWizard.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewBookmarkWizard.java?view=diff&rev=526280&r1=526279&r2=526280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewBookmarkWizard.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewBookmarkWizard.java
Fri Apr  6 14:08:21 2007
@@ -25,9 +25,14 @@
 import org.apache.directory.ldapstudio.browser.core.model.DN;
 import org.apache.directory.ldapstudio.browser.core.model.IAttribute;
 import org.apache.directory.ldapstudio.browser.core.model.IBookmark;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
 import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.core.model.ISearch;
 import org.apache.directory.ldapstudio.browser.core.model.ISearchResult;
 import org.apache.directory.ldapstudio.browser.core.model.IValue;
+import org.apache.directory.ldapstudio.browser.ui.widgets.browser.BrowserCategory;
+import org.apache.directory.ldapstudio.browser.ui.widgets.browser.BrowserEntryPage;
+import org.apache.directory.ldapstudio.browser.ui.widgets.browser.BrowserSearchResultPage;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.IWizardPage;
 import org.eclipse.jface.wizard.Wizard;
@@ -93,9 +98,9 @@
         {
             selectedEntry = ( ( ISearchResult ) o ).getEntry();
         }
-        else if ( o instanceof Bookmark )
+        else if ( o instanceof IBookmark )
         {
-            selectedEntry = ( ( Bookmark ) o ).getEntry();
+            selectedEntry = ( ( IBookmark ) o ).getEntry();
         }
         else if ( o instanceof IAttribute )
         {
@@ -105,6 +110,27 @@
         {
             selectedEntry = ( ( IValue ) o ).getAttribute().getEntry();
         }
+        else if ( o instanceof IConnection )
+        {
+            selectedEntry = ( ( IConnection ) o ).getRootDSE();
+        }
+        else if ( o instanceof ISearch )
+        {
+            selectedEntry = ( ( ISearch ) o ).getConnection().getRootDSE();
+        }
+        else if ( o instanceof BrowserCategory )
+        {
+            selectedEntry = ( ( BrowserCategory ) o ).getParent().getRootDSE();
+        }
+        else if ( o instanceof BrowserSearchResultPage )
+        {
+            selectedEntry = ( ( BrowserSearchResultPage ) o ).getSearch().getConnection().getRootDSE();
+        }
+        else if ( o instanceof BrowserEntryPage )
+        {
+            selectedEntry = ( ( BrowserEntryPage ) o ).getEntry();
+        }
+        
         else
         {
             selectedEntry = null;
@@ -145,7 +171,7 @@
         {
             super( "" );
             setTitle( "No entry selected" );
-            setDescription( "In order to use the bookmark creation wizard please select an
entry." );
+            setDescription( "In order to use the bookmark creation wizard please select an
entry or connection." );
             // setImageDescriptor(BrowserUIPlugin.getDefault().getImageDescriptor(BrowserUIConstants.IMG_ATTRIBUTE_WIZARD));
             setPageComplete( true );
         }

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryObjectclassWizardPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryObjectclassWizardPage.java?view=diff&rev=526280&r1=526279&r2=526280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryObjectclassWizardPage.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryObjectclassWizardPage.java
Fri Apr  6 14:08:21 2007
@@ -31,12 +31,14 @@
 import org.apache.directory.ldapstudio.browser.core.internal.model.Attribute;
 import org.apache.directory.ldapstudio.browser.core.internal.model.DummyEntry;
 import org.apache.directory.ldapstudio.browser.core.internal.model.Value;
+import org.apache.directory.ldapstudio.browser.core.jobs.OpenConnectionsJob;
 import org.apache.directory.ldapstudio.browser.core.model.IAttribute;
 import org.apache.directory.ldapstudio.browser.core.model.IValue;
 import org.apache.directory.ldapstudio.browser.core.model.ModelModificationException;
 import org.apache.directory.ldapstudio.browser.core.model.schema.ObjectClassDescription;
 import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
 import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.apache.directory.ldapstudio.browser.ui.jobs.RunnableContextJobAdapter;
 import org.apache.directory.ldapstudio.browser.ui.widgets.BaseWidgetUtils;
 import org.eclipse.jface.fieldassist.DecoratedField;
 import org.eclipse.jface.fieldassist.FieldDecoration;
@@ -156,6 +158,12 @@
 
         if ( wizard.getSelectedConnection() != null )
         {
+            if( !wizard.getSelectedConnection().isOpened() )
+            {
+                OpenConnectionsJob job = new OpenConnectionsJob(wizard.getSelectedConnection());
+                RunnableContextJobAdapter.execute( job, getContainer() );
+            }
+            
             availableObjectClasses.addAll( Arrays.asList( wizard.getSelectedConnection().getSchema()
                 .getObjectClassDescriptions() ) );
 

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryWizard.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryWizard.java?view=diff&rev=526280&r1=526279&r2=526280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryWizard.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/NewEntryWizard.java
Fri Apr  6 14:08:21 2007
@@ -22,11 +22,11 @@
 
 
 import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
-import org.apache.directory.ldapstudio.browser.core.internal.model.Bookmark;
 import org.apache.directory.ldapstudio.browser.core.internal.model.DummyEntry;
 import org.apache.directory.ldapstudio.browser.core.jobs.CreateEntryJob;
 import org.apache.directory.ldapstudio.browser.core.model.DN;
 import org.apache.directory.ldapstudio.browser.core.model.IAttribute;
+import org.apache.directory.ldapstudio.browser.core.model.IBookmark;
 import org.apache.directory.ldapstudio.browser.core.model.IConnection;
 import org.apache.directory.ldapstudio.browser.core.model.IEntry;
 import org.apache.directory.ldapstudio.browser.core.model.ISearch;
@@ -35,6 +35,9 @@
 import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
 import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
 import org.apache.directory.ldapstudio.browser.ui.jobs.RunnableContextJobAdapter;
+import org.apache.directory.ldapstudio.browser.ui.widgets.browser.BrowserCategory;
+import org.apache.directory.ldapstudio.browser.ui.widgets.browser.BrowserEntryPage;
+import org.apache.directory.ldapstudio.browser.ui.widgets.browser.BrowserSearchResultPage;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.IWizardPage;
 import org.eclipse.jface.wizard.Wizard;
@@ -118,9 +121,9 @@
             selectedEntry = ( ( ISearchResult ) o ).getEntry();
             selectedConnection = selectedEntry.getConnection();
         }
-        else if ( o instanceof Bookmark )
+        else if ( o instanceof IBookmark )
         {
-            selectedEntry = ( ( Bookmark ) o ).getEntry();
+            selectedEntry = ( ( IBookmark ) o ).getEntry();
             selectedConnection = selectedEntry.getConnection();
         }
         else if ( o instanceof IAttribute )
@@ -143,6 +146,21 @@
             selectedEntry = null;
             selectedConnection = ( IConnection ) o;
         }
+        else if ( o instanceof BrowserCategory )
+        {
+            selectedEntry = null;
+            selectedConnection = ( ( BrowserCategory ) o ).getParent();
+        }
+        else if ( o instanceof BrowserSearchResultPage )
+        {
+            selectedEntry = null;
+            selectedConnection = ( ( BrowserSearchResultPage ) o ).getSearch().getConnection();
+        }
+        else if ( o instanceof BrowserEntryPage )
+        {
+            selectedEntry = null;
+            selectedConnection = ( ( BrowserEntryPage ) o ).getEntry().getConnection();
+        }
         else
         {
             selectedEntry = null;
@@ -162,7 +180,7 @@
      */
     public void addPages()
     {
-        if ( selectedConnection != null && selectedConnection.isOpened() )
+        if ( selectedConnection != null )
         {
             typePage = new NewEntryTypeWizardPage( NewEntryTypeWizardPage.class.getName(),
this );
             addPage( typePage );
@@ -192,14 +210,17 @@
         super.createPageControls( pageContainer );
 
         // set help context ID
-        PlatformUI.getWorkbench().getHelpSystem().setHelp( typePage.getControl(),
-            BrowserUIPlugin.PLUGIN_ID + "." + "tools_newentry_wizard" );
-        PlatformUI.getWorkbench().getHelpSystem().setHelp( ocPage.getControl(),
-            BrowserUIPlugin.PLUGIN_ID + "." + "tools_newentry_wizard" );
-        PlatformUI.getWorkbench().getHelpSystem().setHelp( dnPage.getControl(),
-            BrowserUIPlugin.PLUGIN_ID + "." + "tools_newentry_wizard" );
-        PlatformUI.getWorkbench().getHelpSystem().setHelp( attributePage.getControl(),
-            BrowserUIPlugin.PLUGIN_ID + "." + "tools_newentry_wizard" );
+        if ( selectedConnection != null )
+        {
+            PlatformUI.getWorkbench().getHelpSystem().setHelp( typePage.getControl(),
+                BrowserUIPlugin.PLUGIN_ID + "." + "tools_newentry_wizard" );
+            PlatformUI.getWorkbench().getHelpSystem().setHelp( ocPage.getControl(),
+                BrowserUIPlugin.PLUGIN_ID + "." + "tools_newentry_wizard" );
+            PlatformUI.getWorkbench().getHelpSystem().setHelp( dnPage.getControl(),
+                BrowserUIPlugin.PLUGIN_ID + "." + "tools_newentry_wizard" );
+            PlatformUI.getWorkbench().getHelpSystem().setHelp( attributePage.getControl(),
+                BrowserUIPlugin.PLUGIN_ID + "." + "tools_newentry_wizard" );
+        }
     }
 
     /**
@@ -218,7 +239,7 @@
         {
             super( "" );
             setTitle( "No connection selected or connection is closed" );
-            setDescription( "In order to use the entry creation wizard please select an opened
connection." );
+            setDescription( "In order to use the entry creation wizard please select an entry
or connection." );
             setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor(
                 BrowserUIConstants.IMG_ENTRY_WIZARD ) );
             setPageComplete( true );



Mime
View raw message