directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r663873 - in /directory/studio/trunk/rcp: pom.xml src/main/java/org/apache/directory/studio/Application.java
Date Fri, 06 Jun 2008 09:45:03 GMT
Author: pamarcelot
Date: Fri Jun  6 02:45:03 2008
New Revision: 663873

URL: http://svn.apache.org/viewvc?rev=663873&view=rev
Log:
The Application class now implements the IApplication interface since the IPlatformRunnable
interface is deprecated.

Modified:
    directory/studio/trunk/rcp/pom.xml
    directory/studio/trunk/rcp/src/main/java/org/apache/directory/studio/Application.java

Modified: directory/studio/trunk/rcp/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/rcp/pom.xml?rev=663873&r1=663872&r2=663873&view=diff
==============================================================================
--- directory/studio/trunk/rcp/pom.xml (original)
+++ directory/studio/trunk/rcp/pom.xml Fri Jun  6 02:45:03 2008
@@ -180,6 +180,11 @@
       <artifactId>filesystem</artifactId>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>org.eclipse.equinox</groupId>
+      <artifactId>app</artifactId>
+      <scope>provided</scope>
+    </dependency>
   </dependencies>
 
 </project>

Modified: directory/studio/trunk/rcp/src/main/java/org/apache/directory/studio/Application.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/rcp/src/main/java/org/apache/directory/studio/Application.java?rev=663873&r1=663872&r2=663873&view=diff
==============================================================================
--- directory/studio/trunk/rcp/src/main/java/org/apache/directory/studio/Application.java
(original)
+++ directory/studio/trunk/rcp/src/main/java/org/apache/directory/studio/Application.java
Fri Jun  6 02:45:03 2008
@@ -23,9 +23,11 @@
 
 import org.apache.log4j.Logger;
 import org.apache.log4j.PropertyConfigurator;
-import org.eclipse.core.runtime.IPlatformRunnable;
 import org.eclipse.core.runtime.Platform;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
 import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.PlatformUI;
 
 
@@ -35,33 +37,36 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class Application implements IPlatformRunnable
+public class Application implements IApplication
 {
-
+    /** The plugin ID */
     public static final String PLUGIN_ID = "org.apache.directory.studio.rcp"; //$NON-NLS-1$
+
+    /** The logger*/
     private static Logger logger = Logger.getLogger( Application.class );
 
 
     /* (non-Javadoc)
-     * @see org.eclipse.core.runtime.IPlatformRunnable#run(java.lang.Object)
+     * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
      */
-    public Object run( Object args ) throws Exception
+    public Object start( IApplicationContext context ) throws Exception
     {
-        //Set up a simple configuration that logs on the console.
+        // Set up a simple configuration that logs on the console.
         PropertyConfigurator.configure( Platform.getBundle( Application.PLUGIN_ID ).getResource(
"log4j.conf" ) ); //$NON-NLS-1$
         logger.info( "Entering Apache Directory Studio." ); //$NON-NLS-1$
         Display display = PlatformUI.createDisplay();
-        
+
         try
         {
             int returnCode = PlatformUI.createAndRunWorkbench( display, new ApplicationWorkbenchAdvisor()
);
-        
             if ( returnCode == PlatformUI.RETURN_RESTART )
             {
-                return IPlatformRunnable.EXIT_RESTART;
+                return IApplication.EXIT_RESTART;
+            }
+            else
+            {
+                return IApplication.EXIT_OK;
             }
-            
-            return IPlatformRunnable.EXIT_OK;
         }
         finally
         {
@@ -69,4 +74,28 @@
             logger.info( "Exiting Apache Directory Studio." ); //$NON-NLS-1$
         }
     }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.equinox.app.IApplication#stop()
+     */
+    public void stop()
+    {
+        final IWorkbench workbench = PlatformUI.getWorkbench();
+        if ( workbench == null )
+        {
+            return;
+        }
+        final Display display = workbench.getDisplay();
+        display.syncExec( new Runnable()
+        {
+            public void run()
+            {
+                if ( !display.isDisposed() )
+                {
+                    workbench.close();
+                }
+            }
+        } );
+    }
 }



Mime
View raw message