You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2008/09/01 10:21:34 UTC

svn commit: r690907 - in /directory/studio/trunk/ldapbrowser-core: plugin.properties src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserCoreConstants.java src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserCorePlugin.java

Author: pamarcelot
Date: Mon Sep  1 01:21:33 2008
New Revision: 690907

URL: http://svn.apache.org/viewvc?rev=690907&view=rev
Log:
Part of a fix for DIRSTUDIO-375 (Move each plugin IDs in a plugin.properties file).

Modified:
    directory/studio/trunk/ldapbrowser-core/plugin.properties
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserCoreConstants.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserCorePlugin.java

Modified: directory/studio/trunk/ldapbrowser-core/plugin.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/plugin.properties?rev=690907&r1=690906&r2=690907&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/plugin.properties (original)
+++ directory/studio/trunk/ldapbrowser-core/plugin.properties Mon Sep  1 01:21:33 2008
@@ -15,6 +15,8 @@
 # specific language governing permissions and limitations
 # under the License.
 
+Plugin_id=org.apache.directory.studio.ldapbrowser.core
+
 ConnectionListener_BrowserConnectionListener_id=org.apache.directory.studio.ldapbrowser.core.model.impl.BrowserConnection
 ConnectionListener_BrowserConnectionListener_name=Browser Connection Listener
 ConnectionListener_BrowserConnectionListener_description=Opens/closes browser connection when the underlying connection is opened/closed
\ No newline at end of file

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserCoreConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserCoreConstants.java?rev=690907&r1=690906&r2=690907&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserCoreConstants.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserCoreConstants.java Mon Sep  1 01:21:33 2008
@@ -33,6 +33,9 @@
  */
 public interface BrowserCoreConstants
 {
+    /** The plug-in ID */
+    public static final String PLUGIN_ID = BrowserCorePlugin.getDefault().getPluginProperties().getString( "Plugin_id" );
+
     public static final String PREFERENCE_BINARY_SYNTAXES = "binarySyntaxes"; //$NON-NLS-1$
 
     public static final String PREFERENCE_BINARY_ATTRIBUTES = "binaryAttributes"; //$NON-NLS-1$

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserCorePlugin.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserCorePlugin.java?rev=690907&r1=690906&r2=690907&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserCorePlugin.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserCorePlugin.java Mon Sep  1 01:21:33 2008
@@ -21,9 +21,15 @@
 package org.apache.directory.studio.ldapbrowser.core;
 
 
+import java.io.IOException;
+import java.util.PropertyResourceBundle;
+
 import org.apache.directory.studio.ldapbrowser.core.events.CoreEventRunner;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRunner;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
 import org.osgi.framework.BundleContext;
 
 
@@ -32,9 +38,6 @@
  */
 public class BrowserCorePlugin extends Plugin
 {
-    /** The plugin ID */
-    public static final String PLUGIN_ID = "org.apache.directory.studio.ldapbrowser.core"; //$NON-NLS-1$
-
     /** The shared instance. */
     private static BrowserCorePlugin plugin;
 
@@ -47,6 +50,9 @@
     /** The event runner. */
     private EventRunner eventRunner;
 
+    /** The plugin properties */
+    private PropertyResourceBundle properties;
+
 
     /**
      * Creates a new instance of BrowserCorePlugin.
@@ -92,11 +98,11 @@
 
         if ( connectionManager != null )
         {
-//            IConnection[] connections = connectionManager.getConnections();
-//            for ( int i = 0; i < connections.length; i++ )
-//            {
-//                connections[i].close();
-//            }
+            //            IConnection[] connections = connectionManager.getConnections();
+            //            for ( int i = 0; i < connections.length; i++ )
+            //            {
+            //                connections[i].close();
+            //            }
             connectionManager = null;
         }
     }
@@ -144,4 +150,33 @@
     {
         return eventRunner;
     }
+
+
+    /**
+     * Gets the plugin properties.
+     *
+     * @return
+     *      the plugin properties
+     */
+    public PropertyResourceBundle getPluginProperties()
+    {
+        if ( properties == null )
+        {
+            try
+            {
+                properties = new PropertyResourceBundle( FileLocator.openStream( this.getBundle(), new Path(
+                    "plugin.properties" ), false ) );
+            }
+            catch ( IOException e )
+            {
+                // We can't use the PLUGIN_ID constant since loading the plugin.properties file has failed,
+                // So we're using a default plugin id.
+                getLog().log(
+                    new Status( Status.ERROR, "org.apache.directory.studio.ldapbrowser.core", Status.OK,
+                        "Unable to get the plugin properties.", e ) );
+            }
+        }
+
+        return properties;
+    }
 }