Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 38968 invoked from network); 9 Apr 2007 09:53:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Apr 2007 09:53:48 -0000 Received: (qmail 78410 invoked by uid 500); 9 Apr 2007 09:53:54 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 78347 invoked by uid 500); 9 Apr 2007 09:53:54 -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 78335 invoked by uid 99); 9 Apr 2007 09:53:54 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Apr 2007 02:53:54 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Apr 2007 02:53:45 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id BBEFF1A9838; Mon, 9 Apr 2007 02:53:24 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r526695 [1/2] - in /directory/ldapstudio/trunk/ldapstudio-valueeditors: ./ META-INF/ resources/ resources/icons/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/or... Date: Mon, 09 Apr 2007 09:53:23 -0000 To: commits@directory.apache.org From: seelmann@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070409095324.BBEFF1A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: seelmann Date: Mon Apr 9 02:53:20 2007 New Revision: 526695 URL: http://svn.apache.org/viewvc?view=rev&rev=526695 Log: Added ldapstudio-valueeditors (DIRSTUDIO-78) Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/ directory/ldapstudio/trunk/ldapstudio-valueeditors/.classpath directory/ldapstudio/trunk/ldapstudio-valueeditors/.project directory/ldapstudio/trunk/ldapstudio-valueeditors/META-INF/ directory/ldapstudio/trunk/ldapstudio-valueeditors/META-INF/MANIFEST.MF directory/ldapstudio/trunk/ldapstudio-valueeditors/build.properties directory/ldapstudio/trunk/ldapstudio-valueeditors/build.xml directory/ldapstudio/trunk/ldapstudio-valueeditors/ivy.xml directory/ldapstudio/trunk/ldapstudio-valueeditors/plugin.xml directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/ directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/ directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/addresseditor.gif (with props) directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/attributetypeeditor.png (with props) directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/dneditor.gif (with props) directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/generalizedtimeeditor.gif (with props) directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/imageeditor.gif (with props) directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/inplace_oceditor.gif (with props) directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/integereditor.gif (with props) directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/objectclasseditor.png (with props) directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/passwordeditor.gif (with props) directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/texteditor.gif (with props) directory/ldapstudio/trunk/ldapstudio-valueeditors/src/ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/ValueEditorsActivator.java directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/ValueEditorsConstants.java directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/address/ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/address/AddressDialog.java directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/address/AddressValueEditor.java directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/dn/ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/dn/DnDialog.java directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/dn/DnValueEditor.java directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/image/ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/image/ImageDialog.java directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/image/ImageValueEditor.java directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/integer/ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/integer/IntegerDialog.java directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/integer/IntegerValueEditor.java directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/objectclass/ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/objectclass/ObjectClassDialog.java directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/objectclass/ObjectClassValueEditor.java directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/password/ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/password/PasswordDialog.java directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/password/PasswordValueEditor.java directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/time/ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/time/InPlaceGeneralizedTimeValueEditor.java directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/resources/ Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/.classpath URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/.classpath?view=auto&rev=526695 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-valueeditors/.classpath (added) +++ directory/ldapstudio/trunk/ldapstudio-valueeditors/.classpath Mon Apr 9 02:53:20 2007 @@ -0,0 +1,8 @@ + + + + + + + + Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/.project URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/.project?view=auto&rev=526695 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-valueeditors/.project (added) +++ directory/ldapstudio/trunk/ldapstudio-valueeditors/.project Mon Apr 9 02:53:20 2007 @@ -0,0 +1,28 @@ + + + ldapstudio-valueeditors + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/META-INF/MANIFEST.MF URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/META-INF/MANIFEST.MF?view=auto&rev=526695 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-valueeditors/META-INF/MANIFEST.MF (added) +++ directory/ldapstudio/trunk/ldapstudio-valueeditors/META-INF/MANIFEST.MF Mon Apr 9 02:53:20 2007 @@ -0,0 +1,21 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: LDAP Studio Value Editors Plug-in +Bundle-SymbolicName: org.apache.directory.ldapstudio.valueeditors;singleton:=true +Bundle-Version: 0.0.0.SNAPSHOT +Bundle-Activator: org.apache.directory.ldapstudio.valueeditors.ValueEditorsActivator +Bundle-Vendor: Apache Software Foundation +Bundle-Localization: plugin +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.apache.directory.ldapstudio.browser.core, + org.apache.directory.ldapstudio.browser.common +Eclipse-LazyStart: true +Export-Package: org.apache.directory.ldapstudio.valueeditors, + org.apache.directory.ldapstudio.valueeditors.address, + org.apache.directory.ldapstudio.valueeditors.dn, + org.apache.directory.ldapstudio.valueeditors.image, + org.apache.directory.ldapstudio.valueeditors.integer, + org.apache.directory.ldapstudio.valueeditors.objectclass, + org.apache.directory.ldapstudio.valueeditors.password, + org.apache.directory.ldapstudio.valueeditors.time Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/build.properties URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/build.properties?view=auto&rev=526695 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-valueeditors/build.properties (added) +++ directory/ldapstudio/trunk/ldapstudio-valueeditors/build.properties Mon Apr 9 02:53:20 2007 @@ -0,0 +1,5 @@ +source.. = src/main/java/ +output.. = target/classes/ +bin.includes = META-INF/,\ + .,\ + plugin.xml Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/build.xml URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/build.xml?view=auto&rev=526695 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-valueeditors/build.xml (added) +++ directory/ldapstudio/trunk/ldapstudio-valueeditors/build.xml Mon Apr 9 02:53:20 2007 @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/ivy.xml URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/ivy.xml?view=auto&rev=526695 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-valueeditors/ivy.xml (added) +++ directory/ldapstudio/trunk/ldapstudio-valueeditors/ivy.xml Mon Apr 9 02:53:20 2007 @@ -0,0 +1,21 @@ + + + + \ No newline at end of file Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/plugin.xml URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/plugin.xml?view=auto&rev=526695 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-valueeditors/plugin.xml (added) +++ directory/ldapstudio/trunk/ldapstudio-valueeditors/plugin.xml Mon Apr 9 02:53:20 2007 @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/addresseditor.gif URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/addresseditor.gif?view=auto&rev=526695 ============================================================================== Binary file - no diff available. Propchange: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/addresseditor.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/attributetypeeditor.png URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/attributetypeeditor.png?view=auto&rev=526695 ============================================================================== Binary file - no diff available. Propchange: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/attributetypeeditor.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/dneditor.gif URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/dneditor.gif?view=auto&rev=526695 ============================================================================== Binary file - no diff available. Propchange: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/dneditor.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/generalizedtimeeditor.gif URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/generalizedtimeeditor.gif?view=auto&rev=526695 ============================================================================== Binary file - no diff available. Propchange: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/generalizedtimeeditor.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/imageeditor.gif URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/imageeditor.gif?view=auto&rev=526695 ============================================================================== Binary file - no diff available. Propchange: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/imageeditor.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/inplace_oceditor.gif URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/inplace_oceditor.gif?view=auto&rev=526695 ============================================================================== Binary file - no diff available. Propchange: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/inplace_oceditor.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/integereditor.gif URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/integereditor.gif?view=auto&rev=526695 ============================================================================== Binary file - no diff available. Propchange: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/integereditor.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/objectclasseditor.png URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/objectclasseditor.png?view=auto&rev=526695 ============================================================================== Binary file - no diff available. Propchange: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/objectclasseditor.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/passwordeditor.gif URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/passwordeditor.gif?view=auto&rev=526695 ============================================================================== Binary file - no diff available. Propchange: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/passwordeditor.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/texteditor.gif URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/texteditor.gif?view=auto&rev=526695 ============================================================================== Binary file - no diff available. Propchange: directory/ldapstudio/trunk/ldapstudio-valueeditors/resources/icons/texteditor.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/ValueEditorsActivator.java URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/ValueEditorsActivator.java?view=auto&rev=526695 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/ValueEditorsActivator.java (added) +++ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/ValueEditorsActivator.java Mon Apr 9 02:53:20 2007 @@ -0,0 +1,119 @@ +package org.apache.directory.ldapstudio.valueeditors; + + +import java.net.URL; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + + +/** + * The activator class controls the plug-in life cycle + */ +public class ValueEditorsActivator extends AbstractUIPlugin +{ + + /** The plug-in ID */ + public static final String PLUGIN_ID = "org.apache.directory.ldapstudio.valueeditors"; + + /** The shared instance */ + private static ValueEditorsActivator plugin; + + + /** + * The constructor + */ + public ValueEditorsActivator() + { + plugin = this; + } + + + /** + * {@inheritDoc} + */ + public void start( BundleContext context ) throws Exception + { + super.start( context ); + } + + + /** + * {@inheritDoc} + */ + public void stop( BundleContext context ) throws Exception + { + plugin = null; + super.stop( context ); + } + + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static ValueEditorsActivator getDefault() + { + return plugin; + } + + + /** + * Use this method to get SWT images. Use the IMG_ constants from + * ValueEditorConstants for the key. + * + * @param key + * The key (relative path to the image im filesystem) + * @return The image discriptor or null + */ + public ImageDescriptor getImageDescriptor( String key ) + { + if ( key != null ) + { + URL url = FileLocator.find( getBundle(), new Path( key ), null ); + if ( url != null ) + return ImageDescriptor.createFromURL( url ); + else + return null; + } + else + { + return null; + } + } + + + /** + * Use this method to get SWT images. Use the IMG_ constants from + * ValueEditorConstants for the key. A ImageRegistry is used to manage the + * the key->Image mapping. + *

+ * Note: Don't dispose the returned SWT Image. It is disposed + * automatically when the plugin is stopped. + * + * @param key + * The key (relative path to the image im filesystem) + * @return The SWT Image or null + * @see ValueEditorsConstants + */ + public Image getImage( String key ) + { + Image image = getImageRegistry().get( key ); + if ( image == null ) + { + ImageDescriptor id = getImageDescriptor( key ); + if ( id != null ) + { + image = id.createImage(); + getImageRegistry().put( key, image ); + } + } + return image; + } + +} Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/ValueEditorsConstants.java URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/ValueEditorsConstants.java?view=auto&rev=526695 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/ValueEditorsConstants.java (added) +++ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/ValueEditorsConstants.java Mon Apr 9 02:53:20 2007 @@ -0,0 +1,32 @@ + +package org.apache.directory.ldapstudio.valueeditors; + +public interface ValueEditorsConstants +{ + + public static final String PREFERENCE_SYNTAX_VALUEPROVIDER_RELATIONS = "syntaxValueProviderRelations"; + + public static final String PREFERENCE_ATTRIBUTE_VALUEPROVIDER_RELATIONS = "attributeValueProviderRelations"; + + public static final String PREFERENCE_SHOW_RAW_VALUES = "showRawValues"; + + + public static final String IMG_IMAGEEDITOR = "resources/icons/imageeditor.gif"; + + public static final String IMG_ADDRESSEDITOR = "resources/icons/addresseditor.gif"; + + public static final String IMG_DNEDITOR = "resources/icons/dneditor.gif"; + + public static final String IMG_PASSWORDEDITOR = "resources/icons/passwordeditor.gif"; + + public static final String IMG_INPLACE_OCEDITOR = "resources/icons/inplace_oceditor.gif"; + + public static final String IMG_INPLACE_GENERALIZEDTIMEEDITOR = "resources/icons/inplace_generalizedtimeeditor.gif"; + + public static final String IMG_ATDEDITOR = "resources/icons/attributetypeeditor.png"; + + public static final String IMG_OCDEDITOR = "resources/icons/objectclasseditor.png"; + + public static final String IMG_FILTEREDITOR = "resources/icons/filtereditor.png"; + +} Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/address/AddressDialog.java URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/address/AddressDialog.java?view=auto&rev=526695 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/address/AddressDialog.java (added) +++ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/address/AddressDialog.java Mon Apr 9 02:53:20 2007 @@ -0,0 +1,120 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.directory.ldapstudio.valueeditors.address; + + +import org.apache.directory.ldapstudio.browser.core.BrowserCoreConstants; +import org.apache.directory.ldapstudio.valueeditors.ValueEditorsActivator; +import org.apache.directory.ldapstudio.valueeditors.ValueEditorsConstants; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + + +public class AddressDialog extends Dialog +{ + + public static final String DIALOG_TITLE = "Address Editor"; + + public static final double MAX_WIDTH = 250.0; + + public static final double MAX_HEIGHT = 250.0; + + private String initialValue; + + private String returnValue; + + private Text text; + + + public AddressDialog( Shell parentShell, String initialValue ) + { + super( parentShell ); + super.setShellStyle( super.getShellStyle() | SWT.RESIZE ); + this.initialValue = initialValue; + this.returnValue = null; + } + + + public boolean close() + { + return super.close(); + } + + + protected void configureShell( Shell shell ) + { + super.configureShell( shell ); + shell.setText( DIALOG_TITLE ); + shell.setImage( ValueEditorsActivator.getDefault().getImage( ValueEditorsConstants.IMG_ADDRESSEDITOR ) ); + } + + + protected void createButtonsForButtonBar( Composite parent ) + { + createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false ); + createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false ); + } + + + protected void okPressed() + { + this.returnValue = this.text.getText(); + this.returnValue = this.returnValue.replaceAll( "\n", "\\$" ); + this.returnValue = this.returnValue.replaceAll( "\r", "\\$" ); + this.returnValue = this.returnValue.replaceAll( "\\$\\$", "\\$" ); + super.okPressed(); + } + + + protected Control createDialogArea( Composite parent ) + { + // create composite + Composite composite = ( Composite ) super.createDialogArea( parent ); + GridData gd = new GridData( GridData.FILL_BOTH ); + composite.setLayoutData( gd ); + + // text widget + text = new Text( composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL ); + text.setText( this.initialValue.replaceAll( "\\$", BrowserCoreConstants.LINE_SEPARATOR ) ); + // GridData gd = new GridData(GridData.GRAB_HORIZONTAL | + // GridData.HORIZONTAL_ALIGN_FILL); + gd = new GridData( GridData.FILL_BOTH ); + gd.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ); + gd.heightHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2 ); + text.setLayoutData( gd ); + + applyDialogFont( composite ); + return composite; + } + + + public String getText() + { + return this.returnValue; + } + +} Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/address/AddressValueEditor.java URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/address/AddressValueEditor.java?view=auto&rev=526695 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/address/AddressValueEditor.java (added) +++ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/address/AddressValueEditor.java Mon Apr 9 02:53:20 2007 @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.directory.ldapstudio.valueeditors.address; + + +import org.apache.directory.ldapstudio.browser.common.dialogs.TextDialog; +import org.apache.directory.ldapstudio.browser.core.model.IValue; +import org.apache.directory.ldapstudio.valueeditors.AbstractDialogStringValueEditor; +import org.eclipse.swt.widgets.Shell; + + +/** + * Implementation of IValueEditor for syntax 1.3.6.1.4.1.1466.115.121.1.41 + * (Postal Address). In the displayed value the $ separators are replaced + * by commas. In the opened AddressDialog the $ separators are recplaced by + * line breaks. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ +public class AddressValueEditor extends AbstractDialogStringValueEditor +{ + + /** + * {@inheritDoc} + * + * This implementation opens the AddressDialog. + */ + protected boolean openDialog( Shell shell ) + { + Object value = getValue(); + if ( value != null && value instanceof String ) + { + AddressDialog dialog = new AddressDialog( shell, ( String ) value ); + if ( dialog.open() == TextDialog.OK && !"".equals( dialog.getText() ) ) + { + setValue( dialog.getText() ); + return true; + } + } + return false; + } + + + /** + * {@inheritDoc} + * + * This implementatiosn replaces the $ separators by commas. + */ + public String getDisplayValue( IValue value ) + { + String displayValue = super.getDisplayValue( value ); + + if ( !showRawValues() ) + { + displayValue = displayValue.replaceAll( "\\$", ", " ); + } + + return displayValue; + } + +} Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/dn/DnDialog.java URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/dn/DnDialog.java?view=auto&rev=526695 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/dn/DnDialog.java (added) +++ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/dn/DnDialog.java Mon Apr 9 02:53:20 2007 @@ -0,0 +1,117 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.directory.ldapstudio.valueeditors.dn; + + +import org.apache.directory.ldapstudio.browser.common.widgets.BaseWidgetUtils; +import org.apache.directory.ldapstudio.browser.common.widgets.WidgetModifyEvent; +import org.apache.directory.ldapstudio.browser.common.widgets.WidgetModifyListener; +import org.apache.directory.ldapstudio.browser.common.widgets.search.EntryWidget; +import org.apache.directory.ldapstudio.browser.core.model.DN; +import org.apache.directory.ldapstudio.browser.core.model.IConnection; +import org.apache.directory.ldapstudio.valueeditors.ValueEditorsActivator; +import org.apache.directory.ldapstudio.valueeditors.ValueEditorsConstants; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; + + +public class DnDialog extends Dialog implements WidgetModifyListener +{ + + public static final String DIALOG_TITLE = "DN Editor"; + + private EntryWidget entryWidget; + + private IConnection connection; + + private DN dn; + + + public DnDialog( Shell parentShell, IConnection connection, DN dn ) + { + super( parentShell ); + super.setShellStyle( super.getShellStyle() | SWT.RESIZE ); + this.connection = connection; + this.dn = dn; + } + + + protected void configureShell( Shell shell ) + { + super.configureShell( shell ); + shell.setText( DIALOG_TITLE ); + shell.setImage( ValueEditorsActivator.getDefault().getImage( ValueEditorsConstants.IMG_DNEDITOR ) ); + } + + + public boolean close() + { + this.entryWidget.removeWidgetModifyListener( this ); + return super.close(); + } + + + protected void okPressed() + { + this.dn = this.entryWidget.getDn(); + this.entryWidget.saveDialogSettings(); + super.okPressed(); + } + + + protected Control createDialogArea( Composite parent ) + { + + Composite composite = ( Composite ) super.createDialogArea( parent ); + GridData gd = new GridData( GridData.FILL_BOTH ); + gd.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ) * 3 / 2; + composite.setLayoutData( gd ); + + Composite innerComposite = BaseWidgetUtils.createColumnContainer( composite, 2, 1 ); + this.entryWidget = new EntryWidget( connection, dn ); + this.entryWidget.addWidgetModifyListener( this ); + this.entryWidget.createWidget( innerComposite ); + + applyDialogFont( composite ); + return composite; + } + + + public void widgetModified( WidgetModifyEvent event ) + { + if ( getButton( IDialogConstants.OK_ID ) != null ) + { + getButton( IDialogConstants.OK_ID ).setEnabled( this.entryWidget.getDn() != null ); + } + } + + + public DN getDn() + { + return this.dn; + } + +} Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/dn/DnValueEditor.java URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/dn/DnValueEditor.java?view=auto&rev=526695 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/dn/DnValueEditor.java (added) +++ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/dn/DnValueEditor.java Mon Apr 9 02:53:20 2007 @@ -0,0 +1,206 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.directory.ldapstudio.valueeditors.dn; + + +import org.apache.directory.ldapstudio.browser.common.dialogs.TextDialog; +import org.apache.directory.ldapstudio.browser.core.model.AttributeHierarchy; +import org.apache.directory.ldapstudio.browser.core.model.DN; +import org.apache.directory.ldapstudio.browser.core.model.IConnection; +import org.apache.directory.ldapstudio.browser.core.model.IValue; +import org.apache.directory.ldapstudio.browser.core.model.NameException; +import org.apache.directory.ldapstudio.valueeditors.AbstractDialogStringValueEditor; +import org.eclipse.swt.widgets.Shell; + + +/** + * Implementation of IValueEditor for syntax 1.3.6.1.4.1.1466.115.121.1.12 + * (Distinguished Name). + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ +public class DnValueEditor extends AbstractDialogStringValueEditor +{ + + /** + * {@inheritDoc} + * + * This implementation opens the DnDialog. + */ + protected boolean openDialog( Shell shell ) + { + Object value = getValue(); + if ( value != null && value instanceof DnValueEditorRawValueWrapper ) + { + DnValueEditorRawValueWrapper wrapper = ( DnValueEditorRawValueWrapper ) value; + DnDialog dialog = new DnDialog( shell, wrapper.connection, wrapper.dn ); + if ( dialog.open() == TextDialog.OK && dialog.getDn() != null ) + { + setValue( dialog.getDn().toString() ); + return true; + } + } + return false; + } + + + /** + * {@inheritDoc} + * + * Returns a DnValueEditorRawValueWrapper with the connection of + * the attribute hierarchy and a null DN if there are no values + * in attributeHierarchy. + * + * Returns a DnValueEditorRawValueWrapper with the connection of + * the attribute hierarchy and a DN if there is one value + * in attributeHierarchy. + */ + public Object getRawValue( AttributeHierarchy attributeHierarchy ) + { + if ( attributeHierarchy == null ) + { + return null; + } + else if ( attributeHierarchy.size() == 1 && attributeHierarchy.getAttribute().getValueSize() == 0 ) + { + IConnection connection = attributeHierarchy.getAttribute().getEntry().getConnection(); + DN dn = null; + return new DnValueEditorRawValueWrapper( connection, dn ); + } + else if ( attributeHierarchy.size() == 1 && attributeHierarchy.getAttribute().getValueSize() == 1 ) + { + IConnection connection = attributeHierarchy.getAttribute().getEntry().getConnection(); + try + { + DN dn = new DN( getDisplayValue( attributeHierarchy ) ); + return new DnValueEditorRawValueWrapper( connection, dn ); + } + catch ( NameException e ) + { + return new DnValueEditorRawValueWrapper( connection, null ); + } + } + else + { + return null; + } + } + + + /** + * {@inheritDoc} + * + * Returns a DnValueEditorRawValueWrapper with the connection of + * the value and a DN build from the given value. + * + * If the value doesn't contain a valid DN a DnValueEditorRawValueWrapper + * with a null DN is returned. + */ + public Object getRawValue( IValue value ) + { + Object o = super.getRawValue( value ); + if ( o != null && o instanceof String ) + { + IConnection connection = value.getAttribute().getEntry().getConnection(); + try + { + DN dn = new DN( ( String ) o ); + return new DnValueEditorRawValueWrapper( connection, dn ); + } + catch ( NameException e ) + { + return new DnValueEditorRawValueWrapper( connection, null ); + } + } + + return null; + } + + + /** + * {@inheritDoc} + * + * Returns a DnValueEditorRawValueWrapper with the given + * connection and a DN build from the given value. + * + * If the value doesn't contain a valid DN a DnValueEditorRawValueWrapper + * with a null DN is returned. + */ + public Object getRawValue( IConnection connection, Object value ) + { + Object o = super.getRawValue( connection, value ); + if ( o != null && o instanceof String ) + { + try + { + DN dn = new DN( ( String ) o ); + return new DnValueEditorRawValueWrapper( connection, dn ); + } + catch ( NameException e ) + { + return new DnValueEditorRawValueWrapper( connection, null ); + } + } + + return null; + } + + + /** + * The DnValueEditorRawValueWrapper is used to pass contextual + * information to the opened DnDialog. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ + private class DnValueEditorRawValueWrapper + { + /** The connection, used in DnDialog to browse for an entry */ + private IConnection connection; + + /** The DN, used as initial value in DnDialog */ + private DN dn; + + + /** + * Creates a new instance of DnValueEditorRawValueWrapper. + * + * @param connection the connection + * @param dn the DN + */ + private DnValueEditorRawValueWrapper( IConnection connection, DN dn ) + { + this.connection = connection; + this.dn = dn; + } + + /** + * {@inheritDoc} + */ + public String toString() + { + return dn == null ? "" : dn.toString(); + } + + } + +} Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/image/ImageDialog.java URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/image/ImageDialog.java?view=auto&rev=526695 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/image/ImageDialog.java (added) +++ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/image/ImageDialog.java Mon Apr 9 02:53:20 2007 @@ -0,0 +1,686 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.directory.ldapstudio.valueeditors.image; + + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; + +import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator; +import org.apache.directory.ldapstudio.browser.common.widgets.BaseWidgetUtils; +import org.apache.directory.ldapstudio.valueeditors.ValueEditorsActivator; +import org.apache.directory.ldapstudio.valueeditors.ValueEditorsConstants; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.swt.SWT; +import org.eclipse.swt.SWTException; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.graphics.ImageLoader; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.TabFolder; +import org.eclipse.swt.widgets.TabItem; +import org.eclipse.swt.widgets.Text; + + +public class ImageDialog extends Dialog +{ + + public static final String DIALOG_TITLE = "Image Editor"; + + // public static final String[] IMAGE_FILE_EXTENSIONS = {"*.jpg; *.jpeg; + // *.gif; *.bmp; *.png"}; + public static final int MAX_WIDTH = 250; + + public static final int MAX_HEIGHT = 250; + + public static final int CURRENT_TAB = 0; + + public static final int NEW_TAB = 1; + + public static final String SELECTED_TAB_DIALOGSETTINGS_KEY = ImageDialog.class.getName() + ".tab"; + + private TabFolder tabFolder; + + private TabItem currentTab; + + private TabItem newTab; + + private byte[] currentImageRawData; + + private Image currentImage; + + private Composite currentImageContainer; + + private Label currentImageLabel; + + private Text currentImageTypeText; + + private Text currentImageWidthText; + + private Text currentImageHeightText; + + private Text currentImageSizeText; + + private Button currentImageSaveButton; + + private byte[] newImageRawData; + + private Image newImage; + + private Composite newImageContainer; + + private Label newImageLabel; + + private Text newImageTypeText; + + private Text newImageWidthText; + + private Text newImageHeightText; + + private Text newImageSizeText; + + private Text newImageFilenameText; + + private Button newImageBrowseButton; + + private int requiredImageType; + + private byte[] newImageRawDataInRequiredFormat; + + private Button okButton; + + + public ImageDialog( Shell parentShell, byte[] currentImageRawData, int requiredImageType ) + { + super( parentShell ); + super.setShellStyle( super.getShellStyle() | SWT.RESIZE ); + this.currentImageRawData = currentImageRawData; + this.requiredImageType = requiredImageType; + + newImageRawDataInRequiredFormat = null; + } + + + public boolean close() + { + if ( this.currentImage != null && !this.currentImage.isDisposed() ) + { + this.currentImage.dispose(); + } + if ( this.newImage != null && !this.newImage.isDisposed() ) + { + this.newImage.dispose(); + } + + // save selected tab to dialog settings + ValueEditorsActivator.getDefault().getDialogSettings().put( SELECTED_TAB_DIALOGSETTINGS_KEY, + this.tabFolder.getSelectionIndex() ); + + return super.close(); + } + + + protected void buttonPressed( int buttonId ) + { + if ( buttonId == IDialogConstants.OK_ID ) + { + if ( this.newImageRawData != null ) + { + try + { + ImageData imageData = new ImageData( new ByteArrayInputStream( this.newImageRawData ) ); + if ( imageData.type != this.requiredImageType ) + { + ImageLoader imageLoader = new ImageLoader(); + imageLoader.data = new ImageData[] + { imageData }; + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + imageLoader.save( baos, this.requiredImageType ); + this.newImageRawDataInRequiredFormat = baos.toByteArray(); + } + else + { + this.newImageRawDataInRequiredFormat = this.newImageRawData; + } + } + catch ( SWTException swte ) + { + this.newImageRawDataInRequiredFormat = null; + } + } + + } + else + { + this.newImageRawDataInRequiredFormat = null; + } + + super.buttonPressed( buttonId ); + } + + + protected void configureShell( Shell shell ) + { + super.configureShell( shell ); + shell.setText( DIALOG_TITLE ); + shell.setImage( ValueEditorsActivator.getDefault().getImage( ValueEditorsConstants.IMG_IMAGEEDITOR ) ); + } + + + protected void createButtonsForButtonBar( Composite parent ) + { + okButton = createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false ); + createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false ); + + // load dialog settings + try + { + int tabIndex = ValueEditorsActivator.getDefault().getDialogSettings().getInt( SELECTED_TAB_DIALOGSETTINGS_KEY ); + this.tabFolder.setSelection( tabIndex ); + } + catch ( Exception e ) + { + } + + // update on load + updateTabFolder(); + } + + + protected Control createDialogArea( Composite parent ) + { + + Composite composite = ( Composite ) super.createDialogArea( parent ); + GridData gd1 = new GridData( GridData.FILL_BOTH ); + gd1.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ); + gd1.heightHint = convertVerticalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ); + composite.setLayoutData( gd1 ); + + this.tabFolder = new TabFolder( composite, SWT.TOP ); + GridLayout mainLayout = new GridLayout(); + mainLayout.marginWidth = 0; + mainLayout.marginHeight = 0; + this.tabFolder.setLayout( mainLayout ); + this.tabFolder.setLayoutData( new GridData( GridData.FILL_BOTH ) ); + this.tabFolder.addSelectionListener( new SelectionAdapter() + { + public void widgetSelected( SelectionEvent e ) + { + updateTabFolder(); + } + } ); + + // current image + if ( this.currentImageRawData != null && this.currentImageRawData.length > 0 ) + { + currentImageContainer = new Composite( this.tabFolder, SWT.NONE ); + GridLayout currentLayout = new GridLayout( 1, false ); + currentLayout.marginHeight = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_MARGIN ); + currentLayout.marginWidth = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_MARGIN ); + currentLayout.verticalSpacing = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_SPACING ); + currentLayout.horizontalSpacing = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_SPACING ); + currentImageContainer.setLayout( currentLayout ); + currentImageContainer.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); + + currentImageLabel = createImageLabel( currentImageContainer ); + + Composite currentImageInfoContainer = createImageInfoContainer( currentImageContainer ); + currentImageTypeText = createImageInfo( currentImageInfoContainer, "Image Type:" ); + currentImageSizeText = createImageInfo( currentImageInfoContainer, "Image Size:" ); + currentImageWidthText = createImageInfo( currentImageInfoContainer, "Image Width:" ); + currentImageHeightText = createImageInfo( currentImageInfoContainer, "Image Height:" ); + + Composite currentImageSaveContainer = createImageInfoContainer( currentImageContainer ); + Label dummyLabel = BaseWidgetUtils.createLabel( currentImageSaveContainer, "", 1 ); + GridData gd = new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL ); + dummyLabel.setLayoutData( gd ); + currentImageSaveButton = createButton( currentImageSaveContainer, "Save..." ); + currentImageSaveButton.addSelectionListener( new SelectionAdapter() + { + public void widgetSelected( SelectionEvent event ) + { + FileDialog fileDialog = new FileDialog( ImageDialog.this.getShell(), SWT.SAVE ); + fileDialog.setText( "Save Image" ); + fileDialog.setFilterExtensions( new String[] + { "*.jpg" } ); + String returnedFileName = fileDialog.open(); + if ( returnedFileName != null ) + { + try + { + File file = new File( returnedFileName ); + FileOutputStream out = new FileOutputStream( file ); + out.write( currentImageRawData ); + out.flush(); + out.close(); + } + catch ( FileNotFoundException e ) + { + + BrowserCommonActivator.getDefault() + .getExceptionHandler().handleException( + new Status( IStatus.ERROR, ValueEditorsActivator.PLUGIN_ID, IStatus.ERROR, + "Can't write to file", e ) ); + } + catch ( IOException e ) + { + BrowserCommonActivator.getDefault() + .getExceptionHandler().handleException( + new Status( IStatus.ERROR, ValueEditorsActivator.PLUGIN_ID, IStatus.ERROR, + "Can't write to file", e ) ); + } + } + } + } ); + + this.currentTab = new TabItem( this.tabFolder, SWT.NONE ); + this.currentTab.setText( "Current Image" ); + this.currentTab.setControl( currentImageContainer ); + } + + // new image + newImageContainer = new Composite( this.tabFolder, SWT.NONE ); + GridLayout newLayout = new GridLayout( 1, false ); + newLayout.marginHeight = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_MARGIN ); + newLayout.marginWidth = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_MARGIN ); + newLayout.verticalSpacing = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_SPACING ); + newLayout.horizontalSpacing = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_SPACING ); + newImageContainer.setLayout( newLayout ); + newImageContainer.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); + + newImageLabel = createImageLabel( newImageContainer ); + + Composite newImageInfoContainer = createImageInfoContainer( newImageContainer ); + newImageTypeText = createImageInfo( newImageInfoContainer, "Image Type:" ); + newImageSizeText = createImageInfo( newImageInfoContainer, "Image Size:" ); + newImageWidthText = createImageInfo( newImageInfoContainer, "Image Width:" ); + newImageHeightText = createImageInfo( newImageInfoContainer, "Image Height:" ); + + Composite newImageSelectContainer = createImageInfoContainer( newImageContainer ); + newImageFilenameText = new Text( newImageSelectContainer, SWT.SINGLE | SWT.BORDER ); + GridData gd = new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL ); + newImageFilenameText.setLayoutData( gd ); + newImageFilenameText.addModifyListener( new ModifyListener() + { + public void modifyText( ModifyEvent e ) + { + updateNewImageGroup(); + } + } ); + newImageBrowseButton = createButton( newImageSelectContainer, "Browse..." ); + newImageBrowseButton.addSelectionListener( new SelectionAdapter() + { + public void widgetSelected( SelectionEvent event ) + { + FileDialog fileDialog = new FileDialog( ImageDialog.this.getShell(), SWT.OPEN ); + fileDialog.setText( "Select Image" ); + // fileDialog.setFilterExtensions(IMAGE_FILE_EXTENSIONS); + fileDialog.setFileName( new File( newImageFilenameText.getText() ).getName() ); + fileDialog.setFilterPath( new File( newImageFilenameText.getText() ).getParent() ); + String returnedFileName = fileDialog.open(); + if ( returnedFileName != null ) + { + newImageFilenameText.setText( returnedFileName ); + } + } + } ); + + this.newTab = new TabItem( this.tabFolder, SWT.NONE ); + this.newTab.setText( "New Image" ); + this.newTab.setControl( newImageContainer ); + + applyDialogFont( composite ); + return composite; + } + + + private void updateCurrentImageGroup() + { + + if ( currentTab != null ) + { + + if ( currentImage != null && !currentImage.isDisposed() ) + { + currentImage.dispose(); + currentImage = null; + } + + if ( currentImageRawData != null && currentImageRawData.length > 0 ) + { + try + { + ImageData imageData = new ImageData( new ByteArrayInputStream( currentImageRawData ) ); + currentImage = new Image( getShell().getDisplay(), resizeImage( imageData ) ); + currentImageLabel.setText( "" ); + currentImageLabel.setImage( currentImage ); + currentImageTypeText.setText( getImageType( imageData.type ) ); + currentImageSizeText.setText( getSizeString( currentImageRawData.length ) ); + currentImageWidthText.setText( imageData.width + " Pixel" ); + currentImageHeightText.setText( imageData.height + " Pixel" ); + } + catch ( SWTException swte ) + { + currentImageLabel.setImage( null ); + currentImageLabel.setText( " Unsupported format " ); + currentImageTypeText.setText( "Unsupported format" ); + currentImageSizeText.setText( getSizeString( currentImageRawData.length ) ); + currentImageWidthText.setText( "-" ); + currentImageHeightText.setText( "-" ); + } + // currentImageGroup.setVisible(true); + } + else + { + currentImageLabel.setImage( null ); + currentImageLabel.setText( " No Image " ); + currentImageTypeText.setText( "No Image" ); + currentImageSizeText.setText( "-" ); + currentImageWidthText.setText( "-" ); + currentImageHeightText.setText( "-" ); + } + + currentImageSaveButton.setEnabled( currentImageRawData != null && currentImageRawData.length > 0 ); + + // super.initializeBounds(); + } + } + + + private void updateNewImageGroup() + { + + if ( newImage != null && !newImage.isDisposed() ) + { + newImage.dispose(); + newImage = null; + } + + if ( !"".equals( newImageFilenameText.getText() ) ) + { + try + { + File file = new File( newImageFilenameText.getText() ); + FileInputStream in = new FileInputStream( file ); + ByteArrayOutputStream out = new ByteArrayOutputStream( ( int ) file.length() ); + byte[] buf = new byte[4096]; + int len; + while ( ( len = in.read( buf ) ) > 0 ) + { + out.write( buf, 0, len ); + } + this.newImageRawData = out.toByteArray(); + out.close(); + in.close(); + } + catch ( FileNotFoundException e ) + { + newImageRawData = null; + newImageLabel.setImage( null ); + newImageLabel.setText( " Error: File not found " ); + newImageTypeText.setText( "-" ); + newImageSizeText.setText( "-" ); + newImageWidthText.setText( "-" ); + newImageHeightText.setText( "-" ); + } + catch ( IOException e ) + { + newImageRawData = null; + newImageLabel.setImage( null ); + newImageLabel.setText( " Error: Can't read file (" + e.getMessage() + ") " ); + newImageTypeText.setText( "-" ); + newImageSizeText.setText( "-" ); + newImageWidthText.setText( "-" ); + newImageHeightText.setText( "-" ); + } + } + else + { + newImageRawData = null; + newImageLabel.setImage( null ); + newImageLabel.setText( " No image selected " ); + newImageTypeText.setText( "-" ); + newImageSizeText.setText( "-" ); + newImageWidthText.setText( "-" ); + newImageHeightText.setText( "-" ); + } + + if ( newImageRawData != null && newImageRawData.length > 0 ) + { + try + { + ImageData imageData = new ImageData( new ByteArrayInputStream( newImageRawData ) ); + newImage = new Image( getShell().getDisplay(), resizeImage( imageData ) ); + newImageLabel.setImage( newImage ); + newImageTypeText.setText( getImageType( imageData.type ) ); + if ( imageData.type != requiredImageType ) + { + newImageTypeText.setText( newImageTypeText.getText() + " (will be converted to " + + getImageType( this.requiredImageType ) + ")" ); + } + newImageSizeText.setText( getSizeString( newImageRawData.length ) ); + newImageWidthText.setText( imageData.width + " Pixel" ); + newImageHeightText.setText( imageData.height + " Pixel" ); + } + catch ( SWTException swte ) + { + newImageLabel.setImage( null ); + newImageLabel.setText( " Unsupported format " ); + newImageTypeText.setText( "Unsupported format" ); + newImageSizeText.setText( getSizeString( newImageRawData.length ) ); + newImageWidthText.setText( "-" ); + newImageHeightText.setText( "-" ); + } + } + + if ( okButton != null ) + { + okButton.setEnabled( newImage != null ); + } + + newImageLabel.getParent().layout(); + newImageTypeText.getParent().layout(); + // newImageGroup.layout(); + // super.initializeBounds(); + + } + + + private void updateTabFolder() + { + if ( currentImageSaveButton != null ) + { + if ( tabFolder.getSelectionIndex() == CURRENT_TAB ) + { + currentImageSaveButton.setFocus(); + } + updateCurrentImageGroup(); + } + + if ( newImageBrowseButton != null ) + { + if ( tabFolder.getSelectionIndex() == NEW_TAB || currentImageSaveButton == null ) + { + newImageBrowseButton.setFocus(); + } + updateNewImageGroup(); + } + } + + + private ImageData resizeImage( ImageData imageData ) + { + double widthScaleFactor = 1.0; + if ( imageData.width > MAX_WIDTH ) + { + widthScaleFactor = ( double ) MAX_WIDTH / imageData.width; + } + double heightScaleFactor = 1.0; + if ( imageData.height > MAX_HEIGHT ) + { + heightScaleFactor = ( double ) MAX_HEIGHT / imageData.height; + } + + if ( heightScaleFactor < widthScaleFactor ) + { + imageData = imageData.scaledTo( + convertHorizontalDLUsToPixels( ( int ) ( imageData.width * heightScaleFactor ) ), + convertHorizontalDLUsToPixels( ( int ) ( imageData.height * heightScaleFactor ) ) ); + } + else + { + imageData = imageData.scaledTo( + convertHorizontalDLUsToPixels( ( int ) ( imageData.width * widthScaleFactor ) ), + convertHorizontalDLUsToPixels( ( int ) ( imageData.height * widthScaleFactor ) ) ); + } + + return imageData; + } + + + private Label createImageLabel( Composite parent ) + { + Composite labelComposite = new Composite( parent, SWT.BORDER ); + GridLayout gl = new GridLayout( 1, true ); + labelComposite.setLayout( gl ); + GridData gd = new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL ); + gd.widthHint = MAX_WIDTH; + gd.heightHint = MAX_HEIGHT; + labelComposite.setLayoutData( gd ); + labelComposite.setBackground( getShell().getDisplay().getSystemColor( SWT.COLOR_WIDGET_NORMAL_SHADOW ) ); + + Label imageLabel = new Label( labelComposite, SWT.CENTER ); + gd = new GridData( SWT.CENTER, SWT.CENTER, true, true ); + imageLabel.setLayoutData( gd ); + return imageLabel; + } + + + private Composite createImageInfoContainer( Composite parent ) + { + Composite imageInfoContainer = new Composite( parent, SWT.NONE ); + GridLayout gl = new GridLayout( 2, false ); + gl.marginHeight = gl.marginWidth = 0; + imageInfoContainer.setLayout( gl ); + imageInfoContainer.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); + return imageInfoContainer; + } + + + private Text createImageInfo( Composite parent, String label ) + { + BaseWidgetUtils.createLabel( parent, label, 1 ); + Text text = BaseWidgetUtils.createLabeledText( parent, "", 1 ); + return text; + } + + + private Button createButton( Composite parent, String label ) + { + Button button = BaseWidgetUtils.createButton( parent, label, 1 ); + return button; + } + + + public static String getSizeString( int length ) + { + if ( length > 1000000 ) + return ( length / 1000000 ) + " MB (" + length + " bytes)"; + else if ( length > 1000 ) + return ( length / 1000 ) + " KB (" + length + " bytes)"; + else + return length + " bytes"; + } + + + public static String getImageInfo( byte[] imageRawData ) + { + + if ( imageRawData == null ) + { + return "NULL"; + } + + String text = "Image (" + imageRawData.length + " Bytes)"; + try + { + ByteArrayInputStream bais = new ByteArrayInputStream( imageRawData ); + ImageData imageData = new ImageData( bais ); + + String typePrefix = getImageType( imageData.type ); + if ( !"".equals( typePrefix ) ) + typePrefix += "-"; + + text = typePrefix + "Image (" + imageData.width + "x" + imageData.height + " Pixel, " + imageRawData.length + + " Bytes)"; + } + catch ( SWTException swte ) + { + text = "Invalid Image (" + imageRawData.length + " Bytes)"; + } + return text; + } + + + public static String getImageType( int swtCode ) + { + String type = ""; + if ( swtCode == SWT.IMAGE_JPEG ) + type = "JPEG"; + else if ( swtCode == SWT.IMAGE_GIF ) + type = "GIF"; + else if ( swtCode == SWT.IMAGE_PNG ) + type = "PNG"; + else if ( swtCode == SWT.IMAGE_BMP || swtCode == SWT.IMAGE_BMP_RLE ) + type = "BMP"; + return type; + } + + + /** + * + * + * @return Returns the image data in required format or null. + */ + public byte[] getNewImageRawData() + { + return this.newImageRawDataInRequiredFormat; + } +} Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/image/ImageValueEditor.java URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/image/ImageValueEditor.java?view=auto&rev=526695 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/image/ImageValueEditor.java (added) +++ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/image/ImageValueEditor.java Mon Apr 9 02:53:20 2007 @@ -0,0 +1,96 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.directory.ldapstudio.valueeditors.image; + + +import org.apache.directory.ldapstudio.browser.common.dialogs.TextDialog; +import org.apache.directory.ldapstudio.browser.core.model.IValue; +import org.apache.directory.ldapstudio.valueeditors.AbstractDialogBinaryValueEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Shell; + + +/** + * Implementation of IValueEditor for syntax 1.3.6.1.4.1.1466.115.121.1.28 + * (JPEG). + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ +public class ImageValueEditor extends AbstractDialogBinaryValueEditor +{ + + /** + * {@inheritDoc} + * + * This implementation opens the ImageDialog. + */ + protected boolean openDialog( Shell shell ) + { + Object value = getValue(); + + if ( value != null && value instanceof byte[] ) + { + byte[] currentImageData = ( byte[] ) value; + + ImageDialog dialog = new ImageDialog( shell, currentImageData, SWT.IMAGE_JPEG ); + if ( dialog.open() == TextDialog.OK && dialog.getNewImageRawData() != null ) + { + setValue( dialog.getNewImageRawData() ); + return true; + } + } + return false; + } + + + /** + * {@inheritDoc} + * + * Returns the image info text created by + * ImageDialog.getImageInfo(). + */ + public String getDisplayValue( IValue value ) + { + if ( showRawValues() ) + { + return getPrintableString( value ); + } + else + { + if ( value == null ) + { + return "NULL"; + } + else if ( value.isBinary() ) + { + byte[] data = value.getBinaryValue(); + String text = ImageDialog.getImageInfo( data ); + return text; + } + else + { + return "Invalid Image Data"; + } + } + } + +} Added: directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/integer/IntegerDialog.java URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/integer/IntegerDialog.java?view=auto&rev=526695 ============================================================================== --- directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/integer/IntegerDialog.java (added) +++ directory/ldapstudio/trunk/ldapstudio-valueeditors/src/main/java/org/apache/directory/ldapstudio/valueeditors/integer/IntegerDialog.java Mon Apr 9 02:53:20 2007 @@ -0,0 +1,139 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.directory.ldapstudio.valueeditors.integer; + + +import org.apache.directory.ldapstudio.valueeditors.ValueEditorsActivator; +import org.apache.directory.ldapstudio.valueeditors.ValueEditorsConstants; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Spinner; + + +/** + * This class provides a dialog to enter or choose an integer. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ +public class IntegerDialog extends Dialog +{ + + /** The dialog title */ + public static final String DIALOG_TITLE = "Integer Editor"; + + /** The initial value. */ + private int initialValue; + + /** The return value. */ + private int returnValue; + + /** The spinner to select an integer */ + private Spinner spinner = null; + + + /** + * Creates a new instance of IntegerDialog. + * + * @param parentShell the parent shell + * @param initialValue the initial value + */ + public IntegerDialog( Shell parentShell, int initialValue ) + { + super( parentShell ); + super.setShellStyle( super.getShellStyle() | SWT.RESIZE ); + this.initialValue = initialValue; + this.returnValue = -1; + } + + + /** + * {@inheritDoc} + */ + protected void configureShell( Shell shell ) + { + super.configureShell( shell ); + shell.setText( DIALOG_TITLE ); + //shell.setImage( Activator.getDefault().getImage( ValueEditorsConstants.IMG_TEXTEDITOR ) ); + } + + + /** + * {@inheritDoc} + */ + protected void createButtonsForButtonBar( Composite parent ) + { + createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false ); + createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false ); + } + + + /** + * {@inheritDoc} + */ + protected void okPressed() + { + returnValue = spinner.getSelection(); + super.okPressed(); + } + + + /** + * {@inheritDoc} + */ + protected Control createDialogArea( Composite parent ) + { + // create composite + Composite composite = ( Composite ) super.createDialogArea( parent ); + composite.setLayout( new GridLayout() ); + GridData gd = new GridData( GridData.FILL_BOTH ); + composite.setLayoutData( gd ); + + spinner = new Spinner( composite, SWT.BORDER ); + spinner.setMinimum( 0 ); + spinner.setMaximum( Integer.MAX_VALUE ); + spinner.setDigits( 0 ); + spinner.setIncrement( 1 ); + spinner.setPageIncrement( 100 ); + spinner.setSelection( initialValue ); + spinner.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); + + applyDialogFont( composite ); + return composite; + } + + + /** + * Gets the integer. + * + * @return the integer + */ + public int getInteger() + { + return returnValue; + } +}