You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2006/12/30 20:19:07 UTC
svn commit: r491293 [1/3] - in
/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor: ./ META-INF/
icons/ lib/ src/ src/main/ src/main/java/ src/main/java/org/
src/main/java/org/apache/
src/main/java/org/apache/directory/ldapstudio/aciitemeditor/ ...
Author: seelmann
Date: Sat Dec 30 11:19:04 2006
New Revision: 491293
URL: http://svn.apache.org/viewvc?view=rev&rev=491293
Log:
Implemented value editor extension; added visual and source sync; removed old editor; javadocs and code cleaning.
Added:
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/build.xml
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/aciitemeditor.gif (with props)
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/error.gif (with props)
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/ivy.xml
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/
- copied from r490781, directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/
- copied from r491291, directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/apache/
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/ACIItemValueEditor.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/Messages.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemProtectedItemsComposite.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemSourceEditorComposite.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemTabFolderComposite.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemUserClassesComposite.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemVisualEditorComposite.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/Messages.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/resources/
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/resources/org/
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/resources/org/apache/
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/resources/org/apache/directory/
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/resources/org/apache/directory/ldapstudio/
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/resources/org/apache/directory/ldapstudio/aciitemeditor/
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/resources/org/apache/directory/ldapstudio/aciitemeditor/dialogs/
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/resources/org/apache/directory/ldapstudio/aciitemeditor/dialogs/messages.properties
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/resources/org/apache/directory/ldapstudio/aciitemeditor/widgets/
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/resources/org/apache/directory/ldapstudio/aciitemeditor/widgets/messages.properties
Removed:
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/sample.gif
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/lib/antlr-2.7.6.jar
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/Test.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/ACIItemSerializer.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/editors/
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemComposite.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/wizards/
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/org/
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/test.aci
Modified:
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/.classpath
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/META-INF/MANIFEST.MF
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/build.properties
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/plugin.xml
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/Activator.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/ACIItemDialog.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/ItemPermissionDialog.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/TextDialog.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/UserPermissionDialog.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemGeneralComposite.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemGrantsAndDenialsComposite.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemItemPermissionsComposite.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemUserPermissionsComposite.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/WidgetModifyEvent.java
directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/WidgetModifyListener.java
Modified: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/.classpath
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/.classpath?view=diff&rev=491293&r1=491292&r2=491293
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/.classpath (original)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/.classpath Sat Dec 30 11:19:04 2006
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
+ <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="lib" path="lib/antlr-2.7.6.jar"/>
<classpathentry kind="lib" path="lib/commons-collections-3.1.jar"/>
<classpathentry kind="lib" path="lib/commons-configuration-1.2.jar"/>
<classpathentry kind="lib" path="lib/commons-lang-2.1.jar"/>
Modified: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/META-INF/MANIFEST.MF?view=diff&rev=491293&r1=491292&r2=491293
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/META-INF/MANIFEST.MF (original)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/META-INF/MANIFEST.MF Sat Dec 30 11:19:04 2006
@@ -9,15 +9,13 @@
org.eclipse.core.runtime,
org.eclipse.jface.text,
org.eclipse.core.resources,
- org.eclipse.ui.editors,
- org.eclipse.ui.ide,
- org.eclipse.ui.workbench.texteditor,
- org.eclipse.ui.forms
+ org.apache.directory.ldapstudio.jars,
+ org.apache.directory.ldapstudio.browser.ui,
+ org.apache.directory.ldapstudio.browser.core
Eclipse-LazyStart: true
Bundle-Vendor: apache.org
Bundle-ClassPath: .,
lib/shared-ldap-0.9.6-SNAPSHOT.jar,
- lib/antlr-2.7.6.jar,
lib/commons-collections-3.1.jar,
lib/commons-configuration-1.2.jar,
lib/commons-lang-2.1.jar,
Modified: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/build.properties
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/build.properties?view=diff&rev=491293&r1=491292&r2=491293
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/build.properties (original)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/build.properties Sat Dec 30 11:19:04 2006
@@ -1,11 +1,10 @@
-source.. = src/
-output.. = classes/
+source.. = src/main/java/
+output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.,\
icons/,\
lib/shared-ldap-0.9.6-SNAPSHOT.jar,\
- lib/antlr-2.7.6.jar,\
lib/commons-collections-3.1.jar,\
lib/commons-configuration-1.2.jar,\
lib/commons-lang-2.1.jar,\
Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/build.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/build.xml?view=auto&rev=491293
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/build.xml (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/build.xml Sat Dec 30 11:19:04 2006
@@ -0,0 +1,157 @@
+<!--
+ 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 name="ldapstudio-aciitemeditor" default="jar" xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
+ <property name="project.name" value="org.apache.directory.ldapstudio.aciitemeditor" />
+ <property name="project.version" value="0.5.5" />
+
+ <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">
+ <ivy:retrieve/>
+ </target>
+
+ <!-- ================================== -->
+ <!-- CLASSPATH -->
+ <!-- ================================== -->
+ <target name="build-classpath" description="Computes a classpath according to current OS" >
+ <echo message="${basedir}" />
+ <path id="classpath">
+ <fileset dir="../dependencies/eclipse/3.2">
+ <include name="**/*.jar"/>
+ </fileset>
+ <fileset dir="${lib.dir}" />
+ <pathelement location="${basedir}/../ldapstudio-browser-ui/target/classes"/>
+ <pathelement location="${basedir}/../ldapstudio-browser-ui/target/build"/>
+ <pathelement location="${basedir}/../ldapstudio-browser-core/target/classes"/>
+ <pathelement location="${basedir}/../ldapstudio-browser-core/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" />
+ </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}/icons" />
+ <copy todir="${project.build}/icons">
+ <fileset dir="${basedir}/icons">
+ <include name="**" />
+ </fileset>
+ </copy>
+ <mkdir dir="${project.build}/ressources" />
+ <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" />
+
+ <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/**"/>
+ </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="META-INF/**"/>
+ <exclude name="src/**" />
+ <exclude name="icons/**" />
+ <exclude name="lib/**" />
+ </fileset>
+ </delete>
+ </target>
+</project>
Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/aciitemeditor.gif
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/aciitemeditor.gif?view=auto&rev=491293
==============================================================================
Binary file - no diff available.
Propchange: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/aciitemeditor.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/error.gif
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/error.gif?view=auto&rev=491293
==============================================================================
Binary file - no diff available.
Propchange: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/icons/error.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/ivy.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/ivy.xml?view=auto&rev=491293
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/ivy.xml (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/ivy.xml Sat Dec 30 11:19:04 2006
@@ -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-aciitemeditor"/>
+</ivy-module>
\ No newline at end of file
Modified: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/plugin.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/plugin.xml?view=diff&rev=491293&r1=491292&r2=491293
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/plugin.xml (original)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/plugin.xml Sat Dec 30 11:19:04 2006
@@ -6,12 +6,20 @@
point="org.eclipse.ui.editors">
<editor
name="ACI Item Editor"
- extensions="aci"
- icon="icons/sample.gif"
+ icon="icons/aciitemeditor.gif"
contributorClass="org.apache.directory.ldapstudio.aciitemeditor.editors.MultiPageEditorContributor"
class="org.apache.directory.ldapstudio.aciitemeditor.editors.MultiPageEditor"
id="org.apache.directory.ldapstudio.aciitemeditor.editors.MultiPageEditor">
</editor>
+ </extension>
+ <extension
+ point="org.apache.directory.ldapstudio.browser.ui.valueEditors">
+ <valueEditor
+ class="org.apache.directory.ldapstudio.aciitemeditor.ACIItemValueEditor"
+ icon="icons/aciitemeditor.gif"
+ name="ACI Item Editor">
+ <syntax syntaxOID="1.3.6.1.4.1.1466.115.121.1.1"/>
+ </valueEditor>
</extension>
</plugin>
Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/ACIItemValueEditor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/ACIItemValueEditor.java?view=auto&rev=491293
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/ACIItemValueEditor.java (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/ACIItemValueEditor.java Sat Dec 30 11:19:04 2006
@@ -0,0 +1,62 @@
+/*
+ * 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.aciitemeditor;
+
+
+import org.apache.directory.ldapstudio.aciitemeditor.dialogs.ACIItemDialog;
+import org.apache.directory.ldapstudio.browser.ui.valueeditors.AbstractDialogStringValueEditor;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The IValueEditor implementation of this plugin.
+ *
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ACIItemValueEditor extends AbstractDialogStringValueEditor
+{
+
+ public ACIItemValueEditor()
+ {
+ super();
+ }
+
+
+ /**
+ * Opens the ACI item dialog.
+ */
+ public boolean openDialog( Shell shell )
+ {
+ Object value = getValue();
+ if ( value != null && value instanceof String )
+ {
+ ACIItemDialog dialog = new ACIItemDialog( shell, ( String ) value );
+ if ( dialog.open() == ACIItemDialog.OK && !"".equals( dialog.getACIItemValue() ) ) //$NON-NLS-1$
+ {
+ setValue( dialog.getACIItemValue() );
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
Modified: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/Activator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/Activator.java?view=diff&rev=491293&r1=491291&r2=491293
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/Activator.java (original)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/Activator.java Sat Dec 30 11:19:04 2006
@@ -20,24 +20,38 @@
package org.apache.directory.ldapstudio.aciitemeditor;
+import org.apache.directory.shared.ldap.aci.ACIItemParser;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
+ *
* The activator class controls the plug-in life cycle
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
*/
public class Activator extends AbstractUIPlugin
{
- // The plug-in ID
- public static final String PLUGIN_ID = "org.apache.directory.ldapstudio.aciitemeditor";
+ /** The plug-in ID */
+ public static final String PLUGIN_ID = "org.apache.directory.ldapstudio.aciitemeditor"; //$NON-NLS-1$
- // The shared instance
+ /** The shared instance */
private static Activator plugin;
+ /** The shared ACI Item parser */
+ private ACIItemParser aciItemParser;
+
/**
* The constructor
@@ -117,4 +131,39 @@
}
return image;
}
+
+
+ /**
+ * Returns the shared ACI item parser. Take care that
+ * the parser isn't used concurrently.
+ *
+ * @return the shared ACI item parser.
+ */
+ public ACIItemParser getACIItemParser()
+ {
+ if ( aciItemParser == null )
+ {
+ aciItemParser = new ACIItemParser( null );
+ }
+ return aciItemParser;
+ }
+
+
+ /**
+ * Returns the button with respect to the font metrics.
+ *
+ * @param control a control
+ * @return the button width
+ */
+ public static int getButtonWidth( Control control )
+ {
+ GC gc = new GC( control );
+ gc.setFont( JFaceResources.getDialogFont() );
+ FontMetrics fontMetrics = gc.getFontMetrics();
+ gc.dispose();
+
+ int width = Dialog.convertHorizontalDLUsToPixels( fontMetrics, IDialogConstants.BUTTON_WIDTH );
+ return width;
+ }
+
}
Modified: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/ACIItemDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/ACIItemDialog.java?view=diff&rev=491293&r1=491291&r2=491293
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/ACIItemDialog.java (original)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/ACIItemDialog.java Sat Dec 30 11:19:04 2006
@@ -20,15 +20,123 @@
package org.apache.directory.ldapstudio.aciitemeditor.dialogs;
+
+import java.text.ParseException;
+
+import org.apache.directory.ldapstudio.aciitemeditor.Activator;
+import org.apache.directory.ldapstudio.aciitemeditor.widgets.ACIItemTabFolderComposite;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.ErrorDialog;
+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;
+
+/**
+ * The main dialog of the ACI item editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
public class ACIItemDialog extends Dialog
{
- protected ACIItemDialog( Shell parentShell )
+ /** The initial value, passed by the constructor */
+ private String initialValue;
+
+ /** The resulting value returned by getACIItemValue() */
+ private String returnValue;
+
+ /** The child composite with the tabs */
+ private ACIItemTabFolderComposite tabFolderComposite;
+
+
+ /**
+ * Creates a new instance of ACIItemDialog.
+ *
+ * @param parentShell the shell
+ * @param initialValue the initial ACI item to edit, or null to
+ * create a new ACI item
+ */
+ public ACIItemDialog( Shell parentShell, String initialValue )
{
super( parentShell );
+ super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
+ this.initialValue = initialValue;
+ this.returnValue = null;
+ }
+
+
+ /**
+ * Sets the dialog image and text.
+ *
+ * {@inheritDoc}
+ */
+ protected void configureShell( Shell shell )
+ {
+ super.configureShell( shell );
+ shell.setText( Messages.getString( "ACIItemDialog.dialog.text" ) ); //$NON-NLS-1$
+ shell.setImage( Activator.getDefault().getImage( Messages.getString( "ACIItemDialog.dialog.icon" ) ) ); //$NON-NLS-1$
+ }
+
+
+ /**
+ * Reimplementation: Checks for valid syntax first and sets the return value.
+ */
+ protected void okPressed()
+ {
+ try
+ {
+ this.returnValue = tabFolderComposite.getInput();
+ super.okPressed();
+ }
+ catch ( ParseException pe )
+ {
+ IStatus status = new Status( IStatus.ERROR, Activator.PLUGIN_ID, 1, Messages
+ .getString( "ACIItemDialog.error.invalidSyntax" ), pe ); //$NON-NLS-1$
+ ErrorDialog.openError( getShell(), Messages.getString( "ACIItemDialog.error.title" ), null, status ); //$NON-NLS-1$
+ }
+ }
+
+
+ /**
+ * Creates the tabFolderComposite.
+ */
+ 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;
+ gd.heightHint = convertVerticalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ) * 3 / 2;
+ composite.setLayoutData( gd );
+
+ tabFolderComposite = new ACIItemTabFolderComposite( composite, SWT.NONE );
+
+ // set initial value
+ if ( initialValue != null )
+ {
+ tabFolderComposite.setInput( initialValue );
+ }
+
+ applyDialogFont( composite );
+ return composite;
+ }
+
+
+ /**
+ * Returns the string representation of the ACI item. Returns
+ * null if Cancel button was pressed.
+ *
+ * @return the string representation of the ACI item or null
+ */
+ public String getACIItemValue()
+ {
+ return returnValue;
}
}
Modified: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/ItemPermissionDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/ItemPermissionDialog.java?view=diff&rev=491293&r1=491291&r2=491293
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/ItemPermissionDialog.java (original)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/ItemPermissionDialog.java Sat Dec 30 11:19:04 2006
@@ -23,13 +23,13 @@
import java.util.Collection;
+import org.apache.directory.ldapstudio.aciitemeditor.Activator;
import org.apache.directory.ldapstudio.aciitemeditor.widgets.ACIItemGrantsAndDenialsComposite;
import org.apache.directory.ldapstudio.aciitemeditor.widgets.ACIItemUserClassesComposite;
import org.apache.directory.shared.ldap.aci.GrantAndDenial;
import org.apache.directory.shared.ldap.aci.ItemPermission;
import org.apache.directory.shared.ldap.aci.UserClass;
import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -43,28 +43,41 @@
import org.eclipse.swt.widgets.Spinner;
+/**
+ * A dialog to compose item permissions.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
public class ItemPermissionDialog extends Dialog
{
- public static final String DIALOG_TITLE = "Item Permission Editor";
-
- public static final double MAX_WIDTH = 250.0;
-
- public static final double MAX_HEIGHT = 350.0;
-
+ /** The initial value, passed by the constructor */
private ItemPermission initialItemPermission;
+ /** The resulting value returned by getItemPermission() */
private ItemPermission returnItemPermission;
-
+
+ /** The precedence checkbox to enable/disable spinner */
private Button precedenceCheckbox = null;
-
+
+ /** The precedence spinner */
private Spinner precedenceSpinner = null;
-
+
+ /** The widget with user classes table */
private ACIItemUserClassesComposite userClassesComposite;
-
+
+ /** The widget with grants and denials table */
private ACIItemGrantsAndDenialsComposite grantsAndDenialsComposite;
+ /**
+ * Creates a new instance of ItemPermissionDialog.
+ *
+ * @param parentShell the shell
+ * @param initialValue the initial item permission to edit,
+ * or null to create a new item permission
+ */
public ItemPermissionDialog( Shell parentShell, ItemPermission initialItemPermission )
{
super( parentShell );
@@ -74,27 +87,22 @@
}
- public boolean close()
- {
- return super.close();
- }
-
-
+ /**
+ * Sets the dialog image and text.
+ *
+ * {@inheritDoc}
+ */
protected void configureShell( Shell shell )
{
super.configureShell( shell );
- shell.setText( DIALOG_TITLE );
- //shell.setImage( BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_TEXTEDITOR ) );
- }
-
-
- protected void createButtonsForButtonBar( Composite parent )
- {
- createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
- createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+ shell.setText( Messages.getString("ItemPermissionDialog.dialog.text") ); //$NON-NLS-1$
+ shell.setImage( Activator.getDefault().getImage( Messages.getString("ItemPermissionDialog.dialog.icon") ) ); //$NON-NLS-1$
}
+ /**
+ * Reimplementation: Checks for valid syntax and sets the return value.
+ */
protected void okPressed()
{
try
@@ -102,27 +110,31 @@
int precedence = precedenceCheckbox.getSelection() ? precedenceSpinner.getSelection() : -1;
Collection<UserClass> userClasses = userClassesComposite.getUserClasses();
Collection<GrantAndDenial> grantsAndDenials = grantsAndDenialsComposite.getGrantsAndDenials();
- returnItemPermission = new ItemPermission(precedence, grantsAndDenials, userClasses);
+ returnItemPermission = new ItemPermission( precedence, grantsAndDenials, userClasses );
super.okPressed();
}
catch ( Exception e )
{
- MessageDialog.openError( getShell(), "Invalid Item Permission", e.getMessage() );
+ MessageDialog.openError( getShell(), Messages.getString("ItemPermissionDialog.error.invalidItemPermission"), e.getMessage() ); //$NON-NLS-1$
}
}
+ /**
+ * Creates all the dialog content.
+ */
protected Control createDialogArea( Composite parent )
{
Composite composite = ( Composite ) super.createDialogArea( parent );
GridData gd = new GridData( GridData.FILL_BOTH );
composite.setLayoutData( gd );
+ // precedence
Composite spinnerComposite = new Composite( composite, SWT.NONE );
spinnerComposite.setLayout( new GridLayout( 2, false ) );
spinnerComposite.setLayoutData( new GridData() );
precedenceCheckbox = new Button( spinnerComposite, SWT.CHECK );
- precedenceCheckbox.setText( "Precedence:" );
+ precedenceCheckbox.setText( Messages.getString("ItemPermissionDialog.precedence.label") ); //$NON-NLS-1$
precedenceCheckbox.addSelectionListener( new SelectionAdapter()
{
public void widgetSelected( SelectionEvent e )
@@ -144,13 +156,15 @@
precedenceGridData.horizontalAlignment = GridData.BEGINNING;
precedenceGridData.widthHint = 3 * 12;
precedenceSpinner.setLayoutData( precedenceGridData );
-
+
+ // user classes
userClassesComposite = new ACIItemUserClassesComposite( composite, SWT.NONE );
-
+
+ // grants and denial
grantsAndDenialsComposite = new ACIItemGrantsAndDenialsComposite( composite, SWT.NONE );
-
- if(initialItemPermission != null)
+ // set initial values
+ if ( initialItemPermission != null )
{
if ( initialItemPermission.getPrecedence() > -1 )
{
@@ -161,14 +175,20 @@
userClassesComposite.setUserClasses( initialItemPermission.getUserClasses() );
grantsAndDenialsComposite.setGrantsAndDenials( initialItemPermission.getGrantsAndDenials() );
}
-
+
applyDialogFont( composite );
return composite;
}
+ /**
+ * Returns the item permission. Returns null if Cancel button was pressed.
+ *
+ * @return the composed item permission or null
+ */
public ItemPermission getItemPermission()
{
return returnItemPermission;
}
+
}
Added: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/Messages.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/Messages.java?view=auto&rev=491293
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/Messages.java (added)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/Messages.java Sat Dec 30 11:19:04 2006
@@ -0,0 +1,31 @@
+package org.apache.directory.ldapstudio.aciitemeditor.dialogs;
+
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+public class Messages
+{
+ private static final String BUNDLE_NAME = "org.apache.directory.ldapstudio.aciitemeditor.dialogs.messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
+
+
+ private Messages()
+ {
+ }
+
+
+ public static String getString( String key )
+ {
+ try
+ {
+ return RESOURCE_BUNDLE.getString( key );
+ }
+ catch ( MissingResourceException e )
+ {
+ return '!' + key + '!';
+ }
+ }
+}
Modified: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/TextDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/TextDialog.java?view=diff&rev=491293&r1=491291&r2=491293
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/TextDialog.java (original)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/TextDialog.java Sat Dec 30 11:19:04 2006
@@ -31,14 +31,17 @@
import org.eclipse.swt.widgets.Text;
+/**
+ * Interim dialog to edit all elements of an ACI item till all smart
+ * dialogs are availble.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
public class TextDialog extends Dialog
{
- public static final String DIALOG_TITLE = "Text Editor";
-
- public static final double MAX_WIDTH = 250.0;
-
- public static final double MAX_HEIGHT = 250.0;
+ public static final String DIALOG_TITLE = "Text Editor"; //$NON-NLS-1$
private String initialValue;
@@ -51,7 +54,7 @@
{
super( parentShell );
super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
- if(initialValue == null) initialValue = "";
+ if(initialValue == null) initialValue = ""; //$NON-NLS-1$
this.initialValue = initialValue;
this.returnValue = null;
}
Modified: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/UserPermissionDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/UserPermissionDialog.java?view=diff&rev=491293&r1=491291&r2=491293
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/UserPermissionDialog.java (original)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/dialogs/UserPermissionDialog.java Sat Dec 30 11:19:04 2006
@@ -23,13 +23,13 @@
import java.util.Collection;
+import org.apache.directory.ldapstudio.aciitemeditor.Activator;
import org.apache.directory.ldapstudio.aciitemeditor.widgets.ACIItemGrantsAndDenialsComposite;
import org.apache.directory.ldapstudio.aciitemeditor.widgets.ACIItemProtectedItemsComposite;
import org.apache.directory.shared.ldap.aci.GrantAndDenial;
import org.apache.directory.shared.ldap.aci.ProtectedItem;
import org.apache.directory.shared.ldap.aci.UserPermission;
import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -43,28 +43,41 @@
import org.eclipse.swt.widgets.Spinner;
+/**
+ * A dialog to compose user permissions.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
public class UserPermissionDialog extends Dialog
{
- public static final String DIALOG_TITLE = "User Permission Editor";
-
- public static final double MAX_WIDTH = 250.0;
-
- public static final double MAX_HEIGHT = 350.0;
-
+ /** The initial value, passed by the constructor */
private UserPermission initialUserPermission;
+ /** The resulting value returned by getUserPermission() */
private UserPermission returnUserPermission;
+ /** The precedence checkbox to enable/disable spinner */
private Button precedenceCheckbox = null;
+ /** The precedence spinner */
private Spinner precedenceSpinner = null;
+ /** The widget with protected items table */
private ACIItemProtectedItemsComposite protectedItemsComposite;
+ /** The widget with grants and denials table */
private ACIItemGrantsAndDenialsComposite grantsAndDenialsComposite;
+ /**
+ * Creates a new instance of UserPermissionDialog.
+ *
+ * @param parentShell the shell
+ * @param initialValue the initial user permission to edit,
+ * or null to create a new user permission
+ */
public UserPermissionDialog( Shell parentShell, UserPermission initialUserPermission )
{
super( parentShell );
@@ -74,27 +87,22 @@
}
- public boolean close()
- {
- return super.close();
- }
-
-
+ /**
+ * Sets the dialog image and text.
+ *
+ * {@inheritDoc}
+ */
protected void configureShell( Shell shell )
{
super.configureShell( shell );
- shell.setText( DIALOG_TITLE );
- //shell.setImage( BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_TEXTEDITOR ) );
- }
-
-
- protected void createButtonsForButtonBar( Composite parent )
- {
- createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
- createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+ shell.setText( Messages.getString("UserPermissionDialog.dialog.text") ); //$NON-NLS-1$
+ shell.setImage( Activator.getDefault().getImage( Messages.getString("UserPermissionDialog.dialog.icon") ) ); //$NON-NLS-1$
}
+ /**
+ * Reimplementation: Checks for valid syntax and sets the return value.
+ */
protected void okPressed()
{
try
@@ -107,22 +115,26 @@
}
catch ( Exception e )
{
- MessageDialog.openError( getShell(), "Invalid User Permission", e.getMessage() );
+ MessageDialog.openError( getShell(), Messages.getString("UserPermissionDialog.error.invalidUserPermission"), e.getMessage() ); //$NON-NLS-1$
}
}
+ /**
+ * Creates all the dialog content.
+ */
protected Control createDialogArea( Composite parent )
{
Composite composite = ( Composite ) super.createDialogArea( parent );
GridData gd = new GridData( GridData.FILL_BOTH );
composite.setLayoutData( gd );
+ // precedence
Composite spinnerComposite = new Composite( composite, SWT.NONE );
spinnerComposite.setLayout( new GridLayout( 2, false ) );
spinnerComposite.setLayoutData( new GridData() );
precedenceCheckbox = new Button( spinnerComposite, SWT.CHECK );
- precedenceCheckbox.setText( "Precedence:" );
+ precedenceCheckbox.setText( Messages.getString("UserPermissionDialog.precedence.label") ); //$NON-NLS-1$
precedenceCheckbox.addSelectionListener( new SelectionAdapter()
{
public void widgetSelected( SelectionEvent e )
@@ -145,10 +157,13 @@
precedenceGridData.widthHint = 3 * 12;
precedenceSpinner.setLayoutData( precedenceGridData );
+ // protected items
protectedItemsComposite = new ACIItemProtectedItemsComposite( composite, SWT.NONE );
+ // grants and denials
grantsAndDenialsComposite = new ACIItemGrantsAndDenialsComposite( composite, SWT.NONE );
+ // set initial values
if ( initialUserPermission != null )
{
if ( initialUserPermission.getPrecedence() > -1 )
@@ -166,8 +181,14 @@
}
+ /**
+ * Returns the user permission. Returns null if Cancel button was pressed.
+ *
+ * @return the composed user permission or null
+ */
public UserPermission getUserPermission()
{
return returnUserPermission;
}
+
}
Modified: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemGeneralComposite.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemGeneralComposite.java?view=diff&rev=491293&r1=491291&r2=491293
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemGeneralComposite.java (original)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemGeneralComposite.java Sat Dec 30 11:19:04 2006
@@ -32,8 +32,8 @@
import org.eclipse.swt.SWT;
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.events.SelectionListener;
import org.eclipse.swt.events.TypedEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -44,8 +44,9 @@
import org.eclipse.swt.widgets.Spinner;
import org.eclipse.swt.widgets.Text;
+
/**
- * This composite contains general ACI item properties:
+ * This is used to edit general ACI item properties:
* <ul>
* <li>identification tag
* <li>precedence
@@ -57,48 +58,48 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public class ACIItemGeneralComposite extends Composite implements ModifyListener, SelectionListener
+public class ACIItemGeneralComposite extends Composite
{
/** The inner composite for all the content */
private Composite composite = null;
-
+
/** The identification tag label */
private Label identificationTagLabel = null;
-
+
/** The identification tag text field */
private Text identificationTagText = null;
/** The precedence label */
private Label precedenceLabel = null;
-
+
/** The spinner to select a valid precedence between 0 and 255 */
private Spinner precedenceSpinner = null;
-
+
/** The authentication level label */
private Label authenticationLevelLabel = null;
-
+
/** The combo to select a valid uthentication level */
private Combo authenticationLevelCombo = null;
-
+
/**
* The combo viewer is attached to authenticationLevelCombo to work with
* AuthenticationLevel objects rather than Strings
*/
private ComboViewer authenticationLevelComboViewer = null;
-
+
/** The user or item first label */
private Label userOrItemFirstLabel = null;
-
+
/** The user first radio button */
private Button userFirstRadioButton = null;
-
+
/** The item first radio button */
private Button itemFirstRadioButton = null;
-
+
/** The list with listers */
private List<WidgetModifyListener> listenerList = new ArrayList<WidgetModifyListener>();
-
+
/**
* Creates a new instance of ACIItemGeneralComposite.
*
@@ -162,15 +163,21 @@
composite = new Composite( this, SWT.NONE );
composite.setLayout( gridLayout );
composite.setLayoutData( gridData );
-
+
identificationTagLabel = new Label( composite, SWT.NONE );
- identificationTagLabel.setText( "Identification Tag:" );
+ identificationTagLabel.setText( Messages.getString("ACIItemGeneralComposite.idTag.label") ); //$NON-NLS-1$
identificationTagText = new Text( composite, SWT.BORDER );
identificationTagText.setLayoutData( identificationTagGridData );
- identificationTagText.addModifyListener( this );
+ identificationTagText.addModifyListener( new ModifyListener()
+ {
+ public void modifyText( ModifyEvent event )
+ {
+ fire( event );
+ }
+ } );
precedenceLabel = new Label( composite, SWT.NONE );
- precedenceLabel.setText( "Precedence:" );
+ precedenceLabel.setText( Messages.getString("ACIItemGeneralComposite.precedence.label") ); //$NON-NLS-1$
precedenceSpinner = new Spinner( composite, SWT.BORDER );
precedenceSpinner.setMinimum( 0 );
precedenceSpinner.setMaximum( 255 );
@@ -179,10 +186,16 @@
precedenceSpinner.setPageIncrement( 10 );
precedenceSpinner.setSelection( 0 );
precedenceSpinner.setLayoutData( precedenceGridData );
- precedenceSpinner.addModifyListener( this );
+ precedenceSpinner.addModifyListener( new ModifyListener()
+ {
+ public void modifyText( ModifyEvent event )
+ {
+ fire( event );
+ }
+ } );
authenticationLevelLabel = new Label( composite, SWT.NONE );
- authenticationLevelLabel.setText( "Authentication Level:" );
+ authenticationLevelLabel.setText( Messages.getString("ACIItemGeneralComposite.authLevel.label") ); //$NON-NLS-1$
authenticationLevelCombo = new Combo( composite, SWT.READ_ONLY );
authenticationLevelCombo.setLayoutData( authenticationLevelGridData );
AuthenticationLevel[] authenticationLevels = new AuthenticationLevel[3];
@@ -193,22 +206,44 @@
authenticationLevelComboViewer.setContentProvider( new ArrayContentProvider() );
authenticationLevelComboViewer.setLabelProvider( new LabelProvider() );
authenticationLevelComboViewer.setInput( authenticationLevels );
- authenticationLevelCombo.addModifyListener( this );
authenticationLevelComboViewer.setSelection( new StructuredSelection( AuthenticationLevel.NONE ) );
-
+ authenticationLevelCombo.addModifyListener( new ModifyListener()
+ {
+ public void modifyText( ModifyEvent event )
+ {
+ fire( event );
+ }
+ } );
userOrItemFirstLabel = new Label( composite, SWT.NONE );
- userOrItemFirstLabel.setText( "User or Item first:" );
+ userOrItemFirstLabel.setText( Messages.getString("ACIItemGeneralComposite.userOrItemFirst.label") ); //$NON-NLS-1$
userFirstRadioButton = new Button( composite, SWT.RADIO );
- userFirstRadioButton.setText( "User First" );
- userFirstRadioButton.addSelectionListener( this );
+ userFirstRadioButton.setText( Messages.getString("ACIItemGeneralComposite.userFirst.label") ); //$NON-NLS-1$
+ userFirstRadioButton.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent event )
+ {
+ fire( event );
+ }
+ } );
itemFirstRadioButton = new Button( composite, SWT.RADIO );
- itemFirstRadioButton.setText( "Item First" );
- itemFirstRadioButton.addSelectionListener( this );
+ itemFirstRadioButton.setText( Messages.getString("ACIItemGeneralComposite.itemFirst.label") ); //$NON-NLS-1$
+ itemFirstRadioButton.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent event )
+ {
+ fire( event );
+ }
+ } );
}
+ /**
+ * Add the listener to the list of listeners.
+ *
+ * @param listener
+ */
public void addWidgetModifyListener( WidgetModifyListener listener )
{
checkWidget();
@@ -218,6 +253,11 @@
}
+ /**
+ * Removes the listener from the list of listeners.
+ *
+ * @param listener
+ */
public void removeWidgetModifyListener( WidgetModifyListener listener )
{
checkWidget();
@@ -227,7 +267,12 @@
}
- private void fire( TypedEvent e)
+ /**
+ * Fires WidgetModifyEvents.
+ *
+ * @param event the original event
+ */
+ private void fire( TypedEvent event )
{
for ( WidgetModifyListener listener : listenerList )
{
@@ -236,23 +281,6 @@
}
- public void modifyText( ModifyEvent e )
- {
- fire( e );
- }
-
-
- public void widgetDefaultSelected( SelectionEvent e )
- {
- fire( e );
- }
-
-
- public void widgetSelected( SelectionEvent e )
- {
- fire( e );
- }
-
/**
* Returns the identification tag.
*
@@ -262,7 +290,19 @@
{
return identificationTagText.getText();
}
-
+
+
+ /**
+ * Sets the identification tag
+ *
+ * @param identificationTag the identification tag
+ */
+ public void setIdentificationTag( String identificationTag )
+ {
+ identificationTagText.setText( identificationTag );
+ }
+
+
/**
* Returns the selected precedence.
*
@@ -272,7 +312,19 @@
{
return precedenceSpinner.getSelection();
}
-
+
+
+ /**
+ * Sets the precedence
+ *
+ * @param precedence the precedence
+ */
+ public void setPrecedence( int precedence )
+ {
+ precedenceSpinner.setSelection( precedence );
+ }
+
+
/**
* Returns the selected authentication level.
*
@@ -283,23 +335,59 @@
IStructuredSelection selection = ( IStructuredSelection ) authenticationLevelComboViewer.getSelection();
return ( AuthenticationLevel ) selection.getFirstElement();
}
-
+
+
+ /**
+ * Sets the authentication level.
+ *
+ * @param authenticationLevel the authentication level
+ */
+ public void setAuthenticationLevel( AuthenticationLevel authenticationLevel )
+ {
+ IStructuredSelection selection = new StructuredSelection( authenticationLevel );
+ authenticationLevelComboViewer.setSelection( selection );
+ }
+
+
/**
* Returns true if user first is selected.
*
* @return true if user first is selected
*/
- public boolean isUserFirst() {
+ public boolean isUserFirst()
+ {
return userFirstRadioButton.getSelection();
}
-
+
+
+ /**
+ * Selects user first.
+ */
+ public void setUserFirst()
+ {
+ userFirstRadioButton.setSelection( true );
+ itemFirstRadioButton.setSelection( false );
+ }
+
+
/**
* Returns true if item first is selected.
*
* @return true if item first is selected
*/
- public boolean isItemFirst() {
+ public boolean isItemFirst()
+ {
return itemFirstRadioButton.getSelection();
}
-
-} // @jve:decl-index=0:visual-constraint="10,10"
+
+
+ /**
+ * Selects item first.
+ */
+ public void setItemFirst()
+ {
+ itemFirstRadioButton.setSelection( true );
+ userFirstRadioButton.setSelection( false );
+ }
+
+}
Modified: directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemGrantsAndDenialsComposite.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemGrantsAndDenialsComposite.java?view=diff&rev=491293&r1=491291&r2=491293
==============================================================================
--- directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemGrantsAndDenialsComposite.java (original)
+++ directory/sandbox/seelmann/trunk/ldapstudio-aciitemeditor/src/main/java/org/apache/directory/ldapstudio/aciitemeditor/widgets/ACIItemGrantsAndDenialsComposite.java Sat Dec 30 11:19:04 2006
@@ -40,7 +40,6 @@
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -91,10 +90,10 @@
private Button redoButton = null;
/** Colum 1 */
- private static String PERMISSION = "Right";
+ private static String PERMISSION = Messages.getString("ACIItemGrantsAndDenialsComposite.column1.header"); //$NON-NLS-1$
/** Colum2 */
- private static String STATE = "Grant/Deny";
+ private static String STATE = Messages.getString("ACIItemGrantsAndDenialsComposite.column2.header"); //$NON-NLS-1$
/** The colums */
private static String[] COLUMNS = new String[]
@@ -103,20 +102,21 @@
/** The undo/redo stack size */
private static final int MAX_STACK_SIZE = 25;
+ /** Used as input for the tree viewer */
private GrantAndDenialCategory[] grantAndDenialCategories = new GrantAndDenialCategory[]
{
- new GrantAndDenialCategory( "Read Rights", true, new GrantAndDenialWrapper[]
+ new GrantAndDenialCategory( Messages.getString("ACIItemGrantsAndDenialsComposite.category.read"), true, new GrantAndDenialWrapper[] //$NON-NLS-1$
{ new GrantAndDenialWrapper( GrantAndDenial.GRANT_BROWSE, GrantAndDenial.DENY_BROWSE ),
new GrantAndDenialWrapper( GrantAndDenial.GRANT_READ, GrantAndDenial.DENY_READ ),
new GrantAndDenialWrapper( GrantAndDenial.GRANT_COMPARE, GrantAndDenial.DENY_COMPARE ),
new GrantAndDenialWrapper( GrantAndDenial.GRANT_FILTER_MATCH, GrantAndDenial.DENY_FILTER_MATCH ),
new GrantAndDenialWrapper( GrantAndDenial.GRANT_RETURN_DN, GrantAndDenial.DENY_RETURN_DN ) } ),
- new GrantAndDenialCategory( "Modification Rights", true, new GrantAndDenialWrapper[]
+ new GrantAndDenialCategory( Messages.getString("ACIItemGrantsAndDenialsComposite.category.modify"), true, new GrantAndDenialWrapper[] //$NON-NLS-1$
{ new GrantAndDenialWrapper( GrantAndDenial.GRANT_ADD, GrantAndDenial.DENY_ADD ),
new GrantAndDenialWrapper( GrantAndDenial.GRANT_MODIFY, GrantAndDenial.DENY_MODIFY ),
new GrantAndDenialWrapper( GrantAndDenial.GRANT_REMOVE, GrantAndDenial.DENY_REMOVE ),
new GrantAndDenialWrapper( GrantAndDenial.GRANT_RENAME, GrantAndDenial.DENY_RENAME ) } ),
- new GrantAndDenialCategory( "Advanced Rights", false, new GrantAndDenialWrapper[]
+ new GrantAndDenialCategory( Messages.getString("ACIItemGrantsAndDenialsComposite.category.advanced"), false, new GrantAndDenialWrapper[] //$NON-NLS-1$
{
new GrantAndDenialWrapper( GrantAndDenial.GRANT_EXPORT, GrantAndDenial.DENY_EXPORT ),
new GrantAndDenialWrapper( GrantAndDenial.GRANT_IMPORT, GrantAndDenial.DENY_IMPORT ),
@@ -124,35 +124,70 @@
new GrantAndDenialWrapper( GrantAndDenial.GRANT_DISCLOSE_ON_ERROR,
GrantAndDenial.DENY_DISCLOSE_ON_ERROR ) } ) };
+ /**
+ * A GrantAndDenialCategory is used to categorize grants and denials in a tree.
+ */
private class GrantAndDenialCategory
{
+ /** The category name, displayed in tree */
private String name;
+
+ /** The initial expanded state */
private boolean expanded;
+
+ /** The grants and denials wrappers display under this category */
private GrantAndDenialWrapper[] grantAndDenialWrappers;
-
- public GrantAndDenialCategory( String name, boolean expanded, GrantAndDenialWrapper[] grantAndDenialWrappers )
+ /**
+ * Creates a new instance of GrantAndDenialCategory.
+ *
+ * @param name the category name, displayed in tree
+ * @param expanded true if category should be initially expanded
+ * @param grantAndDenialWrappers the grants and denials wrappers display under this category
+ */
+ private GrantAndDenialCategory( String name, boolean expanded, GrantAndDenialWrapper[] grantAndDenialWrappers )
{
- super();
this.name = name;
this.expanded = expanded;
this.grantAndDenialWrappers = grantAndDenialWrappers;
}
}
+ /**
+ * A GrantAndDenialWrapper is used to display grants and denials in tree and to
+ * track the current state (not specified, grant or deny). Additional it provides
+ * undo/redo functionality.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
private class GrantAndDenialWrapper
{
+ /** The grant */
private GrantAndDenial grant;
- private GrantAndDenial deny;
+
+ /** The denial */
+ private GrantAndDenial denial;
+
+ /** The current state: null=not specified, grant or denial */
private GrantAndDenial activeGrantAndDenial;
+ /** List containing previous states of activeGrandAndDenial */
private List<GrantAndDenial> undoStack;
+
+ /** List containing "future" states of activeGrandAndDenial */
private List<GrantAndDenial> redoStack;
- GrantAndDenialWrapper( GrantAndDenial grant, GrantAndDenial deny )
+ /**
+ * Creates a new instance of GrantAndDenialWrapper.
+ *
+ * @param grant
+ * @param denial
+ */
+ private GrantAndDenialWrapper( GrantAndDenial grant, GrantAndDenial denial )
{
this.grant = grant;
- this.deny = deny;
+ this.denial = denial;
this.activeGrantAndDenial = null;
undoStack = new LinkedList<GrantAndDenial>();
redoStack = new LinkedList<GrantAndDenial>();
@@ -160,16 +195,15 @@
}
+ /**
+ * Creates a new instance of ACIItemGrantsAndDenialsComposite.
+ *
+ * @param parent
+ * @param style
+ */
public ACIItemGrantsAndDenialsComposite( Composite parent, int style )
{
super( parent, style );
- initialize();
- }
-
-
- private void initialize()
- {
- setSize( new Point( 300, 200 ) );
GridLayout layout = new GridLayout();
layout.horizontalSpacing = 0;
@@ -178,13 +212,13 @@
layout.marginWidth = 0;
setLayout( layout );
- createComposite();
-
GridData layoutData = new GridData();
layoutData.horizontalAlignment = GridData.FILL;
layoutData.grabExcessHorizontalSpace = true;
layoutData.verticalAlignment = GridData.CENTER;
setLayoutData( layoutData );
+
+ createComposite();
}
@@ -214,7 +248,7 @@
composite.setLayout( gridLayout );
label = new Label( composite, SWT.NONE );
- label.setText( "Grants and Denials:" );
+ label.setText( Messages.getString("ACIItemGrantsAndDenialsComposite.description") ); //$NON-NLS-1$
label.setLayoutData( labelGridData );
createTree();
@@ -248,7 +282,7 @@
c2.setText( COLUMNS[1] );
c2.setWidth( 80 );
TreeColumn c3 = new TreeColumn( tree, SWT.LEFT, 2 );
- c3.setText( " " );
+ c3.setText( " " ); //$NON-NLS-1$
c3.setWidth( 1 );
treeViewer = new TreeViewer( tree );
@@ -261,7 +295,6 @@
CellEditor[] cellEditors = new CellEditor[]
{ null, new CheckboxCellEditor( tree ), null };
treeViewer.setCellEditors( cellEditors );
- //tableViewer.setSorter( new ViewerSorter() );
treeViewer.setContentProvider( new GrantsAndDenialsContentProvider() );
treeViewer.setLabelProvider( new GrantsAndDenialsLabelProvider() );
@@ -290,26 +323,31 @@
deselectAllButtonGridData.horizontalAlignment = GridData.FILL;
deselectAllButtonGridData.grabExcessHorizontalSpace = false;
deselectAllButtonGridData.verticalAlignment = GridData.BEGINNING;
+ deselectAllButtonGridData.widthHint = Activator.getButtonWidth( this );
GridData denyAllButtonGridData = new GridData();
denyAllButtonGridData.horizontalAlignment = GridData.FILL;
denyAllButtonGridData.grabExcessHorizontalSpace = false;
denyAllButtonGridData.verticalAlignment = GridData.BEGINNING;
+ denyAllButtonGridData.widthHint = Activator.getButtonWidth( this );
GridData grantAllButtonGridData = new GridData();
grantAllButtonGridData.horizontalAlignment = GridData.FILL;
grantAllButtonGridData.grabExcessHorizontalSpace = false;
grantAllButtonGridData.verticalAlignment = GridData.BEGINNING;
+ grantAllButtonGridData.widthHint = Activator.getButtonWidth( this );
GridData undoButtonGridData = new GridData();
undoButtonGridData.horizontalAlignment = GridData.FILL;
undoButtonGridData.grabExcessHorizontalSpace = false;
undoButtonGridData.verticalAlignment = GridData.BEGINNING;
+ undoButtonGridData.widthHint = Activator.getButtonWidth( this );
GridData redoButtonGridData = new GridData();
redoButtonGridData.horizontalAlignment = GridData.FILL;
redoButtonGridData.grabExcessHorizontalSpace = false;
redoButtonGridData.verticalAlignment = GridData.BEGINNING;
+ redoButtonGridData.widthHint = Activator.getButtonWidth( this );
GridLayout gridLayout = new GridLayout();
gridLayout.marginWidth = 0;
@@ -325,7 +363,7 @@
buttonComposite.setLayout( gridLayout );
grantAllButton = new Button( buttonComposite, SWT.NONE );
- grantAllButton.setText( "Grant All" );
+ grantAllButton.setText( Messages.getString("ACIItemGrantsAndDenialsComposite.grantAll.button") ); //$NON-NLS-1$
grantAllButton.setLayoutData( grantAllButtonGridData );
grantAllButton.addSelectionListener( new SelectionAdapter()
{
@@ -344,7 +382,7 @@
} );
denyAllButton = new Button( buttonComposite, SWT.NONE );
- denyAllButton.setText( "Deny All" );
+ denyAllButton.setText( Messages.getString("ACIItemGrantsAndDenialsComposite.denyAll.button") ); //$NON-NLS-1$
denyAllButton.setLayoutData( denyAllButtonGridData );
denyAllButton.addSelectionListener( new SelectionAdapter()
{
@@ -355,7 +393,7 @@
{
for ( GrantAndDenialWrapper grantAndDenialWrapper : grantAndDenialCategory.grantAndDenialWrappers )
{
- grantAndDenialWrapper.activeGrantAndDenial = grantAndDenialWrapper.deny;
+ grantAndDenialWrapper.activeGrantAndDenial = grantAndDenialWrapper.denial;
}
}
treeViewer.refresh();
@@ -363,7 +401,7 @@
} );
deselectAllButton = new Button( buttonComposite, SWT.NONE );
- deselectAllButton.setText( "Deselect All" );
+ deselectAllButton.setText( Messages.getString("ACIItemGrantsAndDenialsComposite.deselectAll.button") ); //$NON-NLS-1$
deselectAllButton.setLayoutData( deselectAllButtonGridData );
deselectAllButton.addSelectionListener( new SelectionAdapter()
{
@@ -382,7 +420,7 @@
} );
undoButton = new Button( buttonComposite, SWT.NONE );
- undoButton.setText( "Undo" );
+ undoButton.setText( Messages.getString("ACIItemGrantsAndDenialsComposite.undo.button") ); //$NON-NLS-1$
undoButton.setLayoutData( undoButtonGridData );
undoButton.addSelectionListener( new SelectionAdapter()
{
@@ -395,7 +433,7 @@
undoButton.setEnabled( false );
redoButton = new Button( buttonComposite, SWT.NONE );
- redoButton.setText( "Redo" );
+ redoButton.setText( Messages.getString("ACIItemGrantsAndDenialsComposite.redo.button") ); //$NON-NLS-1$
redoButton.setLayoutData( redoButtonGridData );
redoButton.addSelectionListener( new SelectionAdapter()
{
@@ -409,13 +447,19 @@
}
+ /**
+ * The ICellModifier user for this tree viewer.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
private class GrantsAndDenialsCellModifier implements ICellModifier
{
-
+ /**
+ * Only GrantAndDenialWrappers and the STATE colum is modifyable
+ */
public boolean canModify( Object element, String property )
{
- //System.out.println("canModify() " + element + " " + property);
-
if ( element instanceof GrantAndDenialWrapper )
{
return property.equals( STATE );
@@ -424,11 +468,11 @@
return false;
}
-
+ /**
+ * The used CheckboxCellEditor accepts only Booleans.
+ */
public Object getValue( Object element, String property )
{
- //System.out.println("getValue() " + element + " " + property);
-
if ( element instanceof GrantAndDenialWrapper )
{
if ( property.equals( STATE ) )
@@ -440,7 +484,9 @@
return null;
}
-
+ /**
+ * Performs the tree-state transtion.
+ */
public void modify( Object element, String property, Object value )
{
if ( element != null && element instanceof Item )
@@ -448,8 +494,6 @@
element = ( ( Item ) element ).getData();
}
- //System.out.println("modify() " + element + " " + property + " " + value);
-
if ( element instanceof GrantAndDenialWrapper )
{
GrantAndDenialWrapper grantAndDenialWrapper = ( GrantAndDenialWrapper ) element;
@@ -463,16 +507,13 @@
}
else if ( grantAndDenialWrapper.activeGrantAndDenial == grantAndDenialWrapper.grant )
{
- grantAndDenialWrapper.activeGrantAndDenial = grantAndDenialWrapper.deny;
+ grantAndDenialWrapper.activeGrantAndDenial = grantAndDenialWrapper.denial;
}
- else if ( grantAndDenialWrapper.activeGrantAndDenial == grantAndDenialWrapper.deny )
+ else if ( grantAndDenialWrapper.activeGrantAndDenial == grantAndDenialWrapper.denial )
{
grantAndDenialWrapper.activeGrantAndDenial = null;
}
}
-
- //System.out.println("modify() " + property + " " + value + " = " + i.state);
-
}
treeViewer.refresh();
@@ -480,9 +521,18 @@
}
+ /**
+ * The content provider used for this tree viewer.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
private class GrantsAndDenialsContentProvider extends ArrayContentProvider implements ITreeContentProvider
{
+ /**
+ * Only GrantAndDenialCategories have children.
+ */
public Object[] getChildren( Object parentElement )
{
if ( parentElement instanceof GrantAndDenialCategory )
@@ -495,12 +545,17 @@
}
+ /**
+ * Not used
+ */
public Object getParent( Object element )
{
return null;
}
-
+ /**
+ * Only GrantAndDenialCategories have children.
+ */
public boolean hasChildren( Object element )
{
return ( element instanceof GrantAndDenialCategory );
@@ -508,9 +563,18 @@
}
+ /**
+ * The label provider used for this tree viewer.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
private class GrantsAndDenialsLabelProvider extends LabelProvider implements ITableLabelProvider
{
+ /**
+ * The STATE is displayed as image.
+ */
public Image getColumnImage( Object element, int columnIndex )
{
if ( element instanceof GrantAndDenialWrapper )
@@ -523,15 +587,15 @@
case 1:
if ( grantAndDenialWrapper.activeGrantAndDenial == null )
{
- return Activator.getDefault().getImage( "icons/checkbox_unchecked.gif" );
+ return Activator.getDefault().getImage( Messages.getString("ACIItemGrantsAndDenialsComposite.unspecified.icon") ); //$NON-NLS-1$
}
else if ( grantAndDenialWrapper.activeGrantAndDenial == grantAndDenialWrapper.grant )
{
- return Activator.getDefault().getImage( "icons/checkbox_grant.gif" );
+ return Activator.getDefault().getImage( Messages.getString("ACIItemGrantsAndDenialsComposite.grant.icon") ); //$NON-NLS-1$
}
- else if ( grantAndDenialWrapper.activeGrantAndDenial == grantAndDenialWrapper.deny )
+ else if ( grantAndDenialWrapper.activeGrantAndDenial == grantAndDenialWrapper.denial )
{
- return Activator.getDefault().getImage( "icons/checkbox_deny.gif" );
+ return Activator.getDefault().getImage( Messages.getString("ACIItemGrantsAndDenialsComposite.deny.icon") ); //$NON-NLS-1$
}
case 2:
return null;
@@ -541,6 +605,9 @@
}
+ /**
+ * Returns GrantAndDenialCategory name or the MicroOperation name.
+ */
public String getColumnText( Object element, int columnIndex )
{
if ( element instanceof GrantAndDenialCategory )
@@ -560,7 +627,7 @@
}
}
- return "";
+ return ""; //$NON-NLS-1$
}
}
@@ -569,7 +636,7 @@
/**
* Sets the grants and denials.
*
- * @param set
+ * @param grantsAndDenials
*/
public void setGrantsAndDenials( Collection<GrantAndDenial> grantsAndDenials )
{
@@ -583,9 +650,9 @@
{
grantAndDenialWrapper.activeGrantAndDenial = grantAndDenialWrapper.grant;
}
- else if ( grantAndDenialWrapper.deny == grantAndDenial )
+ else if ( grantAndDenialWrapper.denial == grantAndDenial )
{
- grantAndDenialWrapper.activeGrantAndDenial = grantAndDenialWrapper.deny;
+ grantAndDenialWrapper.activeGrantAndDenial = grantAndDenialWrapper.denial;
}
}
}
@@ -620,6 +687,9 @@
}
+ /**
+ * Undos the last modification.
+ */
private void undo()
{
for ( GrantAndDenialCategory grantAndDenialCategory : grantAndDenialCategories )
@@ -638,7 +708,9 @@
}
}
-
+ /**
+ * Redos the last modification
+ */
private void redo()
{
for ( GrantAndDenialCategory grantAndDenialCategory : grantAndDenialCategories )
@@ -657,7 +729,9 @@
}
}
-
+ /**
+ * Saves the current state to the undo stack.
+ */
private void backup()
{
for ( GrantAndDenialCategory grantAndDenialCategory : grantAndDenialCategories )