Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 28527 invoked from network); 1 Sep 2008 09:21:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Sep 2008 09:21:34 -0000 Received: (qmail 63407 invoked by uid 500); 1 Sep 2008 09:21:32 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 63345 invoked by uid 500); 1 Sep 2008 09:21:32 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 63336 invoked by uid 99); 1 Sep 2008 09:21:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Sep 2008 02:21:32 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Sep 2008 09:20:42 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 666662388876; Mon, 1 Sep 2008 02:20:43 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@directory.apache.org From: pamarcelot@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080901092043.666662388876@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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; }