directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r963347 - in /directory/studio/trunk/ldapservers: ./ resources/ resources/icons/ src/main/java/org/apache/directory/studio/ldapservers/ src/main/java/org/apache/directory/studio/ldapservers/actions/ src/main/java/org/apache/directory/studio...
Date Mon, 12 Jul 2010 16:56:29 GMT
Author: pamarcelot
Date: Mon Jul 12 16:56:29 2010
New Revision: 963347

URL: http://svn.apache.org/viewvc?rev=963347&view=rev
Log:
Added serialization of basic information about the server adapter when serializing the server.
Added the "new server" wizard.

Added:
    directory/studio/trunk/ldapservers/resources/icons/server_new.gif   (with props)
    directory/studio/trunk/ldapservers/resources/icons/server_new_wizard.png   (with props)
    directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/NewServerAction.java
    directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/UnknownLdapServerAdapterExtension.java
    directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/
    directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/Messages.java
    directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/NewServerWizard.java
    directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/NewServerWizardPage.java
    directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/messages.properties
    directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/messages_de.properties
    directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/messages_fr.properties
Modified:
    directory/studio/trunk/ldapservers/plugin.xml
    directory/studio/trunk/ldapservers/resources/ldapServerAdapters.exsd
    directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServerAdapterExtensionsManager.java
    directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManagerIO.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/model/LdapServer.java
    directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapterExtension.java
    directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/ServersView.java

Modified: directory/studio/trunk/ldapservers/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/plugin.xml?rev=963347&r1=963346&r2=963347&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers/plugin.xml (original)
+++ directory/studio/trunk/ldapservers/plugin.xml Mon Jul 12 16:56:29 2010
@@ -8,14 +8,14 @@
             class="org.apache.directory.studio.ldapservers.apacheds.ApacheDS157LdapServerAdapter"
             id="org.apache.directory.server.1.5.7"
             name="Apache DS"
-            vendorName="Apache Software Foundation"
+            vendor="Apache Software Foundation"
             version="1.5.7">
       </ldapServerAdapter>
       <ldapServerAdapter
             class="org.apache.directory.studio.ldapservers.apacheds.ApacheDS156LdapServerAdapter"
             id="org.apache.directory.server.1.5.6"
             name="Apache DS"
-            vendorName="Apache Software Foundation"
+            vendor="Apache Software Foundation"
             version="1.5.6">
       </ldapServerAdapter>
    </extension>

Added: directory/studio/trunk/ldapservers/resources/icons/server_new.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/resources/icons/server_new.gif?rev=963347&view=auto
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/ldapservers/resources/icons/server_new.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/ldapservers/resources/icons/server_new_wizard.png
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/resources/icons/server_new_wizard.png?rev=963347&view=auto
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/ldapservers/resources/icons/server_new_wizard.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: directory/studio/trunk/ldapservers/resources/ldapServerAdapters.exsd
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/resources/ldapServerAdapters.exsd?rev=963347&r1=963346&r2=963347&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers/resources/ldapServerAdapters.exsd (original)
+++ directory/studio/trunk/ldapservers/resources/ldapServerAdapters.exsd Mon Jul 12 16:56:29 2010
@@ -59,28 +59,28 @@
          <attribute name="name" type="string" use="required">
             <annotation>
                <documentation>
-                  
+                  The name of the LDAP Server Adapter
                </documentation>
             </annotation>
          </attribute>
          <attribute name="version" type="string" use="required">
             <annotation>
                <documentation>
-                  
+                  The version of the LDAP Server Adapter
                </documentation>
             </annotation>
          </attribute>
-         <attribute name="vendorName" type="string" use="required">
+         <attribute name="vendor" type="string" use="required">
             <annotation>
                <documentation>
-                  
+                  The vendor of the LDAP Server Adapter
                </documentation>
             </annotation>
          </attribute>
          <attribute name="description" type="string">
             <annotation>
                <documentation>
-                  
+                  The description of the LDAP Server Adapter
                </documentation>
             </annotation>
          </attribute>

Modified: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServerAdapterExtensionsManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServerAdapterExtensionsManager.java?rev=963347&r1=963346&r2=963347&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServerAdapterExtensionsManager.java (original)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServerAdapterExtensionsManager.java Mon Jul 12 16:56:29 2010
@@ -86,7 +86,7 @@ public class LdapServerAdapterExtensions
             ldapServerAdapterExtension.setId( member.getAttribute( "id" ) );
             ldapServerAdapterExtension.setName( member.getAttribute( "name" ) );
             ldapServerAdapterExtension.setVersion( member.getAttribute( "version" ) );
-            ldapServerAdapterExtension.setVendorName( member.getAttribute( "vendorName" ) );
+            ldapServerAdapterExtension.setVendor( member.getAttribute( "vendor" ) );
             ldapServerAdapterExtension.setClassName( member.getAttribute( "class" ) );
             ldapServerAdapterExtension.setDescription( member.getAttribute( "description" ) );
             String iconPath = member.getAttribute( "icon" );

Modified: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManagerIO.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManagerIO.java?rev=963347&r1=963346&r2=963347&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManagerIO.java (original)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManagerIO.java Mon Jul 12 16:56:29 2010
@@ -28,6 +28,8 @@ import java.util.Iterator;
 import java.util.List;
 
 import org.apache.directory.studio.ldapservers.model.LdapServer;
+import org.apache.directory.studio.ldapservers.model.LdapServerAdapterExtension;
+import org.apache.directory.studio.ldapservers.model.UnknownLdapServerAdapterExtension;
 import org.dom4j.Attribute;
 import org.dom4j.Document;
 import org.dom4j.DocumentException;
@@ -51,6 +53,9 @@ public class LdapServersManagerIO
     private static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
     private static final String NAME_ATTRIBUTE = "name"; //$NON-NLS-1$
     private static final String ADAPTER_ID_ATTRIBUTE = "adapterId"; //$NON-NLS-1$
+    private static final String ADAPTER_NAME_ATTRIBUTE = "adapterName"; //$NON-NLS-1$
+    private static final String ADAPTER_VENDOR_ATTRIBUTE = "adapterVendor"; //$NON-NLS-1$
+    private static final String ADAPTER_VERSION_ATTRIBUTE = "adapterVersion"; //$NON-NLS-1$
 
 
     /**
@@ -81,7 +86,7 @@ public class LdapServersManagerIO
         Element rootElement = document.getRootElement();
         if ( !rootElement.getName().equals( LDAP_SERVERS_TAG ) )
         {
-            throw new LdapServersManagerIOException( Messages.getString( "ServersHandlerIO.ErrorNotValidServersFile" ) ); //$NON-NLS-1$
+            throw new LdapServersManagerIOException( Messages.getString( "ServersHandlerIO.ErrorNotValidServersFile" ) ); //$NON-NLS-1$ // TODO
         }
 
         for ( Iterator<?> i = rootElement.elementIterator( LDAP_SERVER_TAG ); i.hasNext(); )
@@ -119,8 +124,54 @@ public class LdapServersManagerIO
             server.setName( nameAttribute.getValue() );
         }
 
-        // Adapter
-        // TODO
+        // Adapter ID
+        Attribute adapterIdAttribute = element.attribute( ADAPTER_ID_ATTRIBUTE );
+        if ( adapterIdAttribute != null )
+        {
+            // Getting the id
+            String adapterId = adapterIdAttribute.getValue();
+
+            // Looking for the correct LDAP Server Adapter Extension object
+            LdapServerAdapterExtension ldapServerAdapterExtension = LdapServerAdapterExtensionsManager.getDefault()
+                .getLdapServerAdapterExtensionById( adapterId );
+            if ( ldapServerAdapterExtension != null )
+            {
+                // The Adapter Extension has been found
+                // Assigning it to the server
+                server.setLdapServerAdapterExtension( ldapServerAdapterExtension );
+            }
+            else
+            {
+                // The Adapter Extension has not been found
+                // Assigning an "unknown" Adapter Extension
+                UnknownLdapServerAdapterExtension unknownLdapServerAdapterExtension = new UnknownLdapServerAdapterExtension();
+
+                // Adapter Name
+                Attribute adapterNameAttribute = element.attribute( ADAPTER_NAME_ATTRIBUTE );
+                if ( adapterNameAttribute != null )
+                {
+                    unknownLdapServerAdapterExtension.setName( adapterNameAttribute.getValue() );
+                }
+
+                // Adapter Vendor
+                Attribute adapterVendorAttribute = element.attribute( ADAPTER_VENDOR_ATTRIBUTE );
+                if ( adapterVendorAttribute != null )
+                {
+                    unknownLdapServerAdapterExtension.setVendor( adapterVendorAttribute.getValue() );
+                }
+
+                // Adapter Version
+                Attribute adapterVersionAttribute = element.attribute( ADAPTER_VERSION_ATTRIBUTE );
+                if ( adapterVersionAttribute != null )
+                {
+                    unknownLdapServerAdapterExtension.setVersion( adapterVersionAttribute.getValue() );
+                }
+            }
+        }
+        else
+        {
+            // TODO No Adapter ID, throw an error ?
+        }
 
         return server;
     }
@@ -180,7 +231,16 @@ public class LdapServersManagerIO
         // Name
         serverElement.addAttribute( NAME_ATTRIBUTE, server.getName() );
 
-        // Adapter
-        // TODO
+        // Adapter ID
+        serverElement.addAttribute( ADAPTER_ID_ATTRIBUTE, server.getLdapServerAdapterExtension().getId() );
+
+        // Adapter Name
+        serverElement.addAttribute( ADAPTER_NAME_ATTRIBUTE, server.getLdapServerAdapterExtension().getName() );
+
+        // Adapter Vendor
+        serverElement.addAttribute( ADAPTER_VENDOR_ATTRIBUTE, server.getLdapServerAdapterExtension().getVendor() );
+
+        // Adapter Version
+        serverElement.addAttribute( ADAPTER_VERSION_ATTRIBUTE, server.getLdapServerAdapterExtension().getVersion() );
     }
 }

Modified: 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=963347&r1=963346&r2=963347&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPluginConstants.java (original)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPluginConstants.java Mon Jul 12 16:56:29 2010
@@ -38,6 +38,8 @@ public interface LdapServersPluginConsta
     // ------
     // IMAGES
     // ------
+    public static final String IMG_SERVER_NEW = "resources/icons/server_new.gif";
+    public static final String IMG_SERVER_NEW_WIZARD = "resources/icons/server_new_wizard.png";
     public static final String IMG_SERVER = "resources/icons/server.gif";
     public static final String IMG_SERVER_STARTED = "resources/icons/server_started.gif";
     public static final String IMG_SERVER_STARTING1 = "resources/icons/server_starting1.gif";

Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/NewServerAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/NewServerAction.java?rev=963347&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/NewServerAction.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/NewServerAction.java Mon Jul 12 16:56:29 2010
@@ -0,0 +1,106 @@
+/*
+ *  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.actions;
+
+
+import org.apache.directory.studio.ldapservers.LdapServersPlugin;
+import org.apache.directory.studio.ldapservers.LdapServersPluginConstants;
+import org.apache.directory.studio.ldapservers.wizards.NewServerWizard;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This class implements the new server action.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class NewServerAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /**
+     * Creates a new instance of NewServerAction.
+     */
+    public NewServerAction()
+    {
+        super( "New Server" );
+        //        setId( ApacheDsPluginConstants.CMD_NEW_SERVER ); TODO
+        //        setActionDefinitionId( ApacheDsPluginConstants.CMD_NEW_SERVER ); // TODO
+        //        setToolTipText( Messages.getString( "NewServerAction.NewServerToolTip" ) ); //$NON-NLS-1$ // TODO
+        setImageDescriptor( LdapServersPlugin.getDefault().getImageDescriptor(
+            LdapServersPluginConstants.IMG_SERVER_NEW ) );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        // Instantiates and initializes the wizard
+        NewServerWizard wizard = new NewServerWizard();
+        wizard.init( PlatformUI.getWorkbench(), StructuredSelection.EMPTY );
+        // Instantiates the wizard container with the wizard and opens it
+        WizardDialog dialog = new WizardDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard );
+        dialog.create();
+        dialog.open();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run( IAction action )
+    {
+        run();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+     */
+    public void dispose()
+    {
+        // Nothing to do
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+     */
+    public void init( IWorkbenchWindow window )
+    {
+        // Nothing to do
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        // Nothing to do
+    }
+}

Modified: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServer.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServer.java?rev=963347&r1=963346&r2=963347&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServer.java (original)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServer.java Mon Jul 12 16:56:29 2010
@@ -35,6 +35,14 @@ public class LdapServer
 
     private LdapServerStatus status = LdapServerStatus.STOPPED;
 
+    private LdapServerAdapterExtension ldapServerAdapterExtension;
+
+
+    public void setLdapServerAdapterExtension( LdapServerAdapterExtension ldapServerAdapterExtension )
+    {
+        this.ldapServerAdapterExtension = ldapServerAdapterExtension;
+    }
+
 
     /**
      * Gets the name of the server.
@@ -73,12 +81,12 @@ public class LdapServer
 
 
     /**
-     * Gets the associated {@link LdapServerAdapter}.
+     * Gets the associated {@link LdapServerAdapterExtension}.
      *
      * @return
-     *      the associated {@link LdapServerAdapter}
+     *      the associated {@link LdapServerAdapterExtension}
      */
-    public LdapServerAdapter getLdapServerAdapter()
+    public LdapServerAdapterExtension getLdapServerAdapterExtension()
     {
         return null;
     }

Modified: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapterExtension.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapterExtension.java?rev=963347&r1=963346&r2=963347&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapterExtension.java (original)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapterExtension.java Mon Jul 12 16:56:29 2010
@@ -35,7 +35,7 @@ public class LdapServerAdapterExtension
     private String id;
     private String name;
     private String version;
-    private String vendorName;
+    private String vendor;
     private String className;
     private String description;
     private ImageDescriptor icon;
@@ -97,13 +97,13 @@ public class LdapServerAdapterExtension
 
 
     /**
-     * TODO getVendorName.
+     * TODO vendor.
      *
      * @return
      */
-    public String getVendorName()
+    public String getVendor()
     {
-        return vendorName;
+        return vendor;
     }
 
 
@@ -174,13 +174,13 @@ public class LdapServerAdapterExtension
 
 
     /**
-     * TODO setVendorName.
+     * TODO setVendor.
      *
-     * @param vendorName
+     * @param vendor
      */
-    public void setVendorName( String vendorName )
+    public void setVendor( String vendor )
     {
-        this.vendorName = vendorName;
+        this.vendor = vendor;
     }
 
 

Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/UnknownLdapServerAdapterExtension.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/UnknownLdapServerAdapterExtension.java?rev=963347&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/UnknownLdapServerAdapterExtension.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/UnknownLdapServerAdapterExtension.java Mon Jul 12 16:56:29 2010
@@ -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.ldapservers.model;
+
+
+/**
+ * The {@link UnknownLdapServerAdapterExtension} class represents an extension to the 
+ * LDAP Server Adapters extension point that can not be found while parsing the server instances file.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class UnknownLdapServerAdapterExtension extends LdapServerAdapterExtension
+{
+}

Modified: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/ServersView.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/ServersView.java?rev=963347&r1=963346&r2=963347&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/ServersView.java (original)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/ServersView.java Mon Jul 12 16:56:29 2010
@@ -22,7 +22,19 @@ package org.apache.directory.studio.ldap
 
 import org.apache.directory.studio.ldapservers.LdapServersManager;
 import org.apache.directory.studio.ldapservers.LdapServersManagerListener;
+import org.apache.directory.studio.ldapservers.actions.NewServerAction;
 import org.apache.directory.studio.ldapservers.model.LdapServer;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.commands.ActionHandler;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
@@ -33,11 +45,18 @@ import org.eclipse.swt.widgets.Composite
 import org.eclipse.swt.widgets.Tree;
 import org.eclipse.swt.widgets.TreeColumn;
 import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IPartListener2;
 import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchPartReference;
 import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
 import org.eclipse.ui.contexts.IContextActivation;
+import org.eclipse.ui.contexts.IContextService;
 import org.eclipse.ui.part.ViewPart;
 
+import com.sun.corba.se.spi.activation.Server;
+
 
 /**
  * This class implements the Servers view.
@@ -67,7 +86,7 @@ public class ServersView extends ViewPar
     protected int[] columnWidths;
 
     // Actions
-//    private NewServerAction newServer;
+    private NewServerAction newServer;
 //    private OpenConfigurationAction openConfiguration;
 //    private DeleteAction delete;
 //    private RenameAction rename;
@@ -127,10 +146,10 @@ public class ServersView extends ViewPar
         // Creating the viewer
         tableViewer = new ServersTableViewer( tree );
 
-//        initActions();
-//        initToolbar();
-//        initContextMenu();
-//        initListeners();
+        initActions();
+        initToolbar();
+        initContextMenu();
+        initListeners();
 
         // set help context
         // TODO
@@ -216,13 +235,13 @@ public class ServersView extends ViewPar
     }
 
 
-//    /**
-//     * Initializes the actions.
-//     */
-//    private void initActions()
-//    {
-//        newServer = new NewServerAction();
-//
+    /**
+     * Initializes the actions.
+     */
+    private void initActions()
+    {
+        newServer = new NewServerAction();
+
 //        openConfiguration = new OpenConfigurationAction( this );
 //        openConfiguration.setEnabled( false );
 //
@@ -243,36 +262,36 @@ public class ServersView extends ViewPar
 //
 //        properties = new PropertiesAction( this );
 //        properties.setEnabled( false );
-//    }
+    }
 
 
-//    /**
-//     * Initializes the toolbar.
-//     */
-//    private void initToolbar()
-//    {
-//        IToolBarManager toolbar = getViewSite().getActionBars().getToolBarManager();
-//        toolbar.add( newServer );
+    /**
+     * Initializes the toolbar.
+     */
+    private void initToolbar()
+    {
+        IToolBarManager toolbar = getViewSite().getActionBars().getToolBarManager();
+        toolbar.add( newServer );
 //        toolbar.add( new Separator() );
 //        toolbar.add( run );
 //        toolbar.add( stop );
-//    }
+    }
 
 
-//    /**
-//     * Initializes the Context Menu.
-//     */
-//    private void initContextMenu()
-//    {
-//        MenuManager contextMenu = new MenuManager( "" ); //$NON-NLS-1$
-//        contextMenu.setRemoveAllWhenShown( true );
-//        contextMenu.addMenuListener( new IMenuListener()
-//        {
-//            public void menuAboutToShow( IMenuManager manager )
-//            {
-//                MenuManager newManager = new MenuManager( Messages.getString( "ServersView.new" ) ); //$NON-NLS-1$
-//                newManager.add( newServer );
-//                manager.add( newManager );
+    /**
+     * Initializes the Context Menu.
+     */
+    private void initContextMenu()
+    {
+        MenuManager contextMenu = new MenuManager( "" ); //$NON-NLS-1$
+        contextMenu.setRemoveAllWhenShown( true );
+        contextMenu.addMenuListener( new IMenuListener()
+        {
+            public void menuAboutToShow( IMenuManager manager )
+            {
+                MenuManager newManager = new MenuManager( Messages.getString( "ServersView.new" ) ); //$NON-NLS-1$
+                newManager.add( newServer );
+                manager.add( newManager );
 //                manager.add( openConfiguration );
 //                manager.add( new Separator() );
 //                manager.add( delete );
@@ -286,25 +305,25 @@ public class ServersView extends ViewPar
 //                manager.add( ldapBrowserManager );
 //                manager.add( new Separator() );
 //                manager.add( properties );
-//            }
-//        } );
-//
-//        // set the context menu to the table viewer
-//        tableViewer.getControl().setMenu( contextMenu.createContextMenu( tableViewer.getControl() ) );
-//
-//        // register the context menu to enable extension actions
-//        getSite().registerContextMenu( contextMenu, tableViewer );
-//    }
+            }
+        } );
 
+        // set the context menu to the table viewer
+        tableViewer.getControl().setMenu( contextMenu.createContextMenu( tableViewer.getControl() ) );
+
+        // register the context menu to enable extension actions
+        getSite().registerContextMenu( contextMenu, tableViewer );
+    }
+
+
+    /**
+     * Initializes the listeners
+     */
+    private void initListeners()
+    {
+        LdapServersManager serversHandler = LdapServersManager.getDefault();
+        serversHandler.addListener( ldapServersManagerListener );
 
-//    /**
-//     * Initializes the listeners
-//     */
-//    private void initListeners()
-//    {
-//        LdapServersManager serversHandler = LdapServersManager.getDefault();
-//        serversHandler.addListener( ldapServersManagerListener );
-//
 //        tableViewer.addDoubleClickListener( new IDoubleClickListener()
 //        {
 //            public void doubleClick( DoubleClickEvent event )
@@ -312,53 +331,53 @@ public class ServersView extends ViewPar
 //                openConfiguration.run();
 //            }
 //        } );
-//
-//        tableViewer.addSelectionChangedListener( new ISelectionChangedListener()
-//        {
-//            public void selectionChanged( SelectionChangedEvent event )
-//            {
-//                updateActionsStates();
-//            }
-//        } );
-//
-//        // Initializing the PartListener
-//        getSite().getPage().addPartListener( new IPartListener2()
-//        {
-//            /**
-//              * This implementation deactivates the shortcuts when the part is deactivated.
-//              */
-//            public void partDeactivated( IWorkbenchPartReference partRef )
-//            {
-//                if ( partRef.getPart( false ) == instance && contextActivation != null )
-//                {
-//                    ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
-//                        ICommandService.class );
-//                    if ( commandService != null )
-//                    {
-//                        commandService.getCommand( newServer.getActionDefinitionId() ).setHandler( null );
+
+        tableViewer.addSelectionChangedListener( new ISelectionChangedListener()
+        {
+            public void selectionChanged( SelectionChangedEvent event )
+            {
+                updateActionsStates();
+            }
+        } );
+
+        // Initializing the PartListener
+        getSite().getPage().addPartListener( new IPartListener2()
+        {
+            /**
+              * This implementation deactivates the shortcuts when the part is deactivated.
+              */
+            public void partDeactivated( IWorkbenchPartReference partRef )
+            {
+                if ( partRef.getPart( false ) == instance && contextActivation != null )
+                {
+                    ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
+                        ICommandService.class );
+                    if ( commandService != null )
+                    {
+                        commandService.getCommand( newServer.getActionDefinitionId() ).setHandler( null );
 //                        commandService.getCommand( openConfiguration.getActionDefinitionId() ).setHandler( null );
 //                        commandService.getCommand( delete.getActionDefinitionId() ).setHandler( null );
 //                        commandService.getCommand( rename.getActionDefinitionId() ).setHandler( null );
 //                        commandService.getCommand( run.getActionDefinitionId() ).setHandler( null );
 //                        commandService.getCommand( stop.getActionDefinitionId() ).setHandler( null );
 //                        commandService.getCommand( properties.getActionDefinitionId() ).setHandler( null );
-//                    }
-//
-//                    IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
-//                        IContextService.class );
-//                    contextService.deactivateContext( contextActivation );
-//                    contextActivation = null;
-//                }
-//            }
-//
-//
-//            /**
-//             * This implementation activates the shortcuts when the part is activated.
-//             */
-//            public void partActivated( IWorkbenchPartReference partRef )
-//            {
-//                if ( partRef.getPart( false ) == instance )
-//                {
+                    }
+
+                    IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
+                        IContextService.class );
+                    contextService.deactivateContext( contextActivation );
+                    contextActivation = null;
+                }
+            }
+
+
+            /**
+             * This implementation activates the shortcuts when the part is activated.
+             */
+            public void partActivated( IWorkbenchPartReference partRef )
+            {
+                if ( partRef.getPart( false ) == instance )
+                {
 //                    IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
 //                        IContextService.class );
 //                    contextActivation = contextService.activateContext( ApacheDsPluginConstants.CONTEXTS_SERVERS_VIEW );
@@ -381,88 +400,88 @@ public class ServersView extends ViewPar
 //                        commandService.getCommand( properties.getActionDefinitionId() ).setHandler(
 //                            new ActionHandler( properties ) );
 //                    }
-//                }
-//            }
-//
-//
-//            public void partBroughtToTop( IWorkbenchPartReference partRef )
-//            {
-//            }
-//
-//
-//            public void partClosed( IWorkbenchPartReference partRef )
-//            {
-//            }
-//
-//
-//            public void partHidden( IWorkbenchPartReference partRef )
-//            {
-//            }
-//
-//
-//            public void partInputChanged( IWorkbenchPartReference partRef )
-//            {
-//            }
-//
-//
-//            public void partOpened( IWorkbenchPartReference partRef )
-//            {
-//            }
-//
-//
-//            public void partVisible( IWorkbenchPartReference partRef )
-//            {
-//            }
-//
-//        } );
-//    }
-//
-//
-//    /**
-//     * Enables or disables the actions according to the current selection 
-//     * in the viewer.
-//     */
-//    public void updateActionsStates()
-//    {
-//        // Getting the selection
-//        StructuredSelection selection = ( StructuredSelection ) tableViewer.getSelection();
-//
-//        if ( !selection.isEmpty() )
-//        {
-//            Server server = ( Server ) selection.getFirstElement();
-//
-//            switch ( server.getState() )
-//            {
-//                case STARTED:
+                }
+            }
+
+
+            public void partBroughtToTop( IWorkbenchPartReference partRef )
+            {
+            }
+
+
+            public void partClosed( IWorkbenchPartReference partRef )
+            {
+            }
+
+
+            public void partHidden( IWorkbenchPartReference partRef )
+            {
+            }
+
+
+            public void partInputChanged( IWorkbenchPartReference partRef )
+            {
+            }
+
+
+            public void partOpened( IWorkbenchPartReference partRef )
+            {
+            }
+
+
+            public void partVisible( IWorkbenchPartReference partRef )
+            {
+            }
+
+        } );
+    }
+
+
+    /**
+     * Enables or disables the actions according to the current selection 
+     * in the viewer.
+     */
+    public void updateActionsStates()
+    {
+        // Getting the selection
+        StructuredSelection selection = ( StructuredSelection ) tableViewer.getSelection();
+
+        if ( !selection.isEmpty() )
+        {
+            LdapServer server = ( LdapServer ) selection.getFirstElement();
+
+            switch ( server.getStatus() )
+            {
+                case STARTED:
 //                    run.setEnabled( false );
 //                    stop.setEnabled( true );
-//                    break;
-//                case STARTING:
+                    break;
+                case STARTING:
 //                    run.setEnabled( false );
 //                    stop.setEnabled( false );
-//                    break;
-//                case STOPPED:
+                    break;
+                case STOPPED:
 //                    run.setEnabled( true );
 //                    stop.setEnabled( false );
-//                    break;
-//                case STOPPING:
+                    break;
+                case STOPPING:
 //                    run.setEnabled( false );
 //                    stop.setEnabled( false );
-//                    break;
-//                case UNKNONW:
+                    break;
+                case UNKNOWN:
 //                    run.setEnabled( false );
 //                    stop.setEnabled( false );
-//                    break;
-//            }
-//
+                    break;
+            }
+
 //            openConfiguration.setEnabled( true );
 //            delete.setEnabled( true );
 //            rename.setEnabled( true );
 //            createConnection.setEnabled( true );
 //            properties.setEnabled( true );
-//        }
-//        else
-//        {
+        }
+        else
+        {
 //            openConfiguration.setEnabled( false );
 //            delete.setEnabled( false );
 //            rename.setEnabled( false );
@@ -470,8 +489,8 @@ public class ServersView extends ViewPar
 //            stop.setEnabled( false );
 //            createConnection.setEnabled( false );
 //            properties.setEnabled( false );
-//        }
-//    }
+        }
+    }
 
 
     /**

Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/Messages.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/Messages.java?rev=963347&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/Messages.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/Messages.java Mon Jul 12 16:56:29 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.wizards;
+
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+public class Messages
+{
+    private static final String BUNDLE_NAME = "org.apache.directory.studio.ldapservers.wizards.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/wizards/NewServerWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/NewServerWizard.java?rev=963347&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/NewServerWizard.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/NewServerWizard.java Mon Jul 12 16:56:29 2010
@@ -0,0 +1,78 @@
+/*
+ *  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.wizards;
+
+
+import org.apache.directory.studio.ldapservers.LdapServersManager;
+import org.apache.directory.studio.ldapservers.model.LdapServer;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+
+
+/**
+ * This class implements the new server wizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class NewServerWizard extends Wizard implements INewWizard
+{
+    /** The wizard page */
+    private NewServerWizardPage page;
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.wizard.Wizard#addPages()
+     */
+    public void addPages()
+    {
+        page = new NewServerWizardPage();
+        addPage( page );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.wizard.Wizard#performFinish()
+     */
+    public boolean performFinish()
+    {
+        // Creating the new server
+        LdapServer server = new LdapServer();
+        server.setName( page.getServerName() );
+
+        // Adding the new server to the servers handler
+        LdapServersManager.getDefault().addServer( server );
+
+        // Creating the complete folder structure for the new server
+        //ApacheDsPluginUtils.createNewServerFolder( server.getId() ); // TODO
+
+        return true;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
+     */
+    public void init( IWorkbench workbench, IStructuredSelection selection )
+    {
+        setNeedsProgressMonitor( false );
+    }
+}

Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/NewServerWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/NewServerWizardPage.java?rev=963347&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/NewServerWizardPage.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/NewServerWizardPage.java Mon Jul 12 16:56:29 2010
@@ -0,0 +1,138 @@
+/*
+ *  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.wizards;
+
+
+import org.apache.directory.studio.ldapservers.LdapServersManager;
+import org.apache.directory.studio.ldapservers.LdapServersPlugin;
+import org.apache.directory.studio.ldapservers.LdapServersPluginConstants;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+
+/**
+ * This class implements the wizard page for the new server wizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class NewServerWizardPage extends WizardPage
+{
+    /** The servers handler */
+    private LdapServersManager ldapServersManager;
+
+    // UI fields
+    private Text nameText;
+
+
+    /**
+     * Creates a new instance of NewServerWizardPage.
+     */
+    public NewServerWizardPage()
+    {
+        super( NewServerWizardPage.class.getCanonicalName() );
+        setTitle( Messages.getString( "NewServerWizardPage.CreateNewServer" ) ); //$NON-NLS-1$
+        setDescription( Messages.getString( "NewServerWizardPage.PleaseSpecifyName" ) ); //$NON-NLS-1$
+        setImageDescriptor( LdapServersPlugin.getDefault().getImageDescriptor(
+            LdapServersPluginConstants.IMG_SERVER_NEW_WIZARD ) );
+        setPageComplete( false );
+        ldapServersManager = LdapServersManager.getDefault();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+     */
+    public void createControl( Composite parent )
+    {
+        Composite composite = new Composite( parent, SWT.NONE );
+        composite.setLayout( new GridLayout( 2, false ) );
+
+        Label nameLabel = new Label( composite, SWT.NONE );
+        nameLabel.setText( Messages.getString( "NewServerWizardPage.Name" ) ); //$NON-NLS-1$
+        nameText = new Text( composite, SWT.BORDER );
+        nameText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        nameText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                validate();
+            }
+        } );
+
+        setControl( composite );
+    }
+
+
+    /**
+     * Validates the page.
+     */
+    private void validate()
+    {
+        displayErrorMessage( null );
+
+        String name = nameText.getText();
+        if ( ( name != null ) )
+        {
+            if ( "".equals( name ) ) //$NON-NLS-1$
+            {
+                displayErrorMessage( Messages.getString( "NewServerWizardPage.ErrorEnterName" ) ); //$NON-NLS-1$
+                return;
+            }
+            if ( !ldapServersManager.isNameAvailable( name ) )
+            {
+                displayErrorMessage( Messages.getString( "NewServerWizardPage.ErrorNameExists" ) ); //$NON-NLS-1$
+                return;
+            }
+        }
+    }
+
+
+    /**
+     * Displays an error message and set the page status as incomplete
+     * if the message is not null.
+     *
+     * @param message
+     *      the message to display
+     */
+    protected void displayErrorMessage( String message )
+    {
+        setErrorMessage( message );
+        setPageComplete( message == null );
+    }
+
+
+    /**
+     * Gets the name of the server.
+     *
+     * @return
+     *      the name of the server
+     */
+    public String getServerName()
+    {
+        return nameText.getText();
+    }
+}

Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/messages.properties?rev=963347&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/messages.properties (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/messages.properties Mon Jul 12 16:56:29 2010
@@ -0,0 +1,22 @@
+#  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.
+
+NewServerWizardPage.CreateNewServer=Create a Server
+NewServerWizardPage.ErrorEnterName=Enter a name for the server.
+NewServerWizardPage.ErrorNameExists=A server with the same name already exists.
+NewServerWizardPage.Name=Name\:
+NewServerWizardPage.PleaseSpecifyName=Please specify a name to create a new server.

Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/messages_de.properties?rev=963347&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/messages_de.properties (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/messages_de.properties Mon Jul 12 16:56:29 2010
@@ -0,0 +1,21 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+
+NewServerWizardPage.CreateNewServer=Erstelle einen Server
+NewServerWizardPage.ErrorEnterName=Geben Sie einen Namen f\u00FCr den Server ein.
+NewServerWizardPage.ErrorNameExists=Ein Server mit diesem Namen existiert bereits.
+NewServerWizardPage.PleaseSpecifyName=Bitte geben Sie einen Namen zum Erstellen eines neuen Servers an.

Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/messages_fr.properties?rev=963347&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/messages_fr.properties (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/messages_fr.properties Mon Jul 12 16:56:29 2010
@@ -0,0 +1,22 @@
+#  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.
+
+NewServerWizardPage.CreateNewServer=Cr\u00E9er un nouveau serveur
+NewServerWizardPage.ErrorEnterName=Entrez un nom pour le nouveau serveur
+NewServerWizardPage.ErrorNameExists=Un serveur portant ce nom existe d\u00E9j\u00E0.
+NewServerWizardPage.Name=Nom\:
+NewServerWizardPage.PleaseSpecifyName=Veuillez d'indiquer le nom du serveur \u00E0 cr\u00E9er.



Mime
View raw message