[ooo-build-commit] ooeclipse: Branch 'master'

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Wed Nov 11 05:14:29 PST 2009


 core/source/org/openoffice/ide/eclipse/core/editors/description/DescriptionEditor.java |   22 ++++++++--
 core/source/org/openoffice/ide/eclipse/core/editors/description/GeneralSection.java    |    2 
 2 files changed, 19 insertions(+), 5 deletions(-)

New commits:
commit dd45af9775202b752a40e12dfe40c57726d5da40
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Wed Nov 11 14:14:18 2009 +0100

    [Core]Description editor fixes
    
     * The editor is now saving properly
     * The description field was resetting the display name (copy/paste) error

diff --git a/core/source/org/openoffice/ide/eclipse/core/editors/description/DescriptionEditor.java b/core/source/org/openoffice/ide/eclipse/core/editors/description/DescriptionEditor.java
index cb92d4a..9450ca7 100644
--- a/core/source/org/openoffice/ide/eclipse/core/editors/description/DescriptionEditor.java
+++ b/core/source/org/openoffice/ide/eclipse/core/editors/description/DescriptionEditor.java
@@ -32,12 +32,15 @@ package org.openoffice.ide.eclipse.core.editors.description;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.OutputStream;
 import java.io.StringReader;
 
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 
+import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.jface.text.IDocument;
 import org.eclipse.ui.IEditorInput;
@@ -46,6 +49,7 @@ import org.eclipse.ui.IFileEditorInput;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.editors.text.TextFileDocumentProvider;
 import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.part.FileEditorInput;
 import org.openoffice.ide.eclipse.core.PluginLogger;
 import org.openoffice.ide.eclipse.core.editors.Messages;
 import org.openoffice.ide.eclipse.core.model.description.DescriptionHandler;
@@ -134,11 +138,21 @@ public class DescriptionEditor extends FormEditor {
      */
     @Override
     public void doSave(IProgressMonitor pMonitor) {
-        // Reload the model if the we haven't moved from the overview page
-        if ( getActivePageInstance() == mFormPage ) {  
-            writeDescrToSource();
+        OutputStream out = null;
+        try {
+            FileEditorInput input = (FileEditorInput)getEditorInput();
+            File file = new File( input.getFile().getLocationURI() );
+            out = new FileOutputStream( file );
+            getDescriptionModel().serialize( out );
+            
+            input.getFile().refreshLocal( IResource.DEPTH_ZERO, pMonitor );
+        } catch ( Exception e ) {
+            PluginLogger.error( "Error saving the description.xml", e );
+        } finally {
+            try { out.close(); } catch ( Exception e ) { }
+            mSourcePage.doRevertToSaved();
+            mFormPage.reloadData();
         }
-        mSourcePage.doSave( pMonitor );
     }
 
     /**
diff --git a/core/source/org/openoffice/ide/eclipse/core/editors/description/GeneralSection.java b/core/source/org/openoffice/ide/eclipse/core/editors/description/GeneralSection.java
index e716828..4ed958e 100644
--- a/core/source/org/openoffice/ide/eclipse/core/editors/description/GeneralSection.java
+++ b/core/source/org/openoffice/ide/eclipse/core/editors/description/GeneralSection.java
@@ -154,7 +154,7 @@ public class GeneralSection extends LocalizedSection< DescriptionModel > {
         mDescriptionTxt.setEnabled( false );
         mDescriptionTxt.addModifyListener( new ModifyListener () {
             public void modifyText(ModifyEvent pE) {
-                getModel().addDisplayName( mCurrentLocale, mDescriptionTxt.getText() );
+                getModel().addDescription( mCurrentLocale, mDescriptionTxt.getText() );
             }
         });
         


More information about the ooo-build-commit mailing list