From: <gjo...@us...> - 2008-12-12 02:45:13
|
Revision: 2775 http://abbot.svn.sourceforge.net/abbot/?rev=2775&view=rev Author: gjohnsto Date: 2008-12-12 02:45:07 +0000 (Fri, 12 Dec 2008) Log Message: ----------- General ------- o More conveniently handles finding/matching widget text that can contain mnemonic indicators. o More universally support using regex patterns for finding/matching things. So now, almost anywhere you specify a string to match against something (a menu item, shell title, combo item, etc.) you can supply a regexp string if you like. o Refactoring to cleaner API & package structure. More to do... o Added lots more javadoc, especially in abbot.swt.eclipse. o Cleaned up more raw class usage. abbot.swt --------- Abbot added. Abbot.getVersion() will get you the version, including qualifier (build). SWTWorkarounds & WidgetLocator moved to abbot.swt.internal. WaitTimedOutError moved to abbot.swt.utilities (where Wait lives). abbot.swt.display ----------------- DisplayTester Changed key(int) --> key(int...) - Means you can now do multi-key things with just one method call. Example: displayTester.key(SWT.ALT|SWT.SHIFT|'x', 'r'); abbot.swt.hierarchy.text ------------------------ HierarchyPrinter - Fixed a bug where it would sometimes print the hierarchy all on one line. WidgetFormatter - Made it print more information (e.g., primary and secondary text) for each widget. abbot.swt.matcher ----------------- RootItemTreeMatcher added. Use it to find a Tree based on the text of one of its root TreeItems. For example, you could use it to find the Package Explorer's tree if you have the name of a project. WidgetMatcher - Fixed a bug where it would croak if it encountered any disposed Widgets. Disposed Widgets are considered to be not visible. WidgetTextMatcher2 added. Use it to find a Widget based on its secondary text. E.g., find a Combo by one of its items (not necessarily showing in its text field). WidgetTextMatcher matches only on a Widget's primary text. WidgetTextMatcher - Moved isTextMatch(String, String) to ExtendedComparator so that other text matching code can more naturally use it for regex and mnemonic handling. abbot.swt.tester ---------------- General o Fixed several isVisible(Widget) bugs that would croak if the Widget is disposed. Now disposed widgets are considered to be not visible. o Added getText2() methods to Textable2 testers to get their secondary text. o Removed getTextArray() that used to get an array of *all* text (primary *and* secondary) because need to be able to find/search based on secondary text only sometimes. o Added getToolTipText() to all appropriate *Tester classes. ButtonTester - Added getId(Button) to get a button's JFace ID (if it has one). See IDialogConstants. ControlTester - Changed key(Control, int) --> key(Control, int...) for multi-key input in one method call. ItemPath - Consolidated constructors that take String args into ItemPath(String...) which takes zero or more segments. If you need to build an ItemPath from a single string, use static ItemPath.fromString(String) or, for non-default delimiter, static ItemPath.fromString(String, String). I got tired of getting bitten by trying to use the 2 arg ctor to create a 2 segment path when that ctor really interpreted the 2nd arg as a delimiter. ShellTester activate(Shell) - Added. close(Shell) - Added. clickMenuBarIten(Shell, *) - Added (several veriations). TabItemTester getToolTipText(TabItem) - Added. TextTester ToolTipTester getMessage(*) & setMessage(*, String) added. WidgetTester toStringExtra(Widget) - Added. Prints more text info than toString(Widget). abbot.swt.tester.misc --------------------- Textable2 added. TextArrayable removed. abbot.swt.utilities ------------------- ExtendedComparator stringsMatch(String, String, boolean) added to handle possible mnemonic indicator in candidate string. arraysEqual(Object[], Object[]) added. Insist added. Consolidated most *Tester checkThis(), checkThat() methods here so they're more conveniently available outside the *Tester hierarchy. JavaUtil getClassName(Class) produces a more nice, concise human-readable class name. append(Object[], Object) and append(Object[], Object[]) added for fast convenient array appending. SWTUtil IsWindows, IsGTK, IsCarbon, IsMotif, IsPhoton fields added for window system checking. Avoids having to do: SWT.getPlatform().equals("gtk") toStringStyleBit(int, Class) result is more concise. abbot.swt.eclipse ----------------- EclipsePlugin removed. Not used. Not needed. abbot.swt.eclipse.fixture ------------------------- JavaProjectCreator removed. Didn't work right anyway. abbot.swt.eclipse.junit.extensions ---------------------------------- WorkbenchTestCase WorkbenchTestSuite Moved to abbot.swt.eclipse.junit abbot.swt.eclipse.tester ------------------------ WindowTester waitClose(long) added WorkbenchTester clickMenuBarItem(String path) added (joins clickMenuBarItem(ItemPath)). abbot.swt.eclipse.utils --> abbot.swt.eclipse.util -------------------------------------------------- DialogUtils --> DialogUtil Preferences, PreferencesUtils --> PreferencesUtil WorkbenchUtilities --> WorkbenchUtil WorkspaceUtilities --> WorkspaceUtil FileCompareUtils, FileUtils, InvokeMenuItem, InvokeNewWizard, ProjectUtils, Utils, WizardLaunchUtils, WorkbenchLaunchUtils removed. Modified Paths: -------------- abbot.swt/trunk/abbot.swt/.classpath abbot.swt/trunk/abbot.swt/build.properties abbot.swt/trunk/abbot.swt/doc/swt/patchingSWT.txt abbot.swt/trunk/abbot.swt/src/abbot/swt/Log.java abbot.swt/trunk/abbot.swt/src/abbot/swt/display/DisplayTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/hierarchy/Hierarchy.java abbot.swt/trunk/abbot.swt/src/abbot/swt/hierarchy/WidgetHierarchyImpl.java abbot.swt/trunk/abbot.swt/src/abbot/swt/hierarchy/text/HierarchyPrinter.java abbot.swt/trunk/abbot.swt/src/abbot/swt/hierarchy/text/WidgetFormatter.java abbot.swt/trunk/abbot.swt/src/abbot/swt/i18n/Strings.java abbot.swt/trunk/abbot.swt/src/abbot/swt/junit/extensions/ProxyTestResult.java abbot.swt/trunk/abbot.swt/src/abbot/swt/junit/extensions/SWTTestUtil.java abbot.swt/trunk/abbot.swt/src/abbot/swt/matcher/ClassMatcher.java abbot.swt/trunk/abbot.swt/src/abbot/swt/matcher/LabeledTextMatcher.java abbot.swt/trunk/abbot.swt/src/abbot/swt/matcher/NameMatcher.java abbot.swt/trunk/abbot.swt/src/abbot/swt/matcher/WidgetMatcher.java abbot.swt/trunk/abbot.swt/src/abbot/swt/matcher/WidgetTextMatcher.java abbot.swt/trunk/abbot.swt/src/abbot/swt/script/AbstractResolver.java abbot.swt/trunk/abbot.swt/src/abbot/swt/script/Assert.java abbot.swt/trunk/abbot.swt/src/abbot/swt/script/Resolver.java abbot.swt/trunk/abbot.swt/src/abbot/swt/script/SimpleResolver.java abbot.swt/trunk/abbot.swt/src/abbot/swt/script/Step.java abbot.swt/trunk/abbot.swt/src/abbot/swt/script/WidgetReference.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/AbstractTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/ButtonTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/CComboTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/CanvasTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/CaretTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/ComboTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/CompositeTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/ControlTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/CoolBarTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/DecorationsTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/GroupTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/ItemPath.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/ItemTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/LabelTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/LinkTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/ListTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/MenuItemTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/MenuTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/ProgressBarTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/SWTConstants.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/SashTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/ScaleTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/ScrollBarTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/ScrollableTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/ShellTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/SliderTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/StyledTextTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/TabFolderTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/TabItemTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/TableColumnTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/TableItemTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/TableTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/TextTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/ToolBarTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/ToolItemTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/ToolTipTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/TreeColumnTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/TreeItemTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/TreeTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/WidgetTester.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/WidgetTesterFactoryImpl.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/misc/MnemonicTextable.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/misc/Textable.java abbot.swt/trunk/abbot.swt/src/abbot/swt/utilities/EventFormattable.java abbot.swt/trunk/abbot.swt/src/abbot/swt/utilities/EventWatcher.java abbot.swt/trunk/abbot.swt/src/abbot/swt/utilities/ExtendedComparator.java abbot.swt/trunk/abbot.swt/src/abbot/swt/utilities/ImageComparator.java abbot.swt/trunk/abbot.swt/src/abbot/swt/utilities/JavaUtil.java abbot.swt/trunk/abbot.swt/src/abbot/swt/utilities/SWTUtil.java abbot.swt/trunk/abbot.swt/src/abbot/swt/utilities/Threads.java abbot.swt/trunk/abbot.swt/src/abbot/swt/utilities/Wait.java abbot.swt/trunk/abbot.swt.eclipse/META-INF/MANIFEST.MF abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/jobs/Jobs.java abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/matcher/ButtonIdMatcher.java abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/popups/Popups.java abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/popups/ShellTextHandler.java abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/tester/DialogTester.java abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/tester/PreferenceDialogTester.java abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/tester/WindowTester.java abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/tester/WizardTester.java abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/tester/WorkbenchTester.java abbot.swt/trunk/abbot.swt.eclipse.test/META-INF/MANIFEST.MF abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/junit/test/AllTests.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/junit/test/WorkbenchTestCaseTest.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/junit/test/WorkbenchTestSuiteTest.java abbot.swt/trunk/abbot.swt.examples/src/abbot/swt/examples/MenuItemGetBoundsStandaloneSnippet.java abbot.swt/trunk/abbot.swt.examples/src/abbot/swt/examples/SWTPatchTest1.java abbot.swt/trunk/abbot.swt.examples/src/abbot/swt/examples/TableTreeExample.java abbot.swt/trunk/abbot.swt.gef/src/abbot/swt/gef/tester/FigureTester.java abbot.swt/trunk/abbot.swt.gef/src/abbot/swt/gef/tester/PaletteTester.java abbot.swt/trunk/abbot.swt.gef/src/abbot/swt/gef/util/GEFWorkbenchUtilities.java abbot.swt/trunk/abbot.swt.gef.test/src/abbot/swt/gef/test/GEFTestProjectSetup.java abbot.swt/trunk/abbot.swt.test/META-INF/MANIFEST.MF abbot.swt/trunk/abbot.swt.test/src/abbot/swt/finder/matchers/test/AllTests.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/finder/matchers/test/IndexedMultiMatcherTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/finder/matchers/test/MatcherTestApplication.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/finder/matchers/test/WidgetMatcherTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/finder/matchers/test/WidgetTextMatcherTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/finder/test/ExtraFinderTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/junit/extensions/test/FailuresAndErrors.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/test/AllTests.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/tester/test/AbstractTesterTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/tester/test/ItemPathTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/tester/test/ShellTesterTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/tester/test/TreeTesterTest2.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/tester/test/WidgetLocatorTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/tester/test/WidgetTestFixture.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/tester/test/WidgetTesterTest.java abbot.swt/trunk/abbot.swt.wtp/META-INF/MANIFEST.MF abbot.swt/trunk/abbot.swt.wtp.test/src/abbot/swt/wtp/test/TestDOMNodeSupport.java Added Paths: ----------- abbot.swt/trunk/abbot.swt/customBuildCallbacks.xml abbot.swt/trunk/abbot.swt/src/abbot/swt/Abbot.java abbot.swt/trunk/abbot.swt/src/abbot/swt/abbot.properties abbot.swt/trunk/abbot.swt/src/abbot/swt/internal/ abbot.swt/trunk/abbot.swt/src/abbot/swt/internal/SWTWorkarounds.java abbot.swt/trunk/abbot.swt/src/abbot/swt/internal/WidgetLocator.java abbot.swt/trunk/abbot.swt/src/abbot/swt/matcher/RootItemTreeMatcher.java abbot.swt/trunk/abbot.swt/src/abbot/swt/matcher/WidgetText2Matcher.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/misc/Textable2.java abbot.swt/trunk/abbot.swt/src/abbot/swt/utilities/Insist.java abbot.swt/trunk/abbot.swt/src/abbot/swt/utilities/WaitTimedOutError.java abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/junit/WorkbenchTestCase.java abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/junit/WorkbenchTestSuite.java abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/util/ abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/util/DialogUtil.java abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/util/PreferencesUtil.java abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/util/WorkbenchUtil.java abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/util/WorkspaceUtil.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/junit/test/ abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/test/ abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/test/AllTests.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tester/ abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tester/test/ abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tester/test/AbstractWindowTesterTest.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tester/test/AllTests.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tester/test/DialogTesterTest.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tester/test/PreferenceDialogTesterTest.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tester/test/WindowTesterTest.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tester/test/WizardTesterTest.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tester/test/WorkbenchTesterTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/display/ abbot.swt/trunk/abbot.swt.test/src/abbot/swt/display/test/ abbot.swt/trunk/abbot.swt.test/src/abbot/swt/display/test/AllTests.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/display/test/DisplayTesterTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/finder/matchers/test/WidgetText2MatcherTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/internal/ abbot.swt/trunk/abbot.swt.test/src/abbot/swt/internal/test/ abbot.swt/trunk/abbot.swt.test/src/abbot/swt/internal/test/AllTests.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/internal/test/SWTWorkaroundsTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/test/AbbotTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/test/LogTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/test/all/ abbot.swt/trunk/abbot.swt.test/src/abbot/swt/test/all/AllTests.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/test/resources/ abbot.swt/trunk/abbot.swt.test/src/abbot/swt/test/resources/Images.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/test/resources/image.gif abbot.swt/trunk/abbot.swt.test/src/abbot/swt/test/resources/image.jpg abbot.swt/trunk/abbot.swt.test/src/abbot/swt/util/ abbot.swt/trunk/abbot.swt.test/src/abbot/swt/util/test/ abbot.swt/trunk/abbot.swt.test/src/abbot/swt/util/test/AllTests.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/util/test/InsistTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/util/test/JavaUtilTest.java abbot.swt/trunk/abbot.swt.test/src/not/ abbot.swt/trunk/abbot.swt.test/src/not/an/ abbot.swt/trunk/abbot.swt.test/src/not/an/abbot/ abbot.swt/trunk/abbot.swt.test/src/not/an/abbot/pkg/ abbot.swt/trunk/abbot.swt.test/src/not/an/abbot/pkg/NotAnAbbotClass.java Removed Paths: ------------- abbot.swt/trunk/abbot.swt/src/abbot/swt/SWTWorkarounds.java abbot.swt/trunk/abbot.swt/src/abbot/swt/Version.java abbot.swt/trunk/abbot.swt/src/abbot/swt/WaitTimedOutError.java abbot.swt/trunk/abbot.swt/src/abbot/swt/WidgetLocator.java abbot.swt/trunk/abbot.swt/src/abbot/swt/tester/misc/TextArrayable.java abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/EclipsePlugin.java abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/fixture/ abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/junit/extensions/ abbot.swt/trunk/abbot.swt.eclipse/src/abbot/swt/eclipse/utils/ abbot.swt/trunk/abbot.swt.eclipse/src/junit/extensions/ abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/junit/extensions/test/ abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tests/AllTests.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tests/DriveHTMLWizard.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tests/DriveSimpleWebProject.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tests/InvokeNewWizardTest.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tests/JavaProjectTester.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tests/MarkTestSuite.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tests/MultiPageWizardExampleTest.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tests/TestCase.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tests/TestsStrings.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tests/WTPSimpleWebProjectTest.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tests/WTPWizardTest.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tests/examples/ProjectWizardTest.java abbot.swt/trunk/abbot.swt.eclipse.test/src/abbot/swt/eclipse/tests/tests.properties abbot.swt/trunk/abbot.swt.test/src/abbot/swt/finder/matchers/test/IndexedClassMultiMatcherTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/finder/matchers/test/IndexedTextMultiMatcherTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/test/DisplayTesterTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/test/GetBoundsTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/test/KeyPostTest.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/test/KeyPostTest2.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/test/Log.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/test/SyncBug.java abbot.swt/trunk/abbot.swt.test/src/abbot/swt/test/image.gif abbot.swt/trunk/abbot.swt.test/src/abbot/swt/test/image.jpg Modified: abbot.swt/trunk/abbot.swt/.classpath =================================================================== --- abbot.swt/trunk/abbot.swt/.classpath 2008-12-12 02:41:00 UTC (rev 2774) +++ abbot.swt/trunk/abbot.swt/.classpath 2008-12-12 02:45:07 UTC (rev 2775) @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry exported="true" kind="lib" path="lib/jdom-1.0.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry exported="true" kind="lib" path="lib/abbot.jar" sourcepath="lib/abbotsrc.zip"/> <classpathentry exported="true" kind="lib" path="lib/bsh-2.0b4.jar" sourcepath="abbot.swtsrc.zip"/> <classpathentry exported="true" kind="lib" path="lib/gnu-regexp-1.1.0.jar" sourcepath="abbot.swtsrc.zip"/> + <classpathentry exported="true" kind="lib" path="lib/jdom-1.0.jar" sourcepath="abbot.swtsrc.zip"/> <classpathentry kind="output" path="bin"/> </classpath> Modified: abbot.swt/trunk/abbot.swt/build.properties =================================================================== --- abbot.swt/trunk/abbot.swt/build.properties 2008-12-12 02:41:00 UTC (rev 2774) +++ abbot.swt/trunk/abbot.swt/build.properties 2008-12-12 02:45:07 UTC (rev 2775) @@ -8,3 +8,5 @@ src.includes = CPL.html,\ lib/abbotsrc.zip jars.compile.order = . +customBuildCallbacks = customBuildCallbacks.xml +customBuildCallbacks.failonerror = true Added: abbot.swt/trunk/abbot.swt/customBuildCallbacks.xml =================================================================== --- abbot.swt/trunk/abbot.swt/customBuildCallbacks.xml (rev 0) +++ abbot.swt/trunk/abbot.swt/customBuildCallbacks.xml 2008-12-12 02:45:07 UTC (rev 2775) @@ -0,0 +1,166 @@ +<!-- ===================================================================== --> +<!-- Custom targets called from a project's generated build.xml --> +<!-- Set customBuildCallbacks=<path/to/this/file> in your build.properties.--> +<!-- ===================================================================== --> +<project name="Build specific targets and properties" default="noDefault"> + + <!-- ===================================================================== --> + <!-- Default target --> + <!-- ===================================================================== --> + <target name="noDefault"> + <echo message="This file must be called with explicit targets" /> + </target> + + <!-- ===================================================================== --> + <!-- Steps to do before the target build.jars --> + <!-- Available parameters : --> + <!-- build.result.folder - folder to contain the build results --> + <!-- ===================================================================== --> + <target name="pre.build.jars"> + </target> + + <!-- ===================================================================== --> + <!-- Steps to do after the target build.jars --> + <!-- Available parameters : --> + <!-- build.result.folder - folder to contain the build results --> + <!-- ===================================================================== --> + <target name="post.build.jars"> + </target> + + <!-- ===================================================================== --> + <!-- Steps to do before the target build.sources --> + <!-- Available parameters : --> + <!-- build.result.folder - folder to contain the build results --> + <!-- ===================================================================== --> + <target name="pre.build.sources"> + </target> + + <!-- ===================================================================== --> + <!-- Steps to do after the target build.sources --> + <!-- Available parameters : --> + <!-- build.result.folder - folder to contain the build results --> + <!-- ===================================================================== --> + <target name="post.build.sources"> + </target> + + <!-- ===================================================================== --> + <!-- Steps to do before the compilation target <name> --> + <!-- Substitute "name" with the name of the compilation target, eg @dot --> + <!-- Available parameters : --> + <!-- source.foldern : n = 1 ... N, the source folders --> + <!-- target.folder : where the results of the compilation go --> + <!-- <name>.classpath : name = name of the compilation target. A --> + <!-- reference to the classpath structure. --> + <!-- ===================================================================== --> + <target name="pre.name"> + </target> + + <target name="pre.@dot"> + </target> + + <!-- ===================================================================== --> + <!-- Steps to do during the compilation target <name>, after the compile --> + <!-- but before jaring. Substitute "name" with the name of the compilation--> + <!-- target, eg @dot --> + <!-- Available parameters : --> + <!-- source.foldern : n = 1 ... N, the source folders --> + <!-- target.folder : where the results of the compilation go --> + <!-- <name>.classpath : name = name of the compilation target. A --> + <!-- reference to the classpath structure. --> + <!-- ===================================================================== --> + <target name="post.compile.name"> + </target> + + <target name="post.compile.@dot"> + </target> + + <!-- ===================================================================== --> + <!-- Steps to do after the compilation target <name> --> + <!-- Substitute "name" with the name of the compilation target, eg @dot --> + <!-- Available parameters : --> + <!-- jar.location - the location of the compilation results --> + <!-- <name>.classpath : name = name of the compilation target. A --> + <!-- reference to the classpath structure. --> + <!-- ===================================================================== --> + <target name="post.name"> + </target> + + <target name="post.@dot"> + </target> + + <!-- ===================================================================== --> + <!-- Steps to do before the target gather.bin.parts --> + <!-- Available parameters : --> + <!-- build.result.folder - folder containing the build results --> + <!-- target.folder - destination folder --> + <!-- ===================================================================== --> + <target name="pre.gather.bin.parts"> + </target> + + <!-- ===================================================================== --> + <!-- Steps to do after the target gather.bin.parts --> + <!-- Available parameters : --> + <!-- build.result.folder - folder containing the build results --> + <!-- target.folder - destination folder --> + <!-- ===================================================================== --> + <target name="post.gather.bin.parts"> + + <loadproperties srcfile="${target.folder}/META-INF/MANIFEST.MF"> + <filterchain> + <containsregex pattern="^Bundle-Version" replace="abbot.swt.bundle.version" /> + </filterchain> + </loadproperties> + <echo file="${target.folder}/abbot/swt/abbot.properties">abbot.swt.bundle.version=${abbot.swt.bundle.version}</echo> + + </target> + + <!-- ===================================================================== --> + <!-- Steps to do before the target gather.sources --> + <!-- Available parameters : --> + <!-- destination.temp.folder - destination folder --> + <!-- ===================================================================== --> + <target name="pre.gather.sources"> + </target> + + <!-- ===================================================================== --> + <!-- Steps to do after the target gather.sources --> + <!-- Available parameters : --> + <!-- destination.temp.folder - destination folder --> + <!-- ===================================================================== --> + <target name="post.gather.sources"> + </target> + + <!-- ===================================================================== --> + <!-- Steps to do before the target gather.logs --> + <!-- Available parameters : --> + <!-- destination.temp.folder - destination folder --> + <!-- ===================================================================== --> + <target name="pre.gather.logs"> + </target> + + <!-- ===================================================================== --> + <!-- Steps to do after the target gather.logs --> + <!-- Available parameters : --> + <!-- destination.temp.folder - destination folder --> + <!-- ===================================================================== --> + <target name="post.gather.logs"> + </target> + + <!-- ===================================================================== --> + <!-- Steps to do before the target clean --> + <!-- Available parameters : --> + <!-- destination.temp.folder - destination folder --> + <!-- ===================================================================== --> + <target name="pre.clean"> + </target> + + <!-- ===================================================================== --> + <!-- Steps to do after the target clean --> + <!-- Available parameters : --> + <!-- plugin.destination - final destination of the build --> + <!-- build.result.folder - results of the compilation --> + <!-- temp.folder - temporary folder --> + <!-- ===================================================================== --> + <target name="post.clean"> + </target> +</project> Modified: abbot.swt/trunk/abbot.swt/doc/swt/patchingSWT.txt =================================================================== --- abbot.swt/trunk/abbot.swt/doc/swt/patchingSWT.txt 2008-12-12 02:41:00 UTC (rev 2774) +++ abbot.swt/trunk/abbot.swt/doc/swt/patchingSWT.txt 2008-12-12 02:45:07 UTC (rev 2775) @@ -49,7 +49,7 @@ reliably (duh), abbot.swt went ahead and patched. Fortunately the patches are simple, few, and are available for all to -see in the Abbot class abbot.swt.SWTWorkarounds, aka +see in the Abbot class abbot.swt.internal.SWTWorkarounds, aka http://cvs.sourceforge.net/viewcvs.py/*checkout*/abbot/abbot.swt/src/abbot/swt/SWTWorkarounds.java?rev=HEAD Added: abbot.swt/trunk/abbot.swt/src/abbot/swt/Abbot.java =================================================================== --- abbot.swt/trunk/abbot.swt/src/abbot/swt/Abbot.java (rev 0) +++ abbot.swt/trunk/abbot.swt/src/abbot/swt/Abbot.java 2008-12-12 02:45:07 UTC (rev 2775) @@ -0,0 +1,45 @@ +package abbot.swt; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +public class Abbot { + + private static final String PropertiesFile = "abbot.properties"; + + private static final String VersionKey = "abbot.swt.bundle.version"; + + private static String Version; + + public static synchronized String getVersion() { + if (Version == null) { + Version = getProperties().getProperty(VersionKey); + if (Version == null) + Version = org.osgi.framework.Version.emptyVersion.toString(); + } + return Version; + } + + private static synchronized Properties getProperties() { + Properties properties = new Properties(); + InputStream stream = null; + try { + stream = Abbot.class.getResourceAsStream(PropertiesFile); + if (stream != null) + properties.load(stream); + } catch (Exception exception) { + // Empty block intended. + } finally { + if (stream != null) { + try { + stream.close(); + } catch (IOException exception) { + exception.printStackTrace(); + } + } + } + return properties; + } + +} Modified: abbot.swt/trunk/abbot.swt/src/abbot/swt/Log.java =================================================================== --- abbot.swt/trunk/abbot.swt/src/abbot/swt/Log.java 2008-12-12 02:41:00 UTC (rev 2774) +++ abbot.swt/trunk/abbot.swt/src/abbot/swt/Log.java 2008-12-12 02:45:07 UTC (rev 2775) @@ -1,41 +1,100 @@ package abbot.swt; -import java.io.PrintStream; +import java.util.Formatter; +import java.util.logging.Level; +import java.util.logging.Logger; +/** + * Convenience methods for logging. + * + * @see Logger + * @author Gary Johnston + */ public class Log { - private static void log(PrintStream stream, String prefix, String format, - Object... args) { + private static void log(Level level, String format, Object... args) { - if (prefix != null) - stream.printf("%s: ", prefix); - stream.printf(format, args); - stream.println(); + // Format the message. + String message = String.format(format, args); - for (Object object : args) { - if (object instanceof Throwable) - ((Throwable) object).printStackTrace(stream); + // Find a throwable if there is one. + Throwable throwable = null; + for (Object arg : args) { + if (arg instanceof Throwable) { + throwable = (Throwable) arg; + break; + } } + + getLogger().log(level, message, throwable); } - public static void log(String format, Object... args) { - log(System.out, null, format, args); + private static Logger getLogger() { + return Logger.getLogger("abbot.swt"); } + /** + * Logs a formatted {@link Level#INFO} message. + * + * @param format + * A format string. + * @param args + * Arguments to be referenced by the format string. + * @see Logger#log(Level, String) + * @see Formatter#format(String, Object[]) + */ + public static void info(String format, Object... args) { + log(Level.INFO, format, args); + } + + /** + * Logs a formatted {@link Level#FINE} message. + * + * @param format + * A format string. + * @param args + * Arguments to be referenced by the format string. + * @see Logger#log(Level, String) + * @see Formatter#format(String, Object[]) + */ public static void debug(String format, Object... args) { - log(System.out, "debug", format, args); + log(Level.FINE, format, args); } + /** + * Logs a generic {@link Level#FINE} message about a {@link Throwable}. + * + * @param throwable + * A {@link Throwable}. + * @see Logger#log(Level, String) + */ public static void debug(Throwable throwable) { debug("%s", throwable); } - public static void warn(String format, Object... args) { - log(System.err, "warning", format, args); + /** + * Logs a formatted {@link Level#WARNING} message. + * + * @param format + * A format string. + * @param args + * Arguments to be referenced by the format string. + * @see Logger#log(Level, String) + * @see Formatter#format(String, Object[]) + */ + public static void warning(String format, Object... args) { + log(Level.WARNING, format, args); } - public static void warn(Throwable throwable) { - warn("%s", throwable); + /** + * Logs a generic {@link Level#WARNING} message about a {@link Throwable}. + * + * @param throwable + * A {@link Throwable}. + * @see Logger#log(Level, String) + */ + public static void warning(Throwable throwable) { + warning("%s", throwable); } } Deleted: abbot.swt/trunk/abbot.swt/src/abbot/swt/SWTWorkarounds.java =================================================================== --- abbot.swt/trunk/abbot.swt/src/abbot/swt/SWTWorkarounds.java 2008-12-12 02:41:00 UTC (rev 2774) +++ abbot.swt/trunk/abbot.swt/src/abbot/swt/SWTWorkarounds.java 2008-12-12 02:45:07 UTC (rev 2775) @@ -1,272 +0,0 @@ -package abbot.swt; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.widgets.CoolItem; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.swt.widgets.ScrollBar; -import org.eclipse.swt.widgets.Scrollable; -import org.eclipse.swt.widgets.TabFolder; -import org.eclipse.swt.widgets.TabItem; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.swt.widgets.ToolItem; -import org.eclipse.swt.widgets.TreeItem; - -/** - * This class adapts SWT to Abbot, e.g. where SWT methods are not public. - * - * @author Gary Johnston - * @author Steve Northover - */ -public class SWTWorkarounds { - - /*************************** COMMON *****************************/ - public static Rectangle getBounds (Object object) { - Rectangle result = new Rectangle (0, 0, 0, 0); - try { - Method method = object.getClass().getDeclaredMethod ("getBounds", (Class[]) null); - method.setAccessible(true); - result = (Rectangle) method.invoke (object, (Object[]) null); - } catch (Throwable th) { - // TODO - decide what should happen when the method is unavailable - } - return result; - } - - public static Rectangle getBounds(MenuItem menuItem) { - Rectangle itemRect = getBounds ((Object)menuItem); - Rectangle menuRect = getBounds (menuItem.getParent ()); - if ((menuItem.getParent ().getStyle() & SWT.RIGHT_TO_LEFT) != 0) { - itemRect.x = menuRect.x + menuRect.width - itemRect.width - itemRect.x; - } else { - itemRect.x += menuRect.x; - } - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=38436#c143 - itemRect.y += menuRect.y; - return itemRect; - } - - public static Rectangle getBounds (Menu menu) { - return getBounds ((Object)menu); - } - - public static Rectangle getBounds (ScrollBar bar) { - - // Set x,y to the location of the bar relative to its parent. - Scrollable parent = bar.getParent(); - Point parentSize = parent.getSize(); - Point size = bar.getSize(); - int x, y; - if ((bar.getStyle() & SWT.HORIZONTAL) != 0) { - x = 0; - y = parentSize.y - size.y; - } else { - x = parentSize.x - size.x; - y = 0; - } - - // Return the bar's bounds in display coordinates. - return bar.getDisplay().map(parent, null, x, y, size.x, size.y); - } - - /*************************** WIN32 *****************************/ - static int SendMessage (int hWnd, int Msg, int wParam, int [] lParam) { - int result = 0; - try { - Class clazz = Class.forName ("org.eclipse.swt.internal.win32.OS"); - Class [] params = new Class [] { - Integer.TYPE, - Integer.TYPE, - Integer.TYPE, - lParam.getClass (), - }; - Method method = clazz.getMethod ("SendMessage", params); - Object [] args = new Object [] { - new Integer (hWnd), - new Integer (Msg), - new Integer (wParam), - lParam, - }; - result = ((Integer) method.invoke (clazz, args)).intValue (); - } catch (Throwable e) { - // TODO - decide what should happen when the method is unavailable - } - return result; - } - - static Rectangle win32_getBounds(TabItem tabItem) { - TabFolder parent = tabItem.getParent(); - int index = parent.indexOf (tabItem); - if (index == -1) return new Rectangle (0, 0, 0, 0); - int [] rect = new int [4]; - SendMessage (parent.handle, /*TCM_GETITEMRECT*/ 0x130a, index, rect); - int width = rect [2] - rect[0]; - int height = rect [3] - rect [1]; - Rectangle bounds = new Rectangle (rect [0], rect [1], width, height); - return tabItem.getDisplay().map (tabItem.getParent (), null, bounds); - } - - static Rectangle win32_getBounds(TableColumn tableColumn) { - Table parent = tableColumn.getParent (); - int index = parent.indexOf (tableColumn); - if (index == -1) return new Rectangle (0, 0, 0, 0); - int hwndHeader = SendMessage (parent.handle, /*LVM_GETHEADER*/ 0x101f, 0, new int [0]); - int [] rect = new int [4]; - SendMessage (hwndHeader, /*HDM_GETITEMRECT*/ 0x1200 + 7, index, rect); - int width = rect [2] - rect[0]; - int height = rect [3] - rect [1]; - Rectangle bounds = new Rectangle (rect [0], rect [1], width, height); - // TODO - oordinate system may change when the API is added to SWT - return tableColumn.getDisplay().map (parent, null, bounds); - } - - /*************************** GTK *****************************/ - static void gtk_getBounds (int handle, Rectangle bounds) { - try { - Class clazz = Class.forName ("org.eclipse.swt.internal.gtk.OS"); - Class [] params = new Class [] {Integer.TYPE}; - Object [] args = new Object [] {new Integer (handle)}; - Method method = clazz.getMethod ("GTK_WIDGET_X", params); - bounds.x = ((Integer) method.invoke (clazz, args)).intValue (); - method = clazz.getMethod ("GTK_WIDGET_Y", params); - bounds.y = ((Integer) method.invoke (clazz, args)).intValue (); - method = clazz.getMethod ("GTK_WIDGET_WIDTH", params); - bounds.width = ((Integer) method.invoke (clazz, args)).intValue (); - method = clazz.getMethod ("GTK_WIDGET_HEIGHT", params); - bounds.height = ((Integer) method.invoke (clazz, args)).intValue (); - } catch (Throwable e) { - // TODO - decide what should happen when the method is unavailable - } - } - - static Rectangle gtk_getBounds(TableColumn tabColumn) { - Rectangle bounds = new Rectangle (0, 0, 0, 0); - try { - Class c = tabColumn.getClass(); - Field f = c.getDeclaredField("buttonHandle"); - f.setAccessible(true); - int handle = f.getInt(tabColumn); - gtk_getBounds(handle, bounds); - } catch (Throwable e) { - // TODO - decide what should happen when the method is unavailable - } - return tabColumn.getDisplay().map (tabColumn.getParent (), null, bounds); - } - - static Rectangle gtk_getBounds(TabItem tabItem) { - Rectangle bounds = new Rectangle (0, 0, 0, 0); - try { - Class c = Class.forName ("org.eclipse.swt.widgets.Widget"); - Field f = c.getDeclaredField("handle"); - f.setAccessible(true); - int handle = f.getInt(tabItem); - gtk_getBounds(handle, bounds); - } catch (Throwable e) { - // TODO - decide what should happen when the method is unavailable - } - return tabItem.getDisplay().map (tabItem.getParent (), null, bounds); - } - - /*************************** MOTIF *****************************/ - static Rectangle motif_getBounds(TabItem tabItem) { - Rectangle bounds = new Rectangle (0, 0, 0, 0); - try { - Class c = tabItem.getClass(); - Method m = c.getDeclaredMethod("getBounds", (Class[]) null); - m.setAccessible(true); - bounds = (Rectangle)m.invoke(tabItem, (Object[]) null); - int margin = 2; - bounds.x +=margin;bounds.y+=margin; - bounds.width -= 2*margin; bounds.height-=margin; - } catch (Throwable e) { - // TODO - decide what should happen when the method is unavailable - } - return tabItem.getDisplay().map (tabItem.getParent (), null, bounds); - } - - static Rectangle motif_getBounds(TableColumn tableColumn) { - Rectangle bounds = new Rectangle (0, 0, 0, 0); - try { - Class c = tableColumn.getClass(); - Method m = c.getDeclaredMethod("getX", (Class[]) null); - m.setAccessible(true); - bounds.x = ((Integer)m.invoke(tableColumn, (Object[]) null)).intValue(); - bounds.width = tableColumn.getWidth() - 2; - bounds.height = tableColumn.getParent().getHeaderHeight() - 2; - } catch (Throwable e) { - // TODO - decide what should happen when the method is unavailable - } - return tableColumn.getDisplay().map (tableColumn.getParent (), null, bounds); - } - - /*************************** CARBON *****************************/ - static Rectangle carbon_getBounds(TabItem tabItem) { - return null; - } - - static Rectangle carbon_getBounds(TableColumn tableColumn) { - return null; - } - - public static Rectangle getBounds (TabItem tabItem){ - if (SWT.getPlatform().equals("win32")) { - return win32_getBounds (tabItem); - } - if (SWT.getPlatform().equals("gtk")) { - return gtk_getBounds (tabItem); - } - if (SWT.getPlatform().equals("motif")) { - return motif_getBounds (tabItem); - } - if (SWT.getPlatform().equals("carbon")) { - return carbon_getBounds (tabItem); - } - return null; - } - - public static Rectangle getBounds (TableColumn tableColumn) { - if (SWT.getPlatform().equals("win32")) { - return win32_getBounds (tableColumn); - } - if (SWT.getPlatform().equals("gtk")) { - return gtk_getBounds (tableColumn); - } - if (SWT.getPlatform().equals("motif")) { - return motif_getBounds (tableColumn); - } - if (SWT.getPlatform().equals("carbon")) { - return carbon_getBounds (tableColumn); - } - return null; - } - - public static Rectangle getBounds (TableItem item) { - return item.getDisplay().map (item.getParent (), null, item.getBounds (0)); - } - - public static Rectangle getBounds (TreeItem item) { - return item.getDisplay().map (item.getParent (), null, item.getBounds ()); - } - - public static Rectangle getBounds (CTabItem item) { - return item.getDisplay().map (item.getParent (), null, item.getBounds ()); - } - - public static Rectangle getBounds (ToolItem item) { - return item.getDisplay().map (item.getParent (), null, item.getBounds ()); - } - - public static Rectangle getBounds (CoolItem item) { - return item.getDisplay().map (item.getParent (), null, item.getBounds ()); - } -} - - Deleted: abbot.swt/trunk/abbot.swt/src/abbot/swt/Version.java =================================================================== --- abbot.swt/trunk/abbot.swt/src/abbot/swt/Version.java 2008-12-12 02:41:00 UTC (rev 2774) +++ abbot.swt/trunk/abbot.swt/src/abbot/swt/Version.java 2008-12-12 02:45:07 UTC (rev 2775) @@ -1,11 +0,0 @@ -package abbot.swt; - -/** Current version of the framework. */ - -public interface Version { - String VERSION = "0.12.0"; -} - - - - Deleted: abbot.swt/trunk/abbot.swt/src/abbot/swt/WaitTimedOutError.java =================================================================== --- abbot.swt/trunk/abbot.swt/src/abbot/swt/WaitTimedOutError.java 2008-12-12 02:41:00 UTC (rev 2774) +++ abbot.swt/trunk/abbot.swt/src/abbot/swt/WaitTimedOutError.java 2008-12-12 02:45:07 UTC (rev 2775) @@ -1,23 +0,0 @@ -package abbot.swt; - -import junit.framework.AssertionFailedError; -import abbot.swt.utilities.Wait; - -/** - * Thrown when a wait times out. - * - * @see Wait - */ -public class WaitTimedOutError extends AssertionFailedError { - - private static final long serialVersionUID = 6286817949395706974L; - - public WaitTimedOutError() { - super(); - } - - public WaitTimedOutError(String message) { - super(message); - } - -} Deleted: abbot.swt/trunk/abbot.swt/src/abbot/swt/WidgetLocator.java =================================================================== --- abbot.swt/trunk/abbot.swt/src/abbot/swt/WidgetLocator.java 2008-12-12 02:41:00 UTC (rev 2774) +++ abbot.swt/trunk/abbot.swt/src/abbot/swt/WidgetLocator.java 2008-12-12 02:45:07 UTC (rev 2775) @@ -1,210 +0,0 @@ -package abbot.swt; - -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.CoolItem; -import org.eclipse.swt.widgets.Decorations; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.swt.widgets.ScrollBar; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.TabItem; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.swt.widgets.ToolItem; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.swt.widgets.TreeItem; -import org.eclipse.swt.widgets.Widget; - -/** - * Provides a means to find the coordinates of an SWT Widget in display-space, given an SWT Display - * object. - * - * @author Kevin T Dale - * @version $Id: WidgetLocator.java 2112 2007-01-15 13:56:34Z gjohnsto $ - */ -public class WidgetLocator { - public static final String copyright = "Licensed Materials -- Property of IBM\n" - + "(c) Copyright International Business Machines Corporation, 2003\nUS Government " - + "Users Restricted Rights - Use, duplication or disclosure restricted by GSA " - + "ADP Schedule Contract with IBM Corp."; - - /** - * Returns the location of the top left-hand corner of a the client area of a given Widget in - * display space. - * - * @param w - * the Widget to be found - * @return the location of Widget w - */ - public static Point getLocation(Widget w) { - return getLocation(w, true); - } - - /** - * Returns the location of the top left-hand corner of a given Widget in display space, - * optionally ignoring the Widget's trimmings. For example, to obtain the location of the area - * of the Widget that can recieve mouse actions, use <code>ignoreBorder==true</code>. - * - * @param w - * the Widget to be found - * @param ignoreBorder - * should the border be considered? - * @return the location of Widget w - */ - public static Point getLocation(Widget w, boolean ignoreBorder) { - Rectangle bounds; - try { - bounds = getBounds(w, ignoreBorder); - } catch (NullPointerException npe) { - return null; - } - return new Point(bounds.x, bounds.y); - } - - /** - * Finds the display-space rectangle that bounds the given Widget's client area. - * - * @param w - * the Widget to be found - * @return the bounds of the widget's client area - */ - public static Rectangle getBounds(Widget w) { - return getBounds(w, true); - } - - /** - * Finds the display space rectangle that bounds the given Widget, optionally ignoring the - * Widget's trimmings. - * - * @param w - * the Widget to be found - * @param ignoreBorder - * should the border be considered? - * @return the bounding rectangle - */ - public static Rectangle getBounds(Widget w, boolean ignoreBorder) { - if (w instanceof Control) { - if (ignoreBorder && w instanceof Decorations) { - Rectangle bounds = ((Decorations) w).getBounds(); - Rectangle clientArea = ((Decorations) w).getClientArea(); - Rectangle calced = ((Decorations) w).computeTrim( - bounds.x, - bounds.y, - clientArea.width, - clientArea.height); - Rectangle correct = new Rectangle(2 * bounds.x - calced.x, 2 * bounds.y - calced.y, - clientArea.width - 1, // bug workaround - clientArea.height - 1); - return toDisplay(correct, ((Decorations) w)); - } - if (ignoreBorder && w instanceof Button) { - Rectangle bounds = ((Button) w).getBounds(); - bounds.width -= 1; - bounds.height -= 1; - return toDisplay(bounds, (Control) w); - } else { - return toDisplay(((Control) w).getBounds(), ((Control) w)); - } - } - // The following block exists to workaround problems with Widget.getBounds() - if (w instanceof Menu) - return SWTWorkarounds.getBounds((Menu) w); - if (w instanceof CTabItem) { - return SWTWorkarounds.getBounds((CTabItem) w); - } - if (w instanceof MenuItem) { - // MenuItem item = (MenuItem)w; - // Rectangle bounds = SWTWorkarounds.getBounds(item); - // Point p = item.getParent().getParent().toDisplay(bounds.x,bounds.y); - // return new Rectangle(p.x,p.y,bounds.width,bounds.height); - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=38436#c113 - // thanks Veronika Irvine - return SWTWorkarounds.getBounds((MenuItem) w); - } - if (w instanceof TabItem) { - // moved to SWTWorkarounds.getBounds(TabItem) - // TabItem item = (TabItem)w; - // Rectangle bounds = SWTWorkarounds.getBounds(item); - // Point p = item.getParent().toDisplay(bounds.x,bounds.y); - // return new Rectangle(p.x,p.y,bounds.width,bounds.height); - return SWTWorkarounds.getBounds((TabItem) w); - } - if (w instanceof TableColumn) { - // moved to SWTWorkarounds.getBounds(TableColumn) - // TableColumn col = (TableColumn)w; - // Rectangle bounds = SWTWorkarounds.getBounds(col); - // Point p = col.getParent().toDisplay(bounds.x,bounds.y); - // return new Rectangle(p.x,p.y,bounds.width,bounds.height); - return SWTWorkarounds.getBounds((TableColumn) w); - } - if (w instanceof TreeColumn) { - return SWTWorkarounds.getBounds(w); - } - if (w instanceof ScrollBar) { - return SWTWorkarounds.getBounds((ScrollBar) w); - // ScrollBar bar = (ScrollBar)w; - // Rectangle bounds = bar.getBounds(); - // Point p = bar.getParent().toDisplay(bounds.x,bounds.y); - // return new Rectangle(p.x,p.y,bounds.width,bounds.height); - } - if (w instanceof ToolItem) { - // moved to SWTWorkarounds.getBounds(ToolItem) - // ToolItem item = (ToolItem)w; - // Rectangle bounds = item.getBounds(); - // Point p = item.getParent().toDisplay(bounds.x,bounds.y); - // return new Rectangle(p.x,p.y,bounds.width,bounds.height); - return SWTWorkarounds.getBounds((ToolItem) w); - } - if (w instanceof CoolItem) { - // moved to SWTWorkarounds.getBounds(CoolItem) - // CoolItem item = (CoolItem)w; - // Rectangle bounds = item.getBounds(); - // Point p = item.getParent().toDisplay(bounds.x,bounds.y); - // return new Rectangle(p.x,p.y,bounds.width,bounds.height); - return SWTWorkarounds.getBounds((CoolItem) w); - } - if (w instanceof TreeItem) { - // moved to SWTWorkarounds.getBounds(TreeItem) - // TreeItem item = (TreeItem)w; - // Rectangle bounds = item.getBounds(); - // Point p = item.getParent().toDisplay(bounds.x,bounds.y); - // return new Rectangle(p.x,p.y,bounds.width,bounds.height); - return SWTWorkarounds.getBounds((TreeItem) w); - } - // Tao Weng 04/25/2005 10:39:05 AM: thanks! - if (w instanceof TableItem) { - // moved to SWTWorkarounds.getBounds(TreeItem) - // TableItem item = (TableItem)w; - // Rectangle bounds = SWTWorkarounds.getBounds(item); - // Point p = item.getParent().toDisplay(bounds.x,bounds.y); - // return new Rectangle(p.x,p.y,bounds.width,bounds.height); - return SWTWorkarounds.getBounds((TableItem) w); - } - - // TODO: look for ALL items that have a getBounds() method in 3.0: - // TODO: (cont'd) ToolItem, CoolItem, TableItem, TreeItem, etc - // System.err.println( - // "Unable to find coordinates of \""+w.getClass()+"\"; returning NULL"); - return null; - } - - /** - * Helper method to convert a Rectangle, given in the coordinate system of the given Control's - * parent, to display-cordinates. - */ - public static Rectangle toDisplay(Rectangle bounds, Control control) { - - // If it's a Shell or has no parent then the bounds are already display-relative. - if (control instanceof Shell || control.getParent() == null) - return bounds; - - // Convert from parent-relative to display-relative. - Point point = control.getParent().toDisplay(bounds.x, bounds.y); - return new Rectangle(point.x, point.y, bounds.width, bounds.height); - } - -} Added: abbot.swt/trunk/abbot.swt/src/abbot/swt/abbot.properties =================================================================== --- abbot.swt/trunk/abbot.swt/src/abbot/swt/abbot.properties (rev 0) +++ abbot.swt/trunk/abbot.swt/src/abbot/swt/abbot.properties 2008-12-12 02:45:07 UTC (rev 2775) @@ -0,0 +1 @@ +abbot.swt.bundle.version = 0.1.0 Modified: abbot.swt/trunk/abbot.swt/src/abbot/swt/display/DisplayTester.java =================================================================== --- abbot.swt/trunk/abbot.swt/src/abbot/swt/display/DisplayTester.java 2008-12-12 02:41:00 UTC (rev 2774) +++ abbot.swt/trunk/abbot.swt/src/abbot/swt/display/DisplayTester.java 2008-12-12 02:45:07 UTC (rev 2775) @@ -24,13 +24,14 @@ import org.eclipse.swt.widgets.Shell; import abbot.swt.Log; -import abbot.swt.WaitTimedOutError; import abbot.swt.script.Condition; import abbot.swt.tester.Action; import abbot.swt.tester.ControlTester; import abbot.swt.utilities.Bresenham; +import abbot.swt.utilities.SWTUtil; import abbot.swt.utilities.Threads; import abbot.swt.utilities.Wait; +import abbot.swt.utilities.WaitTimedOutError; /** * A tester for a {@link Display}. @@ -510,7 +511,7 @@ */ public synchronized void mouseWheel(int count, boolean page) { checkThread(); - if (SWT.getPlatform().equals("gtk")) + if (SWTUtil.IsGTK) throw new UnsupportedOperationException("unsupported on GTK"); postMouseWheel(count, page); } @@ -531,14 +532,13 @@ * pressed at the drag starting location and released at the drop target location * @throws IllegalArgumentException * <ul> - * <li>if called on the receiver's {@link Display} {@link Thread}; or </li> <li>if - * either the starting location or target location are invalid; or</li> <li>the - * buttonMask is invalid</li> + * <li>if called on the receiver's {@link Display} {@link Thread}; or</li> + * <li>if either the starting location or target location are invalid; or</li> + * <li>the buttonMask is invalid</li> * </ul> */ @Action - public synchronized void dragDrop(int sx, int sy, int tx, int ty, - final int buttonmask) { + public synchronized void dragDrop(int sx, int sy, int tx, int ty, final int buttonmask) { checkThread(); checkLocation(sx, sy); checkLocation(tx, ty); @@ -609,7 +609,7 @@ waitMouseLocation(x, y); return; } catch (WaitTimedOutError exception) { - Log.warn("Strike one: %s\n", exception); + Log.warning("Strike one: %s\n", exception); } // Second try. @@ -618,7 +618,7 @@ waitMouseLocation(x, y); return; } catch (WaitTimedOutError exception) { - Log.warn("Strike two: %s\n", exception); + Log.warning("Strike two: %s\n", exception); } // Third and final try. @@ -690,17 +690,20 @@ } /** - * Generates user input events to cause a keystroke (key press and release), optionally - * including one or more modifiers. + * Generates user input events to cause one or more keystrokes (key press and release), each + * optionally including one or more modifiers. * <p> - * They keystroke is specified as an integer keymask which can contain exactly one character or + * Each keystroke is specified as an integer keymask which can contain exactly one character or * keycode and, optionally, one or more modifier flags ({@link SWT#CTRL}, {@link SWT#ALT}, - * {@link SWT#SHIFT} and {@link SWT#COMMAND} ). + ... [truncated message content] |