directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1213822 - /directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/EditorsUtils.java
Date Tue, 13 Dec 2011 18:20:48 GMT
Author: pamarcelot
Date: Tue Dec 13 18:20:48 2011
New Revision: 1213822

URL: http://svn.apache.org/viewvc?rev=1213822&view=rev
Log:
Part of a fix for DIRSTUDIO-446 (Allow the user to rename any item using the F2 shortcut).

Modified:
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/EditorsUtils.java

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/EditorsUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/EditorsUtils.java?rev=1213822&r1=1213821&r2=1213822&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/EditorsUtils.java
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/EditorsUtils.java
Tue Dec 13 18:20:48 2011
@@ -36,8 +36,10 @@ import java.util.List;
 import java.util.Set;
 
 import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.jface.window.Window;
+import org.eclipse.swt.graphics.Image;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IWorkbench;
@@ -91,7 +93,7 @@ public class EditorsUtils
         ListDialog dialog = new ListDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()
);
         dialog.setTitle( "Save All Modified Resources" );
         dialog.setAddCancelButton( true );
-        dialog.setLabelProvider( new LabelProvider() );
+        dialog.setLabelProvider( createDialogLabelProvider() );
         dialog.setMessage( "All modified resources must be saved before this operation."
);
         dialog.setContentProvider( new ArrayContentProvider() );
         dialog.setInput( dirtyEditors );
@@ -100,6 +102,29 @@ public class EditorsUtils
 
 
     /**
+     * Create the dialog label provider.
+     *
+     * @return the dialog label provider
+     */
+    private static ILabelProvider createDialogLabelProvider()
+    {
+        return new LabelProvider()
+        {
+            public Image getImage( Object element )
+            {
+                return ( ( IEditorPart ) element ).getTitleImage();
+            }
+
+
+            public String getText( Object element )
+            {
+                return ( ( IEditorPart ) element ).getTitle();
+            }
+        };
+    }
+
+
+    /**
      * Returns an array of all editors that have an unsaved content. If the identical content
is 
      * presented in more than one editor, only one of those editor parts is part of the result.
      * 



Mime
View raw message