Author: timotei
Date: Sat Jul 30 09:57:12 2011
New Revision: 50474

URL: http://svn.gna.org/viewcvs/wesnoth?rev=50474&view=rev
Log:
eclipse plugin: Rework a bit the MyRunnable

Added:
    
trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/RunnableWithResult.java
      - copied, changed from r50473, 
trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/MyRunnable.java
Removed:
    trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/MyRunnable.java
Modified:
    trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/GUIUtils.java
    trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/WorkspaceUtils.java

Modified: trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/GUIUtils.java
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/GUIUtils.java?rev=50474&r1=50473&r2=50474&view=diff
==============================================================================
--- trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/GUIUtils.java 
(original)
+++ trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/GUIUtils.java Sat Jul 
30 09:57:12 2011
@@ -87,19 +87,19 @@
                if (window == null || window.getShell() == null || message == 
null)
                        return -1;
 
-               MyRunnable<Integer> runnable = new MyRunnable<Integer>() {
+               RunnableWithResult<Integer> runnable = new 
RunnableWithResult<Integer>() {
                        @Override
                        public void run()
                        {
                                MessageBox box = new 
MessageBox(window.getShell(), style);
                                box.setMessage(message);
-                               runnableObject_ =  box.open();
+                               setResult( box.open() );
                        }
                } ;
                try
                {
                        window.getShell().getDisplay().syncExec(runnable);
-                       return runnable.runnableObject_;
+                       return runnable.getResult( );
                } catch (Exception e)
                {
                        Logger.getInstance().logException(e);

Removed: trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/MyRunnable.java
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/MyRunnable.java?rev=50473&view=auto
==============================================================================
--- trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/MyRunnable.java 
(original)
+++ trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/MyRunnable.java 
(removed)
@@ -1,26 +1,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 - 2011 by Timotei Dolean <[email protected]>
- *
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- 
*******************************************************************************/
-package org.wesnoth.utils;
-
-public class MyRunnable<T> implements Runnable
-{
-       protected T     runnableObject_;
-
-       public MyRunnable(T t) {
-               this.runnableObject_ = t;
-       }
-
-       public MyRunnable(){
-
-       }
-       @Override
-       public void run()
-       {
-       }
-}

Copied: 
trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/RunnableWithResult.java 
(from r50473, 
trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/MyRunnable.java)
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/RunnableWithResult.java?p2=trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/RunnableWithResult.java&p1=trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/MyRunnable.java&r1=50473&r2=50474&rev=50474&view=diff
==============================================================================
--- trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/MyRunnable.java 
(original)
+++ 
trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/RunnableWithResult.java 
Sat Jul 30 09:57:12 2011
@@ -8,19 +8,17 @@
  
*******************************************************************************/
 package org.wesnoth.utils;
 
-public class MyRunnable<T> implements Runnable
+public abstract class RunnableWithResult<T> implements Runnable
 {
-       protected T     runnableObject_;
+       private T result_;
 
-       public MyRunnable(T t) {
-               this.runnableObject_ = t;
+       public void setResult( T result )
+       {
+           result_ = result;
        }
 
-       public MyRunnable(){
-
-       }
-       @Override
-       public void run()
+       public T getResult( )
        {
+           return result_;
        }
 }

Modified: 
trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/WorkspaceUtils.java
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/WorkspaceUtils.java?rev=50474&r1=50473&r2=50474&view=diff
==============================================================================
--- trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/WorkspaceUtils.java 
(original)
+++ trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/WorkspaceUtils.java 
Sat Jul 30 09:57:12 2011
@@ -146,15 +146,21 @@
        {
                if (window == null)
                        return null;
-               MyRunnable<IStructuredSelection> runnable = new 
MyRunnable<IStructuredSelection>(){
+
+               RunnableWithResult<IStructuredSelection> runnable =
+                       new RunnableWithResult<IStructuredSelection>(){
                        @Override
                        public void run()
                        {
                                try{
-                                       runnableObject_ = null;
-                                       if 
(!(window.getSelectionService().getSelection() instanceof IStructuredSelection))
+                                       setResult( null );
+
+                                       if ( !( 
window.getSelectionService().getSelection()
+                                               instanceof IStructuredSelection 
) )
                                                return;
-                                       runnableObject_ = 
(IStructuredSelection) window.getSelectionService().getSelection();
+
+                                       setResult( ( IStructuredSelection)
+                                               
window.getSelectionService().getSelection( ) );
                                }
                                catch (Exception e) {
                                        e.printStackTrace();
@@ -162,7 +168,7 @@
                        }
                };
                Display.getDefault().syncExec(runnable);
-               return runnable.runnableObject_;
+               return runnable.getResult( );
        }
 
        /**


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to