directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r690919 - in /directory/studio/trunk/valueeditors: ./ src/main/java/org/apache/directory/studio/valueeditors/ src/main/java/org/apache/directory/studio/valueeditors/image/
Date Mon, 01 Sep 2008 09:20:43 GMT
Author: pamarcelot
Date: Mon Sep  1 02:20:42 2008
New Revision: 690919

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

Modified:
    directory/studio/trunk/valueeditors/plugin.properties
    directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorsActivator.java
    directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorsConstants.java
    directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/image/ImageDialog.java

Modified: directory/studio/trunk/valueeditors/plugin.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/valueeditors/plugin.properties?rev=690919&r1=690918&r2=690919&view=diff
==============================================================================
--- directory/studio/trunk/valueeditors/plugin.properties (original)
+++ directory/studio/trunk/valueeditors/plugin.properties Mon Sep  1 02:20:42 2008
@@ -15,6 +15,8 @@
 # specific language governing permissions and limitations
 # under the License.
 
+Plugin_id=org.apache.directory.studio.valueeditors
+
 ValueEditor_PasswordValueEditor_name=Password Editor
 
 ValueEditor_ImageValueEditor_name=Image Editor

Modified: directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorsActivator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorsActivator.java?rev=690919&r1=690918&r2=690919&view=diff
==============================================================================
--- directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorsActivator.java
(original)
+++ directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorsActivator.java
Mon Sep  1 02:20:42 2008
@@ -20,10 +20,13 @@
 package org.apache.directory.studio.valueeditors;
 
 
+import java.io.IOException;
 import java.net.URL;
+import java.util.PropertyResourceBundle;
 
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -35,13 +38,12 @@
  */
 public class ValueEditorsActivator extends AbstractUIPlugin
 {
-
-    /** The plug-in ID */
-    public static final String PLUGIN_ID = "org.apache.directory.studio.valueeditors";
-
     /** The shared instance */
     private static ValueEditorsActivator plugin;
 
+    /** The plugin properties */
+    private PropertyResourceBundle properties;
+
 
     /**
      * The constructor
@@ -134,5 +136,33 @@
         }
         return image;
     }
-    
+
+
+    /**
+     * 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.valueeditors",
Status.OK,
+                        "Unable to get the plugin properties.", e ) );
+            }
+        }
+
+        return properties;
+    }
 }

Modified: directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorsConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorsConstants.java?rev=690919&r1=690918&r2=690919&view=diff
==============================================================================
--- directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorsConstants.java
(original)
+++ directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorsConstants.java
Mon Sep  1 02:20:42 2008
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.studio.valueeditors;
 
+
 /**
  * Contains constants for the value editors.
  *
@@ -27,6 +28,9 @@
  */
 public interface ValueEditorsConstants
 {
+    /** The plug-in ID */
+    public static final String PLUGIN_ID = ValueEditorsActivator.getDefault().getPluginProperties().getString(
+        "Plugin_id" );
 
     /** The relative path to the image editor icon */
     public static final String IMG_IMAGEEDITOR = "resources/icons/imageeditor.gif";
@@ -45,11 +49,11 @@
 
     /** The relative path to the object class editor icon */
     public static final String IMG_OCDEDITOR = "resources/icons/objectclasseditor.png";
-    
+
     /** The relative path to the integer editor icon */
     public static final String IMG_INTEGEREDITOR = "resources/icons/integereditor.gif";
-    
+
     /** The relative path to the administrative role editor icon */
     public static final String IMG_ADMINISTRATIVEROLEEDITOR = "resources/icons/administrativeroleeditor.gif";
-    
+
 }

Modified: directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/image/ImageDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/image/ImageDialog.java?rev=690919&r1=690918&r2=690919&view=diff
==============================================================================
--- directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/image/ImageDialog.java
(original)
+++ directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/image/ImageDialog.java
Mon Sep  1 02:20:42 2008
@@ -58,6 +58,7 @@
 import org.eclipse.swt.widgets.TabItem;
 import org.eclipse.swt.widgets.Text;
 
+
 /**
  * The ImageDialog is used from the image value editor to view the current image
  * and to select a new image.
@@ -232,7 +233,8 @@
         // load dialog settings
         try
         {
-            int tabIndex = ValueEditorsActivator.getDefault().getDialogSettings().getInt(
SELECTED_TAB_DIALOGSETTINGS_KEY );
+            int tabIndex = ValueEditorsActivator.getDefault().getDialogSettings().getInt(
+                SELECTED_TAB_DIALOGSETTINGS_KEY );
             tabFolder.setSelection( tabIndex );
         }
         catch ( Exception e )
@@ -316,17 +318,15 @@
                         catch ( FileNotFoundException e )
                         {
 
-                            ConnectionUIPlugin.getDefault()
-                                .getExceptionHandler().handleException(
-                                    new Status( IStatus.ERROR, ValueEditorsActivator.PLUGIN_ID,
IStatus.ERROR,
-                                        "Can't write to file", e ) );
+                            ConnectionUIPlugin.getDefault().getExceptionHandler().handleException(
+                                new Status( IStatus.ERROR, ValueEditorsConstants.PLUGIN_ID,
IStatus.ERROR,
+                                    "Can't write to file", e ) );
                         }
                         catch ( IOException e )
                         {
-                            ConnectionUIPlugin.getDefault()
-                                .getExceptionHandler().handleException(
-                                    new Status( IStatus.ERROR, ValueEditorsActivator.PLUGIN_ID,
IStatus.ERROR,
-                                        "Can't write to file", e ) );
+                            ConnectionUIPlugin.getDefault().getExceptionHandler().handleException(
+                                new Status( IStatus.ERROR, ValueEditorsConstants.PLUGIN_ID,
IStatus.ERROR,
+                                    "Can't write to file", e ) );
                         }
                     }
                 }
@@ -748,7 +748,7 @@
     private static String getImageType( int swtCode )
     {
         String type = "";
-        
+
         if ( swtCode == SWT.IMAGE_JPEG )
         {
             type = "JPEG";
@@ -765,7 +765,7 @@
         {
             type = "BMP";
         }
-        
+
         return type;
     }
 



Mime
View raw message