directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r986350 - in /directory/studio/trunk/plugins: common.ui/src/main/java/org/apache/directory/studio/common/ui/ ldapservers/src/main/java/org/apache/directory/studio/ldapservers/ ldapservers/src/main/java/org/apache/directory/studio/ldapserver...
Date Tue, 17 Aug 2010 15:03:36 GMT
Author: pamarcelot
Date: Tue Aug 17 15:03:36 2010
New Revision: 986350

URL: http://svn.apache.org/viewvc?rev=986350&view=rev
Log:
Renamed and added methods in CommonUIUtils.
Added the display of a warning message to the UnknownLdapServerAdapterExtension when the methods
'add()', 'openConfiguration()', 'start()' and 'stop()' are used.

Modified:
    directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/CommonUIUtils.java
    directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManager.java
    directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersUtils.java
    directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/UnknownLdapServerAdapterExtension.java

Modified: directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/CommonUIUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/CommonUIUtils.java?rev=986350&r1=986349&r2=986350&view=diff
==============================================================================
--- directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/CommonUIUtils.java
(original)
+++ directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/CommonUIUtils.java
Tue Aug 17 15:03:36 2010
@@ -33,15 +33,87 @@ import org.eclipse.ui.PlatformUI;
 public class CommonUIUtils
 {
     /**
-     * Reports an error.
+     * Opens an Error {@link MessageDialog} with the given message.
      *
      * @param message
      *      the message
      */
-    public static void reportError( String message )
+    public static void openErrorDialog( String message )
+    {
+        openErrorDialog( "Error!", message );
+    }
+
+
+    /**
+     * Opens an Error {@link MessageDialog} with the given title and message.
+     *
+     * @param title
+     *      the title
+     * @param message
+     *      the message
+     */
+    public static void openErrorDialog( String title, String message )
+    {
+        MessageDialog dialog = new MessageDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+            title, null, message, MessageDialog.ERROR, new String[]
+                { IDialogConstants.OK_LABEL }, MessageDialog.OK );
+        dialog.open();
+    }
+
+
+    /**
+     * Opens an Information {@link MessageDialog} with the given message.
+     *
+     * @param message
+     *      the message
+     */
+    public static void openInformationDialog( String message )
+    {
+        openInformationDialog( "Information", message );
+    }
+
+
+    /**
+     * Opens an Information {@link MessageDialog} with the given title and message.
+     *
+     * @param title
+     *      the title
+     * @param message
+     *      the message
+     */
+    public static void openInformationDialog( String title, String message )
+    {
+        MessageDialog dialog = new MessageDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+            title, null, message, MessageDialog.INFORMATION, new String[]
+                { IDialogConstants.OK_LABEL }, MessageDialog.OK );
+        dialog.open();
+    }
+
+
+    /**
+     * Opens an Warning {@link MessageDialog} with the given message.
+     *
+     * @param message
+     *      the message
+     */
+    public static void openWarningDialog( String message )
+    {
+        openInformationDialog( "Information", message );
+    }
+
+
+    /**
+     * Opens an Warning {@link MessageDialog} with the given title and message.
+     *
+     * @param title
+     *      the title
+     * @param message
+     *      the message
+     */
+    public static void openWarningDialog( String title, String message )
     {
         MessageDialog dialog = new MessageDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
-            "Error!", null, message, MessageDialog.ERROR, new String[]
+            title, null, message, MessageDialog.WARNING, new String[]
                 { IDialogConstants.OK_LABEL }, MessageDialog.OK );
         dialog.open();
     }

Modified: directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManager.java?rev=986350&r1=986349&r2=986350&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManager.java
(original)
+++ directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManager.java
Tue Aug 17 15:03:36 2010
@@ -276,13 +276,13 @@ public class LdapServersManager
                     }
                     catch ( Exception e )
                     {
-                        CommonUIUtils.reportError( Messages.getString( "LdapServersManager.ErrorLoadingServer"
) //$NON-NLS-1$
+                        CommonUIUtils.openErrorDialog( Messages.getString( "LdapServersManager.ErrorLoadingServer"
) //$NON-NLS-1$
                             + e.getMessage() );
                     }
                 }
                 else
                 {
-                    CommonUIUtils.reportError( Messages.getString( "LdapServersManager.ErrorLoadingServer"
) //$NON-NLS-1$
+                    CommonUIUtils.openErrorDialog( Messages.getString( "LdapServersManager.ErrorLoadingServer"
) //$NON-NLS-1$
                         + exceptionMessage );
                 }
             }
@@ -329,7 +329,7 @@ public class LdapServersManager
             catch ( Exception e )
             {
                 CommonUIUtils
-                    .reportError( Messages.getString( "LdapServersManager.ErrorLoadingServer"
) + e.getMessage() ); //$NON-NLS-1$
+                    .openErrorDialog( Messages.getString( "LdapServersManager.ErrorLoadingServer"
) + e.getMessage() ); //$NON-NLS-1$
             }
         }
     }

Modified: directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersUtils.java?rev=986350&r1=986349&r2=986350&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersUtils.java
(original)
+++ directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersUtils.java
Tue Aug 17 15:03:36 2010
@@ -328,7 +328,7 @@ public class LdapServersUtils
                 }
                 catch ( IOException e )
                 {
-                    CommonUIUtils.reportError( "An error occurred when copying the library
'" + library
+                    CommonUIUtils.openErrorDialog( "An error occurred when copying the library
'" + library
                         + "' to the location '" + destinationLibraryFile.getAbsolutePath()
+ "'.\n\n" + e.getMessage() );
                 }
             }

Modified: directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/UnknownLdapServerAdapterExtension.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/UnknownLdapServerAdapterExtension.java?rev=986350&r1=986349&r2=986350&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/UnknownLdapServerAdapterExtension.java
(original)
+++ directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/UnknownLdapServerAdapterExtension.java
Tue Aug 17 15:03:36 2010
@@ -23,11 +23,8 @@ package org.apache.directory.studio.ldap
 
 import org.apache.directory.studio.common.core.jobs.StudioProgressMonitor;
 import org.apache.directory.studio.common.ui.CommonUIUtils;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
 
 
 /**
@@ -51,7 +48,7 @@ public class UnknownLdapServerAdapterExt
              */
             public void add( LdapServer server, StudioProgressMonitor monitor ) throws Exception
             {
-                // Will never occur
+                showWarningDialog();
             }
 
 
@@ -69,13 +66,7 @@ public class UnknownLdapServerAdapterExt
              */
             public void openConfiguration( LdapServer server, StudioProgressMonitor monitor
) throws Exception
             {
-                Display.getDefault().asyncExec( new Runnable()
-                {
-                    public void run()
-                    {
-                        // TODO
-                    }
-                } );
+                showWarningDialog();
             }
 
 
@@ -84,11 +75,9 @@ public class UnknownLdapServerAdapterExt
              */
             public void start( LdapServer server, StudioProgressMonitor monitor ) throws
Exception
             {
-                throw new Exception(
-                    NLS.bind(
-                        "This server was created with a server adapter which is no longer
available. You need install it (again) using the update site of the vendor. \nServer adapter
information: ID=''{0}'', Name=''{1}'', Vendor=''{2}'', Version=''{3}''",
-                        new String[]
-                            { getId(), getName(), getVendor(), getVersion() } ) );
+                showWarningDialog();
+
+                server.setStatus( LdapServerStatus.STOPPED );
             }
 
 
@@ -97,8 +86,31 @@ public class UnknownLdapServerAdapterExt
              */
             public void stop( LdapServer server, StudioProgressMonitor monitor ) throws Exception
             {
-                // Will never occur
+                showWarningDialog();
+
+                server.setStatus( LdapServerStatus.STOPPED );
+            }
+
+
+            /**
+             * Shows the warning dialog.
+             */
+            private void showWarningDialog()
+            {
+                Display.getDefault().asyncExec( new Runnable()
+                {
+                    public void run()
+                    {
+                        CommonUIUtils.openWarningDialog(
+                            "Server Adapter Not Available",
+                            NLS.bind(
+                                "This server was created with a server adapter which is no
longer available. You need install it (again) using the update site of the vendor. \n\nServer
adapter information: ID=''{0}'', Name=''{1}'', Vendor=''{2}'', Version=''{3}''",
+                                new String[]
+                                    { getId(), getName(), getVendor(), getVersion() } ) );
+                    }
+                } );
             }
         } );
+
     }
 }



Mime
View raw message