directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r653501 - 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/apacheds/exp...
Date Mon, 05 May 2008 15:30:12 GMT
Author: pamarcelot
Date: Mon May  5 08:30:11 2008
New Revision: 653501

URL: http://svn.apache.org/viewvc?rev=653501&view=rev
Log:
o Added Run and Stop Actions
o Linked them to the view
o Removed unused class
o Improved Launch Job

Added:
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/resources/icons/run.gif
  (with props)
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/resources/icons/stop.gif
  (with props)
    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
Removed:
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/ConsoleDisplayMgr.java
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/jobs/LaunchServerInstanceJob.java
    directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/views/ServersView.java

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

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

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

Propchange: directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/resources/icons/stop.gif
------------------------------------------------------------------------------
    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=653501&r1=653500&r2=653501&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
Mon May  5 08:30:11 2008
@@ -33,12 +33,17 @@
     // -------
     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_RUN = "resources/icons/run.gif";
+    public static final String IMG_STOP = "resources/icons/stop.gif";
 
     // -------
     // ACTIONS
     // -------
     public static final String ACTION_NEW_SERVER_INSTANCE = "org.apache.directory.studio.apacheds.experimentations.actions.newServerInstanceAction";
-
+    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";
+    
+    
     // -----------
     // PREFERENCES
     // -----------

Added: 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=653501&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/ServerInstanceRunAction.java
(added)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/ServerInstanceRunAction.java
Mon May  5 08:30:11 2008
@@ -0,0 +1,124 @@
+/*
+ *  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.ApacheDsPlugin;
+import org.apache.directory.studio.apacheds.experimentations.ApacheDsPluginConstants;
+import org.apache.directory.studio.apacheds.experimentations.jobs.LaunchServerInstanceJob;
+import org.apache.directory.studio.apacheds.experimentations.model.ServerInstance;
+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.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+
+/**
+ * This class implements the run action for a server instance.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ServerInstanceRunAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /** The associated view */
+    private ServersView view;
+
+
+    /**
+     * Creates a new instance of NewServerInstanceAction.
+     */
+    public ServerInstanceRunAction( ServersView view )
+    {
+        super( "Run" );
+        this.view = view;
+        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() );
+            }
+        } );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
+        if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
+        {
+            LaunchServerInstanceJob job = new LaunchServerInstanceJob( ( ServerInstance )
selection.getFirstElement() );
+            job.schedule();
+        }
+    }
+
+
+    /* (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
+    }
+}

Added: 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=653501&view=auto
==============================================================================
--- directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/ServerInstanceStopAction.java
(added)
+++ directory/sandbox/pamarcelot/studio-apacheds-plugin/studio-apacheds-experimentations/src/main/java/org/apache/directory/studio/apacheds/experimentations/actions/ServerInstanceStopAction.java
Mon May  5 08:30:11 2008
@@ -0,0 +1,116 @@
+/*
+ *  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.ApacheDsPlugin;
+import org.apache.directory.studio.apacheds.experimentations.ApacheDsPluginConstants;
+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.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+
+/**
+ * This class implements the stop action for a server instance.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ServerInstanceStopAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /** The associated view */
+    private ServersView view;
+
+
+    /**
+     * Creates a new instance of NewServerInstanceAction.
+     */
+    public ServerInstanceStopAction( ServersView view )
+    {
+        super( "Stop" );
+        this.view = view;
+        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() );
+            }
+        } );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+    }
+
+
+    /* (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/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=653501&r1=653500&r2=653501&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
Mon May  5 08:30:11 2008
@@ -117,8 +117,26 @@
         workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classpath
);
         workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH,
false );
 
-        workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
-            "/usr/local/apacheds-1.5.2/conf/server.xml" );
+        IPath instancesFolderPath = ApacheDsPluginUtils.getApacheDsInstancesFolder();
+        IPath instanceFolderPath = instancesFolderPath.append( serverInstance.getId() );
+
+        StringBuffer arguments = new StringBuffer();
+        arguments.append( instanceFolderPath.append( "conf" ).append( "server.xml" ).toOSString()
);
+        arguments.append( " " );
+        arguments.append( "-Dlog4j.configuration="
+            + instanceFolderPath.append( "conf" ).append( "log4j.properties" ).toOSString()
);
+        arguments.append( " " );
+        arguments.append( "-Dapacheds.var.dir=" + instanceFolderPath.toOSString() );
+        arguments.append( " " );
+        arguments.append( "-Dapacheds.log.dir=" + instanceFolderPath.append( "log" ).toOSString()
);
+        arguments.append( " " );
+        arguments.append( "-Dapacheds.run.dir=" + instanceFolderPath.append( "run" ).toOSString()
);
+        arguments.append( " " );
+        arguments.append( "-Dapacheds.instance=" + serverInstance.getName() );
+
+        System.err.println( arguments.toString() );
+
+        workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
arguments.toString() );
 
         ILaunchConfiguration configuration = null;
         try

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=653501&r1=653500&r2=653501&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
Mon May  5 08:30:11 2008
@@ -23,14 +23,16 @@
 import org.apache.directory.studio.apacheds.experimentations.ApacheDsPlugin;
 import org.apache.directory.studio.apacheds.experimentations.ApacheDsPluginConstants;
 import org.apache.directory.studio.apacheds.experimentations.actions.NewServerInstanceAction;
+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.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.ViewerSorter;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.layout.GridData;
@@ -56,6 +58,8 @@
 
     // Actions
     private NewServerInstanceAction newServerInstance;
+    private ServerInstanceRunAction serverInstanceRun;
+    private ServerInstanceStopAction serverInstanceStop;
 
     // Listeners
     private ServersHandlerListener serversHandlerListener = new ServersHandlerListener()
@@ -153,6 +157,8 @@
     private void initActions()
     {
         newServerInstance = new NewServerInstanceAction();
+        serverInstanceRun = new ServerInstanceRunAction( this );
+        serverInstanceStop = new ServerInstanceStopAction( this );
     }
 
 
@@ -163,6 +169,9 @@
     {
         IToolBarManager toolbar = getViewSite().getActionBars().getToolBarManager();
         toolbar.add( newServerInstance );
+        toolbar.add( new Separator() );
+        toolbar.add( serverInstanceRun );
+        toolbar.add( serverInstanceStop );
     }
 
 



Mime
View raw message