directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r920288 - /directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java
Date Mon, 08 Mar 2010 12:02:49 GMT
Author: seelmann
Date: Mon Mar  8 12:02:49 2010
New Revision: 920288

URL: http://svn.apache.org/viewvc?rev=920288&view=rev
Log:
Fix for DIRSTUDIO-627 (Can't open a LDIF file)

Modified:
    directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java

Modified: directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java?rev=920288&r1=920287&r2=920288&view=diff
==============================================================================
--- directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java
(original)
+++ directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java
Mon Mar  8 12:02:49 2010
@@ -221,18 +221,31 @@
      */
     public void init( IEditorSite site, IEditorInput input ) throws PartInitException
     {
+        String className = input.getClass().getName();
+        File file = null;
         if ( input instanceof IPathEditorInput )
         {
             IPathEditorInput pei = ( IPathEditorInput ) input;
             IPath path = pei.getPath();
-            File javaIoFile = path.toFile();
-            long fileLength = javaIoFile.length();
+            file = path.toFile();
+        }
+        else if ( className.equals( "org.eclipse.ui.internal.editors.text.JavaFileEditorInput"
) //$NON-NLS-1$
+            || className.equals( "org.eclipse.ui.ide.FileStoreEditorInput" ) ) //$NON-NLS-1$
+        // The class 'org.eclipse.ui.internal.editors.text.JavaFileEditorInput'
+        // is used when opening a file from the menu File > Open... in Eclipse 3.2.x
+        // The class 'org.eclipse.ui.ide.FileStoreEditorInput' is used when
+        // opening a file from the menu File > Open... in Eclipse 3.3.x
+        {
+            file = new File( input.getToolTipText() );
+        }
+        if ( file != null )
+        {
+            long fileLength = file.length();
             if ( fileLength > ( 1 * 1024 * 1024 ) )
             {
                 MessageDialog.openError( site.getShell(), Messages.getString( "LdifEditor.LDIFFileIsTooBig"
), //$NON-NLS-1$
                     Messages.getString( "LdifEditor.LDIFFileIsTooBigDescription" ) ); //$NON-NLS-1$
-                super.init( site, new NonExistingLdifEditorInput() );
-                return;
+                input = new NonExistingLdifEditorInput();
             }
         }
 



Mime
View raw message