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 @@
// __________ Imports __________
import com.sun.star.uno.UnoRuntime;
import java.util.Vector;
import com.sun.star.frame.FrameActionEvent;
import com.sun.star.uno.UnoRuntime;
// __________ Implementation __________
/**
......@@ -172,14 +173,7 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
// was it frameAction()?
if (nRequest==OnewayExecutor.REQUEST_FRAMEACTION)
{
com.sun.star.frame.FrameActionEvent[] lOutAction = new com.sun.star.frame.FrameActionEvent[1];
Vector[] lInParams = new Vector[1];
lInParams[0] = lParams;
OnewayExecutor.codeFrameAction( OnewayExecutor.DECODE_PARAMS ,
lInParams ,
lOutAction );
impl_frameAction(lOutAction[0]);
impl_frameAction((FrameActionEvent) lParams.get(0));
}
else
// was it dispatch()?
......@@ -244,16 +238,12 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
return;
// pack the event and start thread - which call us back later
Vector[] lOutParams = new Vector[1];
com.sun.star.frame.FrameActionEvent[] lInAction = new com.sun.star.frame.FrameActionEvent[1];
lInAction[0] = aEvent;
Vector<FrameActionEvent> lOutParams = new Vector<FrameActionEvent>();
lOutParams.add(aEvent);
OnewayExecutor.codeFrameAction( OnewayExecutor.ENCODE_PARAMS ,
lOutParams ,
lInAction );
OnewayExecutor aExecutor = new OnewayExecutor( (IOnewayLink)this ,
OnewayExecutor.REQUEST_FRAMEACTION ,
lOutParams[0] );
lOutParams );
aExecutor.start();
}
......
......@@ -34,6 +34,8 @@
import java.util.Vector;
import com.sun.star.frame.FrameActionEvent;
// __________ Implementation __________
/**
......@@ -142,21 +144,6 @@ class OnewayExecutor extends Thread
* 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 ...
*/
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 @@
// __________ Imports __________
import com.sun.star.uno.UnoRuntime;
import java.lang.String;
import java.awt.Component;
import java.util.Vector;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import java.util.Vector;
import com.sun.star.frame.FrameActionEvent;
import com.sun.star.uno.UnoRuntime;
// __________ Implementation __________
......@@ -176,14 +177,7 @@ class StatusListener implements com.sun.star.frame.XStatusListener,
// was it frameAction()?
if (nRequest==OnewayExecutor.REQUEST_FRAMEACTION)
{
com.sun.star.frame.FrameActionEvent[] lOutAction = new com.sun.star.frame.FrameActionEvent[1];
Vector[] lInParams = new Vector[1];
lInParams[0] = lParams;
OnewayExecutor.codeFrameAction( OnewayExecutor.DECODE_PARAMS ,
lInParams ,
lOutAction );
impl_frameAction(lOutAction[0]);
impl_frameAction((FrameActionEvent) lParams.get(0));
}
}
......@@ -220,16 +214,12 @@ class StatusListener implements com.sun.star.frame.XStatusListener,
if (! bHandle)
return;
Vector[] lOutParams = new Vector[1];
com.sun.star.frame.FrameActionEvent[] lInAction = new com.sun.star.frame.FrameActionEvent[1];
lInAction[0] = aEvent;
Vector<FrameActionEvent> lOutParams = new Vector<FrameActionEvent>();
lOutParams.add(aEvent);
OnewayExecutor.codeFrameAction( OnewayExecutor.ENCODE_PARAMS ,
lOutParams ,
lInAction );
OnewayExecutor aExecutor = new OnewayExecutor( (IOnewayLink)this ,
OnewayExecutor.REQUEST_FRAMEACTION ,
lOutParams[0] );
lOutParams );
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