directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r987577 [7/10] - in /directory/studio/branches/studio-rap/plugins: common.ui/src/main/java/org/apache/directory/studio/common/ui/ connection.ui/src/main/java/org/apache/directory/studio/connection/ui/ connection.ui/src/main/java/org/apache/...
Date Fri, 20 Aug 2010 17:07:23 GMT
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationWizard.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationWizard.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationWizard.java Fri Aug 20 17:07:19 2010
@@ -38,7 +38,6 @@ import org.apache.directory.studio.ldapb
 import org.apache.directory.studio.ldifeditor.editor.LdifEditor;
 import org.apache.directory.studio.ldifeditor.editor.NonExistingLdifEditorInput;
 import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.text.IDocument;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.IWizardPage;
@@ -56,7 +55,6 @@ import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.IDocumentProvider;
 
 
 public class BatchOperationWizard extends Wizard implements INewWizard
@@ -341,15 +339,15 @@ public class BatchOperationWizard extend
                         IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
                         IWorkbenchPage page = window.getActivePage();
                         IEditorPart editor = page.openEditor( input, editorId );
-                        IDocumentProvider documentProvider = ( ( LdifEditor ) editor ).getDocumentProvider();
-                        if ( documentProvider != null && input != null )
-                        {
-                            IDocument document = documentProvider.getDocument( input );
-                            if ( document != null )
-                            {
-                                document.set( ldif.toString() );
-                            }
-                        }
+//                        IDocumentProvider documentProvider = ( ( LdifEditor ) editor ).getDocumentProvider();
+//                        if ( documentProvider != null && input != null )
+//                        {
+//                            IDocument document = documentProvider.getDocument( input );
+//                            if ( document != null )
+//                            {
+//                                document.set( ldif.toString() );
+//                            }
+//                        }
 
                     }
                     catch ( PartInitException e )

Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewSearchWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewSearchWizard.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewSearchWizard.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewSearchWizard.java Fri Aug 20 17:07:19 2010
@@ -22,10 +22,8 @@ package org.apache.directory.studio.ldap
 
 
 import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
-import org.apache.directory.studio.ldapbrowser.ui.search.SearchPage;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.search.ui.NewSearchUI;
 import org.eclipse.ui.INewWizard;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchWindow;
@@ -86,7 +84,7 @@ public class NewSearchWizard extends Wiz
      */
     public boolean performFinish()
     {
-        NewSearchUI.openSearchDialog( window, SearchPage.getId() );
+//        NewSearchUI.openSearchDialog( window, SearchPage.getId() );
         return true;
     }
 

Modified: directory/studio/branches/studio-rap/plugins/ldifeditor/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldifeditor/plugin.xml?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldifeditor/plugin.xml (original)
+++ directory/studio/branches/studio-rap/plugins/ldifeditor/plugin.xml Fri Aug 20 17:07:19 2010
@@ -85,7 +85,7 @@
          <keywordReference id="%Keyword_LDIF_id"/>
       </page>
    </extension>      
-
+<!--
    <extension
          point="org.eclipse.ui.editors.templates">
       <contextType
@@ -225,6 +225,6 @@ ${cursor}
       </template>
       
       
-   </extension>
+   </extension>-->
 
 </plugin>

Modified: directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/LdifEditorActivator.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/LdifEditorActivator.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/LdifEditorActivator.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/LdifEditorActivator.java Fri Aug 20 17:07:19 2010
@@ -31,14 +31,9 @@ import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.resource.ColorRegistry;
 import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.templates.ContextTypeRegistry;
-import org.eclipse.jface.text.templates.GlobalTemplateVariables;
-import org.eclipse.jface.text.templates.persistence.TemplateStore;
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.graphics.RGB;
-import org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry;
-import org.eclipse.ui.editors.text.templates.ContributionTemplateStore;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 
@@ -58,10 +53,10 @@ public class LdifEditorActivator extends
     private ColorRegistry colorRegistry;
 
     /** The template store */
-    private ContributionTemplateStore ldifTemplateStore;
-
-    /** The context type registry */
-    private ContributionContextTypeRegistry ldifTemplateContextTypeRegistry;
+//    private ContributionTemplateStore ldifTemplateStore;
+//
+//    /** The context type registry */
+//    private ContributionContextTypeRegistry ldifTemplateContextTypeRegistry;
 
     /** The plugin properties */
     private PropertyResourceBundle properties;
@@ -92,45 +87,45 @@ public class LdifEditorActivator extends
     {
         super.start( context );
 
-        if ( colorRegistry == null )
-        {
-            colorRegistry = new ColorRegistry( getWorkbench().getDisplay() );
-        }
-
-        if ( ldifTemplateContextTypeRegistry == null )
-        {
-            ldifTemplateContextTypeRegistry = new ContributionContextTypeRegistry();
-
-            ldifTemplateContextTypeRegistry.addContextType( LdifEditorConstants.LDIF_FILE_TEMPLATE_ID );
-            ldifTemplateContextTypeRegistry.getContextType( LdifEditorConstants.LDIF_FILE_TEMPLATE_ID ).addResolver(
-                new GlobalTemplateVariables.Cursor() );
-
-            ldifTemplateContextTypeRegistry.addContextType( LdifEditorConstants.LDIF_ATTR_VAL_RECORD_TEMPLATE_ID );
-            ldifTemplateContextTypeRegistry.getContextType( LdifEditorConstants.LDIF_ATTR_VAL_RECORD_TEMPLATE_ID )
-                .addResolver( new GlobalTemplateVariables.Cursor() );
-
-            ldifTemplateContextTypeRegistry.addContextType( LdifEditorConstants.LDIF_MODIFICATION_RECORD_TEMPLATE_ID );
-            ldifTemplateContextTypeRegistry.getContextType( LdifEditorConstants.LDIF_MODIFICATION_RECORD_TEMPLATE_ID )
-                .addResolver( new GlobalTemplateVariables.Cursor() );
-
-            ldifTemplateContextTypeRegistry.addContextType( LdifEditorConstants.LDIF_MODIFICATION_ITEM_TEMPLATE_ID );
-
-            ldifTemplateContextTypeRegistry.addContextType( LdifEditorConstants.LDIF_MODDN_RECORD_TEMPLATE_ID );
-        }
-
-        if ( ldifTemplateStore == null )
-        {
-            ldifTemplateStore = new ContributionTemplateStore( getLdifTemplateContextTypeRegistry(),
-                getPreferenceStore(), "templates" ); //$NON-NLS-1$
-            try
-            {
-                ldifTemplateStore.load();
-            }
-            catch ( IOException e )
-            {
-                e.printStackTrace();
-            }
-        }
+//        if ( colorRegistry == null )
+//        {
+//            colorRegistry = new ColorRegistry( getWorkbench().getDisplay() );
+//        }
+
+//        if ( ldifTemplateContextTypeRegistry == null )
+//        {
+//            ldifTemplateContextTypeRegistry = new ContributionContextTypeRegistry();
+//
+//            ldifTemplateContextTypeRegistry.addContextType( LdifEditorConstants.LDIF_FILE_TEMPLATE_ID );
+//            ldifTemplateContextTypeRegistry.getContextType( LdifEditorConstants.LDIF_FILE_TEMPLATE_ID ).addResolver(
+//                new GlobalTemplateVariables.Cursor() );
+//
+//            ldifTemplateContextTypeRegistry.addContextType( LdifEditorConstants.LDIF_ATTR_VAL_RECORD_TEMPLATE_ID );
+//            ldifTemplateContextTypeRegistry.getContextType( LdifEditorConstants.LDIF_ATTR_VAL_RECORD_TEMPLATE_ID )
+//                .addResolver( new GlobalTemplateVariables.Cursor() );
+//
+//            ldifTemplateContextTypeRegistry.addContextType( LdifEditorConstants.LDIF_MODIFICATION_RECORD_TEMPLATE_ID );
+//            ldifTemplateContextTypeRegistry.getContextType( LdifEditorConstants.LDIF_MODIFICATION_RECORD_TEMPLATE_ID )
+//                .addResolver( new GlobalTemplateVariables.Cursor() );
+//
+//            ldifTemplateContextTypeRegistry.addContextType( LdifEditorConstants.LDIF_MODIFICATION_ITEM_TEMPLATE_ID );
+//
+//            ldifTemplateContextTypeRegistry.addContextType( LdifEditorConstants.LDIF_MODDN_RECORD_TEMPLATE_ID );
+//        }
+//
+//        if ( ldifTemplateStore == null )
+//        {
+//            ldifTemplateStore = new ContributionTemplateStore( getLdifTemplateContextTypeRegistry(),
+//                getPreferenceStore(), "templates" ); //$NON-NLS-1$
+//            try
+//            {
+//                ldifTemplateStore.load();
+//            }
+//            catch ( IOException e )
+//            {
+//                e.printStackTrace();
+//            }
+//        }
     }
 
 
@@ -147,23 +142,23 @@ public class LdifEditorActivator extends
             colorRegistry = null;
         }
 
-        if ( ldifTemplateContextTypeRegistry != null )
-        {
-            ldifTemplateContextTypeRegistry = null;
-        }
-
-        if ( ldifTemplateStore != null )
-        {
-            try
-            {
-                ldifTemplateStore.save();
-            }
-            catch ( IOException e )
-            {
-                e.printStackTrace();
-            }
-            ldifTemplateStore = null;
-        }
+//        if ( ldifTemplateContextTypeRegistry != null )
+//        {
+//            ldifTemplateContextTypeRegistry = null;
+//        }
+
+//        if ( ldifTemplateStore != null )
+//        {
+//            try
+//            {
+//                ldifTemplateStore.save();
+//            }
+//            catch ( IOException e )
+//            {
+//                e.printStackTrace();
+//            }
+//            ldifTemplateStore = null;
+//        }
     }
 
 
@@ -254,24 +249,24 @@ public class LdifEditorActivator extends
     }
 
 
-    /**
-     * 
-     * @return The LDIF template context type registry
-     */
-    public ContextTypeRegistry getLdifTemplateContextTypeRegistry()
-    {
-        return ldifTemplateContextTypeRegistry;
-    }
-
-
-    /**
-     * 
-     * @return The LDIF template store
-     */
-    public TemplateStore getLdifTemplateStore()
-    {
-        return ldifTemplateStore;
-    }
+//    /**
+//     * 
+//     * @return The LDIF template context type registry
+//     */
+//    public ContextTypeRegistry getLdifTemplateContextTypeRegistry()
+//    {
+//        return ldifTemplateContextTypeRegistry;
+//    }
+//
+//
+//    /**
+//     * 
+//     * @return The LDIF template store
+//     */
+//    public TemplateStore getLdifTemplateStore()
+//    {
+//        return ldifTemplateStore;
+//    }
 
 
     /**

Modified: directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java Fri Aug 20 17:07:19 2010
@@ -135,10 +135,10 @@ public class LdifEntryEditorDialog exten
 
     protected void createButtonsForButtonBar( Composite parent )
     {
-        createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
+        createButton( parent, IDialogConstants.OK_ID, "OK", false );
         if ( entry != null )
         {
-            createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+            createButton( parent, IDialogConstants.CANCEL_ID, "Cancel", false );
         }
 
         getShell().update();

Modified: directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/preferences/LdifEditorSyntaxColoringPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/preferences/LdifEditorSyntaxColoringPreferencePage.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/preferences/LdifEditorSyntaxColoringPreferencePage.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/preferences/LdifEditorSyntaxColoringPreferencePage.java Fri Aug 20 17:07:19 2010
@@ -33,7 +33,6 @@ import org.eclipse.jface.preference.Colo
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.preference.PreferenceConverter;
 import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.text.TextAttribute;
 import org.eclipse.jface.util.IPropertyChangeListener;
 import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.jface.viewers.ArrayContentProvider;
@@ -137,10 +136,10 @@ public class LdifEditorSyntaxColoringPre
                 style |= SWT.BOLD;
             if ( italic )
                 style |= SWT.ITALIC;
-            if ( strikethrough )
-                style |= TextAttribute.STRIKETHROUGH;
-            if ( underline )
-                style |= TextAttribute.UNDERLINE;
+//            if ( strikethrough )
+//                style |= TextAttribute.STRIKETHROUGH;
+//            if ( underline )
+//                style |= TextAttribute.UNDERLINE;
             return style;
         }
 
@@ -149,8 +148,8 @@ public class LdifEditorSyntaxColoringPre
         {
             this.bold = ( style & SWT.BOLD ) != SWT.NORMAL;
             this.italic = ( style & SWT.ITALIC ) != SWT.NORMAL;
-            this.strikethrough = ( style & TextAttribute.STRIKETHROUGH ) != SWT.NORMAL;
-            this.underline = ( style & TextAttribute.UNDERLINE ) != SWT.NORMAL;
+//            this.strikethrough = ( style & TextAttribute.STRIKETHROUGH ) != SWT.NORMAL;
+//            this.underline = ( style & TextAttribute.UNDERLINE ) != SWT.NORMAL;
         }
 
 
@@ -418,12 +417,12 @@ public class LdifEditorSyntaxColoringPre
 
     private void setTextAttribute( SyntaxItem item )
     {
-        ldifEditorWidget.getSourceViewerConfiguration().setTextAttribute( item.key, item.rgb, item.getStyle() );
+//        ldifEditorWidget.getSourceViewerConfiguration().setTextAttribute( item.key, item.rgb, item.getStyle() );
 
-        int topIndex = ldifEditorWidget.getSourceViewer().getTopIndex();
-        // ldifEditorWidget.getSourceViewer().getDocument().set("");
-        ldifEditorWidget.getSourceViewer().getDocument().set( LDIF_INITIAL );
-        ldifEditorWidget.getSourceViewer().setTopIndex( topIndex );
+//        int topIndex = ldifEditorWidget.getSourceViewer().getTopIndex();
+//        // ldifEditorWidget.getSourceViewer().getDocument().set("");
+//        ldifEditorWidget.getSourceViewer().getDocument().set( LDIF_INITIAL );
+//        ldifEditorWidget.getSourceViewer().setTopIndex( topIndex );
     }
 
 
@@ -434,12 +433,12 @@ public class LdifEditorSyntaxColoringPre
 
         ldifEditorWidget = new LdifEditorWidget( null, LDIF_INITIAL, false );
         ldifEditorWidget.createWidget( parent );
-        ldifEditorWidget.getSourceViewer().setEditable( false );
+//        ldifEditorWidget.getSourceViewer().setEditable( false );
 
         GridData gd = new GridData( GridData.FILL_BOTH );
         gd.widthHint = convertWidthInCharsToPixels( 20 );
         gd.heightHint = convertHeightInCharsToPixels( 5 );
-        ldifEditorWidget.getSourceViewer().getControl().setLayoutData( gd );
+//        ldifEditorWidget.getSourceViewer().getControl().setLayoutData( gd );
 
     }
 

Modified: directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/preferences/LdifEditorTemplatesPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/preferences/LdifEditorTemplatesPreferencePage.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/preferences/LdifEditorTemplatesPreferencePage.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/preferences/LdifEditorTemplatesPreferencePage.java Fri Aug 20 17:07:19 2010
@@ -21,19 +21,17 @@
 package org.apache.directory.studio.ldifeditor.dialogs.preferences;
 
 
-import org.apache.directory.studio.ldifeditor.LdifEditorActivator;
-import org.eclipse.ui.texteditor.templates.TemplatePreferencePage;
 
 
-public class LdifEditorTemplatesPreferencePage extends TemplatePreferencePage
+public class LdifEditorTemplatesPreferencePage /*extends TemplatePreferencePage*/
 {
-
-    public LdifEditorTemplatesPreferencePage()
-    {
-        super();
-        super.setPreferenceStore( LdifEditorActivator.getDefault().getPreferenceStore() );
-        super.setTemplateStore( LdifEditorActivator.getDefault().getLdifTemplateStore() );
-        super.setContextTypeRegistry( LdifEditorActivator.getDefault().getLdifTemplateContextTypeRegistry() );
-    }
+//
+//    public LdifEditorTemplatesPreferencePage()
+//    {
+//        super();
+//        super.setPreferenceStore( LdifEditorActivator.getDefault().getPreferenceStore() );
+//        super.setTemplateStore( LdifEditorActivator.getDefault().getLdifTemplateStore() );
+//        super.setContextTypeRegistry( LdifEditorActivator.getDefault().getLdifTemplateContextTypeRegistry() );
+//    }
 
 }

Modified: directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifDocumentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifDocumentProvider.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifDocumentProvider.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifDocumentProvider.java Fri Aug 20 17:07:19 2010
@@ -21,44 +21,6 @@
 package org.apache.directory.studio.ldifeditor.editor;
 
 
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
-import org.apache.directory.studio.ldifeditor.LdifEditorConstants;
-import org.apache.directory.studio.ldifeditor.editor.text.LdifExternalAnnotationModel;
-import org.apache.directory.studio.ldifparser.model.LdifFile;
-import org.apache.directory.studio.ldifparser.model.container.LdifContainer;
-import org.apache.directory.studio.ldifparser.model.container.LdifRecord;
-import org.apache.directory.studio.ldifparser.parser.LdifParser;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextUtilities;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPathEditorInput;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.texteditor.AbstractDocumentProvider;
 
 
 /**
@@ -67,465 +29,465 @@ import org.eclipse.ui.texteditor.Abstrac
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class LdifDocumentProvider extends AbstractDocumentProvider implements IDocumentListener
+public class LdifDocumentProvider /*extends AbstractDocumentProvider implements IDocumentListener*/
 {
-
-    private final LdifParser ldifParser;
-
-    private final LdifDocumentSetupParticipant ldifDocumentSetupParticipant;
-
-    private LdifFile ldifModel;
-
-
-    /**
-     * Creates a new instance of LdifDocumentProvider.
-     */
-    public LdifDocumentProvider()
-    {
-        super();
-        this.ldifParser = new LdifParser();
-        this.ldifDocumentSetupParticipant = new LdifDocumentSetupParticipant();
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public IDocument getDocument( Object element )
-    {
-        IDocument document = super.getDocument( element );
-        return document;
-    }
-
-
-    /**
-     * Gets the LDIF Model
-     *
-     * @return
-     *      the LDIF Model
-     */
-    public LdifFile getLdifModel()
-    {
-        return ldifModel;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void documentAboutToBeChanged( DocumentEvent event )
-    {
-    }
-
-
-    /**
-     * Update the LDIF Model.
-     */
-    public void documentChanged( DocumentEvent event )
-    {
-        try
-        {
-            int changeOffset = event.getOffset();
-            int replacedTextLength = event.getLength();
-            int insertedTextLength = event.getText() != null ? event.getText().length() : 0;
-            IDocument document = event.getDocument();
-            // Region changeRegion = new Region(changeOffset,
-            // replacedTextLength);
-            Region changeRegion = new Region( changeOffset - BrowserCoreConstants.LINE_SEPARATOR.length(),
-                replacedTextLength + ( 2 * BrowserCoreConstants.LINE_SEPARATOR.length() ) );
-
-            // get containers to replace (from changeOffset till
-            // changeOffset+replacedTextLength, check end of record)
-            List<LdifContainer> oldContainerList = new ArrayList<LdifContainer>();
-            LdifContainer[] containers = this.ldifModel.getContainers();
-            for ( int i = 0; i < containers.length; i++ )
-            {
-
-                Region containerRegion = new Region( containers[i].getOffset(), containers[i].getLength() );
-
-                boolean changeOffsetAtEOF = i == containers.length - 1
-                    && changeOffset >= containerRegion.getOffset() + containerRegion.getLength();
-
-                if ( TextUtilities.overlaps( containerRegion, changeRegion ) || changeOffsetAtEOF )
-                {
-
-                    // remember index
-                    int index = i;
-
-                    // add invalid containers and non-records before overlap
-                    i--;
-                    for ( ; i >= 0; i-- )
-                    {
-                        if ( !containers[i].isValid() || !( containers[i] instanceof LdifRecord ) )
-                        {
-                            oldContainerList.add( 0, containers[i] );
-                        }
-                        else
-                        {
-                            break;
-                        }
-                    }
-
-                    // add all overlapping containers
-                    i = index;
-                    for ( ; i < containers.length; i++ )
-                    {
-                        containerRegion = new Region( containers[i].getOffset(), containers[i].getLength() );
-                        if ( TextUtilities.overlaps( containerRegion, changeRegion ) || changeOffsetAtEOF )
-                        {
-                            oldContainerList.add( containers[i] );
-                        }
-                        else
-                        {
-                            break;
-                        }
-                    }
-
-                    // add invalid containers and non-records after overlap
-                    for ( ; i < containers.length; i++ )
-                    {
-                        if ( !containers[i].isValid() || !( containers[i] instanceof LdifRecord )
-                            || !( oldContainerList.get( oldContainerList.size() - 1 ) instanceof LdifRecord ) )
-                        {
-                            oldContainerList.add( containers[i] );
-                        }
-                        else
-                        {
-                            break;
-                        }
-                    }
-                }
-            }
-            LdifContainer[] oldContainers = ( LdifContainer[] ) oldContainerList
-                .toArray( new LdifContainer[oldContainerList.size()] );
-            int oldCount = oldContainers.length;
-            int oldOffset = oldCount > 0 ? oldContainers[0].getOffset() : 0;
-            int oldLength = oldCount > 0 ? ( oldContainers[oldContainers.length - 1].getOffset()
-                + oldContainers[oldContainers.length - 1].getLength() - oldContainers[0].getOffset() ) : 0;
-
-            // get new content
-            int newOffset = oldOffset;
-            int newLength = oldLength - replacedTextLength + insertedTextLength;
-            String textToParse = document.get( newOffset, newLength );
-
-            // parse partion content to containers (offset=0)
-            LdifFile newModel = this.ldifParser.parse( textToParse );
-            LdifContainer[] newContainers = newModel.getContainers();
-
-            // replace old containers with new containers
-            // must adjust offsets of all following containers in model
-            this.ldifModel.replace( oldContainers, newContainers );
-
-        }
-        catch ( Exception e )
-        {
-            e.printStackTrace();
-        }
-
-    }
-
-
-    /**
-     * Creates an LDIF annotation model.
-     */
-    protected IAnnotationModel createAnnotationModel( Object element ) throws CoreException
-    {
-        return new LdifExternalAnnotationModel();
-    }
-
-
-    /**
-     * Tries to read the file pointed at by <code>input</code> if it is an
-     * <code>IPathEditorInput</code>. If the file does not exist, <code>true</code>
-     * is returned.
-     *  
-     * @param document the document to fill with the contents of <code>input</code>
-     * @param input the editor input
-     * @return <code>true</code> if setting the content was successful or no file exists, <code>false</code> otherwise
-     * @throws CoreException if reading the file fails
-     */
-    private boolean setDocumentContent( IDocument document, IEditorInput input ) throws CoreException
-    {
-        // TODO: handle encoding
-        Reader reader;
-        try
-        {
-            String inputClassName = input.getClass().getName();
-            if ( input instanceof IPathEditorInput )
-            {
-                reader = new FileReader( ( ( IPathEditorInput ) input ).getPath().toFile() );
-            }
-            else if ( inputClassName.equals( "org.eclipse.ui.internal.editors.text.JavaFileEditorInput" ) //$NON-NLS-1$
-                || inputClassName.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
-            {
-                reader = new FileReader( new File( input.getToolTipText() ) );
-            }
-            else
-            {
-                return false;
-            }
-        }
-        catch ( FileNotFoundException e )
-        {
-            // return empty document and save later
-            return true;
-        }
-
-        try
-        {
-            setDocumentContent( document, reader );
-            return true;
-        }
-        catch ( IOException e )
-        {
-            throw new CoreException( new Status( IStatus.ERROR, LdifEditorConstants.PLUGIN_ID, IStatus.OK,
-                "error reading file", e ) ); //$NON-NLS-1$
-        }
-    }
-
-
-    /**
-     * Reads in document content from a reader and fills <code>document</code>
-     * 
-     * @param document the document to fill
-     * @param reader the source
-     * @throws IOException if reading fails
-     */
-    private void setDocumentContent( IDocument document, Reader reader ) throws IOException
-    {
-        Reader in = new BufferedReader( reader );
-        try
-        {
-            StringBuffer buffer = new StringBuffer( 512 );
-            char[] readBuffer = new char[512];
-            int n = in.read( readBuffer );
-            while ( n > 0 )
-            {
-                buffer.append( readBuffer, 0, n );
-                n = in.read( readBuffer );
-            }
-
-            document.set( buffer.toString() );
-
-        }
-        finally
-        {
-            in.close();
-        }
-    }
-
-
-    /**
-     * Set up the document: partitioning and incremental parser
-     * 
-     * @param document the new document
-     */
-    protected void setupDocument( IDocument document )
-    {
-
-        // setup document partitioning
-        ldifDocumentSetupParticipant.setup( document );
-
-        // initial parsing of whole document
-        this.ldifModel = this.ldifParser.parse( document.get() );
-
-        // add listener for incremental parsing
-        document.addDocumentListener( this );
-
-    }
-
-
-    /**
-     * Remove document listener.
-     */
-    protected void disposeElementInfo( Object element, ElementInfo info )
-    {
-        IDocument document = info.fDocument;
-        document.removeDocumentListener( this );
-
-        super.disposeElementInfo( element, info );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    protected IDocument createDocument( Object element ) throws CoreException
-    {
-        if ( element instanceof IEditorInput )
-        {
-            IDocument document = new Document();
-            if ( setDocumentContent( document, ( IEditorInput ) element ) )
-            {
-                setupDocument( document );
-            }
-            return document;
-        }
-
-        return null;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    protected void doSaveDocument( IProgressMonitor monitor, Object element, IDocument document, boolean overwrite )
-        throws CoreException
-    {
-        File file = null;
-        String elementClassName = element.getClass().getName();
-        if ( element instanceof FileEditorInput )
-        // FileEditorInput class is used when the file is opened
-        // from a project in the workspace.
-        {
-            writeDocumentContent( document, ( ( FileEditorInput ) element ).getFile(), monitor );
-            return;
-        }
-        else if ( element instanceof IPathEditorInput )
-        {
-            IPathEditorInput pei = ( IPathEditorInput ) element;
-            IPath path = pei.getPath();
-            file = path.toFile();
-        }
-        else if ( elementClassName.equals( "org.eclipse.ui.internal.editors.text.JavaFileEditorInput" ) //$NON-NLS-1$
-            || elementClassName.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( ( ( IEditorInput ) element ).getToolTipText() );
-        }
-
-        if ( file != null )
-        {
-            try
-            {
-                file.createNewFile();
-
-                if ( file.exists() )
-                {
-                    if ( file.canWrite() )
-                    {
-                        Writer writer = new FileWriter( file );
-                        writeDocumentContent( document, writer, monitor );
-                    }
-                    else
-                    {
-                        throw new CoreException( new Status( IStatus.ERROR,
-                            "org.eclipse.ui.examples.rcp.texteditor", IStatus.OK, "file is read-only", null ) ); //$NON-NLS-1$ //$NON-NLS-2$
-                    }
-                }
-                else
-                {
-                    throw new CoreException( new Status( IStatus.ERROR,
-                        "org.eclipse.ui.examples.rcp.texteditor", IStatus.OK, "error creating file", null ) ); //$NON-NLS-1$ //$NON-NLS-2$
-                }
-            }
-            catch ( IOException e )
-            {
-                throw new CoreException( new Status( IStatus.ERROR,
-                    "org.eclipse.ui.examples.rcp.texteditor", IStatus.OK, "error when saving file", e ) ); //$NON-NLS-1$ //$NON-NLS-2$
-            }
-
-        }
-    }
-
-
-    /**
-     * Saves the document contents to a stream.
-     * 
-     * @param document the document to save
-     * @param file the file to save it to
-     * @param monitor a progress monitor to report progress
-     * @throws CoreException 
-     * @throws IOException if writing fails
-     */
-    private void writeDocumentContent( IDocument document, IFile file, IProgressMonitor monitor ) throws CoreException
-    {
-        if ( file != null )
-        {
-            file.setContents( new ByteArrayInputStream( document.get().getBytes() ), true, true, monitor );
-        }
-    }
-
-
-    /**
-     * Saves the document contents to a stream.
-     * 
-     * @param document the document to save
-     * @param writer the stream to save it to
-     * @param monitor a progress monitor to report progress
-     * @throws IOException if writing fails
-     */
-    private void writeDocumentContent( IDocument document, Writer writer, IProgressMonitor monitor ) throws IOException
-    {
-        Writer out = new BufferedWriter( writer );
-        try
-        {
-            out.write( document.get() );
-        }
-        finally
-        {
-            out.close();
-        }
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    protected IRunnableContext getOperationRunner( IProgressMonitor monitor )
-    {
-        return null;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isModifiable( Object element )
-    {
-        String elementClassName = element.getClass().getName();
-        if ( element instanceof IPathEditorInput )
-        {
-            IPathEditorInput pei = ( IPathEditorInput ) element;
-            File file = pei.getPath().toFile();
-            return file.canWrite() || !file.exists(); // Allow to edit new files
-        }
-        else if ( elementClassName.equals( "org.eclipse.ui.internal.editors.text.JavaFileEditorInput" ) //$NON-NLS-1$
-            || elementClassName.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 file = new File( ( ( IEditorInput ) element ).getToolTipText() );
-            return file.canWrite() || !file.exists(); // Allow to edit new files
-        }
-
-        return false;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isReadOnly( Object element )
-    {
-        return !isModifiable( element );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isStateValidated( Object element )
-    {
-        return true;
-    }
+//
+//    private final LdifParser ldifParser;
+//
+//    private final LdifDocumentSetupParticipant ldifDocumentSetupParticipant;
+//
+//    private LdifFile ldifModel;
+//
+//
+//    /**
+//     * Creates a new instance of LdifDocumentProvider.
+//     */
+//    public LdifDocumentProvider()
+//    {
+//        super();
+//        this.ldifParser = new LdifParser();
+//        this.ldifDocumentSetupParticipant = new LdifDocumentSetupParticipant();
+//    }
+//
+//
+//    /**
+//     * {@inheritDoc}
+//     */
+//    public IDocument getDocument( Object element )
+//    {
+//        IDocument document = super.getDocument( element );
+//        return document;
+//    }
+//
+//
+//    /**
+//     * Gets the LDIF Model
+//     *
+//     * @return
+//     *      the LDIF Model
+//     */
+//    public LdifFile getLdifModel()
+//    {
+//        return ldifModel;
+//    }
+//
+//
+//    /**
+//     * {@inheritDoc}
+//     */
+//    public void documentAboutToBeChanged( DocumentEvent event )
+//    {
+//    }
+//
+//
+//    /**
+//     * Update the LDIF Model.
+//     */
+//    public void documentChanged( DocumentEvent event )
+//    {
+//        try
+//        {
+//            int changeOffset = event.getOffset();
+//            int replacedTextLength = event.getLength();
+//            int insertedTextLength = event.getText() != null ? event.getText().length() : 0;
+//            IDocument document = event.getDocument();
+//            // Region changeRegion = new Region(changeOffset,
+//            // replacedTextLength);
+//            Region changeRegion = new Region( changeOffset - BrowserCoreConstants.LINE_SEPARATOR.length(),
+//                replacedTextLength + ( 2 * BrowserCoreConstants.LINE_SEPARATOR.length() ) );
+//
+//            // get containers to replace (from changeOffset till
+//            // changeOffset+replacedTextLength, check end of record)
+//            List<LdifContainer> oldContainerList = new ArrayList<LdifContainer>();
+//            LdifContainer[] containers = this.ldifModel.getContainers();
+//            for ( int i = 0; i < containers.length; i++ )
+//            {
+//
+//                Region containerRegion = new Region( containers[i].getOffset(), containers[i].getLength() );
+//
+//                boolean changeOffsetAtEOF = i == containers.length - 1
+//                    && changeOffset >= containerRegion.getOffset() + containerRegion.getLength();
+//
+//                if ( TextUtilities.overlaps( containerRegion, changeRegion ) || changeOffsetAtEOF )
+//                {
+//
+//                    // remember index
+//                    int index = i;
+//
+//                    // add invalid containers and non-records before overlap
+//                    i--;
+//                    for ( ; i >= 0; i-- )
+//                    {
+//                        if ( !containers[i].isValid() || !( containers[i] instanceof LdifRecord ) )
+//                        {
+//                            oldContainerList.add( 0, containers[i] );
+//                        }
+//                        else
+//                        {
+//                            break;
+//                        }
+//                    }
+//
+//                    // add all overlapping containers
+//                    i = index;
+//                    for ( ; i < containers.length; i++ )
+//                    {
+//                        containerRegion = new Region( containers[i].getOffset(), containers[i].getLength() );
+//                        if ( TextUtilities.overlaps( containerRegion, changeRegion ) || changeOffsetAtEOF )
+//                        {
+//                            oldContainerList.add( containers[i] );
+//                        }
+//                        else
+//                        {
+//                            break;
+//                        }
+//                    }
+//
+//                    // add invalid containers and non-records after overlap
+//                    for ( ; i < containers.length; i++ )
+//                    {
+//                        if ( !containers[i].isValid() || !( containers[i] instanceof LdifRecord )
+//                            || !( oldContainerList.get( oldContainerList.size() - 1 ) instanceof LdifRecord ) )
+//                        {
+//                            oldContainerList.add( containers[i] );
+//                        }
+//                        else
+//                        {
+//                            break;
+//                        }
+//                    }
+//                }
+//            }
+//            LdifContainer[] oldContainers = ( LdifContainer[] ) oldContainerList
+//                .toArray( new LdifContainer[oldContainerList.size()] );
+//            int oldCount = oldContainers.length;
+//            int oldOffset = oldCount > 0 ? oldContainers[0].getOffset() : 0;
+//            int oldLength = oldCount > 0 ? ( oldContainers[oldContainers.length - 1].getOffset()
+//                + oldContainers[oldContainers.length - 1].getLength() - oldContainers[0].getOffset() ) : 0;
+//
+//            // get new content
+//            int newOffset = oldOffset;
+//            int newLength = oldLength - replacedTextLength + insertedTextLength;
+//            String textToParse = document.get( newOffset, newLength );
+//
+//            // parse partion content to containers (offset=0)
+//            LdifFile newModel = this.ldifParser.parse( textToParse );
+//            LdifContainer[] newContainers = newModel.getContainers();
+//
+//            // replace old containers with new containers
+//            // must adjust offsets of all following containers in model
+//            this.ldifModel.replace( oldContainers, newContainers );
+//
+//        }
+//        catch ( Exception e )
+//        {
+//            e.printStackTrace();
+//        }
+//
+//    }
+//
+//
+//    /**
+//     * Creates an LDIF annotation model.
+//     */
+//    protected IAnnotationModel createAnnotationModel( Object element ) throws CoreException
+//    {
+//        return new LdifExternalAnnotationModel();
+//    }
+//
+//
+//    /**
+//     * Tries to read the file pointed at by <code>input</code> if it is an
+//     * <code>IPathEditorInput</code>. If the file does not exist, <code>true</code>
+//     * is returned.
+//     *  
+//     * @param document the document to fill with the contents of <code>input</code>
+//     * @param input the editor input
+//     * @return <code>true</code> if setting the content was successful or no file exists, <code>false</code> otherwise
+//     * @throws CoreException if reading the file fails
+//     */
+//    private boolean setDocumentContent( IDocument document, IEditorInput input ) throws CoreException
+//    {
+//        // TODO: handle encoding
+//        Reader reader;
+//        try
+//        {
+//            String inputClassName = input.getClass().getName();
+//            if ( input instanceof IPathEditorInput )
+//            {
+//                reader = new FileReader( ( ( IPathEditorInput ) input ).getPath().toFile() );
+//            }
+//            else if ( inputClassName.equals( "org.eclipse.ui.internal.editors.text.JavaFileEditorInput" ) //$NON-NLS-1$
+//                || inputClassName.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
+//            {
+//                reader = new FileReader( new File( input.getToolTipText() ) );
+//            }
+//            else
+//            {
+//                return false;
+//            }
+//        }
+//        catch ( FileNotFoundException e )
+//        {
+//            // return empty document and save later
+//            return true;
+//        }
+//
+//        try
+//        {
+//            setDocumentContent( document, reader );
+//            return true;
+//        }
+//        catch ( IOException e )
+//        {
+//            throw new CoreException( new Status( IStatus.ERROR, LdifEditorConstants.PLUGIN_ID, IStatus.OK,
+//                "error reading file", e ) ); //$NON-NLS-1$
+//        }
+//    }
+//
+//
+//    /**
+//     * Reads in document content from a reader and fills <code>document</code>
+//     * 
+//     * @param document the document to fill
+//     * @param reader the source
+//     * @throws IOException if reading fails
+//     */
+//    private void setDocumentContent( IDocument document, Reader reader ) throws IOException
+//    {
+//        Reader in = new BufferedReader( reader );
+//        try
+//        {
+//            StringBuffer buffer = new StringBuffer( 512 );
+//            char[] readBuffer = new char[512];
+//            int n = in.read( readBuffer );
+//            while ( n > 0 )
+//            {
+//                buffer.append( readBuffer, 0, n );
+//                n = in.read( readBuffer );
+//            }
+//
+//            document.set( buffer.toString() );
+//
+//        }
+//        finally
+//        {
+//            in.close();
+//        }
+//    }
+//
+//
+//    /**
+//     * Set up the document: partitioning and incremental parser
+//     * 
+//     * @param document the new document
+//     */
+//    protected void setupDocument( IDocument document )
+//    {
+//
+//        // setup document partitioning
+//        ldifDocumentSetupParticipant.setup( document );
+//
+//        // initial parsing of whole document
+//        this.ldifModel = this.ldifParser.parse( document.get() );
+//
+//        // add listener for incremental parsing
+//        document.addDocumentListener( this );
+//
+//    }
+//
+//
+//    /**
+//     * Remove document listener.
+//     */
+//    protected void disposeElementInfo( Object element, ElementInfo info )
+//    {
+//        IDocument document = info.fDocument;
+//        document.removeDocumentListener( this );
+//
+//        super.disposeElementInfo( element, info );
+//    }
+//
+//
+//    /**
+//     * {@inheritDoc}
+//     */
+//    protected IDocument createDocument( Object element ) throws CoreException
+//    {
+//        if ( element instanceof IEditorInput )
+//        {
+//            IDocument document = new Document();
+//            if ( setDocumentContent( document, ( IEditorInput ) element ) )
+//            {
+//                setupDocument( document );
+//            }
+//            return document;
+//        }
+//
+//        return null;
+//    }
+//
+//
+//    /**
+//     * {@inheritDoc}
+//     */
+//    protected void doSaveDocument( IProgressMonitor monitor, Object element, IDocument document, boolean overwrite )
+//        throws CoreException
+//    {
+//        File file = null;
+//        String elementClassName = element.getClass().getName();
+//        if ( element instanceof FileEditorInput )
+//        // FileEditorInput class is used when the file is opened
+//        // from a project in the workspace.
+//        {
+//            writeDocumentContent( document, ( ( FileEditorInput ) element ).getFile(), monitor );
+//            return;
+//        }
+//        else if ( element instanceof IPathEditorInput )
+//        {
+//            IPathEditorInput pei = ( IPathEditorInput ) element;
+//            IPath path = pei.getPath();
+//            file = path.toFile();
+//        }
+//        else if ( elementClassName.equals( "org.eclipse.ui.internal.editors.text.JavaFileEditorInput" ) //$NON-NLS-1$
+//            || elementClassName.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( ( ( IEditorInput ) element ).getToolTipText() );
+//        }
+//
+//        if ( file != null )
+//        {
+//            try
+//            {
+//                file.createNewFile();
+//
+//                if ( file.exists() )
+//                {
+//                    if ( file.canWrite() )
+//                    {
+//                        Writer writer = new FileWriter( file );
+//                        writeDocumentContent( document, writer, monitor );
+//                    }
+//                    else
+//                    {
+//                        throw new CoreException( new Status( IStatus.ERROR,
+//                            "org.eclipse.ui.examples.rcp.texteditor", IStatus.OK, "file is read-only", null ) ); //$NON-NLS-1$ //$NON-NLS-2$
+//                    }
+//                }
+//                else
+//                {
+//                    throw new CoreException( new Status( IStatus.ERROR,
+//                        "org.eclipse.ui.examples.rcp.texteditor", IStatus.OK, "error creating file", null ) ); //$NON-NLS-1$ //$NON-NLS-2$
+//                }
+//            }
+//            catch ( IOException e )
+//            {
+//                throw new CoreException( new Status( IStatus.ERROR,
+//                    "org.eclipse.ui.examples.rcp.texteditor", IStatus.OK, "error when saving file", e ) ); //$NON-NLS-1$ //$NON-NLS-2$
+//            }
+//
+//        }
+//    }
+//
+//
+//    /**
+//     * Saves the document contents to a stream.
+//     * 
+//     * @param document the document to save
+//     * @param file the file to save it to
+//     * @param monitor a progress monitor to report progress
+//     * @throws CoreException 
+//     * @throws IOException if writing fails
+//     */
+//    private void writeDocumentContent( IDocument document, IFile file, IProgressMonitor monitor ) throws CoreException
+//    {
+//        if ( file != null )
+//        {
+//            file.setContents( new ByteArrayInputStream( document.get().getBytes() ), true, true, monitor );
+//        }
+//    }
+//
+//
+//    /**
+//     * Saves the document contents to a stream.
+//     * 
+//     * @param document the document to save
+//     * @param writer the stream to save it to
+//     * @param monitor a progress monitor to report progress
+//     * @throws IOException if writing fails
+//     */
+//    private void writeDocumentContent( IDocument document, Writer writer, IProgressMonitor monitor ) throws IOException
+//    {
+//        Writer out = new BufferedWriter( writer );
+//        try
+//        {
+//            out.write( document.get() );
+//        }
+//        finally
+//        {
+//            out.close();
+//        }
+//    }
+//
+//
+//    /**
+//     * {@inheritDoc}
+//     */
+//    protected IRunnableContext getOperationRunner( IProgressMonitor monitor )
+//    {
+//        return null;
+//    }
+//
+//
+//    /**
+//     * {@inheritDoc}
+//     */
+//    public boolean isModifiable( Object element )
+//    {
+//        String elementClassName = element.getClass().getName();
+//        if ( element instanceof IPathEditorInput )
+//        {
+//            IPathEditorInput pei = ( IPathEditorInput ) element;
+//            File file = pei.getPath().toFile();
+//            return file.canWrite() || !file.exists(); // Allow to edit new files
+//        }
+//        else if ( elementClassName.equals( "org.eclipse.ui.internal.editors.text.JavaFileEditorInput" ) //$NON-NLS-1$
+//            || elementClassName.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 file = new File( ( ( IEditorInput ) element ).getToolTipText() );
+//            return file.canWrite() || !file.exists(); // Allow to edit new files
+//        }
+//
+//        return false;
+//    }
+//
+//
+//    /**
+//     * {@inheritDoc}
+//     */
+//    public boolean isReadOnly( Object element )
+//    {
+//        return !isModifiable( element );
+//    }
+//
+//
+//    /**
+//     * {@inheritDoc}
+//     */
+//    public boolean isStateValidated( Object element )
+//    {
+//        return true;
+//    }
 }
\ No newline at end of file

Modified: directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifDocumentSetupParticipant.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifDocumentSetupParticipant.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifDocumentSetupParticipant.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifDocumentSetupParticipant.java Fri Aug 20 17:07:19 2010
@@ -21,13 +21,6 @@
 package org.apache.directory.studio.ldifeditor.editor;
 
 
-import org.apache.directory.studio.ldifeditor.LdifEditorConstants;
-import org.apache.directory.studio.ldifeditor.editor.text.LdifPartitionScanner;
-import org.eclipse.core.filebuffers.IDocumentSetupParticipant;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentExtension3;
-import org.eclipse.jface.text.IDocumentPartitioner;
-import org.eclipse.jface.text.rules.FastPartitioner;
 
 
 /**
@@ -35,49 +28,49 @@ import org.eclipse.jface.text.rules.Fast
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class LdifDocumentSetupParticipant implements IDocumentSetupParticipant
+public class LdifDocumentSetupParticipant /*implements IDocumentSetupParticipant*/
 {
-    /** The LDIF Partitioning ID */
-    public final static String LDIF_PARTITIONING = LdifEditorConstants.LDIF_PARTITIONING;
-
-
-    /**
-     * Creates a new instance of LdifDocumentSetupParticipant.
-     */
-    public LdifDocumentSetupParticipant()
-    {
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setup( IDocument document )
-    {
-
-        if ( document instanceof IDocumentExtension3 )
-        {
-            IDocumentExtension3 extension3 = ( IDocumentExtension3 ) document;
-            if ( extension3.getDocumentPartitioner( LdifDocumentSetupParticipant.LDIF_PARTITIONING ) == null )
-            {
-                IDocumentPartitioner partitioner = createDocumentPartitioner();
-                extension3.setDocumentPartitioner( LDIF_PARTITIONING, partitioner );
-                partitioner.connect( document );
-            }
-        }
-    }
-
-
-    /**
-     * Creates the Document Partitioner
-     *
-     * @return
-     *      the Document Partitioner
-     */
-    private IDocumentPartitioner createDocumentPartitioner()
-    {
-        IDocumentPartitioner partitioner = new FastPartitioner( new LdifPartitionScanner(), new String[]
-            { LdifPartitionScanner.LDIF_RECORD } );
-        return partitioner;
-    }
+//    /** The LDIF Partitioning ID */
+//    public final static String LDIF_PARTITIONING = LdifEditorConstants.LDIF_PARTITIONING;
+//
+//
+//    /**
+//     * Creates a new instance of LdifDocumentSetupParticipant.
+//     */
+//    public LdifDocumentSetupParticipant()
+//    {
+//    }
+//
+//
+//    /**
+//     * {@inheritDoc}
+//     */
+//    public void setup( IDocument document )
+//    {
+//
+//        if ( document instanceof IDocumentExtension3 )
+//        {
+//            IDocumentExtension3 extension3 = ( IDocumentExtension3 ) document;
+//            if ( extension3.getDocumentPartitioner( LdifDocumentSetupParticipant.LDIF_PARTITIONING ) == null )
+//            {
+//                IDocumentPartitioner partitioner = createDocumentPartitioner();
+//                extension3.setDocumentPartitioner( LDIF_PARTITIONING, partitioner );
+//                partitioner.connect( document );
+//            }
+//        }
+//    }
+//
+//
+//    /**
+//     * Creates the Document Partitioner
+//     *
+//     * @return
+//     *      the Document Partitioner
+//     */
+//    private IDocumentPartitioner createDocumentPartitioner()
+//    {
+//        IDocumentPartitioner partitioner = new FastPartitioner( new LdifPartitionScanner(), new String[]
+//            { LdifPartitionScanner.LDIF_RECORD } );
+//        return partitioner;
+//    }
 }



Mime
View raw message