directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
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 GMT
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry kind="src" path="src/main/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>ldapstudio-valueeditors</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

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 @@
+<!--
+  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.
+-->
+<project default="jar" xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
+	<property name="project.name" value="org.apache.directory.ldapstudio.valueeditors" />
+	<property name="project.version" value="0.0.0.SNAPSHOT" />
+
+	<property name="project.output" value="${basedir}/target" />
+	<property name="project.build" value="${project.output}/build" />
+	<property name="project.src" value="${basedir}/src/main/java" />
+
+	<property name="lib.dir" value="lib" />
+
+	<property name="repository.dir" location="../dependencies/externals/"/>
+
+	<!-- Configuring Ivy (Needs to be AFTER the $repository.dir declaration) -->
+	<ivy:configure file="../tools/ivyconf.xml"/>
+	
+	<!-- ================================== -->
+	<!--               RESOLVE              -->
+	<!-- ================================== -->
+	<target name="resolve" description="--> retreive dependencies with ivy">
+		<mkdir dir="${basedir}/${lib.dir}" />
+		<ivy:retrieve/>
+	</target>
+		
+	<!-- ================================== -->
+	<!--             CLASSPATH              -->
+	<!-- ================================== -->
+	<target name="build-classpath" description="Computes a classpath according to current OS" >
+		
+		<path id="classpath">
+			<fileset dir="../dependencies/eclipse/3.2">
+				<include name="**/*.jar"/>
+			</fileset>
+			<fileset dir="${lib.dir}" />
+			<pathelement location="${basedir}/../ldapstudio-browser-core/target/classes"/>
+			<pathelement location="${basedir}/../ldapstudio-browser-core/target/build"/>
+			<pathelement location="${basedir}/../ldapstudio-browser-common/target/classes"/>
+			<pathelement location="${basedir}/../ldapstudio-browser-common/target/build"/>
+	        <pathelement location="target/classes"/>
+		</path>
+				
+	</target>
+	
+	<!-- ================================== -->
+	<!--             COMPILE                -->
+	<!-- ================================== -->
+	<target name="compile" depends="resolve,checkclasses,build-classpath" unless="classes-up2date" description="Compiles the plugin">
+		
+		<mkdir dir="${project.build}" />
+		<copy todir="${project.build}">
+			<fileset dir="${basedir}">
+				<include name="plugin.xml" />
+				<include name="plugin.properties" />
+				<include name="about.html" />
+			</fileset>
+		</copy>
+		<mkdir dir="${project.build}/${lib.dir}" />
+		<copy todir="${project.build}/${lib.dir}">
+			<fileset dir="${basedir}/${lib.dir}">
+				<include name="*.jar" />
+			</fileset>
+		</copy>		
+		<mkdir dir="${project.build}/META-INF" />
+		<copy todir="${project.build}/META-INF">
+			<fileset dir="${basedir}/META-INF">
+				<include name="**" />
+			</fileset>
+		</copy>
+		<mkdir dir="${project.build}/resources" />
+		<copy todir="${project.build}/resources">
+			<fileset dir="${basedir}/resources">
+				<include name="**" />
+			</fileset>
+		</copy>
+		
+		<copy todir="${project.build}">
+			<fileset dir="${basedir}/src/main/resources">
+				<include name="**" />
+			</fileset>
+		</copy>	
+			
+		<javac
+			source="1.5"
+			debug="yes"
+			srcdir="${project.src}"
+			excludes=""
+			destdir="${project.build}"
+			classpathref="classpath"
+			listfiles="yes" verbose="false" />
+
+		<tstamp>
+			<format pattern="yyyy-MMM-dd, HH:mm 'GMT'Z" property="timestamp" locale="en" />
+		</tstamp>
+		<echo message="${project.name}-${project.version} compiled ${timestamp} by ${user.name}" file="${project.build}/compile.timestamp" />
+	</target>
+
+	<target name="checkclasses">
+		<uptodate property="classes-up2date" targetfile="${project.build}/compile.timestamp">
+			<srcfiles dir="${project.src}" />
+		</uptodate>
+	</target>
+
+	<!-- ================================== -->
+	<!--              JAVADOC               -->
+	<!-- ================================== -->
+	<target name="javadoc" description="Generate Javadoc files">
+		<mkdir dir="${basedir}/doc" />
+		<javadoc destdir="${basedir}/doc">
+			<fileset dir="src/main/java" defaultexcludes="yes">
+				<include name="org/apache/directory/ldapstudio/**/*.java"/>
+			</fileset>
+		</javadoc>
+	</target>
+	
+	<!-- ================================== -->
+	<!--              JAR                   -->
+	<!-- ================================== -->
+	<target name="jar" description="Creates jar file" depends="compile">
+		<jar destfile="${project.output}/${project.name}_${project.version}.jar" manifest="${project.build}/META-INF/MANIFEST.MF">
+			<fileset dir="${project.build}" excludes="compile.timestamp" />
+		</jar>
+	</target>
+
+	<!-- ================================== -->
+	<!--               CLEAN                -->
+	<!-- ================================== -->
+	<target name="clean" description="Deletes any generated file (javadoc, classes, jars, distribution)">
+		<delete includeemptydirs="true">
+			<fileset dir="${basedir}">
+				<exclude name=".classpath"/>
+				<exclude name=".project"/>
+				<exclude name="about.html"/>
+				<exclude name="build.properties"/>
+				<exclude name="build.xml"/>
+				<exclude name="ivy.xml"/>
+				<exclude name="plugin.properties"/>
+				<exclude name="plugin.xml"/>
+				<exclude name="about_files/**"/>
+				<exclude name="resources/**"/>
+				<exclude name="META-INF/**"/>
+				<exclude name="src/**" />
+			</fileset>
+		</delete>
+	</target>
+</project>

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 @@
+<!--
+  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.
+-->
+<ivy-module version="1.0">
+	<info organisation="org.apache.directory.ldapstudio" module="ldapstudio-valueeditors"/>
+</ivy-module>
\ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+   <extension
+         point="org.apache.directory.ldapstudio.valueeditors">
+    <valueEditor
+          class="org.apache.directory.ldapstudio.valueeditors.password.PasswordValueEditor"
+          icon="resources/icons/passwordeditor.gif"
+          name="Password Editor">
+       <attribute attributeType="userPassword"/>
+    </valueEditor>
+    <valueEditor
+          class="org.apache.directory.ldapstudio.valueeditors.image.ImageValueEditor"
+          icon="resources/icons/imageeditor.gif"
+          name="Image Editor">
+       <syntax syntaxOID="1.3.6.1.4.1.1466.115.121.1.28"/>
+    </valueEditor>
+    <valueEditor
+          class="org.apache.directory.ldapstudio.valueeditors.time.InPlaceGeneralizedTimeValueEditor"
+          icon="resources/icons/generalizedtimeeditor.gif"
+          name="In-Place Generalized Time Editor">
+       <syntax syntaxOID="1.3.6.1.4.1.1466.115.121.1.24"/>
+    </valueEditor>
+    <valueEditor
+          class="org.apache.directory.ldapstudio.valueeditors.objectclass.ObjectClassValueEditor"
+          icon="resources/icons/objectclasseditor.png"
+          name="Object Class Editor">
+       <attribute attributeType="objectClass"/>
+    </valueEditor>
+    <valueEditor
+          class="org.apache.directory.ldapstudio.valueeditors.dn.DnValueEditor"
+          icon="resources/icons/dneditor.gif"
+          name="DN Editor">
+       <syntax syntaxOID="1.3.6.1.4.1.1466.115.121.1.12"/>
+    </valueEditor>
+    <valueEditor
+          class="org.apache.directory.ldapstudio.valueeditors.address.AddressValueEditor"
+          icon="resources/icons/addresseditor.gif"
+          name="Address Editor">
+       <syntax syntaxOID="1.3.6.1.4.1.1466.115.121.1.41"/>
+    </valueEditor>
+    <valueEditor
+          class="org.apache.directory.ldapstudio.valueeditors.integer.IntegerValueEditor"
+          icon="resources/icons/integereditor.gif"
+          name="Integer Editor">
+       <syntax syntaxOID="1.3.6.1.4.1.1466.115.121.1.27"/>
+    </valueEditor>
+   </extension>
+
+</plugin>

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.
+     * <p>
+     * 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 <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @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 <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @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 <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @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 <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @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 <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @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;
+    }
+}



Mime
View raw message