directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1227244 - in /directory/studio/trunk/plugins: ldapservers.apacheds.v153/ ldapservers.apacheds.v154/ ldapservers.apacheds.v155/ ldapservers.apacheds.v156/ ldapservers.apacheds.v157/ ldapservers.apacheds.v200/ ldapservers/ ldapservers/src/ma...
Date Wed, 04 Jan 2012 18:03:14 GMT
Author: pamarcelot
Date: Wed Jan  4 18:03:13 2012
New Revision: 1227244

URL: http://svn.apache.org/viewvc?rev=1227244&view=rev
Log:
Tweaked contributed action to only show when the LDAP Perspective is available.

Modified:
    directory/studio/trunk/plugins/ldapservers.apacheds.v153/plugin.xml
    directory/studio/trunk/plugins/ldapservers.apacheds.v154/plugin.xml
    directory/studio/trunk/plugins/ldapservers.apacheds.v155/plugin.xml
    directory/studio/trunk/plugins/ldapservers.apacheds.v156/plugin.xml
    directory/studio/trunk/plugins/ldapservers.apacheds.v157/plugin.xml
    directory/studio/trunk/plugins/ldapservers.apacheds.v200/plugin.xml
    directory/studio/trunk/plugins/ldapservers/plugin.properties
    directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/CreateConnectionActionHelper.java

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v153/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v153/plugin.xml?rev=1227244&r1=1227243&r2=1227244&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v153/plugin.xml (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v153/plugin.xml Wed Jan  4 18:03:13
2012
@@ -43,10 +43,16 @@
                icon="resources/icons/connection_new.gif">
          </action>
          <visibility>
+            <and>
+               <objectState
+                     name="isLdapPerspectiveAvailable"
+                     value="true">
+               </objectState>
                <objectState
                      name="extensionId"
                      value="%LdapServerAdapter_id">
                </objectState>
+            </and>
          </visibility>
       </objectContribution>
    </extension>

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v154/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v154/plugin.xml?rev=1227244&r1=1227243&r2=1227244&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v154/plugin.xml (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v154/plugin.xml Wed Jan  4 18:03:13
2012
@@ -43,10 +43,16 @@
                icon="resources/icons/connection_new.gif">
          </action>
          <visibility>
+            <and>
+               <objectState
+                     name="isLdapPerspectiveAvailable"
+                     value="true">
+               </objectState>
                <objectState
                      name="extensionId"
                      value="%LdapServerAdapter_id">
                </objectState>
+            </and>
          </visibility>
       </objectContribution>
    </extension>

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v155/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v155/plugin.xml?rev=1227244&r1=1227243&r2=1227244&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v155/plugin.xml (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v155/plugin.xml Wed Jan  4 18:03:13
2012
@@ -43,10 +43,16 @@
                icon="resources/icons/connection_new.gif">
          </action>
          <visibility>
+            <and>
+               <objectState
+                     name="isLdapPerspectiveAvailable"
+                     value="true">
+               </objectState>
                <objectState
                      name="extensionId"
                      value="%LdapServerAdapter_id">
                </objectState>
+            </and>
          </visibility>
       </objectContribution>
    </extension>

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v156/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v156/plugin.xml?rev=1227244&r1=1227243&r2=1227244&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v156/plugin.xml (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v156/plugin.xml Wed Jan  4 18:03:13
2012
@@ -43,10 +43,16 @@
                icon="resources/icons/connection_new.gif">
          </action>
          <visibility>
+            <and>
+               <objectState
+                     name="isLdapPerspectiveAvailable"
+                     value="true">
+               </objectState>
                <objectState
                      name="extensionId"
                      value="%LdapServerAdapter_id">
                </objectState>
+            </and>
          </visibility>
       </objectContribution>
    </extension>

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v157/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v157/plugin.xml?rev=1227244&r1=1227243&r2=1227244&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v157/plugin.xml (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v157/plugin.xml Wed Jan  4 18:03:13
2012
@@ -43,10 +43,16 @@
                icon="resources/icons/connection_new.gif">
          </action>
          <visibility>
+            <and>
+               <objectState
+                     name="isLdapPerspectiveAvailable"
+                     value="true">
+               </objectState>
                <objectState
                      name="extensionId"
                      value="%LdapServerAdapter_id">
                </objectState>
+            </and>
          </visibility>
       </objectContribution>
    </extension>

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v200/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v200/plugin.xml?rev=1227244&r1=1227243&r2=1227244&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v200/plugin.xml (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v200/plugin.xml Wed Jan  4 18:03:13
2012
@@ -43,10 +43,16 @@
                icon="resources/icons/connection_new.gif">
          </action>
          <visibility>
+            <and>
+               <objectState
+                     name="isLdapPerspectiveAvailable"
+                     value="true">
+               </objectState>
                <objectState
                      name="extensionId"
                      value="%LdapServerAdapter_id">
                </objectState>
+            </and>
          </visibility>
       </objectContribution>
    </extension>

Modified: directory/studio/trunk/plugins/ldapservers/plugin.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers/plugin.properties?rev=1227244&r1=1227243&r2=1227244&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers/plugin.properties (original)
+++ directory/studio/trunk/plugins/ldapservers/plugin.properties Wed Jan  4 18:03:13 2012
@@ -61,4 +61,12 @@ Ctx_ServersView_id=org.apache.directory.
 Ctx_ServersView_name=In LDAP Servers View
 Ctx_ServersView_description=In LDAP Servers View
 
+Plugin_ConnectionCore_id=org.apache.directory.studio.connection.core
+Plugin_ConnectionUi_id=org.apache.directory.studio.connection.ui
+Plugin_LdapBrowserCommon_id=org.apache.directory.studio.ldapbrowser.common
+Plugin_LdapBrowserCore_id=org.apache.directory.studio.ldapbrowser.core
+Plugin_LdapBrowserUi_id=org.apache.directory.studio.ldapbrowser.ui
+Plugin_LdifEditor_id=org.apache.directory.studio.ldifeditor
+Plugin_LdifParser_id=org.apache.directory.studio.ldifparser
+
 Perspective_LdapBrowserPerspective_id=org.apache.directory.studio.ldapbrowser.ui.perspective.BrowserPerspective

Modified: directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/CreateConnectionActionHelper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/CreateConnectionActionHelper.java?rev=1227244&r1=1227243&r2=1227244&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/CreateConnectionActionHelper.java
(original)
+++ directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/CreateConnectionActionHelper.java
Wed Jan  4 18:03:13 2012
@@ -20,16 +20,20 @@
 package org.apache.directory.studio.ldapservers.actions;
 
 
+import java.util.PropertyResourceBundle;
+
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
 import org.apache.directory.studio.ldapservers.LdapServersPlugin;
 import org.apache.directory.studio.ldapservers.model.LdapServer;
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.ui.IPerspectiveDescriptor;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.Bundle;
 
 
 /**
@@ -66,7 +70,6 @@ public class CreateConnectionActionHelpe
                 new String[]
                     { IDialogConstants.OK_LABEL }, MessageDialog.OK );
             dialog.open();
-            // TODO use common methods in Common UI plugin
         }
         else
         {
@@ -80,7 +83,6 @@ public class CreateConnectionActionHelpe
                     Messages.getString( "CreateConnectionActionHelper.ConnectionCalledCreatedSwitch"
), new String[] { connection.getName() } ), //$NON-NLS-1$
                 MessageDialog.INFORMATION, new String[]
                     { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, MessageDialog.OK
);
-            // TODO use common methods in Common UI plugin
             if ( dialog.open() == MessageDialog.OK )
             {
                 // Switching to the LDAP perspective
@@ -110,4 +112,103 @@ public class CreateConnectionActionHelpe
 
         return null;
     }
+    
+
+    /**
+     * Indicates if the LDAP Browser plugins are available or not.
+     *
+     * @return
+     *  <code>true</code> if the LDAP Browser plugins are available, 
+     *  <code>false</code> if not.
+     */
+    public static boolean isLdapBrowserPluginsAvailable()
+    {
+        PropertyResourceBundle properties = LdapServersPlugin.getDefault().getPluginProperties();
+
+        // Connection Core Plugin
+        Bundle connectionCoreBundle = Platform.getBundle( properties.getString( "Plugin_ConnectionCore_id"
) ); //$NON-NLS-1$
+        if ( connectionCoreBundle != null )
+        {
+            // Checking the state of the plugin
+            if ( connectionCoreBundle.getState() == Bundle.UNINSTALLED )
+            {
+                return false;
+            }
+
+            // Connection UI Plugin
+            Bundle connectionUiBundle = Platform.getBundle( properties.getString( "Plugin_ConnectionUi_id"
) ); //$NON-NLS-1$
+            if ( connectionUiBundle != null )
+            {
+                // Checking the state of the plugin
+                if ( connectionUiBundle.getState() == Bundle.UNINSTALLED )
+                {
+                    return false;
+                }
+
+                // LDAP Browser Common Plugin
+                Bundle ldapBrowserCommonBundle = Platform.getBundle( properties
+                    .getString( "Plugin_LdapBrowserCommon_id" ) ); //$NON-NLS-1$
+                if ( ldapBrowserCommonBundle != null )
+                {
+                    // Checking the state of the plugin
+                    if ( ldapBrowserCommonBundle.getState() == Bundle.UNINSTALLED )
+                    {
+                        return false;
+                    }
+
+                    // LDAP Browser Core Plugin
+                    Bundle ldapBrowserCoreBundle = Platform.getBundle( properties
+                        .getString( "Plugin_LdapBrowserCore_id" ) ); //$NON-NLS-1$
+                    if ( ldapBrowserCoreBundle != null )
+                    {
+                        // Checking the state of the plugin
+                        if ( ldapBrowserCoreBundle.getState() == Bundle.UNINSTALLED )
+                        {
+                            return false;
+                        }
+
+                        // LDAP Browser UI Plugin
+                        Bundle ldapBrowserUiBundle = Platform.getBundle( properties
+                            .getString( "Plugin_LdapBrowserUi_id" ) ); //$NON-NLS-1$
+                        if ( ldapBrowserUiBundle != null )
+                        {
+                            // Checking the state of the plugin
+                            if ( ldapBrowserUiBundle.getState() == Bundle.UNINSTALLED )
+                            {
+                                return false;
+                            }
+
+                            // LDIF Editor Plugin
+                            Bundle ldifEditorBundle = Platform
+                                .getBundle( properties.getString( "Plugin_LdifEditor_id"
) ); //$NON-NLS-1$
+                            if ( ldifEditorBundle != null )
+                            {
+                                // Checking the state of the plugin
+                                if ( ldifEditorBundle.getState() == Bundle.UNINSTALLED )
+                                {
+                                    return false;
+                                }
+
+                                // LDIF Parser Plugin
+                                Bundle ldifParserBundle = Platform.getBundle( properties
+                                    .getString( "Plugin_LdifParser_id" ) ); //$NON-NLS-1$
+                                if ( ldifParserBundle != null )
+                                {
+                                    // Checking the state of the plugin
+                                    if ( ldifParserBundle.getState() == Bundle.UNINSTALLED
)
+                                    {
+                                        return false;
+                                    }
+
+                                    return true;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        return false;
+    }
 }



Mime
View raw message