You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2008/05/24 16:44:51 UTC

svn commit: r659829 [1/2] - in /directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations: resources/icons/ src/main/java/org/apache/directory/studio/apacheds/experimentations/ src/main/java/org/apache/directory/studio/apache...

Author: pamarcelot
Date: Sat May 24 07:44:50 2008
New Revision: 659829

URL: http://svn.apache.org/viewvc?rev=659829&view=rev
Log:
o Improved the Servers View.
o Added Server Events
o Added Open, Properties and Delete actions.

Added:
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/resources/icons/server_new.gif   (with props)
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/resources/icons/server_new_wizard.png   (with props)
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/Main.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/DeleteAction.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/OpenAction.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/dialogs/
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/dialogs/DeleteServerDialog.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerEvent.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerEventEnum.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerListener.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServerTableViewer.java
Removed:
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/resources/icons/server-instance-new.png
Modified:
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/ApacheDsPluginConstants.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/NewServerInstanceAction.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/PropertiesAction.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/ServerInstanceRunAction.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/ServerInstanceStopAction.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/jobs/LaunchServerInstanceJob.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerInstance.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServersHandler.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/properties/ServerInstancePropertyPage.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServersView.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServersViewContentProvider.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServersViewLabelProvider.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/wizards/NewServerInstanceWizardPage.java

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/resources/icons/server_new.gif
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/resources/icons/server_new.gif?rev=659829&view=auto
==============================================================================
Binary file - no diff available.

Propchange: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/resources/icons/server_new.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/resources/icons/server_new_wizard.png
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/resources/icons/server_new_wizard.png?rev=659829&view=auto
==============================================================================
Binary file - no diff available.

Propchange: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/resources/icons/server_new_wizard.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/ApacheDsPluginConstants.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/ApacheDsPluginConstants.java?rev=659829&r1=659828&r2=659829&view=diff
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/ApacheDsPluginConstants.java (original)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/ApacheDsPluginConstants.java Sat May 24 07:44:50 2008
@@ -32,7 +32,8 @@
     // IMAGES
     // -------
     public static final String IMG_SERVER_INSTANCE = "resources/icons/server-instance.png";
-    public static final String IMG_SERVER_INSTANCE_NEW = "resources/icons/server-instance-new.png";
+    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";
@@ -48,10 +49,12 @@
     // -------
     // ACTIONS
     // -------
-    public static final String ACTION_NEW_SERVER_INSTANCE = "org.apache.directory.studio.apacheds.experimentations.actions.newServerInstanceAction";
+    public static final String ACTION_NEW_SERVER = "org.apache.directory.studio.apacheds.experimentations.actions.newServerAction";
     public static final String ACTION_SERVER_INSTANCE_RUN = "org.apache.directory.studio.apacheds.experimentations.actions.serverInstanceRunAction";
     public static final String ACTION_SERVER_INSTANCE_STOP = "org.apache.directory.studio.apacheds.experimentations.actions.serverInstanceStopAction";
     public static final String ACTION_PROPERTIES = "org.apache.directory.studio.apacheds.experimentations.actions.propertiesAction";
+    public static final String ACTION_OPEN = "org.apache.directory.studio.apacheds.experimentations.actions.openAction";
+    public static final String ACTION_DELETE = "org.apache.directory.studio.apacheds.experimentations.actions.deleteAction";
 
     // -----------
     // PREFERENCES

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/Main.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/Main.java?rev=659829&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/Main.java (added)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/Main.java Sat May 24 07:44:50 2008
@@ -0,0 +1,31 @@
+package org.apache.directory.studio.apacheds.experimentations;
+
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.ldap.InitialLdapContext;
+
+
+public class Main
+{
+    public static void main( String[] args )
+    {
+        Hashtable<String, String> environment = new Hashtable<String, String>();
+        environment.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" ); //$NON-NLS-1$
+        environment.put( "java.naming.ldap.version", "3" ); //$NON-NLS-1$ //$NON-NLS-2$
+
+        environment.put( Context.PROVIDER_URL, "ldap://" + "localhost" + ":" + "10390" ); //$NON-NLS-1$ //$NON-NLS-2$
+
+        try
+        {
+            InitialLdapContext context = new InitialLdapContext( environment, null );
+        }
+        catch ( NamingException e )
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+}

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/DeleteAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/DeleteAction.java?rev=659829&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/DeleteAction.java (added)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/DeleteAction.java Sat May 24 07:44:50 2008
@@ -0,0 +1,122 @@
+/*
+ *  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.apacheds.experimentations.actions;
+
+
+import org.apache.directory.studio.apacheds.experimentations.ApacheDsPluginConstants;
+import org.apache.directory.studio.apacheds.experimentations.dialogs.DeleteServerDialog;
+import org.apache.directory.studio.apacheds.experimentations.model.ServerInstance;
+import org.apache.directory.studio.apacheds.experimentations.model.ServersHandler;
+import org.apache.directory.studio.apacheds.experimentations.views.ServersView;
+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.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This class implements the delete action for a server instance.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DeleteAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /** The associated view */
+    private ServersView view;
+
+
+    /**
+     * Creates a new instance of DeleteAction.
+     * 
+     * @param view
+     *      the associated view
+     */
+    public DeleteAction( ServersView view )
+    {
+        super( "Delete" );
+        this.view = view;
+        setToolTipText( "Delete" );
+        setImageDescriptor( PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(
+            ISharedImages.IMG_TOOL_DELETE ) );
+        setId( ApacheDsPluginConstants.ACTION_DELETE );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        // What we get from the TableViewer is a StructuredSelection
+        StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
+
+        // Here's the real object
+        ServerInstance serverInstance = ( ServerInstance ) selection.getFirstElement();
+
+        // Asking for confirmation
+        DeleteServerDialog dsd = new DeleteServerDialog( view.getSite().getShell(), serverInstance );
+        if ( dsd.open() == DeleteServerDialog.OK )
+        {
+            // Removing the server instance
+            ServersHandler.getDefault().removeServerInstance( serverInstance );
+        }
+    }
+
+
+    /* (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/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/NewServerInstanceAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/NewServerInstanceAction.java?rev=659829&r1=659828&r2=659829&view=diff
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/NewServerInstanceAction.java (original)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/NewServerInstanceAction.java Sat May 24 07:44:50 2008
@@ -48,9 +48,8 @@
     {
         super( "New Server" );
         setToolTipText( "New Server" );
-        setId( ApacheDsPluginConstants.ACTION_NEW_SERVER_INSTANCE );
-        setImageDescriptor( ApacheDsPlugin.getDefault().getImageDescriptor(
-            ApacheDsPluginConstants.IMG_SERVER_INSTANCE_NEW ) );
+        setId( ApacheDsPluginConstants.ACTION_NEW_SERVER );
+        setImageDescriptor( ApacheDsPlugin.getDefault().getImageDescriptor( ApacheDsPluginConstants.IMG_SERVER_NEW ) );
         setEnabled( true );
     }
 

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/OpenAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/OpenAction.java?rev=659829&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/OpenAction.java (added)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/OpenAction.java Sat May 24 07:44:50 2008
@@ -0,0 +1,274 @@
+/*
+ *  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.apacheds.experimentations.actions;
+
+
+import org.apache.directory.studio.apacheds.configuration.editor.ServerConfigurationEditor;
+import org.apache.directory.studio.apacheds.experimentations.ApacheDsPluginConstants;
+import org.apache.directory.studio.apacheds.experimentations.ApacheDsPluginUtils;
+import org.apache.directory.studio.apacheds.experimentations.model.ServerInstance;
+import org.apache.directory.studio.apacheds.experimentations.views.ServersView;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IPathEditorInput;
+import org.eclipse.ui.IPersistableElement;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This class implements the open action for a server instance.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class OpenAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /** The associated view */
+    private ServersView view;
+
+
+    /**
+     * Creates a new instance of OpenAction.
+     * 
+     * @param view
+     *      the associated view
+     */
+    public OpenAction( ServersView view )
+    {
+        super( "Open" );
+        this.view = view;
+        setToolTipText( "Open" );
+        setId( ApacheDsPluginConstants.ACTION_OPEN );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        // What we get from the TableViewer is a StructuredSelection
+        StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
+
+        // Here's the real object
+        ServerInstance serverInstance = ( ServerInstance ) selection.getFirstElement();
+        if ( serverInstance != null )
+        {
+            // Opening the editor
+            IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+            PathEditorInput input = new PathEditorInput( ApacheDsPluginUtils.getApacheDsInstancesFolder().append(
+                serverInstance.getId() ).append( "conf" ).append( "server.xml" ) );
+            try
+            {
+                page.openEditor( input, ServerConfigurationEditor.ID );
+            }
+            catch ( PartInitException e )
+            {
+                // TODO
+            }
+
+        }
+    }
+
+
+    /* (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
+    }
+
+    /**
+     * This IEditorInput is used to open files that are located in the local file system.
+     * 
+     * Inspired from org.eclipse.ui.internal.editors.text.NonExistingFileEditorInput.java
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    class PathEditorInput implements IPathEditorInput
+    {
+        /** The absolute path in local file system */
+        private IPath path;
+
+
+        /**
+         * 
+         * Creates a new instance of PathEditorInput.
+         *
+         * @param path the absolute path
+         */
+        public PathEditorInput( IPath path )
+        {
+            if ( path == null )
+            {
+                throw new IllegalArgumentException();
+            }
+
+            this.path = path;
+        }
+
+
+        /**
+         * Returns hash code of the path.
+         */
+        public int hashCode()
+        {
+            return path.hashCode();
+        }
+
+
+        /** 
+         * This implemention just compares the paths
+         */
+        public boolean equals( Object o )
+        {
+            if ( this == o )
+            {
+                return true;
+            }
+
+            if ( o instanceof PathEditorInput )
+            {
+                PathEditorInput input = ( PathEditorInput ) o;
+                return path.equals( input.path );
+            }
+
+            return false;
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public boolean exists()
+        {
+            return path.toFile().exists();
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public ImageDescriptor getImageDescriptor()
+        {
+            return PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor( path.toString() );
+        }
+
+
+        /**
+         * Returns the file name only.
+         */
+        public String getName()
+        {
+            return path.toFile().getName();
+            //return path.toString();
+        }
+
+
+        /**
+         * Returns the complete path. 
+         */
+        public String getToolTipText()
+        {
+            return path.makeRelative().toOSString();
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public IPath getPath()
+        {
+            return path;
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        @SuppressWarnings("unchecked")
+        public Object getAdapter( Class adapter )
+        {
+            return Platform.getAdapterManager().getAdapter( this, adapter );
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public IPersistableElement getPersistable()
+        {
+            return null;
+        }
+
+
+        /**
+         * Returns the path.
+         */
+        public IPath getErrorMessage( Object element )
+        {
+            if ( element instanceof PathEditorInput )
+            {
+                PathEditorInput input = ( PathEditorInput ) element;
+                return input.getPath();
+            }
+
+            return null;
+        }
+    }
+}

Modified: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/PropertiesAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/PropertiesAction.java?rev=659829&r1=659828&r2=659829&view=diff
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/PropertiesAction.java (original)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/PropertiesAction.java Sat May 24 07:44:50 2008
@@ -49,6 +49,9 @@
 
     /**
      * Creates a new instance of NewServerInstanceAction.
+     * 
+     * @param view
+     *      the associated view
      */
     public PropertiesAction( ServersView view )
     {
@@ -56,19 +59,6 @@
         this.view = view;
         setToolTipText( "Properties" );
         setId( ApacheDsPluginConstants.ACTION_PROPERTIES );
-        setEnabled( false );
-
-        view.getViewer().addSelectionChangedListener( new ISelectionChangedListener()
-        {
-            /* (non-Javadoc)
-             * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
-             */
-            public void selectionChanged( SelectionChangedEvent event )
-            {
-                StructuredSelection selection = ( StructuredSelection ) event.getSelection();
-                setEnabled( !selection.isEmpty() );
-            }
-        } );
     }
 
 

Modified: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/ServerInstanceRunAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/ServerInstanceRunAction.java?rev=659829&r1=659828&r2=659829&view=diff
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/ServerInstanceRunAction.java (original)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/ServerInstanceRunAction.java Sat May 24 07:44:50 2008
@@ -48,7 +48,10 @@
 
 
     /**
-     * Creates a new instance of NewServerInstanceAction.
+     * Creates a new instance of ServerInstanceRunAction.
+     *
+     * @param view
+     *      the associated view
      */
     public ServerInstanceRunAction( ServersView view )
     {
@@ -57,19 +60,6 @@
         setToolTipText( "Run" );
         setId( ApacheDsPluginConstants.ACTION_SERVER_INSTANCE_RUN );
         setImageDescriptor( ApacheDsPlugin.getDefault().getImageDescriptor( ApacheDsPluginConstants.IMG_RUN ) );
-        setEnabled( false );
-
-        view.getViewer().addSelectionChangedListener( new ISelectionChangedListener()
-        {
-            /* (non-Javadoc)
-             * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
-             */
-            public void selectionChanged( SelectionChangedEvent event )
-            {
-                StructuredSelection selection = ( StructuredSelection ) event.getSelection();
-                setEnabled( !selection.isEmpty() );
-            }
-        } );
     }
 
 

Modified: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/ServerInstanceStopAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/ServerInstanceStopAction.java?rev=659829&r1=659828&r2=659829&view=diff
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/ServerInstanceStopAction.java (original)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/ServerInstanceStopAction.java Sat May 24 07:44:50 2008
@@ -26,9 +26,6 @@
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
 
@@ -55,19 +52,6 @@
         setToolTipText( "Stop" );
         setId( ApacheDsPluginConstants.ACTION_SERVER_INSTANCE_STOP );
         setImageDescriptor( ApacheDsPlugin.getDefault().getImageDescriptor( ApacheDsPluginConstants.IMG_STOP ) );
-        setEnabled( false );
-
-        view.getViewer().addSelectionChangedListener( new ISelectionChangedListener()
-        {
-            /* (non-Javadoc)
-             * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
-             */
-            public void selectionChanged( SelectionChangedEvent event )
-            {
-                StructuredSelection selection = ( StructuredSelection ) event.getSelection();
-                setEnabled( !selection.isEmpty() );
-            }
-        } );
     }
 
 

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/dialogs/DeleteServerDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/dialogs/DeleteServerDialog.java?rev=659829&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/dialogs/DeleteServerDialog.java (added)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/dialogs/DeleteServerDialog.java Sat May 24 07:44:50 2008
@@ -0,0 +1,128 @@
+/*
+ *  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.apacheds.experimentations.dialogs;
+
+
+import org.apache.directory.studio.apacheds.experimentations.model.ServerInstance;
+import org.apache.directory.studio.apacheds.experimentations.model.ServerStateEnum;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
+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;
+
+
+/**
+ * Dialog that prompts a user to delete server(s) and/or server configuration(s).
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DeleteServerDialog extends MessageDialog
+{
+    protected ServerInstance server;
+
+    protected Button checkDeleteRunning;
+    protected Button checkDeleteRunningStop;
+
+
+    /**
+     * Creates a new DeleteServerDialog.
+     * 
+     * @param parentShell a shell
+     * @param server
+     *      the server
+     */
+    public DeleteServerDialog( Shell parentShell, ServerInstance server )
+    {
+        super( parentShell, "Delete Server", null, null, QUESTION, new String[]
+            { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0 );
+
+        if ( server == null )
+        {
+            throw new IllegalArgumentException();
+        }
+
+        this.server = server;
+        message = NLS.bind( "Are you sure you want to delete {0}?", server.getName() );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.MessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
+     */
+    protected Control createCustomArea( Composite parent )
+    {
+        // create a composite with standard margins and spacing
+        Composite composite = new Composite( parent, SWT.NONE );
+        GridLayout layout = new GridLayout();
+        layout.marginHeight = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_MARGIN );
+        layout.marginWidth = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_MARGIN );
+        layout.verticalSpacing = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_SPACING );
+        layout.horizontalSpacing = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_SPACING );
+        composite.setLayout( layout );
+        composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
+        composite.setFont( parent.getFont() );
+
+        // prompt for stopping running server
+        if ( server.getState() != ServerStateEnum.STOPPED )
+        {
+            checkDeleteRunning = new Button( composite, SWT.CHECK );
+            checkDeleteRunning.setText( "Delete running server" );
+            checkDeleteRunning.setSelection( true );
+
+            checkDeleteRunningStop = new Button( composite, SWT.CHECK );
+            checkDeleteRunningStop.setText( "Stop server before deleting" );
+            checkDeleteRunningStop.setSelection( true );
+            GridData data = new GridData();
+            data.horizontalIndent = 15;
+            checkDeleteRunningStop.setLayoutData( data );
+
+            checkDeleteRunning.addSelectionListener( new SelectionAdapter()
+            {
+                public void widgetSelected( SelectionEvent e )
+                {
+                    checkDeleteRunningStop.setEnabled( checkDeleteRunning.getSelection() );
+                }
+            } );
+        }
+
+        Dialog.applyDialogFont( composite );
+
+        return composite;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.MessageDialog#buttonPressed(int)
+     */
+    protected void buttonPressed( int buttonId )
+    {
+        super.buttonPressed( buttonId );
+    }
+}
\ No newline at end of file

Modified: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/jobs/LaunchServerInstanceJob.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/jobs/LaunchServerInstanceJob.java?rev=659829&r1=659828&r2=659829&view=diff
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/jobs/LaunchServerInstanceJob.java (original)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/jobs/LaunchServerInstanceJob.java Sat May 24 07:44:50 2008
@@ -32,6 +32,7 @@
 import org.apache.directory.studio.apacheds.experimentations.ConsolesHandler;
 import org.apache.directory.studio.apacheds.experimentations.LogMessageConsole;
 import org.apache.directory.studio.apacheds.experimentations.model.ServerInstance;
+import org.apache.directory.studio.apacheds.experimentations.model.ServerStateEnum;
 import org.apache.log4j.net.SocketServer;
 import org.apache.mina.util.AvailablePortFinder;
 import org.eclipse.core.runtime.CoreException;
@@ -55,7 +56,6 @@
 import org.eclipse.swt.widgets.Display;
 
 
-
 /**
  * This class implements a {@link Job} that is used to launch a server instance.
  *
@@ -87,6 +87,8 @@
         // Setting the name of the Job
         setName( "Starting " + serverInstance.getName() + "..." );
 
+        serverInstance.setState( ServerStateEnum.STARTING );
+
         Display.getDefault().asyncExec( new Runnable()
         {
             public void run()
@@ -116,6 +118,17 @@
         // Launching Apache DS
         launchApacheDS();
 
+        try
+        {
+            Thread.sleep( 1000 );
+        }
+        catch ( InterruptedException e )
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        serverInstance.setState( ServerStateEnum.STARTED );
+
         return Status.OK_STATUS;
     }
 

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerEvent.java?rev=659829&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerEvent.java (added)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerEvent.java Sat May 24 07:44:50 2008
@@ -0,0 +1,68 @@
+/*
+ *  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.apacheds.experimentations.model;
+
+
+/**
+ * This class defines a server event.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ServerEvent
+{
+    /** The server */
+    private ServerInstance server;
+
+    /** The kind of event */
+    private ServerEventEnum kind;
+
+
+    public ServerEvent( ServerInstance server, ServerEventEnum kind )
+    {
+        super();
+        this.server = server;
+        this.kind = kind;
+    }
+
+
+    public ServerInstance getServer()
+    {
+        return server;
+    }
+
+
+    public void setServer( ServerInstance server )
+    {
+        this.server = server;
+    }
+
+
+    public ServerEventEnum getKind()
+    {
+        return kind;
+    }
+
+
+    public void setKind( ServerEventEnum kind )
+    {
+        this.kind = kind;
+    }
+}

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerEventEnum.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerEventEnum.java?rev=659829&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerEventEnum.java (added)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerEventEnum.java Sat May 24 07:44:50 2008
@@ -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.apacheds.experimentations.model;
+
+
+/**
+ * This enums defines the different server events notificiations.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public enum ServerEventEnum
+{
+    RENAMED, STATE_CHANGED
+}

Modified: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerInstance.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerInstance.java?rev=659829&r1=659828&r2=659829&view=diff
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerInstance.java (original)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerInstance.java Sat May 24 07:44:50 2008
@@ -20,6 +20,8 @@
 package org.apache.directory.studio.apacheds.experimentations.model;
 
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.UUID;
 
 import org.eclipse.core.runtime.IAdaptable;
@@ -42,6 +44,8 @@
     /** The state of the instance */
     private ServerStateEnum state = ServerStateEnum.STOPPED;
 
+    private List<ServerListener> listeners = new ArrayList<ServerListener>();
+
 
     /**
      * Creates a new instance of ApacheDsInstance.
@@ -51,6 +55,28 @@
     }
 
 
+    public void addListener( ServerListener listener )
+    {
+        if ( listener == null )
+        {
+            throw new IllegalArgumentException( "Listener cannot be null" );
+        }
+
+        listeners.add( listener );
+    }
+
+
+    public void removeListener( ServerListener listener )
+    {
+        if ( listener == null )
+        {
+            throw new IllegalArgumentException( "Listener cannot be null" );
+        }
+
+        listeners.remove( listener );
+    }
+
+
     /**
      * Creates a new instance of ApacheDsInstance.
      * <p>
@@ -101,7 +127,26 @@
      */
     public void setName( String name )
     {
+        if ( this.name == name )
+        {
+            return;
+        }
+
         this.name = name;
+
+        fireServerNameChangeEvent();
+    }
+
+
+    /**
+     * Fire a server listener name change event.
+     */
+    private void fireServerNameChangeEvent()
+    {
+        for ( ServerListener listener : listeners.toArray( new ServerListener[0] ) )
+        {
+            listener.serverChanged( new ServerEvent( this, ServerEventEnum.RENAMED ) );
+        }
     }
 
 
@@ -161,7 +206,26 @@
      */
     public void setState( ServerStateEnum state )
     {
+        if ( this.state == state )
+        {
+            return;
+        }
+
         this.state = state;
+
+        fireServerStateChangeEvent();
+    }
+
+
+    /**
+     * Fire a server listener state change event.
+     */
+    private void fireServerStateChangeEvent()
+    {
+        for ( ServerListener listener : listeners.toArray( new ServerListener[0] ) )
+        {
+            listener.serverChanged( new ServerEvent( this, ServerEventEnum.STATE_CHANGED ) );
+        }
     }
 
 

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerListener.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerListener.java?rev=659829&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerListener.java (added)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServerListener.java Sat May 24 07:44:50 2008
@@ -0,0 +1,38 @@
+/*
+ *  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.apacheds.experimentations.model;
+
+
+/**
+ * This interface defines a listener for a server.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ServerListener
+{
+    /**
+     * This method is called when the server is changed.
+     *
+     * @param event
+     *      the server event
+     */
+    public void serverChanged( ServerEvent event );
+}

Modified: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServersHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServersHandler.java?rev=659829&r1=659828&r2=659829&view=diff
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServersHandler.java (original)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/model/ServersHandler.java Sat May 24 07:44:50 2008
@@ -130,7 +130,7 @@
             {
                 for ( ServersHandlerListener listener : listeners.toArray( new ServersHandlerListener[0] ) )
                 {
-                    listener.serverInstanceRemoved( serverInstance );
+                    listener.serverInstanceAdded( serverInstance );
                 }
             }
         }

Modified: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/properties/ServerInstancePropertyPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/properties/ServerInstancePropertyPage.java?rev=659829&r1=659828&r2=659829&view=diff
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/properties/ServerInstancePropertyPage.java (original)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/properties/ServerInstancePropertyPage.java Sat May 24 07:44:50 2008
@@ -25,7 +25,6 @@
 import org.eclipse.swt.SWT;
 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.Label;
@@ -65,14 +64,20 @@
         // Name
         Label nameLabel = new Label( composite, SWT.NONE );
         nameLabel.setText( "Name:" );
-        Text nameText = createLabeledText( composite, "", 1 );
+        Text nameText = new Text( composite, SWT.NONE );
+        nameText.setEditable( false );
+        nameText.setBackground( parent.getBackground() );
         nameText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
 
         // Location
         Label locationLabel = new Label( composite, SWT.NONE );
-        locationLabel.setText( "Location" );
-        Text locationText = createLabeledText( composite, "", 1 );
-        locationText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        locationLabel.setText( "Location:" );
+        Text locationText = new Text( composite, SWT.WRAP );
+        locationText.setEditable( false );
+        locationText.setBackground( parent.getBackground() );
+        GridData gd = new GridData( SWT.FILL, SWT.NONE, true, false );
+        gd.widthHint = 300;
+        locationText.setLayoutData( gd );
 
         // Getting the server instance
         ServerInstance serverInstance = ( ServerInstance ) getElement();
@@ -85,28 +90,4 @@
 
         return parent;
     }
-
-
-    /**
-     * Creates a SWT {@link Text} under the given parent.
-     * The created text control behaves like a label: it has no border, 
-     * a grayed background and is not modifyable. 
-     * But the text is selectable and could be copied.
-     *
-     * @param parent the parent
-     * @param text the initial text
-     * @param span the horizontal span
-     * @return the created text
-     */
-    public static Text createLabeledText( Composite parent, String text, int span )
-    {
-        Text t = new Text( parent, SWT.NONE );
-        GridData gd = new GridData( GridData.FILL_HORIZONTAL );
-        gd.horizontalSpan = span;
-        t.setLayoutData( gd );
-        t.setEditable( false );
-        t.setBackground( parent.getBackground() );
-        t.setText( text );
-        return t;
-    }
 }

Added: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServerTableViewer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServerTableViewer.java?rev=659829&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServerTableViewer.java (added)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServerTableViewer.java Sat May 24 07:44:50 2008
@@ -0,0 +1,349 @@
+/*
+ *  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.apacheds.experimentations.views;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.studio.apacheds.experimentations.model.ServerEvent;
+import org.apache.directory.studio.apacheds.experimentations.model.ServerEventEnum;
+import org.apache.directory.studio.apacheds.experimentations.model.ServerInstance;
+import org.apache.directory.studio.apacheds.experimentations.model.ServerListener;
+import org.apache.directory.studio.apacheds.experimentations.model.ServerStateEnum;
+import org.apache.directory.studio.apacheds.experimentations.model.ServersHandler;
+import org.apache.directory.studio.apacheds.experimentations.model.ServersHandlerListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.Widget;
+
+
+/**
+ * This class implements a {@link TreeViewer} that displays the servers.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ServerTableViewer extends TreeViewer
+{
+    protected static final String ROOT = "root";
+
+    private ServersView view;
+
+    private boolean stopAnimation;
+
+    private ServersViewLabelProvider labelProvider;
+
+    private List<ServerInstance> serversNeedingAnimation = new ArrayList<ServerInstance>();
+
+    /** The server handler listener */
+    private ServersHandlerListener serversHandlerListener;
+
+    /** The server listener */
+    private ServerListener serverListener;
+
+
+    public ServerTableViewer( ServersView view, Tree tree )
+    {
+        super( tree );
+        this.view = view;
+
+        labelProvider = new ServersViewLabelProvider();
+        setLabelProvider( labelProvider );
+        setContentProvider( new ServersViewContentProvider() );
+
+        setInput( ROOT );
+
+        addListeners();
+    }
+
+
+    /**
+     * Adds the listener
+     */
+    private void addListeners()
+    {
+        // The server handler listener
+        serversHandlerListener = new ServersHandlerListener()
+        {
+            public void serverInstanceAdded( ServerInstance serverInstance )
+            {
+                addServer( serverInstance );
+                serverInstance.addListener( serverListener );
+            }
+
+
+            public void serverInstanceRemoved( ServerInstance serverInstance )
+            {
+                refreshServer( serverInstance );
+            }
+
+
+            public void serverInstanceUpdated( ServerInstance serverInstance )
+            {
+                removeServer( serverInstance );
+                serverInstance.removeListener( serverListener );
+
+            }
+        };
+
+        // Adding the listener to the servers handler
+        ServersHandler.getDefault().addListener( serversHandlerListener );
+
+        // The server listener
+        serverListener = new ServerListener()
+        {
+            public void serverChanged( ServerEvent event )
+            {
+                // Checking if the event is null
+                if ( event == null )
+                {
+                    return;
+                }
+
+                // Getting the kind of event and the associated server 
+                ServerEventEnum kind = event.getKind();
+                ServerInstance server = event.getServer();
+                switch ( kind )
+                {
+                    // The server state has changed
+                    case STATE_CHANGED:
+                        // First, we refresh the server
+                        refreshServer( server );
+
+                        // Then, we get the state of the server to see if we
+                        // need to start or stop the animation thread
+                        ServerStateEnum state = server.getState();
+
+                        // If the state is STARTING or STOPPING, we need to
+                        // add the server to the list of servers needing
+                        // animation and eventually start the animation thread
+                        if ( ( state == ServerStateEnum.STARTING ) || ( state == ServerStateEnum.STOPPING ) )
+                        {
+                            boolean startAnimationThread = false;
+
+                            synchronized ( serversNeedingAnimation )
+                            {
+                                if ( !serversNeedingAnimation.contains( server ) )
+                                {
+                                    if ( serversNeedingAnimation.isEmpty() )
+                                        startAnimationThread = true;
+                                    serversNeedingAnimation.add( server );
+                                }
+                            }
+
+                            if ( startAnimationThread )
+                            {
+                                startAnimationThread();
+                            }
+                        }
+
+                        // If the state is *not* STARTING or STOPPING, we need
+                        // to remove the server from the list of servers
+                        // needing animation and eventually stop the animation
+                        // if this list is empty
+                        else
+                        {
+                            boolean stopAnimationThread = false;
+
+                            synchronized ( serversNeedingAnimation )
+                            {
+                                if ( serversNeedingAnimation.contains( server ) )
+                                {
+                                    serversNeedingAnimation.remove( server );
+                                    if ( serversNeedingAnimation.isEmpty() )
+                                        stopAnimationThread = true;
+                                }
+                            }
+
+                            if ( stopAnimationThread )
+                            {
+                                stopAnimationThread();
+                            }
+                        }
+                        break;
+                    // The server has been renamed
+                    case RENAMED:
+                        // We simply refresh the server
+                        refreshServer( server );
+                        break;
+                }
+
+            }
+        };
+
+        // Adding the listener to the servers
+        for ( ServerInstance server : ServersHandler.getDefault().getServerInstancesList() )
+        {
+            server.addListener( serverListener );
+        }
+    }
+
+
+    /**
+     * Adds a server.
+     * 
+     * @param server
+     *      the server
+     */
+    private void addServer( final ServerInstance server )
+    {
+        Display.getDefault().asyncExec( new Runnable()
+        {
+            public void run()
+            {
+                add( ROOT, server );
+            }
+        } );
+    }
+
+
+    /**
+     * Refreshes a server.
+     * 
+     * @param server
+     *      the server
+     */
+    private void refreshServer( final ServerInstance server )
+    {
+        Display.getDefault().asyncExec( new Runnable()
+        {
+            public void run()
+            {
+                try
+                {
+                    refresh( server );
+                    ISelection sel = ServerTableViewer.this.getSelection();
+                    ServerTableViewer.this.setSelection( sel );
+                }
+                catch ( Exception e )
+                {
+                    // ignore
+                }
+            }
+        } );
+    }
+
+
+    /**
+     * Removes a server.
+     * 
+     * @param server
+     *      the server
+     */
+    private void removeServer( final ServerInstance server )
+    {
+        Display.getDefault().asyncExec( new Runnable()
+        {
+            public void run()
+            {
+                remove( server );
+            }
+        } );
+    }
+
+
+    /**
+     * Starts the animation thread.
+     */
+    private void startAnimationThread()
+    {
+        stopAnimation = false;
+
+        final Display display = getTree().getDisplay();
+        final int SLEEP = 200;
+        final Runnable[] animatorThread = new Runnable[1];
+        animatorThread[0] = new Runnable()
+        {
+            public void run()
+            {
+                // Checking if we need to stop the animation
+                if ( !stopAnimation )
+                {
+                    try
+                    {
+                        // Changing the animation state on the label provider
+                        labelProvider.animate();
+
+                        // Looping on the currently starting servers
+                        for ( ServerInstance server : serversNeedingAnimation.toArray( new ServerInstance[0] ) )
+                        {
+                            if ( server != null && getTree() != null && !getTree().isDisposed() )
+                            {
+                                updateAnimation( server );
+                            }
+                        }
+                    }
+                    catch ( Exception e )
+                    {
+                        //                        Trace.trace( Trace.FINEST, "Error in Servers view animation", e ); TODO
+                    }
+
+                    // Re-launching the animation
+                    display.timerExec( SLEEP, animatorThread[0] );
+                }
+            }
+        };
+
+        // Launching the animation asynchronously
+        Display.getDefault().asyncExec( new Runnable()
+        {
+            public void run()
+            {
+                display.timerExec( SLEEP, animatorThread[0] );
+            }
+        } );
+    }
+
+
+    /**
+     * Stops the animation thread.
+     */
+    private void stopAnimationThread()
+    {
+        stopAnimation = true;
+    }
+
+
+    /**
+     * Updates the animation for the given server
+     *
+     * @param server
+     *      the server
+     */
+    private void updateAnimation( ServerInstance server )
+    {
+        try
+        {
+            Widget widget = doFindItem( server );
+            TreeItem item = ( TreeItem ) widget;
+            item.setText( 1, labelProvider.getColumnText( server, 1 ) );
+            item.setImage( 1, labelProvider.getColumnImage( server, 1 ) );
+        }
+        catch ( Exception e )
+        {
+            //            Trace.trace( Trace.WARNING, "Error in optimized animation", e );
+            //TODO
+        }
+    }
+}
\ No newline at end of file

Modified: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServersView.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServersView.java?rev=659829&r1=659828&r2=659829&view=diff
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServersView.java (original)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServersView.java Sat May 24 07:44:50 2008
@@ -20,25 +20,24 @@
 package org.apache.directory.studio.apacheds.experimentations.views;
 
 
-import org.apache.directory.studio.apacheds.configuration.editor.ServerConfigurationEditor;
-import org.apache.directory.studio.apacheds.experimentations.ApacheDsPluginUtils;
+import org.apache.directory.studio.apacheds.experimentations.actions.DeleteAction;
 import org.apache.directory.studio.apacheds.experimentations.actions.NewServerInstanceAction;
+import org.apache.directory.studio.apacheds.experimentations.actions.OpenAction;
 import org.apache.directory.studio.apacheds.experimentations.actions.PropertiesAction;
 import org.apache.directory.studio.apacheds.experimentations.actions.ServerInstanceRunAction;
 import org.apache.directory.studio.apacheds.experimentations.actions.ServerInstanceStopAction;
 import org.apache.directory.studio.apacheds.experimentations.model.ServerInstance;
 import org.apache.directory.studio.apacheds.experimentations.model.ServersHandler;
 import org.apache.directory.studio.apacheds.experimentations.model.ServersHandlerListener;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Platform;
 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.resource.ImageDescriptor;
 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;
@@ -46,15 +45,9 @@
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Tree;
 import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPathEditorInput;
-import org.eclipse.ui.IPersistableElement;
 import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.part.ViewPart;
 
 
@@ -72,7 +65,7 @@
     public static final String ID = "org.apache.directory.studio.apacheds.experimentations.serversView";
 
     /** The table viewer */
-    private TreeViewer tableViewer;
+    private ServerTableViewer tableViewer;
 
     private static final String TAG_COLUMN_WIDTH = "columnWidth";
     protected int[] cols;
@@ -82,6 +75,8 @@
     private ServerInstanceRunAction serverInstanceRun;
     private ServerInstanceStopAction serverInstanceStop;
     private PropertiesAction properties;
+    private DeleteAction delete;
+    private OpenAction open;
 
     // Listeners
     private ServersHandlerListener serversHandlerListener = new ServersHandlerListener()
@@ -113,36 +108,35 @@
         }
     };
 
+    private Tree tree;
+
 
     /* (non-Javadoc)
      * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
      */
     public void createPartControl( Composite parent )
     {
-        // Creating the table viewer
-        tableViewer = new TreeViewer( parent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL );
-        Tree table = tableViewer.getTree();
-        table.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
-        table.setHeaderVisible( true );
-        table.setLinesVisible( false );
+        // Creating the Tree
+        tree = new Tree( parent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL );
+        tree.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+        tree.setHeaderVisible( true );
+        tree.setLinesVisible( false );
 
         // Adding columns
-        TreeColumn serverColumn = new TreeColumn( table, SWT.SINGLE );
+        TreeColumn serverColumn = new TreeColumn( tree, SWT.SINGLE );
         serverColumn.setText( "Server" );
         serverColumn.setWidth( cols[0] );
 
-        TreeColumn stateColumn = new TreeColumn( table, SWT.SINGLE );
+        TreeColumn stateColumn = new TreeColumn( tree, SWT.SINGLE );
         stateColumn.setText( "State" );
         stateColumn.setWidth( cols[1] );
 
-        tableViewer.setContentProvider( new ServersViewContentProvider() );
-        tableViewer.setLabelProvider( new ServersViewLabelProvider() );
-        //        tableViewer.setSorter( new ViewerComparator() );
+        // Creating the viewer
+        tableViewer = new ServerTableViewer( this, tree );
 
         initActions();
         initToolbar();
         initContextMenu();
-        initUI();
         initListeners();
     }
 
@@ -187,7 +181,10 @@
      */
     public void setFocus()
     {
-        tableViewer.getTree().setFocus();
+        if ( tree != null )
+        {
+            tree.setFocus();
+        }
     }
 
 
@@ -197,9 +194,21 @@
     private void initActions()
     {
         newServerInstance = new NewServerInstanceAction();
+
         serverInstanceRun = new ServerInstanceRunAction( this );
+        serverInstanceRun.setEnabled( false );
+
         serverInstanceStop = new ServerInstanceStopAction( this );
+        serverInstanceStop.setEnabled( false );
+
         properties = new PropertiesAction( this );
+        properties.setEnabled( false );
+
+        open = new OpenAction( this );
+        open.setEnabled( false );
+
+        delete = new DeleteAction( this );
+        delete.setEnabled( false );
     }
 
 
@@ -230,6 +239,9 @@
                 MenuManager newManager = new MenuManager( "New" );
                 newManager.add( newServerInstance );
                 manager.add( newManager );
+                manager.add( open );
+                manager.add( new Separator() );
+                manager.add( delete );
                 manager.add( new Separator() );
                 manager.add( serverInstanceRun );
                 manager.add( serverInstanceStop );
@@ -247,17 +259,6 @@
 
 
     /**
-     * Initializes the user interface with the servers instances.
-     */
-    private void initUI()
-    {
-        ServersHandler serversHandler = ServersHandler.getDefault();
-        tableViewer.setInput( serversHandler.getServerInstancesList() );
-
-    }
-
-
-    /**
      * Initializes the listeners
      */
     private void initListeners()
@@ -269,189 +270,92 @@
         {
             public void doubleClick( DoubleClickEvent event )
             {
-                // What we get from the TableViewer is a StructuredSelection
-                StructuredSelection selection = ( StructuredSelection ) event.getSelection();
-
-                // Here's the real object
-                ServerInstance serverInstance = ( ServerInstance ) selection.getFirstElement();
+                open.run();
+            }
+        } );
 
-                IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
-                try
-                {
-                    page.openEditor( new PathEditorInput( ApacheDsPluginUtils.getApacheDsInstancesFolder().append(
-                        serverInstance.getId() ).append( "conf" ).append( "server.xml" ) ),
-                        ServerConfigurationEditor.ID );
-                }
-                catch ( PartInitException e )
-                {
-                    // TODO
-                }
+        tableViewer.addSelectionChangedListener( new ISelectionChangedListener()
+        {
+            public void selectionChanged( SelectionChangedEvent event )
+            {
+                updateActionsStates();
             }
         } );
     }
 
 
     /**
-     * Gets the table viewer.
-     *
-     * @return
-     *      the table viewer
+     * Enables or disables the actions according to the current selection 
+     * in the viewer.
      */
-    public TreeViewer getViewer()
+    public void updateActionsStates()
     {
-        return tableViewer;
-    }
-
+        // Getting the selection
+        StructuredSelection selection = ( StructuredSelection ) tableViewer.getSelection();
 
-    /* (non-Javadoc)
-     * @see org.eclipse.ui.part.WorkbenchPart#dispose()
-     */
-    public void dispose()
-    {
-        ServersHandler serversHandler = ServersHandler.getDefault();
-        serversHandler.removeListener( serversHandlerListener );
-
-        super.dispose();
-    }
-}
-
-/**
- * This IEditorInput is used to open files that are located in the local file system.
- * 
- * Inspired from org.eclipse.ui.internal.editors.text.NonExistingFileEditorInput.java
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-class PathEditorInput implements IPathEditorInput
-{
-    /** The absolute path in local file system */
-    private IPath path;
-
-
-    /**
-     * 
-     * Creates a new instance of PathEditorInput.
-     *
-     * @param path the absolute path
-     */
-    public PathEditorInput( IPath path )
-    {
-        if ( path == null )
+        if ( !selection.isEmpty() )
         {
-            throw new IllegalArgumentException();
-        }
-
-        this.path = path;
-    }
-
-
-    /**
-     * Returns hash code of the path.
-     */
-    public int hashCode()
-    {
-        return path.hashCode();
-    }
+            ServerInstance serverInstance = ( ServerInstance ) selection.getFirstElement();
 
+            switch ( serverInstance.getState() )
+            {
+                case STARTED:
+                    serverInstanceRun.setEnabled( false );
+                    serverInstanceStop.setEnabled( true );
+                    break;
+                case STARTING:
+                    serverInstanceRun.setEnabled( false );
+                    serverInstanceStop.setEnabled( false );
+                    break;
+                case STOPPED:
+                    serverInstanceRun.setEnabled( true );
+                    serverInstanceStop.setEnabled( false );
+                    break;
+                case STOPPING:
+                    serverInstanceRun.setEnabled( false );
+                    serverInstanceStop.setEnabled( false );
+                    break;
+                case UNKNONW:
+                    serverInstanceRun.setEnabled( false );
+                    serverInstanceStop.setEnabled( false );
+                    break;
+            }
 
-    /** 
-     * This implemention just compares the paths
-     */
-    public boolean equals( Object o )
-    {
-        if ( this == o )
-        {
-            return true;
+            open.setEnabled( true );
+            delete.setEnabled( true );
+            properties.setEnabled( true );
         }
-
-        if ( o instanceof PathEditorInput )
+        else
         {
-            PathEditorInput input = ( PathEditorInput ) o;
-            return path.equals( input.path );
+            serverInstanceRun.setEnabled( false );
+            serverInstanceStop.setEnabled( false );
+            open.setEnabled( false );
+            delete.setEnabled( false );
+            properties.setEnabled( false );
         }
-
-        return false;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean exists()
-    {
-        return path.toFile().exists();
     }
 
 
     /**
-     * {@inheritDoc}
-     */
-    public ImageDescriptor getImageDescriptor()
-    {
-        return PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor( path.toString() );
-    }
-
-
-    /**
-     * Returns the file name only.
-     */
-    public String getName()
-    {
-        return path.toFile().getName();
-        //return path.toString();
-    }
-
-
-    /**
-     * Returns the complete path. 
-     */
-    public String getToolTipText()
-    {
-        return path.makeRelative().toOSString();
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public IPath getPath()
-    {
-        return path;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @SuppressWarnings("unchecked")
-    public Object getAdapter( Class adapter )
-    {
-        return Platform.getAdapterManager().getAdapter( this, adapter );
-    }
-
-
-    /**
-     * {@inheritDoc}
+     * Gets the table viewer.
+     *
+     * @return
+     *      the table viewer
      */
-    public IPersistableElement getPersistable()
+    public TreeViewer getViewer()
     {
-        return null;
+        return tableViewer;
     }
 
 
-    /**
-     * Returns the path.
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#dispose()
      */
-    public IPath getErrorMessage( Object element )
+    public void dispose()
     {
-        if ( element instanceof PathEditorInput )
-        {
-            PathEditorInput input = ( PathEditorInput ) element;
-            return input.getPath();
-        }
+        ServersHandler serversHandler = ServersHandler.getDefault();
+        serversHandler.removeListener( serversHandlerListener );
 
-        return null;
+        super.dispose();
     }
-
 }

Modified: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServersViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServersViewContentProvider.java?rev=659829&r1=659828&r2=659829&view=diff
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServersViewContentProvider.java (original)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServersViewContentProvider.java Sat May 24 07:44:50 2008
@@ -20,8 +20,7 @@
 package org.apache.directory.studio.apacheds.experimentations.views;
 
 
-import java.util.Collection;
-
+import org.apache.directory.studio.apacheds.experimentations.model.ServersHandler;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.Viewer;
@@ -40,16 +39,8 @@
      */
     public Object[] getElements( Object inputElement )
     {
-        if ( inputElement instanceof Object[] )
-        {
-            return ( Object[] ) inputElement;
-        }
-        else if ( inputElement instanceof Collection )
-        {
-            return ( ( Collection<?> ) inputElement ).toArray();
-        }
-
-        return new Object[0];
+        ServersHandler serversHandler = ServersHandler.getDefault();
+        return serversHandler.getServerInstancesList().toArray();
     }
 
 

Modified: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServersViewLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServersViewLabelProvider.java?rev=659829&r1=659828&r2=659829&view=diff
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServersViewLabelProvider.java (original)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServersViewLabelProvider.java Sat May 24 07:44:50 2008
@@ -23,6 +23,7 @@
 import org.apache.directory.studio.apacheds.experimentations.ApacheDsPlugin;
 import org.apache.directory.studio.apacheds.experimentations.ApacheDsPluginConstants;
 import org.apache.directory.studio.apacheds.experimentations.model.ServerInstance;
+import org.apache.directory.studio.apacheds.experimentations.model.ServerStateEnum;
 import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.swt.graphics.Image;
@@ -36,6 +37,12 @@
  */
 public class ServersViewLabelProvider extends LabelProvider implements ITableLabelProvider
 {
+    private static final String THREE_DOTS = "...";
+    private static final String TWO_DOTS = "..";
+    private static final String ONE_DOT = ".";
+    private int count = 1;
+
+
     /* (non-Javadoc)
      * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
      */
@@ -50,7 +57,20 @@
             }
             else if ( columnIndex == 1 )
             {
-                return serverInstance.getState().toString();
+                ServerStateEnum state = ( ( ServerInstance ) element ).getState();
+                switch ( state )
+                {
+                    case STARTED:
+                        return state.toString();
+                    case STARTING:
+                        return state.toString() + getDots();
+                    case STOPPED:
+                        return state.toString();
+                    case STOPPING:
+                        return state.toString() + getDots();
+                    case UNKNONW:
+                        return state.toString();
+                }
             }
 
         }
@@ -59,6 +79,23 @@
     }
 
 
+    private String getDots()
+    {
+        if ( count == 1 )
+        {
+            return ServersViewLabelProvider.ONE_DOT;
+        }
+        else if ( count == 2 )
+        {
+            return ServersViewLabelProvider.TWO_DOTS;
+        }
+        else
+        {
+            return ServersViewLabelProvider.THREE_DOTS;
+        }
+    }
+
+
     /* (non-Javadoc)
      * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
      */
@@ -77,11 +114,33 @@
                     case STARTED:
                         return ApacheDsPlugin.getDefault().getImage( ApacheDsPluginConstants.IMG_SERVER_STARTED );
                     case STARTING:
-                        return ApacheDsPlugin.getDefault().getImage( ApacheDsPluginConstants.IMG_SERVER_STARTING2 );
+                        switch ( count )
+                        {
+                            case 1:
+                                return ApacheDsPlugin.getDefault().getImage(
+                                    ApacheDsPluginConstants.IMG_SERVER_STARTING1 );
+                            case 2:
+                                return ApacheDsPlugin.getDefault().getImage(
+                                    ApacheDsPluginConstants.IMG_SERVER_STARTING2 );
+                            case 3:
+                                return ApacheDsPlugin.getDefault().getImage(
+                                    ApacheDsPluginConstants.IMG_SERVER_STARTING3 );
+                        }
                     case STOPPED:
                         return ApacheDsPlugin.getDefault().getImage( ApacheDsPluginConstants.IMG_SERVER_STOPPED );
                     case STOPPING:
-                        return ApacheDsPlugin.getDefault().getImage( ApacheDsPluginConstants.IMG_SERVER_STOPPING2 );
+                        switch ( count )
+                        {
+                            case 1:
+                                return ApacheDsPlugin.getDefault().getImage(
+                                    ApacheDsPluginConstants.IMG_SERVER_STOPPING1 );
+                            case 2:
+                                return ApacheDsPlugin.getDefault().getImage(
+                                    ApacheDsPluginConstants.IMG_SERVER_STOPPING2 );
+                            case 3:
+                                return ApacheDsPlugin.getDefault().getImage(
+                                    ApacheDsPluginConstants.IMG_SERVER_STOPPING3 );
+                        }
                     case UNKNONW:
                         return ApacheDsPlugin.getDefault().getImage( ApacheDsPluginConstants.IMG_SERVER );
                 }
@@ -90,4 +149,15 @@
 
         return null;
     }
+
+
+    public void animate()
+    {
+        count++;
+
+        if ( count > 3 )
+        {
+            count = 1;
+        }
+    }
 }