Author: pamarcelot Date: Thu Jul 8 15:01:13 2010 New Revision: 961793 URL: http://svn.apache.org/viewvc?rev=961793&view=rev Log: Created a new 'LDAP Servers' plugin. Added: directory/studio/trunk/ldapservers/ directory/studio/trunk/ldapservers/plugin.properties directory/studio/trunk/ldapservers/plugin.xml directory/studio/trunk/ldapservers/pom.xml directory/studio/trunk/ldapservers/resources/ directory/studio/trunk/ldapservers/resources/org/ directory/studio/trunk/ldapservers/resources/org/apache/ directory/studio/trunk/ldapservers/resources/org/apache/directory/ directory/studio/trunk/ldapservers/resources/org/apache/directory/studio/ directory/studio/trunk/ldapservers/resources/org/apache/directory/studio/ldapservers/ directory/studio/trunk/ldapservers/src/ directory/studio/trunk/ldapservers/src/main/ directory/studio/trunk/ldapservers/src/main/java/ directory/studio/trunk/ldapservers/src/main/java/org/ directory/studio/trunk/ldapservers/src/main/java/org/apache/ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPlugin.java directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPluginConstants.java directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/Messages.java directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/messages.properties directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/messages_de.properties directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/messages_fr.properties directory/studio/trunk/ldapservers/src/main/resources/ directory/studio/trunk/ldapservers/src/test/ directory/studio/trunk/ldapservers/src/test/java/ directory/studio/trunk/ldapservers/src/test/java/org/ directory/studio/trunk/ldapservers/src/test/java/org/apache/ directory/studio/trunk/ldapservers/src/test/java/org/apache/directory/ directory/studio/trunk/ldapservers/src/test/java/org/apache/directory/studio/ directory/studio/trunk/ldapservers/src/test/java/org/apache/directory/studio/ldapservers/ directory/studio/trunk/ldapservers/src/test/resources/ directory/studio/trunk/ldapservers/src/test/resources/org/ directory/studio/trunk/ldapservers/src/test/resources/org/apache/ directory/studio/trunk/ldapservers/src/test/resources/org/apache/directory/ directory/studio/trunk/ldapservers/src/test/resources/org/apache/directory/studio/ directory/studio/trunk/ldapservers/src/test/resources/org/apache/directory/studio/ldapservers/ Added: directory/studio/trunk/ldapservers/plugin.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/plugin.properties?rev=961793&view=auto ============================================================================== --- directory/studio/trunk/ldapservers/plugin.properties (added) +++ directory/studio/trunk/ldapservers/plugin.properties Thu Jul 8 15:01:13 2010 @@ -0,0 +1,18 @@ +# 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_id=org.apache.directory.studio.ldapservers \ No newline at end of file Added: directory/studio/trunk/ldapservers/plugin.xml URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/plugin.xml?rev=961793&view=auto ============================================================================== --- directory/studio/trunk/ldapservers/plugin.xml (added) +++ directory/studio/trunk/ldapservers/plugin.xml Thu Jul 8 15:01:13 2010 @@ -0,0 +1,4 @@ + + + + Added: directory/studio/trunk/ldapservers/pom.xml URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/pom.xml?rev=961793&view=auto ============================================================================== --- directory/studio/trunk/ldapservers/pom.xml (added) +++ directory/studio/trunk/ldapservers/pom.xml Thu Jul 8 15:01:13 2010 @@ -0,0 +1,249 @@ + + + + + 4.0.0 + + org.apache.directory.studio + parent + 2.0.0-SNAPSHOT + + + ldapservers + Apache Directory Studio LDAP Servers + jar + + + + + + + . + + plugin*.properties + plugin.xml + + + + resources + resources + + + src/main/java + + **/*.properties + + + + + + + org.apache.maven.plugins + maven-eclipse-plugin + + false + true + + org.eclipse.jdt.core.javabuilder + org.eclipse.pde.ManifestBuilder + org.eclipse.pde.SchemaBuilder + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + org.eclipse.jem.beaninfo.BeanInfoNature + + + org.eclipse.jdt.launching.JRE_CONTAINER + org.eclipse.pde.core.requiredPlugins + + + + + org.apache.directory.studio + studio-maven-plugin + + false + true + + + + + prepare-jar-package + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + META-INF/MANIFEST.MF + false + + + + + + org.apache.felix + maven-bundle-plugin + true + + META-INF + + ${groupId}.${artifactId};singleton:=true + plugin + true + org.apache.directory.studio.ldapservers.LdapServersPlugin + org.eclipse.core.runtime, + org.eclipse.ui, + org.eclipse.jface.text, + org.apache.directory.studio.jars + + org.apache.directory.studio.* + ! + ! + + + + + generate-manifest + process-classes + + manifest + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + + + + + org.apache.directory.studio + jars + provided + + + + + org.eclipse.core + commands + provided + + + org.eclipse + osgi + provided + + + org.eclipse.core + jobs + provided + + + org.eclipse.equinox + preferences + provided + + + org.eclipse.equinox + common + provided + + + org.eclipse.core + runtime + provided + + + org.eclipse.core + expressions + provided + + + org.eclipse.equinox + registry + provided + + + org.eclipse + jface + provided + + + org.eclipse.jface + text + provided + + + org.eclipse + text + provided + + + org.eclipse.ui + editors + provided + + + org.eclipse.ui + ide + provided + + + org.eclipse.ui + forms + provided + + + org.eclipse.ui + views + provided + + + org.eclipse.ui + workbench + provided + + + org.eclipse.ui.workbench + texteditor + provided + + + org.eclipse.swt.gtk.linux + x86 + provided + + + + \ No newline at end of file Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPlugin.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPlugin.java?rev=961793&view=auto ============================================================================== --- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPlugin.java (added) +++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPlugin.java Thu Jul 8 15:01:13 2010 @@ -0,0 +1,167 @@ +/* + * 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.ldapservers; + + +import java.io.IOException; +import java.net.URL; +import java.util.PropertyResourceBundle; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + + +/** + * The activator class controls the plug-in life cycle + */ +public class LdapServersPlugin extends AbstractUIPlugin +{ + /** The shared plugin instance. */ + private static LdapServersPlugin plugin; + + /** The plugin properties */ + private PropertyResourceBundle properties; + + + /** + * The constructor + */ + public LdapServersPlugin() + { + plugin = this; + } + + + /** + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start( BundleContext context ) throws Exception + { + super.start( context ); + } + + + /** + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop( BundleContext context ) throws Exception + { + plugin = null; + super.stop( context ); + } + + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static LdapServersPlugin getDefault() + { + return plugin; + } + + + /** + * Use this method to get SWT images. Use the IMG_ constants from + * BrowserWidgetsConstants for the key. + * + * @param key + * The key (relative path to the image in filesystem) + * @return The image descriptor or null + */ + public ImageDescriptor getImageDescriptor( String key ) + { + if ( key != null ) + { + URL url = FileLocator.find( getBundle(), new Path( key ), null ); + if ( url != null ) + return ImageDescriptor.createFromURL( url ); + else + return null; + } + else + { + return null; + } + } + + + /** + * Use this method to get SWT images. Use the IMG_ constants from + * BrowserWidgetsConstants for the key. A ImageRegistry is used to manage the + * the key->Image mapping. + *

+ * Note: Don't dispose the returned SWT Image. It is disposed + * automatically when the plugin is stopped. + * + * @param key + * The key (relative path to the image in filesystem) + * @return The SWT Image or null + */ + public Image getImage( String key ) + { + Image image = getImageRegistry().get( key ); + if ( image == null ) + { + ImageDescriptor id = getImageDescriptor( key ); + if ( id != null ) + { + image = id.createImage(); + getImageRegistry().put( key, image ); + } + } + return image; + } + + + /** + * Gets the plugin properties. + * + * @return + * the plugin properties + */ + public PropertyResourceBundle getPluginProperties() + { + if ( properties == null ) + { + try + { + properties = new PropertyResourceBundle( FileLocator.openStream( this.getBundle(), new Path( + "plugin.properties" ), false ) ); //$NON-NLS-1$ + } + catch ( IOException e ) + { + // We can't use the PLUGIN_ID constant since loading the plugin.properties file has failed, + // So we're using a default plugin id. + getLog().log( new Status( Status.ERROR, "org.apache.directory.studio.ldapservers", Status.OK, //$NON-NLS-1$ + Messages.getString( "LdapServersPlugin.UnableGetPluginProperties" ), e ) ); //$NON-NLS-1$ + } + } + + return properties; + } +} Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPluginConstants.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPluginConstants.java?rev=961793&view=auto ============================================================================== --- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPluginConstants.java (added) +++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPluginConstants.java Thu Jul 8 15:01:13 2010 @@ -0,0 +1,34 @@ +/* + * 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.ldapservers; + + +/** + * Constants used in the LDAP Servers plugin. + * + * @author Apache Directory Project + */ +public interface LdapServersPluginConstants +{ + /** The plug-in ID */ + public static final String PLUGIN_ID = LdapServersPlugin.getDefault().getPluginProperties().getString( "Plugin_id" ); //$NON-NLS-1$ + +} Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/Messages.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/Messages.java?rev=961793&view=auto ============================================================================== --- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/Messages.java (added) +++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/Messages.java Thu Jul 8 15:01:13 2010 @@ -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.ldapservers; + + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + + +public class Messages +{ + private static final String BUNDLE_NAME = "org.apache.directory.studio.connection.ui.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 + '!'; + } + } +} Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/messages.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/messages.properties?rev=961793&view=auto ============================================================================== --- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/messages.properties (added) +++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/messages.properties Thu Jul 8 15:01:13 2010 @@ -0,0 +1,18 @@ +# 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. + +LdapServersPlugin.UnableGetPluginProperties=Unable to get the plugin properties. Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/messages_de.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/messages_de.properties?rev=961793&view=auto ============================================================================== --- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/messages_de.properties (added) +++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/messages_de.properties Thu Jul 8 15:01:13 2010 @@ -0,0 +1,18 @@ +# 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. + +LdapServersPlugin.UnableGetPluginProperties=Die Plugin Eigenschaften k\u00F6nnen nicht geladen werden. Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/messages_fr.properties URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/messages_fr.properties?rev=961793&view=auto ============================================================================== --- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/messages_fr.properties (added) +++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/messages_fr.properties Thu Jul 8 15:01:13 2010 @@ -0,0 +1,18 @@ +# 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. + +LdapServersPlugin.UnableGetPluginProperties=Impossible de r\u00E9cup\u00E9rer les propri\u00E9t\u00E9s de ce plugin