directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1208440 - in /directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions: DeleteProjectAction.java messages.properties messages_de.properties messages_fr.properties
Date Wed, 30 Nov 2011 14:02:43 GMT
Author: pamarcelot
Date: Wed Nov 30 14:02:42 2011
New Revision: 1208440

URL: http://svn.apache.org/viewvc?rev=1208440&view=rev
Log:
Switched to 'MessageDialog' class instead of 'MessageBox' class for user confirmation.
Reused commonly used sentences in the LDAP Brower for a better uniformity between plugins.

Modified:
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/DeleteProjectAction.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages.properties
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_de.properties
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_fr.properties

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/DeleteProjectAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/DeleteProjectAction.java?rev=1208440&r1=1208439&r2=1208440&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/DeleteProjectAction.java
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/DeleteProjectAction.java
Wed Nov 30 14:02:42 2011
@@ -22,6 +22,7 @@ package org.apache.directory.studio.sche
 
 import java.util.Iterator;
 
+import org.apache.directory.studio.connection.core.ConnectionCoreConstants;
 import org.apache.directory.studio.schemaeditor.Activator;
 import org.apache.directory.studio.schemaeditor.PluginConstants;
 import org.apache.directory.studio.schemaeditor.controller.ProjectsHandler;
@@ -30,17 +31,14 @@ import org.apache.directory.studio.schem
 import org.apache.directory.studio.schemaeditor.view.wrappers.ProjectWrapper;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
 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.jface.viewers.TableViewer;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.MessageBox;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.PlatformUI;
 
 
 /**
@@ -104,23 +102,43 @@ public class DeleteProjectAction extends
 
         if ( !selection.isEmpty() )
         {
-            MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
-                SWT.YES | SWT.NO | SWT.ICON_QUESTION );
+            StringBuilder title = new StringBuilder();
+            StringBuilder message = new StringBuilder();
+
             int count = selection.size();
-            if ( count == 1 )
+
+            if ( count <= 5 )
             {
-                ProjectWrapper wrapper = ( ProjectWrapper ) selection.getFirstElement();
-                messageBox
-                    .setMessage( NLS
-                        .bind(
-                            Messages.getString( "DeleteProjectAction.SureToDeleteProject"
), new String[] { wrapper.getProject().getName() } ) ); //$NON-NLS-1$
+                if ( count == 1 )
+                {
+                    // Only 1 project to delete
+                    title.append( Messages.getString( "DeleteProjectAction.DeleteProjectTitle"
) ); //$NON-NLS-1$
+                    message.append( Messages.getString( "DeleteProjectAction.SureDeleteFollowingProject"
) ); //$NON-NLS-1$
+                }
+                else
+                {
+                    // Between 2 to 5 projects to delete
+                    title.append( Messages.getString( "DeleteProjectAction.DeleteProjectsTitle"
) ); //$NON-NLS-1$
+                    message.append( Messages.getString( "DeleteProjectAction.SureDeleteFollowingProjects"
) ); //$NON-NLS-1$
+                }
+
+                // Appending the projects names
+                for ( Iterator<?> iterator = selection.iterator(); iterator.hasNext();
)
+                {
+                    message.append( ConnectionCoreConstants.LINE_SEPARATOR );
+                    message.append( "  - " ); //$NON-NLS-1$
+                    message.append( ( ( ProjectWrapper ) iterator.next() ).getProject().getName()
);
+                }
             }
             else
             {
-                messageBox.setMessage( NLS.bind(
-                    Messages.getString( "DeleteProjectAction.SureToDeleteProjects" ), new
Object[] { count } ) ); //$NON-NLS-1$
+                // More than 5 projects to delete
+                title.append( Messages.getString( "DeleteProjectAction.DeleteProjectsTitle"
) ); //$NON-NLS-1$
+                message.append( Messages.getString( "DeleteProjectAction.SureDeleteSelectedProjects"
) ); //$NON-NLS-1$
             }
-            if ( messageBox.open() == SWT.YES )
+
+            // Showing the confirmation window
+            if ( MessageDialog.openConfirm( viewer.getControl().getShell(), title.toString(),
message.toString() ) )
             {
                 for ( Iterator<?> iterator = selection.iterator(); iterator.hasNext();
)
                 {

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages.properties?rev=1208440&r1=1208439&r2=1208440&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages.properties
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages.properties
Wed Nov 30 14:02:42 2011
@@ -22,8 +22,11 @@ CommitChangesAction.CommitChangesAction=
 DeleteProjectAction.DeleteProjectAction=&Delete Project
 DeleteProjectAction.DeleteProjectsAction=&Delete Projects
 DeleteProjectAction.DeleteProjectToolTip=Delete Project
-DeleteProjectAction.SureToDeleteProject=Are you sure you want to delete project "{0}"?
-DeleteProjectAction.SureToDeleteProjects=Are you sure you want to delete these {0} projects?
+DeleteProjectAction.DeleteProjectTitle=Delete Project
+DeleteProjectAction.DeleteProjectsTitle=Delete Projects
+DeleteProjectAction.SureDeleteFollowingProject=Are you sure to delete the following project?
+DeleteProjectAction.SureDeleteFollowingProjects=Are you sure to delete these projects?
+DeleteProjectAction.SureDeleteSelectedProjects=Are you sure to delete the selected projects?
 DeleteSchemaElementAction.DeleteAction=&Delete
 DeleteSchemaElementAction.DeleteToolTip=Delete
 DeleteSchemaElementAction.SureToDeleteAttributeType=Are you sure you want to delete this
attribute type?

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_de.properties?rev=1208440&r1=1208439&r2=1208440&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_de.properties
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_de.properties
Wed Nov 30 14:02:42 2011
@@ -22,8 +22,11 @@ CommitChangesAction.CommitChangesAction=
 DeleteProjectAction.DeleteProjectAction=Projekt &L\u00F6schen
 DeleteProjectAction.DeleteProjectsAction=Projekte &L\u00F6schen
 DeleteProjectAction.DeleteProjectToolTip=Projekt l\u00F6schen
-DeleteProjectAction.SureToDeleteProject=Wollen Sie das Projekt "{0}" wirklich l\u00F6schen?
-DeleteProjectAction.SureToDeleteProjects=Wollen Sie diese Projekte "{0}" wirklich l\u00F6schen?
+DeleteProjectAction.DeleteProjectTitle=Projekt L\u00F6schen
+DeleteProjectAction.DeleteProjectsTitle=Projekte L\u00F6schen
+DeleteProjectAction.SureDeleteFollowingProject=Wollen Sie folgende Projekt wirklich l\u00F6schen?
+DeleteProjectAction.SureDeleteFollowingProjects=Wollen Sie folgende Projekte wirklich l\u00F6schen?
+DeleteProjectAction.SureDeleteSelectedProjects=Wollen Sie die ausgew\u00E4hlten Projekte
wirklich l\u00F6schen?
 DeleteSchemaElementAction.DeleteAction=&L\u00F6schen
 DeleteSchemaElementAction.DeleteToolTip=L\u00F6schen
 DeleteSchemaElementAction.SureToDeleteAttributeType=Wollen Sie diesen Attribut Typ wirklich
l\u00F6schen?

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_fr.properties?rev=1208440&r1=1208439&r2=1208440&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_fr.properties
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_fr.properties
Wed Nov 30 14:02:42 2011
@@ -22,8 +22,11 @@ CommitChangesAction.CommitChangesAction=
 DeleteProjectAction.DeleteProjectAction=&Supprimer le projet
 DeleteProjectAction.DeleteProjectsAction=&Supprimer les projets
 DeleteProjectAction.DeleteProjectToolTip=Supprime le projet
-DeleteProjectAction.SureToDeleteProject=Etes-vous s\u00FBr de vouloir supprimer le projet
"{0}"?
-DeleteProjectAction.SureToDeleteProjects=Etes-vous s\u00FBr de vouloir supprimer ces projets
{0}?
+DeleteProjectAction.DeleteProjectTitle=Supprimer le projet
+DeleteProjectAction.DeleteProjectsTitle=Supprimer les projets
+DeleteProjectAction.SureDeleteFollowingProject=Etes-vous s\u00FBr de vouloir supprimer le
projet suivant ?
+DeleteProjectAction.SureDeleteFollowingProjects=Etes-vous s\u00FBr de vouloir supprimer les
projets suivants ?
+DeleteProjectAction.SureDeleteSelectedProjects=Etes-vous s\u00FBr de vouloir supprimer les
projets s\u00E9lectionn\u00E9s ?
 DeleteSchemaElementAction.DeleteAction=&Supprimer
 DeleteSchemaElementAction.DeleteToolTip=Supprime
 DeleteSchemaElementAction.SureToDeleteAttributeType=Etes-vous s\u00FBr de vouloir supprimer
ce type d'attribut?



Mime
View raw message