mail[Wesnoth-commits] r44296 - in /trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils: MyRunnable.java WMLTools.java


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by timotei_cluj on July 18, 2010 - 16:50:
Author: timotei
Date: Sun Jul 18 16:50:43 2010
New Revision: 44296

URL: http://svn.gna.org/viewcvs/wesnoth?rev=44296&view=rev
Log:
eclipse plugin: fix the running of WMLTools as a workspace jobs (now the 
editor won't take the focus)

Modified:
    
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/MyRunnable.java
    
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WMLTools.java

Modified: 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/MyRunnable.java
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/MyRunnable.java?rev=44296&r1=44295&r2=44296&view=diff
==============================================================================
--- 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/MyRunnable.java
 (original)
+++ 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/MyRunnable.java
 Sun Jul 18 16:50:43 2010
@@ -10,7 +10,7 @@
 
 public class MyRunnable<T> implements Runnable
 {
-       protected final T       runnableObject_;
+       protected T     runnableObject_;
 
        public MyRunnable(T t) {
                this.runnableObject_ = t;

Modified: 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WMLTools.java
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WMLTools.java?rev=44296&r1=44295&r2=44296&view=diff
==============================================================================
--- 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WMLTools.java
 (original)
+++ 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WMLTools.java
 Sun Jul 18 16:50:43 2010
@@ -22,7 +22,6 @@
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Status;
-import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.IEditorReference;
 import org.eclipse.ui.console.MessageConsole;
 
@@ -143,7 +142,7 @@
                }
 
                if (targetPath == null && WorkspaceUtils.getSelectedFile() != 
null)
-                       
EditorUtils.openEditor(WorkspaceUtils.getSelectedFile(), true);
+                       
EditorUtils.openEditor(WorkspaceUtils.getSelectedFile(), false);
                final String toolName = tool.toString();
 
                WorkspaceJob job = new WorkspaceJob("Running " + toolName) {
@@ -158,57 +157,57 @@
                        @Override
                        public IStatus runInWorkspace(final IProgressMonitor 
monitor)
                        {
-                               Display.getDefault().asyncExec(new Runnable() 
{
-                                       @Override
-                                       public void run()
-                                       {
-                                               monitor.beginTask(toolName, 
50);
-                                               
monitor.beginTask(tool.toString(), 50);
-                                               MessageConsole console = 
GUIUtils.createConsole(toolName + " result:", null, true);
-                                               OutputStream messageStream = 
console.newMessageStream();
-                                               //TODO: multiple streams? - 
check performance
-                                               OutputStream[] stream = new 
OutputStream[]{ messageStream};
-
-                                               String stdin = 
EditorUtils.getEditorDocument().get();
-
-                                               String location;
-                                               IFile selFile = 
WorkspaceUtils.getSelectedFile();
-                                               if (targetPath != null)
-                                                       location = targetPath;
-                                               else
-                                               {
-                                                       if (selFile != null)
-                                                               location = 
selFile.getLocation().toOSString();
-                                                       else //TODO: add 
container instead of project?
-                                                               location = 
WorkspaceUtils.getSelectedProject().getLocation().toOSString();
-                                               }
-
-                                               switch(tool)
-                                               {
-                                                       case WMLINDENT:
-                                                               if (selFile 
!= null && targetPath == null)
-                                                                       
toolInvoker = WMLTools.runWMLIndent(null, stdin, false,
-                                                                             
          null, stream);
-                                                               else
-                                                                       
toolInvoker = WMLTools.runWMLIndent(location, null, false,
-                                                                             
          stream, stream);
-                                                               break;
-                                                       case WMLLINT:
-                                                               toolInvoker = 
WMLTools.runWMLLint(location, true, stream, stream);
-                                                               break;
-                                                       case WMLSCOPE:
-                                                               toolInvoker = 
WMLTools.runWMLScope(location, stream, stream);
-                                                               break;
-                                               }
-                                               toolInvoker.waitForTool();
-                                               if (selFile != null && 
targetPath == null)
-                                               {
-                                                       
EditorUtils.replaceEditorText(toolInvoker.getOutputContent());
-                                               }
-                                               monitor.worked(50);
-                                               monitor.done();
-                                       };
-                               });
+                               try{
+                                       monitor.beginTask(toolName, 50);
+                                       monitor.beginTask(tool.toString(), 
50);
+                                       MessageConsole console = 
GUIUtils.createConsole(toolName + " result:", null, true);
+                                       OutputStream messageStream = 
console.newMessageStream();
+                                       //TODO: multiple streams? - check 
performance
+                                       OutputStream[] stream = new 
OutputStream[]{ messageStream};
+
+                                       String location;
+                                       String stdin = 
EditorUtils.getEditorDocument().get();
+
+                                       IFile selFile = 
WorkspaceUtils.getSelectedFile();
+                                       if (targetPath != null)
+                                               location = targetPath;
+                                       else
+                                       {
+                                               if (selFile != null)
+                                                       location = 
selFile.getLocation().toOSString();
+                                               else //TODO: add container 
instead of project?
+                                                       location = 
WorkspaceUtils.getSelectedProject().getLocation().toOSString();
+                                       }
+
+                                       switch(tool)
+                                       {
+                                               case WMLINDENT:
+                                                       if (selFile != null 
&& targetPath == null)
+                                                               toolInvoker = 
WMLTools.runWMLIndent(null, stdin, false,
+                                                                             
  null, stream);
+                                                       else
+                                                               toolInvoker = 
WMLTools.runWMLIndent(location, null, false,
+                                                                             
  stream, stream);
+                                                       break;
+                                               case WMLLINT:
+                                                       toolInvoker = 
WMLTools.runWMLLint(location, true, stream, stream);
+                                                       break;
+                                               case WMLSCOPE:
+                                                       toolInvoker = 
WMLTools.runWMLScope(location, stream, stream);
+                                                       break;
+                                       }
+                                       toolInvoker.waitForTool();
+                                       if (selFile != null && targetPath == 
null)
+                                       {
+                                               
EditorUtils.replaceEditorText(toolInvoker.getOutputContent());
+                                       }
+                                       monitor.worked(50);
+                                       monitor.done();
+                               }
+                               catch(Exception e)
+                               {
+                                       Logger.getInstance().logException(e);
+                               }
                                return Status.OK_STATUS;
                        }
                };




Related Messages


Powered by MHonArc, Updated Sun Jul 18 17:00:12 2010