You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by fe...@apache.org on 2007/11/05 15:28:02 UTC
svn commit: r592011 [1/6] - in
/directory/sandbox/felixk/studio-aciitemeditor: ./ META-INF/ src/ src/main/
src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/directory/
src/main/java/org/apache/directory/studio/ src/ma...
Author: felixk
Date: Mon Nov 5 06:27:47 2007
New Revision: 592011
URL: http://svn.apache.org/viewvc?rev=592011&view=rev
Log:
Initial studio maven-build
Added:
directory/sandbox/felixk/studio-aciitemeditor/ (with props)
directory/sandbox/felixk/studio-aciitemeditor/META-INF/
directory/sandbox/felixk/studio-aciitemeditor/META-INF/MANIFEST.MF (with props)
directory/sandbox/felixk/studio-aciitemeditor/plugin.properties (with props)
directory/sandbox/felixk/studio-aciitemeditor/plugin.xml (with props)
directory/sandbox/felixk/studio-aciitemeditor/pom.xml (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/
directory/sandbox/felixk/studio-aciitemeditor/src/main/
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIITemConstants.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIItemValueEditor.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIItemValueWithContext.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/Activator.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/ACIItemDialog.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/ItemPermissionDialog.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/Messages.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/MultiValuedDialog.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/UserPermissionDialog.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/package-info.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/model/
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/model/Messages.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/model/ProtectedItemWrapper.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/model/ProtectedItemWrapperFactory.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/model/UserClassWrapper.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/model/UserClassWrapperFactory.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/model/package-info.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/package-info.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/sourceeditor/
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/sourceeditor/ACICodeScanner.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/sourceeditor/ACIContentAssistProcessor.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/sourceeditor/ACIFormattingStrategy.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/sourceeditor/ACISourceViewerConfiguration.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/sourceeditor/ACITextAttributeProvider.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/sourceeditor/DialogContentAssistant.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/sourceeditor/package-info.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/AttributeTypeAndValueDialog.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/AttributeTypeAndValueValueEditor.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/AttributeTypeDialog.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/AttributeTypeValueEditor.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/ExclusionDialog.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/FilterValueEditor.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/MaxValueCountValueEditor.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/Messages.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/RestrictedByValueEditor.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeSpecificationDialog.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeValueEditor.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/package-info.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemGeneralComposite.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemGrantsAndDenialsComposite.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemItemPermissionsComposite.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemProtectedItemsComposite.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemSourceEditorComposite.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemTabFolderComposite.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemUserClassesComposite.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemUserPermissionsComposite.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemVisualEditorComposite.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/Messages.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/WidgetModifyEvent.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/WidgetModifyListener.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/package-info.java (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/org/
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/org/apache/
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/org/apache/directory/
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/org/apache/directory/studio/
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/org/apache/directory/studio/aciitemeditor/
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/org/apache/directory/studio/aciitemeditor/dialogs/
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/org/apache/directory/studio/aciitemeditor/dialogs/messages.properties (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/org/apache/directory/studio/aciitemeditor/model/
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/org/apache/directory/studio/aciitemeditor/model/messages.properties (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/org/apache/directory/studio/aciitemeditor/valueeditors/
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/org/apache/directory/studio/aciitemeditor/valueeditors/messages.properties (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/org/apache/directory/studio/aciitemeditor/widgets/
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/org/apache/directory/studio/aciitemeditor/widgets/messages.properties (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/resources/
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/resources/icons/
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/resources/icons/aciitemeditor.gif (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/resources/icons/attributetypeeditor.png (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/resources/icons/checkbox_checked.gif (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/resources/icons/checkbox_deny.gif (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/resources/icons/checkbox_grant.gif (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/resources/icons/checkbox_unchecked.gif (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/resources/icons/error.gif (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/resources/icons/filtereditor.gif (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/resources/icons/subtreeeditor.png (with props)
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/resources/templates/
directory/sandbox/felixk/studio-aciitemeditor/src/main/resources/resources/templates/templates.xml (with props)
Propchange: directory/sandbox/felixk/studio-aciitemeditor/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov 5 06:27:47 2007
@@ -0,0 +1,2 @@
+target
+.settings
Added: directory/sandbox/felixk/studio-aciitemeditor/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-aciitemeditor/META-INF/MANIFEST.MF?rev=592011&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-aciitemeditor/META-INF/MANIFEST.MF (added)
+++ directory/sandbox/felixk/studio-aciitemeditor/META-INF/MANIFEST.MF Mon Nov 5 06:27:47 2007
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache Directory Studio ACI Item Editor
+Bundle-SymbolicName: org.apache.directory.studio.aciitemeditor;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.apache.directory.studio.aciitemeditor.Activator
+Bundle-Vendor: Apache Software Foundation
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.jface.text,
+ org.eclipse.core.resources,
+ org.eclipse.ui.editors,
+ org.eclipse.ui.workbench.texteditor,
+ org.apache.directory.studio.jars,
+ org.apache.directory.studio.connection.core,
+ org.apache.directory.studio.connection.ui,
+ org.apache.directory.studio.ldapbrowser.core,
+ org.apache.directory.studio.valueeditors,
+ org.apache.directory.studio.ldapbrowser.common
+Eclipse-LazyStart: true
+Bundle-ClassPath: .
Propchange: directory/sandbox/felixk/studio-aciitemeditor/META-INF/MANIFEST.MF
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-aciitemeditor/plugin.properties
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-aciitemeditor/plugin.properties?rev=592011&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-aciitemeditor/plugin.properties (added)
+++ directory/sandbox/felixk/studio-aciitemeditor/plugin.properties Mon Nov 5 06:27:47 2007
@@ -0,0 +1,19 @@
+# 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=Apache Directory Studio ACI Item Editor
+project.version=1.0.0
+project.id=org.apache.directory.studio.aciitemeditor
Propchange: directory/sandbox/felixk/studio-aciitemeditor/plugin.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-aciitemeditor/plugin.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-aciitemeditor/plugin.xml?rev=592011&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-aciitemeditor/plugin.xml (added)
+++ directory/sandbox/felixk/studio-aciitemeditor/plugin.xml Mon Nov 5 06:27:47 2007
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<!--
+ 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.
+-->
+<plugin>
+
+ <extension
+ point="org.apache.directory.studio.valueeditors">
+ <valueEditor
+ class="org.apache.directory.studio.aciitemeditor.ACIItemValueEditor"
+ icon="resources/icons/aciitemeditor.gif"
+ name="ACI Item Editor">
+ <syntax syntaxOID="1.3.6.1.4.1.1466.115.121.1.1"/>
+ </valueEditor>
+ <valueEditor
+ class="org.apache.directory.studio.aciitemeditor.valueeditors.SubtreeValueEditor"
+ icon="resources/icons/subtreeeditor.png"
+ name="Subtree Specification Editor">
+ <syntax syntaxOID="1.3.6.1.4.1.1466.115.121.1.45"/>
+ </valueEditor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.editors.templates">
+ <include file="resources/templates/templates.xml"/>
+ <contextType
+ class="org.eclipse.jface.text.templates.TemplateContextType"
+ id="org.apache.directory.studio.aciitemeditor.templates"
+ name="ACI Item"/>
+ </extension>
+
+</plugin>
Propchange: directory/sandbox/felixk/studio-aciitemeditor/plugin.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-aciitemeditor/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-aciitemeditor/pom.xml?rev=592011&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-aciitemeditor/pom.xml (added)
+++ directory/sandbox/felixk/studio-aciitemeditor/pom.xml Mon Nov 5 06:27:47 2007
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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.
+-->
+<!--
+ @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ @version $Id: pom.xml 353 2007-10-28 14:59:35Z felix $
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.directory.studio</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0.2-SNAPSHOT</version>
+ </parent>
+ <artifactId>${pom.groupId}.aciitemeditor</artifactId>
+ <name>Apache Directory Studio ACI Item Editor</name>
+ <packaging>jar</packaging>
+
+ <description></description>
+
+ <!-- Set path for local repository -->
+ <properties>
+ <local-repo>${project.basedir}/../local-repository</local-repo>
+ </properties>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>.</directory>
+ <includes>
+ <include>plugin.properties</include>
+ <include>plugin.xml</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ <addMavenDescriptor>false</addMavenDescriptor>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.directory.shared</groupId>
+ <artifactId>shared-ldap</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.jface</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.directory.studio</groupId>
+ <artifactId>${pom.groupId}.ldapbrowser.common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.directory.studio</groupId>
+ <artifactId>${pom.groupId}.valueeditors</artifactId>
+ </dependency>
+ </dependencies>
+</project>
Propchange: directory/sandbox/felixk/studio-aciitemeditor/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIITemConstants.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIITemConstants.java?rev=592011&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIITemConstants.java (added)
+++ directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIITemConstants.java Mon Nov 5 06:27:47 2007
@@ -0,0 +1,32 @@
+/*
+ * 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.studio.aciitemeditor;
+
+/**
+ * This interface is used to store all constants related to the ACI Item Editor Plugin
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ACIITemConstants
+{
+ /** The ID for ACI Item Template*/
+ public static final String ACI_ITEM_TEMPLATE_ID = "org.apache.directory.studio.aciitemeditor.templates"; //$NON-NLS-1$
+}
Propchange: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIITemConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIItemValueEditor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIItemValueEditor.java?rev=592011&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIItemValueEditor.java (added)
+++ directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIItemValueEditor.java Mon Nov 5 06:27:47 2007
@@ -0,0 +1,136 @@
+/*
+ * 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.studio.aciitemeditor;
+
+
+import org.apache.directory.studio.aciitemeditor.dialogs.ACIItemDialog;
+import org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.core.model.IValue;
+import org.apache.directory.studio.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
+{
+
+ /**
+ * The Constructor.
+ */
+ public ACIItemValueEditor()
+ {
+ super();
+ }
+
+
+ /**
+ * Opens the ACI item dialog.
+ *
+ * @param shell the shell
+ *
+ * @return true, if open dialog
+ */
+ public boolean openDialog( Shell shell )
+ {
+ Object value = getValue();
+ if ( value != null && value instanceof ACIItemValueWithContext )
+ {
+ ACIItemValueWithContext context = (ACIItemValueWithContext)value;
+
+ ACIItemDialog dialog = new ACIItemDialog( shell, context );
+ if ( dialog.open() == ACIItemDialog.OK && !"".equals( dialog.getACIItemValue() ) ) //$NON-NLS-1$
+ {
+ setValue( dialog.getACIItemValue() );
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * Returns a ACIItemValueContext with the connection
+ * and entry of the attribute hierarchy and an empty value if there
+ * are no values in attributeHierarchy.
+ *
+ * Returns a ACIItemValueContext with the connection
+ * and entry of the attribute hierarchy and a value if there is
+ * one value in attributeHierarchy.
+ *
+ * @param attributeHierarchy the attribute hierarchy
+ *
+ * @return the raw value
+ */
+ public Object getRawValue( AttributeHierarchy attributeHierarchy )
+ {
+ if ( attributeHierarchy == null )
+ {
+ return null;
+ }
+ else if ( attributeHierarchy.size() == 1 && attributeHierarchy.getAttribute().getValueSize() == 0 )
+ {
+ IEntry entry = attributeHierarchy.getAttribute().getEntry();
+ IBrowserConnection connection = entry.getBrowserConnection();
+ return new ACIItemValueWithContext( connection, entry, "" ); //$NON-NLS-1$
+ }
+ else if ( attributeHierarchy.size() == 1 && attributeHierarchy.getAttribute().getValueSize() == 1 )
+ {
+ IEntry entry = attributeHierarchy.getAttribute().getEntry();
+ IBrowserConnection connection = entry.getBrowserConnection();
+ String value = getDisplayValue( attributeHierarchy );
+ return new ACIItemValueWithContext( connection, entry, value );
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+
+ /**
+ * Returns a ACIItemValueContext with the connection,
+ * entry and string value of the given value.
+ *
+ * @param value the value
+ *
+ * @return the raw value
+ */
+ public Object getRawValue( IValue value )
+ {
+ Object o = super.getRawValue( value );
+ if ( o != null && o instanceof String )
+ {
+ IEntry entry = value.getAttribute().getEntry();
+ IBrowserConnection connection = entry.getBrowserConnection();
+ String v = (String) o;
+ return new ACIItemValueWithContext( connection, entry, v );
+ }
+
+ return null;
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIItemValueEditor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIItemValueWithContext.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIItemValueWithContext.java?rev=592011&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIItemValueWithContext.java (added)
+++ directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIItemValueWithContext.java Mon Nov 5 06:27:47 2007
@@ -0,0 +1,99 @@
+/*
+ * 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.studio.aciitemeditor;
+
+
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+
+
+/**
+ * The ACIItemValueContext is used to pass contextual
+ * information to the opened ACIItemDialog.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ACIItemValueWithContext
+{
+
+ /** The connection, used to browse the directory. */
+ private IBrowserConnection connection;
+
+ /** The entry. */
+ private IEntry entry;
+
+ /** The ACI item. */
+ private String aciItemValue;
+
+
+ /**
+ * Creates a new instance of ACIItemValueContext.
+ *
+ * @param aciItemValue the ACI item value
+ * @param connection the connection
+ * @param entry the entry
+ */
+ public ACIItemValueWithContext( IBrowserConnection connection, IEntry entry, String aciItemValue )
+ {
+ this.connection = connection;
+ this.entry = entry;
+ this.aciItemValue = aciItemValue;
+ }
+
+
+ /**
+ * Gets the aci item value.
+ *
+ * @return the aciItemValue
+ */
+ public String getACIItemValue()
+ {
+ return aciItemValue;
+ }
+
+
+ /**
+ * @return the connection
+ */
+ public IBrowserConnection getConnection()
+ {
+ return connection;
+ }
+
+
+ /**
+ * @return the entry
+ */
+ public IEntry getEntry()
+ {
+ return entry;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return aciItemValue == null ? "" : aciItemValue; //$NON-NLS-1$
+ }
+
+}
\ No newline at end of file
Propchange: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIItemValueWithContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/Activator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/Activator.java?rev=592011&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/Activator.java (added)
+++ directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/Activator.java Mon Nov 5 06:27:47 2007
@@ -0,0 +1,266 @@
+/*
+ * 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.studio.aciitemeditor;
+
+
+import java.io.IOException;
+
+import org.apache.directory.shared.ldap.aci.ACIItemParser;
+import org.apache.directory.studio.aciitemeditor.sourceeditor.ACICodeScanner;
+import org.apache.directory.studio.aciitemeditor.sourceeditor.ACITextAttributeProvider;
+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.jface.text.templates.GlobalTemplateVariables;
+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.editors.text.templates.ContributionContextTypeRegistry;
+import org.eclipse.ui.editors.text.templates.ContributionTemplateStore;
+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.studio.aciitemeditor"; //$NON-NLS-1$
+
+ /** The shared instance */
+ private static Activator plugin;
+
+ /** The shared ACI Item parser */
+ private ACIItemParser aciItemParser;
+
+ /** The shared ACI Code Scanner */
+ private ACICodeScanner aciCodeScanner;
+
+ /** The shared ACI TextAttribute Provider */
+ private ACITextAttributeProvider textAttributeProvider;
+
+ /** The template store */
+ private ContributionTemplateStore aciTemplateStore;
+
+ /** The context type registry */
+ private ContributionContextTypeRegistry aciTemplateContextTypeRegistry;
+
+
+ /**
+ * The constructor
+ */
+ public Activator()
+ {
+ plugin = this;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void start( BundleContext context ) throws Exception
+ {
+ super.start( context );
+
+ // ACI Template ContextType Registry initialization
+ if ( aciTemplateContextTypeRegistry == null )
+ {
+ aciTemplateContextTypeRegistry = new ContributionContextTypeRegistry();
+
+ aciTemplateContextTypeRegistry.addContextType( ACIITemConstants.ACI_ITEM_TEMPLATE_ID );
+ aciTemplateContextTypeRegistry.getContextType( ACIITemConstants.ACI_ITEM_TEMPLATE_ID ).addResolver(
+ new GlobalTemplateVariables.Cursor() );
+ }
+
+ // ACI Template Store initialization
+ if ( aciTemplateStore == null )
+ {
+ aciTemplateStore = new ContributionTemplateStore( getAciTemplateContextTypeRegistry(),
+ getPreferenceStore(), "templates" ); //$NON-NLS-1$
+ try
+ {
+ aciTemplateStore.load();
+ }
+ catch ( IOException e )
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void stop( BundleContext context ) throws Exception
+ {
+ plugin = null;
+ super.stop( context );
+ }
+
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault()
+ {
+ return plugin;
+ }
+
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor( String path )
+ {
+ return imageDescriptorFromPlugin( PLUGIN_ID, path );
+ }
+
+
+ /**
+ * Use this method to get SWT images. A ImageRegistry is used
+ * to manage the the path->Image mapping.
+ * <p>
+ * Note: Don't dispose the returned SWT Image. It is disposed
+ * automatically when the plugin is stopped.
+ *
+ * @param path the path
+ * @return The SWT Image or null
+ */
+ public Image getImage( String path )
+ {
+ Image image = getImageRegistry().get( path );
+ if ( image == null )
+ {
+ ImageDescriptor id = getImageDescriptor( path );
+ if ( id != null )
+ {
+ image = id.createImage();
+ getImageRegistry().put( path, image );
+ }
+ }
+ 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;
+ }
+
+
+ /**
+ * Returns the TextAttribute Provider
+ *
+ * @return
+ * the TextAttribute Provider
+ */
+ public ACITextAttributeProvider getTextAttributeProvider()
+ {
+ if ( textAttributeProvider == null )
+ {
+ textAttributeProvider = new ACITextAttributeProvider();
+ }
+ return textAttributeProvider;
+ }
+
+
+ /**
+ * Retuns the the Aci Code Scanner
+ *
+ * @return
+ * the the Aci Code Scanner
+ */
+ public ACICodeScanner getAciCodeScanner()
+ {
+ if ( aciCodeScanner == null )
+ {
+ aciCodeScanner = new ACICodeScanner( getTextAttributeProvider() );
+ }
+ return aciCodeScanner;
+ }
+
+
+ /**
+ * Gets the ACI Template ContextType Registry
+ *
+ * @return
+ * the ACI Template ContextType Registry
+ */
+ public ContributionContextTypeRegistry getAciTemplateContextTypeRegistry()
+ {
+ return aciTemplateContextTypeRegistry;
+ }
+
+
+ /**
+ * Gets the ACI Template Store
+ *
+ * @return
+ * the ACI Template Store
+ */
+ public ContributionTemplateStore getAciTemplateStore()
+ {
+ return aciTemplateStore;
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/Activator.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/ACIItemDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/ACIItemDialog.java?rev=592011&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/ACIItemDialog.java (added)
+++ directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/ACIItemDialog.java Mon Nov 5 06:27:47 2007
@@ -0,0 +1,201 @@
+/*
+ * 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.studio.aciitemeditor.dialogs;
+
+
+import java.text.ParseException;
+
+import org.apache.directory.studio.aciitemeditor.ACIItemValueWithContext;
+import org.apache.directory.studio.aciitemeditor.Activator;
+import org.apache.directory.studio.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.jface.dialogs.MessageDialog;
+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
+{
+
+ /** The context containing the initial value, passed by the constructor */
+ private ACIItemValueWithContext context;
+
+ /** 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 context the context
+ */
+ public ACIItemDialog( Shell parentShell, ACIItemValueWithContext context )
+ {
+ super( parentShell );
+ super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
+
+ assert context != null;
+ assert context.getACIItemValue() != null;
+ assert context.getConnection() != null;
+
+ this.context = context;
+
+ 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$
+ }
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * This implementation additionally adds the Format button.
+ */
+ protected Control createButtonBar( Composite parent )
+ {
+ Composite composite = ( Composite ) super.createButtonBar( parent );
+ super.createButton( composite, 987654321, Messages.getString( "ACIItemDialog.button.format" ), false ); //$NON-NLS-1$
+ super.createButton( composite, 876543210, Messages.getString( "ACIItemDialog.button.checkSyntax" ), false ); //$NON-NLS-1$
+ return composite;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * This implementation checks if the Format button was pressed.
+ */
+ protected void buttonPressed( int buttonId )
+ {
+ if ( buttonId == 987654321 )
+ {
+ tabFolderComposite.format();
+ }
+ if ( buttonId == 876543210 )
+ {
+ try
+ {
+ tabFolderComposite.getInput();
+ MessageDialog
+ .openInformation(
+ getShell(),
+ Messages.getString( "ACIItemDialog.syntaxOk.title" ), Messages.getString( "ACIItemDialog.syntaxOk.text" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ 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$
+ }
+ }
+
+ // call super implementation
+ super.buttonPressed( buttonId );
+ }
+
+
+ /**
+ * 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.
+ *
+ * @param parent the parent
+ *
+ * @return the control
+ */
+ 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 ) * 4 / 3;
+ gd.heightHint = convertVerticalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ) * 4 / 3;
+ composite.setLayoutData( gd );
+
+ tabFolderComposite = new ACIItemTabFolderComposite( composite, SWT.NONE );
+
+ // set initial value
+ if ( context != null )
+ {
+ tabFolderComposite.setContext( context );
+ tabFolderComposite.setInput( context.getACIItemValue() );
+ }
+
+ 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;
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/ACIItemDialog.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/ItemPermissionDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/ItemPermissionDialog.java?rev=592011&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/ItemPermissionDialog.java (added)
+++ directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/ItemPermissionDialog.java Mon Nov 5 06:27:47 2007
@@ -0,0 +1,208 @@
+/*
+ * 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.studio.aciitemeditor.dialogs;
+
+
+import java.util.Collection;
+
+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.apache.directory.studio.aciitemeditor.ACIItemValueWithContext;
+import org.apache.directory.studio.aciitemeditor.Activator;
+import org.apache.directory.studio.aciitemeditor.widgets.ACIItemGrantsAndDenialsComposite;
+import org.apache.directory.studio.aciitemeditor.widgets.ACIItemUserClassesComposite;
+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;
+import org.eclipse.swt.events.SelectionEvent;
+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.Shell;
+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
+{
+
+ /** The context */
+ private ACIItemValueWithContext context;
+
+ /** 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 initialItemPermission the initial item permission
+ * @param context the context
+ */
+ public ItemPermissionDialog( Shell parentShell, ItemPermission initialItemPermission,
+ ACIItemValueWithContext context )
+ {
+ super( parentShell );
+ super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
+ this.context = context;
+ this.initialItemPermission = initialItemPermission;
+ this.returnItemPermission = null;
+ }
+
+
+ /**
+ * Sets the dialog image and text.
+ *
+ * {@inheritDoc}
+ */
+ protected void configureShell( Shell shell )
+ {
+ super.configureShell( shell );
+ 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
+ {
+ int precedence = precedenceCheckbox.getSelection() ? precedenceSpinner.getSelection() : -1;
+ Collection<UserClass> userClasses = userClassesComposite.getUserClasses();
+ Collection<GrantAndDenial> grantsAndDenials = grantsAndDenialsComposite.getGrantsAndDenials();
+ returnItemPermission = new ItemPermission( precedence, grantsAndDenials, userClasses );
+ super.okPressed();
+ }
+ catch ( Exception e )
+ {
+ MessageDialog.openError( getShell(), Messages
+ .getString( "ItemPermissionDialog.error.invalidItemPermission" ), e.getMessage() ); //$NON-NLS-1$
+ }
+ }
+
+
+ /**
+ * Creates all the dialog content.
+ *
+ * @param parent the parent
+ *
+ * @return the control
+ */
+ 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 );
+ gd.heightHint = convertVerticalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ) * 4 / 3;
+ 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( Messages.getString( "ItemPermissionDialog.precedence.label" ) ); //$NON-NLS-1$
+ precedenceCheckbox.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ precedenceSpinner.setEnabled( precedenceCheckbox.getSelection() );
+ }
+ } );
+ precedenceSpinner = new Spinner( spinnerComposite, SWT.BORDER );
+ precedenceSpinner.setMinimum( 0 );
+ precedenceSpinner.setMaximum( 255 );
+ precedenceSpinner.setDigits( 0 );
+ precedenceSpinner.setIncrement( 1 );
+ precedenceSpinner.setPageIncrement( 10 );
+ precedenceSpinner.setSelection( 0 );
+ precedenceSpinner.setEnabled( false );
+ GridData precedenceGridData = new GridData();
+ precedenceGridData.grabExcessHorizontalSpace = true;
+ precedenceGridData.verticalAlignment = GridData.CENTER;
+ precedenceGridData.horizontalAlignment = GridData.BEGINNING;
+ precedenceGridData.widthHint = 3 * 12;
+ precedenceSpinner.setLayoutData( precedenceGridData );
+
+ // user classes
+ userClassesComposite = new ACIItemUserClassesComposite( composite, SWT.NONE );
+ userClassesComposite.setContext( context );
+
+ // grants and denial
+ grantsAndDenialsComposite = new ACIItemGrantsAndDenialsComposite( composite, SWT.NONE );
+
+ // set initial values
+ if ( initialItemPermission != null )
+ {
+ if ( initialItemPermission.getPrecedence() > -1 )
+ {
+ precedenceCheckbox.setSelection( true );
+ precedenceSpinner.setEnabled( true );
+ precedenceSpinner.setSelection( initialItemPermission.getPrecedence() );
+ }
+ 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;
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/ItemPermissionDialog.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/Messages.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/Messages.java?rev=592011&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/Messages.java (added)
+++ directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/Messages.java Mon Nov 5 06:27:47 2007
@@ -0,0 +1,50 @@
+/*
+ * 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.studio.aciitemeditor.dialogs;
+
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+public class Messages
+{
+ private static final String BUNDLE_NAME = "org.apache.directory.studio.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 + '!';
+ }
+ }
+}
Propchange: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/Messages.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/MultiValuedDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/MultiValuedDialog.java?rev=592011&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/MultiValuedDialog.java (added)
+++ directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/MultiValuedDialog.java Mon Nov 5 06:27:47 2007
@@ -0,0 +1,388 @@
+/*
+ * 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.studio.aciitemeditor.dialogs;
+
+
+import java.util.List;
+
+import org.apache.directory.studio.aciitemeditor.ACIItemValueWithContext;
+import org.apache.directory.studio.aciitemeditor.Activator;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.apache.directory.studio.ldapbrowser.core.model.IValue;
+import org.apache.directory.studio.ldapbrowser.core.model.impl.Attribute;
+import org.apache.directory.studio.ldapbrowser.core.model.impl.Value;
+import org.apache.directory.studio.valueeditors.AbstractDialogStringValueEditor;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+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.Shell;
+import org.eclipse.swt.widgets.Table;
+
+
+/**
+ * Dialog to edit user classes or protected items with multiple values.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class MultiValuedDialog extends Dialog
+{
+ /** The dialog title */
+ private String displayName;
+
+ /** The value editor */
+ private AbstractDialogStringValueEditor valueEditor;
+
+ /** The values, may be empty. */
+ private List<String> values;
+
+ /** The context */
+ private ACIItemValueWithContext context;
+
+ /** The inner composite for all the content */
+ private Composite composite = null;
+
+ /** The table control for the table viewer */
+ private Table table = null;
+
+ /** The table viewer containing all user classes */
+ private TableViewer tableViewer = null;
+
+ /** The composite containing the buttons */
+ private Composite buttonComposite = null;
+
+ /** The add button */
+ private Button addButton = null;
+
+ /** The edit button */
+ private Button editButton = null;
+
+ /** The delete button */
+ private Button deleteButton = null;
+
+
+ /**
+ * Creates a new instance of MultiValuedDialog.
+ *
+ * @param parentShell the shell
+ * @param displayName the display name of the edited element
+ * @param values a modifyable list of values
+ * @param context the context
+ * @param valueEditor the detail value editor
+ */
+ public MultiValuedDialog( Shell parentShell, String displayName, List<String> values,
+ ACIItemValueWithContext context, AbstractDialogStringValueEditor valueEditor )
+ {
+ super( parentShell );
+ super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
+
+ this.displayName = displayName;
+ this.values = values;
+ this.context = context;
+ this.valueEditor = valueEditor;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * Sets the dialog title.
+ */
+ protected void configureShell( Shell shell )
+ {
+ super.configureShell( shell );
+ shell.setText( Messages.getString("MultiValuedDialog.dialog.titlePrefix") + displayName ); //$NON-NLS-1$
+ shell.setImage( Activator.getDefault().getImage( Messages.getString("MultiValuedDialog.dialog.icon") ) ); //$NON-NLS-1$
+ }
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * Creates only a OK button.
+ */
+ protected void createButtonsForButtonBar( Composite parent )
+ {
+ createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ protected Control createDialogArea( Composite parent )
+ {
+ // create composite
+ composite = ( Composite ) super.createDialogArea( parent );
+ GridData gd = new GridData( GridData.FILL_BOTH );
+ gd.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH );
+ gd.heightHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2 );
+ composite.setLayoutData( gd );
+ GridLayout layout = ( GridLayout ) composite.getLayout();
+ layout.makeColumnsEqualWidth = false;
+ layout.numColumns = 2;
+
+ createTable();
+
+ createButtonComposite();
+
+ applyDialogFont( composite );
+ return composite;
+ }
+
+
+ /**
+ * This method initializes table and table viewer
+ */
+ private void createTable()
+ {
+ GridData tableGridData = new GridData( GridData.FILL_BOTH );
+ tableGridData.grabExcessHorizontalSpace = true;
+ tableGridData.verticalAlignment = GridData.FILL;
+ tableGridData.horizontalAlignment = GridData.FILL;
+ //tableGridData.heightHint = 100;
+
+ table = new Table( composite, SWT.BORDER );
+ table.setHeaderVisible( false );
+ table.setLayoutData( tableGridData );
+ table.setLinesVisible( false );
+ tableViewer = new TableViewer( table );
+ tableViewer.setContentProvider( new ArrayContentProvider() );
+ tableViewer.setLabelProvider( new LabelProvider() );
+ tableViewer.setInput( values );
+
+ tableViewer.addSelectionChangedListener( new ISelectionChangedListener()
+ {
+ public void selectionChanged( SelectionChangedEvent event )
+ {
+ valueSelected();
+ }
+ } );
+
+ tableViewer.addDoubleClickListener( new IDoubleClickListener()
+ {
+ public void doubleClick( DoubleClickEvent event )
+ {
+ editValue();
+ }
+ } );
+ }
+
+
+ /**
+ * This method initializes buttons
+ */
+ private void createButtonComposite()
+ {
+ GridData deleteButtonGridData = new GridData();
+ deleteButtonGridData.horizontalAlignment = GridData.FILL;
+ deleteButtonGridData.grabExcessHorizontalSpace = false;
+ deleteButtonGridData.verticalAlignment = GridData.BEGINNING;
+ deleteButtonGridData.widthHint = Activator.getButtonWidth( composite );
+
+ GridData editButtonGridData = new GridData();
+ editButtonGridData.horizontalAlignment = GridData.FILL;
+ editButtonGridData.grabExcessHorizontalSpace = false;
+ editButtonGridData.verticalAlignment = GridData.BEGINNING;
+ editButtonGridData.widthHint = Activator.getButtonWidth( composite );
+
+ GridData addButtonGridData = new GridData();
+ addButtonGridData.horizontalAlignment = GridData.FILL;
+ addButtonGridData.grabExcessHorizontalSpace = false;
+ addButtonGridData.verticalAlignment = GridData.BEGINNING;
+ addButtonGridData.widthHint = Activator.getButtonWidth( composite );
+
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.CENTER;
+ gridData.grabExcessHorizontalSpace = false;
+ gridData.grabExcessVerticalSpace = false;
+ gridData.verticalAlignment = GridData.FILL;
+
+ buttonComposite = new Composite( composite, SWT.NONE );
+ buttonComposite.setLayoutData( gridData );
+ buttonComposite.setLayout( gridLayout );
+
+ addButton = new Button( buttonComposite, SWT.NONE );
+ addButton.setText( Messages.getString( "MultiValuedDialog.button.add" ) ); //$NON-NLS-1$
+ addButton.setLayoutData( addButtonGridData );
+ addButton.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ addValue();
+ }
+ } );
+
+ editButton = new Button( buttonComposite, SWT.NONE );
+ editButton.setText( Messages.getString( "MultiValuedDialog.button.edit" ) ); //$NON-NLS-1$
+ editButton.setLayoutData( editButtonGridData );
+ editButton.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ editValue();
+ }
+ } );
+ editButton.setEnabled( false );
+
+ deleteButton = new Button( buttonComposite, SWT.NONE );
+ deleteButton.setText( Messages.getString( "MultiValuedDialog.button.delete" ) ); //$NON-NLS-1$
+ deleteButton.setLayoutData( deleteButtonGridData );
+ deleteButton.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ deleteValue();
+ }
+ } );
+ deleteButton.setEnabled( false );
+
+ }
+
+
+ /**
+ * Opens the editor and adds the new value to the list.
+ */
+ private void addValue()
+ {
+ IAttribute attribute = new Attribute( context.getEntry(), "" ); //$NON-NLS-1$
+ IValue value = new Value( attribute, "" ); //$NON-NLS-1$
+ Object oldRawValue = valueEditor.getRawValue( value ); //$NON-NLS-1$
+
+ CellEditor cellEditor = valueEditor.getCellEditor();
+ cellEditor.setValue( oldRawValue );
+ cellEditor.activate();
+ Object newRawValue = cellEditor.getValue();
+
+ if ( newRawValue != null )
+ {
+ String newValue = ( String ) valueEditor.getStringOrBinaryValue( newRawValue );
+
+ values.add( newValue );
+ tableViewer.refresh();
+ }
+ }
+
+
+ /**
+ * Opens the editor with the currently selected
+ * value and puts the modified value into the list.
+ */
+ private void editValue()
+ {
+ String oldValue = getSelectedValue();
+ if ( oldValue != null )
+ {
+ IAttribute attribute = new Attribute( context.getEntry(), "" ); //$NON-NLS-1$
+ IValue value = new Value( attribute, oldValue ); //$NON-NLS-1$
+ Object oldRawValue = valueEditor.getRawValue( value ); //$NON-NLS-1$
+
+ CellEditor cellEditor = valueEditor.getCellEditor();
+ cellEditor.setValue( oldRawValue );
+ cellEditor.activate();
+ Object newRawValue = cellEditor.getValue();
+
+ if ( newRawValue != null )
+ {
+ String newValue = ( String ) valueEditor.getStringOrBinaryValue( newRawValue );
+
+ values.remove( oldValue );
+ values.add( newValue );
+ tableViewer.refresh();
+ }
+ }
+ }
+
+
+ /**
+ * Deletes the currently selected value from list.
+ */
+ private void deleteValue()
+ {
+ String value = getSelectedValue();
+ if ( value != null )
+ {
+ values.remove( value );
+ tableViewer.refresh();
+ }
+ }
+
+
+ /**
+ * Called when value is selected in table viewer.
+ * Updates the enabled/disabled state of the buttons.
+ */
+ private void valueSelected()
+ {
+ String value = getSelectedValue();
+
+ if ( value == null )
+ {
+ editButton.setEnabled( false );
+ deleteButton.setEnabled( false );
+ }
+ else
+ {
+ editButton.setEnabled( true );
+ deleteButton.setEnabled( true );
+ }
+ }
+
+
+ /**
+ * @return the value that is selected in the table viewer, or null.
+ */
+ private String getSelectedValue()
+ {
+ String value = null;
+
+ IStructuredSelection selection = ( IStructuredSelection ) tableViewer.getSelection();
+ if ( !selection.isEmpty() )
+ {
+ Object element = selection.getFirstElement();
+ if ( element instanceof String )
+ {
+ value = ( String ) element;
+ }
+ }
+
+ return value;
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/MultiValuedDialog.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/UserPermissionDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/UserPermissionDialog.java?rev=592011&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/UserPermissionDialog.java (added)
+++ directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/UserPermissionDialog.java Mon Nov 5 06:27:47 2007
@@ -0,0 +1,202 @@
+/*
+ * 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.studio.aciitemeditor.dialogs;
+
+
+import java.util.Collection;
+
+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.apache.directory.studio.aciitemeditor.ACIItemValueWithContext;
+import org.apache.directory.studio.aciitemeditor.Activator;
+import org.apache.directory.studio.aciitemeditor.widgets.ACIItemGrantsAndDenialsComposite;
+import org.apache.directory.studio.aciitemeditor.widgets.ACIItemProtectedItemsComposite;
+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;
+import org.eclipse.swt.events.SelectionEvent;
+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.Shell;
+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
+{
+
+ /** The context */
+ private ACIItemValueWithContext context;
+
+ /** 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 initialUserPermission the initial user permission
+ * @param context the context
+ */
+ public UserPermissionDialog( Shell parentShell, UserPermission initialUserPermission, ACIItemValueWithContext context )
+ {
+ super( parentShell );
+ super.setShellStyle( super.getShellStyle() | SWT.RESIZE );
+ this.initialUserPermission = initialUserPermission;
+ this.context = context;
+ this.returnUserPermission = null;
+ }
+
+
+ /**
+ * Sets the dialog image and text.
+ *
+ * {@inheritDoc}
+ */
+ protected void configureShell( Shell shell )
+ {
+ super.configureShell( shell );
+ 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
+ {
+ int precedence = precedenceCheckbox.getSelection() ? precedenceSpinner.getSelection() : -1;
+ Collection<ProtectedItem> protectedItems = protectedItemsComposite.getProtectedItems();
+ Collection<GrantAndDenial> grantsAndDenials = grantsAndDenialsComposite.getGrantsAndDenials();
+ returnUserPermission = new UserPermission( precedence, grantsAndDenials, protectedItems );
+ super.okPressed();
+ }
+ catch ( Exception e )
+ {
+ MessageDialog.openError( getShell(), Messages.getString("UserPermissionDialog.error.invalidUserPermission"), e.getMessage() ); //$NON-NLS-1$
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ 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 );
+ gd.heightHint = convertVerticalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ) * 4 / 3;
+ 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( Messages.getString("UserPermissionDialog.precedence.label") ); //$NON-NLS-1$
+ precedenceCheckbox.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ precedenceSpinner.setEnabled( precedenceCheckbox.getSelection() );
+ }
+ } );
+ precedenceSpinner = new Spinner( spinnerComposite, SWT.BORDER );
+ precedenceSpinner.setMinimum( 0 );
+ precedenceSpinner.setMaximum( 255 );
+ precedenceSpinner.setDigits( 0 );
+ precedenceSpinner.setIncrement( 1 );
+ precedenceSpinner.setPageIncrement( 10 );
+ precedenceSpinner.setSelection( 0 );
+ precedenceSpinner.setEnabled( false );
+ GridData precedenceGridData = new GridData();
+ precedenceGridData.grabExcessHorizontalSpace = true;
+ precedenceGridData.verticalAlignment = GridData.CENTER;
+ precedenceGridData.horizontalAlignment = GridData.BEGINNING;
+ precedenceGridData.widthHint = 3 * 12;
+ precedenceSpinner.setLayoutData( precedenceGridData );
+
+ // protected items
+ protectedItemsComposite = new ACIItemProtectedItemsComposite( composite, SWT.NONE );
+ protectedItemsComposite.setContext( context );
+
+ // grants and denials
+ grantsAndDenialsComposite = new ACIItemGrantsAndDenialsComposite( composite, SWT.NONE );
+
+ // set initial values
+ if ( initialUserPermission != null )
+ {
+ if ( initialUserPermission.getPrecedence() > -1 )
+ {
+ precedenceCheckbox.setSelection( true );
+ precedenceSpinner.setEnabled( true );
+ precedenceSpinner.setSelection( initialUserPermission.getPrecedence() );
+ }
+ protectedItemsComposite.setProtectedItems( initialUserPermission.getProtectedItems() );
+ grantsAndDenialsComposite.setGrantsAndDenials( initialUserPermission.getGrantsAndDenials() );
+ }
+
+ applyDialogFont( composite );
+ return composite;
+ }
+
+
+ /**
+ * Returns the user permission. Returns null if Cancel button was pressed.
+ *
+ * @return the composed user permission or null
+ */
+ public UserPermission getUserPermission()
+ {
+ return returnUserPermission;
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/UserPermissionDialog.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/package-info.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/package-info.java?rev=592011&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/package-info.java (added)
+++ directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/package-info.java Mon Nov 5 06:27:47 2007
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ *
+ */
+/**
+ * Contains the dialogs of the ACI item editor.
+ */
+package org.apache.directory.studio.aciitemeditor.dialogs;
\ No newline at end of file
Propchange: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/model/Messages.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/model/Messages.java?rev=592011&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/model/Messages.java (added)
+++ directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/model/Messages.java Mon Nov 5 06:27:47 2007
@@ -0,0 +1,50 @@
+/*
+ * 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.studio.aciitemeditor.model;
+
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+public class Messages
+{
+ private static final String BUNDLE_NAME = "org.apache.directory.studio.aciitemeditor.model.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 + '!';
+ }
+ }
+}
Propchange: directory/sandbox/felixk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/model/Messages.java
------------------------------------------------------------------------------
svn:eol-style = native