From d2f490169ee8fe6b23c204713453e7fa1cd6a168 Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien
true
if process correctly exited
* (exit code doesn't affect to this result).
*/
- public boolean waitFor(long timeout)
- {
- return waitFor(timeout, true);
- }
+ public boolean waitFor(long timeout)
+ {
+ return waitFor(timeout, true);
+ }
private boolean waitFor(long timeout, boolean bKillProcessAfterTimeout)
{
diff --git a/qadevOOo/runner/org/openoffice/Runner.java b/qadevOOo/runner/org/openoffice/Runner.java
index 47216ad8d815..dcecca69f0cc 100644
--- a/qadevOOo/runner/org/openoffice/Runner.java
+++ b/qadevOOo/runner/org/openoffice/Runner.java
@@ -48,7 +48,7 @@ public class Runner
private static long m_nStartTime;
- private static long getStartTime()
+ public static long getRunnerStartTime()
{
return m_nStartTime;
}
@@ -69,7 +69,7 @@ public class Runner
/*
return the time, which is done until last startTime()
*/
- private static long meanTime(long _nCurrentTimer)
+ public static long meanTime(long _nCurrentTimer)
{
if (_nCurrentTimer == 0)
{
@@ -109,6 +109,7 @@ public class Runner
}
return false;
}
+
private static boolean checkPathVariable(String _sPath, String delim)
{
String sPath = System.getProperty(_sPath);
@@ -117,7 +118,7 @@ public class Runner
StringTokenizer aTokenEnum = new StringTokenizer(sPath, delim);
while (aTokenEnum.hasMoreElements())
{
- String sToken = (String)aTokenEnum.nextElement();
+ String sToken = (String) aTokenEnum.nextElement();
if (checkVariableForCygwin(sToken))
{
System.err.println("ERROR: OOoRunner detect cygwin path in '" + _sPath + "'");
@@ -132,7 +133,7 @@ public class Runner
{
// ----- check all System.getProperty(key) variables -----
String sOsName = System.getProperty("os.name");
- if (! sOsName.toLowerCase().startsWith("windows"))
+ if (!sOsName.toLowerCase().startsWith("windows"))
{
// we need to check only on windows
return;
@@ -145,7 +146,7 @@ public class Runner
while (aEnum.hasMoreElements())
{
- String sKey = (String)aEnum.nextElement();
+ String sKey = (String) aEnum.nextElement();
String sValue = System.getProperty(sKey);
if (checkVariableForCygwin(sValue))
@@ -165,10 +166,10 @@ public class Runner
aEnum = _aParams.keys();
while (aEnum.hasMoreElements())
{
- String sKey = (String)aEnum.nextElement();
+ String sKey = (String) aEnum.nextElement();
if (_aParams.get(sKey) instanceof String)
{
- String sValue = (String)_aParams.get(sKey);
+ String sValue = (String) _aParams.get(sKey);
if (checkVariableForCygwin(sValue))
{
@@ -240,7 +241,7 @@ public class Runner
checkAllVariablesForCygwinPath(param);
boolean worked = toExecute.executeTest(param);
- long nTime = meanTime(getStartTime());
+ long nTime = meanTime(getRunnerStartTime());
String sBeautifyTime = beautifyTime(nTime);
System.out.println("Job run took: " + nTime + "ms " + " [" + sBeautifyTime + "]");
diff --git a/qadevOOo/runner/util/DesktopTools.java b/qadevOOo/runner/util/DesktopTools.java
index ec62745ac4df..c214459c3e67 100644
--- a/qadevOOo/runner/util/DesktopTools.java
+++ b/qadevOOo/runner/util/DesktopTools.java
@@ -56,23 +56,25 @@ import helper.ConfigHelper;
import java.util.Vector;
import lib.StatusException;
-
/**
* contains helper methods for the Desktop
*/
-public class DesktopTools {
+public class DesktopTools
+{
+
/**
* Queries the XComponentLoader
*
* @param xMSF the MultiServiceFactory
* @return the gained XComponentLoader
- */
- public static XComponentLoader getCLoader(XMultiServiceFactory xMSF) {
+ */
+ public static XComponentLoader getCLoader(XMultiServiceFactory xMSF)
+ {
XDesktop oDesktop = (XDesktop) UnoRuntime.queryInterface(
- XDesktop.class, createDesktop(xMSF));
+ XDesktop.class, createDesktop(xMSF));
XComponentLoader oCLoader = (XComponentLoader) UnoRuntime.queryInterface(
- XComponentLoader.class, oDesktop);
+ XComponentLoader.class, oDesktop);
return oCLoader;
} // finish getCLoader
@@ -82,13 +84,17 @@ public class DesktopTools {
*
* @param xMSF the MultiServiceFactory
* @return the gained Object
- */
- public static Object createDesktop(XMultiServiceFactory xMSF) {
+ */
+ public static Object createDesktop(XMultiServiceFactory xMSF)
+ {
Object oInterface;
- try {
+ try
+ {
oInterface = xMSF.createInstance("com.sun.star.comp.framework.Desktop");
- } catch (com.sun.star.uno.Exception e) {
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
throw new IllegalArgumentException("Desktop Service not available");
}
@@ -100,9 +106,10 @@ public class DesktopTools {
* @param xMSF the XMultiServiceFactory
* @return XEnumeration of all components on the desktop
*/
- public static XEnumeration getAllComponents(XMultiServiceFactory xMSF) {
+ public static XEnumeration getAllComponents(XMultiServiceFactory xMSF)
+ {
XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(
- XDesktop.class, createDesktop(xMSF));
+ XDesktop.class, createDesktop(xMSF));
return xDesktop.getComponents().createEnumeration();
}
@@ -111,9 +118,10 @@ public class DesktopTools {
* @param xMSF the XMultiServiceFactory
* @return XComponent of the current component on the desktop
*/
- public static XComponent getCurrentComponent(XMultiServiceFactory xMSF) {
+ public static XComponent getCurrentComponent(XMultiServiceFactory xMSF)
+ {
XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(
- XDesktop.class, createDesktop(xMSF));
+ XDesktop.class, createDesktop(xMSF));
return xDesktop.getCurrentComponent();
}
@@ -122,9 +130,10 @@ public class DesktopTools {
* @param xMSF the XMultiServiceFactory
* @return XComponent of the current component on the desktop
*/
- public static XFrame getCurrentFrame(XMultiServiceFactory xMSF) {
+ public static XFrame getCurrentFrame(XMultiServiceFactory xMSF)
+ {
XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(
- XDesktop.class, createDesktop(xMSF));
+ XDesktop.class, createDesktop(xMSF));
return xDesktop.getCurrentFrame();
}
@@ -138,22 +147,33 @@ public class DesktopTools {
* @param xMSF the XMultiSerivceFactory
* @return returns an array of all open documents
*/
- public static Object[] getAllOpenDocuments(XMultiServiceFactory xMSF) {
+ public static Object[] getAllOpenDocuments(XMultiServiceFactory xMSF)
+ {
Vector components = new Vector();
XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(
- XDesktop.class, createDesktop(xMSF));
+ XDesktop.class, createDesktop(xMSF));
XEnumeration allComp = getAllComponents(xMSF);
- while (allComp.hasMoreElements()){
- try{
+ while (allComp.hasMoreElements())
+ {
+ try
+ {
XComponent xComponent = (XComponent) UnoRuntime.queryInterface(
- XComponent.class, allComp.nextElement());
+ XComponent.class, allComp.nextElement());
- if (getDocumentType(xComponent) != null) components.add(xComponent);
+ if (getDocumentType(xComponent) != null)
+ {
+ components.add(xComponent);
+ }
- } catch (com.sun.star.container.NoSuchElementException e) {
- } catch ( com.sun.star.lang.WrappedTargetException e) {}
+ }
+ catch (com.sun.star.container.NoSuchElementException e)
+ {
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ }
}
return components.toArray();
}
@@ -170,28 +190,41 @@ public class DesktopTools {
*
* or null
*/
- public static String getDocumentType(XComponent xComponent) {
- XServiceInfo sInfo = (XServiceInfo)UnoRuntime.queryInterface(
+ public static String getDocumentType(XComponent xComponent)
+ {
+ XServiceInfo sInfo = (XServiceInfo) UnoRuntime.queryInterface(
XServiceInfo.class, xComponent);
- if (sInfo == null) {
+ if (sInfo == null)
+ {
return "";
- } else if (sInfo.supportsService("com.sun.star.sheet.SpreadsheetDocument")) {
+ }
+ else if (sInfo.supportsService("com.sun.star.sheet.SpreadsheetDocument"))
+ {
return "scalc";
- } else if (sInfo.supportsService("com.sun.star.text.TextDocument")) {
+ }
+ else if (sInfo.supportsService("com.sun.star.text.TextDocument"))
+ {
return "swriter";
- } else if (sInfo.supportsService("com.sun.star.drawing.DrawingDocument")) {
+ }
+ else if (sInfo.supportsService("com.sun.star.drawing.DrawingDocument"))
+ {
return "sdraw";
- } else if (sInfo.supportsService("com.sun.star.presentation.PresentationDocument")) {
+ }
+ else if (sInfo.supportsService("com.sun.star.presentation.PresentationDocument"))
+ {
return "simpress";
- } else if (sInfo.supportsService("com.sun.star.formula.FormulaProperties")) {
+ }
+ else if (sInfo.supportsService("com.sun.star.formula.FormulaProperties"))
+ {
return "smath";
- } else {
+ }
+ else
+ {
return null;
}
}
-
/**
* Opens a new document of a given kind
* with arguments
@@ -208,14 +241,17 @@ public class DesktopTools {
* @param xMSF the MultiServiceFactory
*/
public static XComponent openNewDoc(XMultiServiceFactory xMSF, String kind,
- PropertyValue[] Args) {
+ PropertyValue[] Args)
+ {
XComponent oDoc = null;
- try {
- oDoc = getCLoader(xMSF)
- .loadComponentFromURL("private:factory/" + kind,
- "_blank", 0, Args);
- } catch (com.sun.star.uno.Exception e) {
+ try
+ {
+ oDoc = getCLoader(xMSF).loadComponentFromURL("private:factory/" + kind,
+ "_blank", 0, Args);
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
throw new IllegalArgumentException("Document could not be opened");
}
@@ -231,7 +267,8 @@ public class DesktopTools {
* @param xMSF the MultiServiceFactory
*/
public static XComponent loadDoc(XMultiServiceFactory xMSF, String url,
- PropertyValue[] Args) {
+ PropertyValue[] Args)
+ {
XComponent oDoc = null;
if (Args == null)
{
@@ -254,34 +291,48 @@ public class DesktopTools {
* closes a given document
* @param DocumentToClose the document to close
*/
- public static void closeDoc(XInterface DocumentToClose) {
+ public static void closeDoc(XInterface DocumentToClose)
+ {
if (DocumentToClose == null)
{
return;
}
String kd = System.getProperty("KeepDocument");
- if (kd != null ) {
+ if (kd != null)
+ {
System.out.println("The property 'KeepDocument' is set and so the document won't be disposed");
return;
}
- XModifiable modified = (XModifiable) UnoRuntime.queryInterface(
- XModifiable.class, DocumentToClose);
- XCloseable closer = (XCloseable) UnoRuntime.queryInterface(
- XCloseable.class, DocumentToClose);
+ XModifiable modified = (XModifiable) UnoRuntime.queryInterface(XModifiable.class, DocumentToClose);
+ XCloseable closer = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, DocumentToClose);
- try {
- if (modified != null){
+ try
+ {
+ if (modified != null)
+ {
modified.setModified(false);
}
closer.close(true);
- } catch (com.sun.star.util.CloseVetoException e) {
+ }
+ catch (com.sun.star.util.CloseVetoException e)
+ {
+ e.printStackTrace();
System.out.println("Couldn't close document");
- } catch (com.sun.star.lang.DisposedException e) {
+ }
+ catch (com.sun.star.lang.DisposedException e)
+ {
+ e.printStackTrace();
System.out.println("Couldn't close document");
- } catch (java.lang.NullPointerException e) {
+ }
+ catch (java.lang.NullPointerException e)
+ {
+ e.printStackTrace();
System.out.println("Couldn't close document");
- } catch (com.sun.star.beans.PropertyVetoException e) {
+ }
+ catch (com.sun.star.beans.PropertyVetoException e)
+ {
+ e.printStackTrace();
System.out.println("Couldn't close document");
}
}
@@ -293,10 +344,12 @@ public class DesktopTools {
* @return a floating XWindow
*/
public static XWindowPeer createFloatingWindow(XMultiServiceFactory xMSF)
- throws StatusException{
- return createFloatingWindow(xMSF, 500, 100, 400, 600);
+ throws StatusException
+ {
+ return createFloatingWindow(xMSF, 500, 100, 400, 600);
}
- /**
+
+ /**
* Creates a floating XWindow on the given position and size.
* @return a floating XWindow
* @param X the X-Postion of the floating XWindow
@@ -307,44 +360,51 @@ public class DesktopTools {
* @throws lib.StatusException if it is not possible to create a floating window a lib.StatusException was thrown
*/
public static XWindowPeer createFloatingWindow(XMultiServiceFactory xMSF, int X, int Y, int width, int height)
- throws StatusException{
+ throws StatusException
+ {
XInterface oObj = null;
- try {
+ try
+ {
oObj = (XInterface) xMSF.createInstance("com.sun.star.awt.Toolkit");
- } catch (com.sun.star.uno.Exception e) {
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
throw new StatusException("Couldn't get toolkit", e);
}
XToolkit tk = (XToolkit) UnoRuntime.queryInterface(
- XToolkit.class, oObj);
+ XToolkit.class, oObj);
- WindowDescriptor descriptor = new com.sun.star.awt.WindowDescriptor();
+ WindowDescriptor descriptor = new com.sun.star.awt.WindowDescriptor();
descriptor.Type = com.sun.star.awt.WindowClass.TOP;
descriptor.WindowServiceName = "modelessdialog";
- descriptor.ParentIndex = -1;
+ descriptor.ParentIndex = -1;
- Rectangle bounds = new com.sun.star.awt.Rectangle();
- bounds.X = X;
- bounds.Y = Y;
- bounds.Width = width;
- bounds.Height = height;
+ Rectangle bounds = new com.sun.star.awt.Rectangle();
+ bounds.X = X;
+ bounds.Y = Y;
+ bounds.Width = width;
+ bounds.Height = height;
descriptor.Bounds = bounds;
descriptor.WindowAttributes = (com.sun.star.awt.WindowAttribute.BORDER +
- com.sun.star.awt.WindowAttribute.MOVEABLE +
- com.sun.star.awt.WindowAttribute.SIZEABLE +
- com.sun.star.awt.WindowAttribute.CLOSEABLE +
- com.sun.star.awt.VclWindowPeerAttribute.CLIPCHILDREN);
+ com.sun.star.awt.WindowAttribute.MOVEABLE +
+ com.sun.star.awt.WindowAttribute.SIZEABLE +
+ com.sun.star.awt.WindowAttribute.CLOSEABLE +
+ com.sun.star.awt.VclWindowPeerAttribute.CLIPCHILDREN);
XWindowPeer xWindow = null;
- try{
- xWindow = tk.createWindow( descriptor );
- }catch ( com.sun.star.lang.IllegalArgumentException e){
- throw new StatusException("Could not create window", e);
+ try
+ {
+ xWindow = tk.createWindow(descriptor);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ throw new StatusException("Could not create window", e);
}
return xWindow;
@@ -355,27 +415,28 @@ public class DesktopTools {
* zoom to have a view over the hole page
* @param xDoc the document to zoom
*/
- public static void zoomToEntirePage( XInterface xDoc){
- try {
+ public static void zoomToEntirePage(XInterface xDoc)
+ {
+ try
+ {
XModel xMod = (XModel) UnoRuntime.queryInterface(XModel.class, xDoc);
XInterface oCont = xMod.getCurrentController();
- XViewSettingsSupplier oVSSupp = (XViewSettingsSupplier)
- UnoRuntime.queryInterface(XViewSettingsSupplier.class, oCont);
+ XViewSettingsSupplier oVSSupp = (XViewSettingsSupplier) UnoRuntime.queryInterface(XViewSettingsSupplier.class, oCont);
XInterface oViewSettings = oVSSupp.getViewSettings();
- XPropertySet oViewProp = (XPropertySet)
- UnoRuntime.queryInterface(XPropertySet.class, oViewSettings);
+ XPropertySet oViewProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oViewSettings);
oViewProp.setPropertyValue("ZoomType",
- new Short(com.sun.star.view.DocumentZoomType.ENTIRE_PAGE));
+ new Short(com.sun.star.view.DocumentZoomType.ENTIRE_PAGE));
utils.shortWait(5000);
- } catch (Exception e){
+ }
+ catch (Exception e)
+ {
System.out.println("Could not zoom to entire page: " + e.toString());
}
}
-
/**
* This function docks the Stylist onto the right side of the window.
* Note:@@ -383,31 +444,35 @@ public class DesktopTools { * the chage of the docking will be effective at a restart. * @param xMSF the XMultiServiceFactory */ - public static void dockStylist(XMultiServiceFactory xMSF){ + public static void dockStylist(XMultiServiceFactory xMSF) + { // prepare Window-Settings - try { + try + { ConfigHelper aConfig = new ConfigHelper(xMSF, - "org.openoffice.Office.Views", false); + "org.openoffice.Office.Views", false); // Is node "5539" (slot-id for navigator) available? If not, insert it XNameReplace x5539 = aConfig.getOrInsertGroup("Windows", "5539"); aConfig.updateGroupProperty( - "Windows", "5539", "WindowState", "952,180,244,349;1;0,0,0,0;"); + "Windows", "5539", "WindowState", "952,180,244,349;1;0,0,0,0;"); aConfig.insertOrUpdateExtensibleGroupProperty( - "Windows", "5539", "UserData", "Data","V2,V,0,AL:(5,16,0/0/244/349,244;610)"); + "Windows", "5539", "UserData", "Data", "V2,V,0,AL:(5,16,0/0/244/349,244;610)"); // Is node "SplitWindow2" available? If not, instert it. aConfig.getOrInsertGroup("Windows", "SplitWindow2"); aConfig.insertOrUpdateExtensibleGroupProperty( - "Windows", "SplitWindow2","UserData", "UserItem","V1,2,1,0,5539"); + "Windows", "SplitWindow2", "UserData", "UserItem", "V1,2,1,0,5539"); aConfig.flush(); aConfig = null; - } catch (com.sun.star.uno.Exception e) { + } + catch (com.sun.star.uno.Exception e) + { e.printStackTrace(); } } @@ -418,7 +483,8 @@ public class DesktopTools { * @deprecated */ @Deprecated - public static void bringWindowToFromt(XModel xModel){ + public static void bringWindowToFromt(XModel xModel) + { bringWindowToFront(xModel); } @@ -428,7 +494,8 @@ public class DesktopTools { * Only the order of Office documents are changeable. * @param xModel the XModel of the document to bring to top */ - public static void bringWindowToFront(XModel xModel){ + public static void bringWindowToFront(XModel xModel) + { // System.out.println("DEBUG: bring to front xModel"); XTopWindow xTopWindow = @@ -439,10 +506,12 @@ public class DesktopTools { xTopWindow.toFront(); } - public static void bringWindowToFront(XComponent xComponent){ + public static void bringWindowToFront(XComponent xComponent) + { // System.out.println("DEBUG: bring to front xComponent"); XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xComponent); - if (xModel != null){ + if (xModel != null) + { bringWindowToFront(xModel); } } diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java index f4cf3d1253dd..3ec523e32fec 100644 --- a/qadevOOo/runner/util/utils.java +++ b/qadevOOo/runner/util/utils.java @@ -186,7 +186,13 @@ public class utils { } else { if (fullDocPath.startsWith("/")) { prefix = "file://"; - } else { +// if (helper.OSHelper.isLinuxIntel()) +// { +// prefix = "file:/"; +// } + } + else + { prefix = "file:///"; } }