Author: fmancinelli
Date: 2007-11-26 18:05:33 +0100 (Mon, 26 Nov 2007)
New Revision: 6082

Modified:
   
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/eclipse/editors/XWikiPageDocumentProvider.java
Log:
* Added a progress monitor while loading a page

Modified: 
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/eclipse/editors/XWikiPageDocumentProvider.java
===================================================================
--- 
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/eclipse/editors/XWikiPageDocumentProvider.java
       2007-11-26 16:15:54 UTC (rev 6081)
+++ 
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/eclipse/editors/XWikiPageDocumentProvider.java
       2007-11-26 17:05:33 UTC (rev 6082)
@@ -20,17 +20,21 @@
  */
 package org.xwiki.eclipse.editors;
 
+import java.lang.reflect.InvocationTargetException;
+
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.text.Document;
 import org.eclipse.jface.text.IDocument;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.editors.text.StorageDocumentProvider;
 import org.xwiki.eclipse.model.IXWikiPage;
 import org.xwiki.eclipse.model.XWikiConnectionException;
+import org.xwiki.eclipse.utils.XWikiEclipseUtil;
 import org.xwiki.plugins.eclipse.XWikiEclipsePlugin;
 
 public class XWikiPageDocumentProvider extends StorageDocumentProvider
@@ -50,10 +54,29 @@
     @Override
     protected IDocument createDocument(Object element) throws CoreException
     {
-        IDocument document = new Document();
+        final IDocument document = new Document();
         if (element instanceof XWikiPageEditorInput) {
-            XWikiPageEditorInput input = (XWikiPageEditorInput) element;
-            document.set(input.getXWikiPage().getContent());
+            final XWikiPageEditorInput input = (XWikiPageEditorInput) element;
+
+            try {
+                XWikiEclipseUtil.runOperationWithProgress(new 
IRunnableWithProgress()
+                {
+                    public void run(IProgressMonitor monitor) throws 
InvocationTargetException,
+                        InterruptedException
+                    {
+                        monitor.beginTask("Loading page", 
IProgressMonitor.UNKNOWN);
+                        String content = input.getXWikiPage().getContent();
+                        document.set(content);
+                        monitor.done();
+                    }
+
+                }, Display.getDefault().getActiveShell());
+            } catch (Exception e) {
+                throw new CoreException(new Status(IStatus.ERROR,
+                    XWikiEclipsePlugin.PLUGIN_ID,
+                    "Error opening page",
+                    e));
+            }
         }
 
         return document;

_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications

Reply via email to