Kaydet (Commit) 43cd64dd authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Michael Stahl

Java cleanup, simplify and generify

Convert this code to use generics and remove needless complexity

Change-Id: Icc87face21de963f433d2422b3e9d62042de24a8
üst a5ff5aad
...@@ -34,10 +34,11 @@ ...@@ -34,10 +34,11 @@
// __________ Imports __________ // __________ Imports __________
import com.sun.star.uno.UnoRuntime;
import java.util.Vector; import java.util.Vector;
import com.sun.star.frame.FrameActionEvent;
import com.sun.star.uno.UnoRuntime;
// __________ Implementation __________ // __________ Implementation __________
/** /**
...@@ -172,14 +173,7 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener, ...@@ -172,14 +173,7 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
// was it frameAction()? // was it frameAction()?
if (nRequest==OnewayExecutor.REQUEST_FRAMEACTION) if (nRequest==OnewayExecutor.REQUEST_FRAMEACTION)
{ {
com.sun.star.frame.FrameActionEvent[] lOutAction = new com.sun.star.frame.FrameActionEvent[1]; impl_frameAction((FrameActionEvent) lParams.get(0));
Vector[] lInParams = new Vector[1];
lInParams[0] = lParams;
OnewayExecutor.codeFrameAction( OnewayExecutor.DECODE_PARAMS ,
lInParams ,
lOutAction );
impl_frameAction(lOutAction[0]);
} }
else else
// was it dispatch()? // was it dispatch()?
...@@ -244,16 +238,12 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener, ...@@ -244,16 +238,12 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
return; return;
// pack the event and start thread - which call us back later // pack the event and start thread - which call us back later
Vector[] lOutParams = new Vector[1]; Vector<FrameActionEvent> lOutParams = new Vector<FrameActionEvent>();
com.sun.star.frame.FrameActionEvent[] lInAction = new com.sun.star.frame.FrameActionEvent[1]; lOutParams.add(aEvent);
lInAction[0] = aEvent;
OnewayExecutor.codeFrameAction( OnewayExecutor.ENCODE_PARAMS ,
lOutParams ,
lInAction );
OnewayExecutor aExecutor = new OnewayExecutor( (IOnewayLink)this , OnewayExecutor aExecutor = new OnewayExecutor( (IOnewayLink)this ,
OnewayExecutor.REQUEST_FRAMEACTION , OnewayExecutor.REQUEST_FRAMEACTION ,
lOutParams[0] ); lOutParams );
aExecutor.start(); aExecutor.start();
} }
......
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
import java.util.Vector; import java.util.Vector;
import com.sun.star.frame.FrameActionEvent;
// __________ Implementation __________ // __________ Implementation __________
/** /**
...@@ -142,21 +144,6 @@ class OnewayExecutor extends Thread ...@@ -142,21 +144,6 @@ class OnewayExecutor extends Thread
* one easier - you can use this helper methods. They know how suchlist * one easier - you can use this helper methods. They know how suchlist
* must be coded. It's not a must to use it - but you can ... * must be coded. It's not a must to use it - but you can ...
*/ */
public static void codeFrameAction(
boolean bEncode, Vector[] lParams,
com.sun.star.frame.FrameActionEvent[] aAction)
{
if (bEncode)
{
lParams[0] = new Vector<Object>(1);
lParams[0].add( (Object)(aAction[0]) );
}
else
{
aAction[0] = (com.sun.star.frame.FrameActionEvent)
(lParams[0].elementAt(0));
}
}
// _______________________________ // _______________________________
......
...@@ -34,13 +34,14 @@ ...@@ -34,13 +34,14 @@
// __________ Imports __________ // __________ Imports __________
import com.sun.star.uno.UnoRuntime;
import java.lang.String;
import java.awt.Component; import java.awt.Component;
import java.util.Vector;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JLabel; import javax.swing.JLabel;
import java.util.Vector;
import com.sun.star.frame.FrameActionEvent;
import com.sun.star.uno.UnoRuntime;
// __________ Implementation __________ // __________ Implementation __________
...@@ -176,14 +177,7 @@ class StatusListener implements com.sun.star.frame.XStatusListener, ...@@ -176,14 +177,7 @@ class StatusListener implements com.sun.star.frame.XStatusListener,
// was it frameAction()? // was it frameAction()?
if (nRequest==OnewayExecutor.REQUEST_FRAMEACTION) if (nRequest==OnewayExecutor.REQUEST_FRAMEACTION)
{ {
com.sun.star.frame.FrameActionEvent[] lOutAction = new com.sun.star.frame.FrameActionEvent[1]; impl_frameAction((FrameActionEvent) lParams.get(0));
Vector[] lInParams = new Vector[1];
lInParams[0] = lParams;
OnewayExecutor.codeFrameAction( OnewayExecutor.DECODE_PARAMS ,
lInParams ,
lOutAction );
impl_frameAction(lOutAction[0]);
} }
} }
...@@ -220,16 +214,12 @@ class StatusListener implements com.sun.star.frame.XStatusListener, ...@@ -220,16 +214,12 @@ class StatusListener implements com.sun.star.frame.XStatusListener,
if (! bHandle) if (! bHandle)
return; return;
Vector[] lOutParams = new Vector[1]; Vector<FrameActionEvent> lOutParams = new Vector<FrameActionEvent>();
com.sun.star.frame.FrameActionEvent[] lInAction = new com.sun.star.frame.FrameActionEvent[1]; lOutParams.add(aEvent);
lInAction[0] = aEvent;
OnewayExecutor.codeFrameAction( OnewayExecutor.ENCODE_PARAMS ,
lOutParams ,
lInAction );
OnewayExecutor aExecutor = new OnewayExecutor( (IOnewayLink)this , OnewayExecutor aExecutor = new OnewayExecutor( (IOnewayLink)this ,
OnewayExecutor.REQUEST_FRAMEACTION , OnewayExecutor.REQUEST_FRAMEACTION ,
lOutParams[0] ); lOutParams );
aExecutor.start(); aExecutor.start();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment