diff options
author | cvs2svn | 2002-06-26 20:46:23 +0000 |
---|---|---|
committer | cvs2svn | 2002-06-26 20:46:23 +0000 |
commit | 04527b169a6cc32d46fc2e54564a316d329a2f30 (patch) | |
tree | 9f66eff993c82bd45c6c999e66d91486fc7d6778 | |
parent | 1cde07f37683aadb8b521425b967428284f85342 (diff) | |
download | eclipse.platform.swt-04527b169a6cc32d46fc2e54564a316d329a2f30.tar.gz eclipse.platform.swt-04527b169a6cc32d46fc2e54564a316d329a2f30.tar.xz eclipse.platform.swt-04527b169a6cc32d46fc2e54564a316d329a2f30.zip |
This commit was manufactured by cvs2svn to create branch 'R2_0_1'.
Sprout from master 2002-06-26 20:46:22 UTC Steve Northover <steve> '21006'
Delete:
examples/org.eclipse.swt.examples.controls/.classpath
examples/org.eclipse.swt.examples.controls/.cvsignore
examples/org.eclipse.swt.examples.controls/.project
examples/org.eclipse.swt.examples.controls/about.html
examples/org.eclipse.swt.examples.controls/build.properties
examples/org.eclipse.swt.examples.controls/doc-html/hglegal2002.htm
examples/org.eclipse.swt.examples.controls/doc-html/ngibmcpy2002.gif
examples/org.eclipse.swt.examples.controls/doc-html/swt_controls_ex.html
examples/org.eclipse.swt.examples.controls/icons/controls_example.gif
examples/org.eclipse.swt.examples.controls/plugin.properties
examples/org.eclipse.swt.examples.controls/plugin.xml
examples/org.eclipse.swt.examples.controls/src/import.properties
examples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlPlugin.java
examples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlView.java
examples/org.eclipse.swt.examples.launcher/.classpath
examples/org.eclipse.swt.examples.launcher/.cvsignore
examples/org.eclipse.swt.examples.launcher/.project
examples/org.eclipse.swt.examples.launcher/about.html
examples/org.eclipse.swt.examples.launcher/build.properties
examples/org.eclipse.swt.examples.launcher/doc-html/hglegal2002.htm
examples/org.eclipse.swt.examples.launcher/doc-html/ngibmcpy2002.gif
examples/org.eclipse.swt.examples.launcher/doc-html/swt_launcher_ex.html
examples/org.eclipse.swt.examples.launcher/doc/org.eclipse.swt.examples.launcher.launchItems.html
examples/org.eclipse.swt.examples.launcher/icons/closedFolder.gif
examples/org.eclipse.swt.examples.launcher/icons/generic_example.gif
examples/org.eclipse.swt.examples.launcher/icons/launcher_example.gif
examples/org.eclipse.swt.examples.launcher/icons/openFolder.gif
examples/org.eclipse.swt.examples.launcher/plugin.properties
examples/org.eclipse.swt.examples.launcher/plugin.xml
examples/org.eclipse.swt.examples.launcher/schema/org.eclipse.swt.examples.launcher.launchItems.exsd
examples/org.eclipse.swt.examples.launcher/src/import.properties
examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemDescriptor.java
examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemTreeNode.java
examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherPlugin.java
examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherView.java
examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/SplitLayout.java
examples/org.eclipse.swt.examples.layouts/.classpath
examples/org.eclipse.swt.examples.layouts/.cvsignore
examples/org.eclipse.swt.examples.layouts/.project
examples/org.eclipse.swt.examples.layouts/about.html
examples/org.eclipse.swt.examples.layouts/build.properties
examples/org.eclipse.swt.examples.layouts/doc-html/hglegal2002.htm
examples/org.eclipse.swt.examples.layouts/doc-html/ngibmcpy2002.gif
examples/org.eclipse.swt.examples.layouts/doc-html/swt_layout_ex.html
examples/org.eclipse.swt.examples.layouts/icons/layouts_example.gif
examples/org.eclipse.swt.examples.layouts/plugin.properties
examples/org.eclipse.swt.examples.layouts/plugin.xml
examples/org.eclipse.swt.examples.layouts/src/import.properties
examples/org.eclipse.swt.examples.layouts/src/org/eclipse/swt/examples/layouts/LayoutPlugin.java
examples/org.eclipse.swt.examples.layouts/src/org/eclipse/swt/examples/layouts/LayoutView.java
examples/org.eclipse.swt.examples.ole.win32/.classpath
examples/org.eclipse.swt.examples.ole.win32/.cvsignore
examples/org.eclipse.swt.examples.ole.win32/.project
examples/org.eclipse.swt.examples.ole.win32/about.html
examples/org.eclipse.swt.examples.ole.win32/build.properties
examples/org.eclipse.swt.examples.ole.win32/doc-html/hglegal2002.htm
examples/org.eclipse.swt.examples.ole.win32/doc-html/ngibmcpy2002.gif
examples/org.eclipse.swt.examples.ole.win32/doc-html/swt_ole_ex.html
examples/org.eclipse.swt.examples.ole.win32/icons/backward_nav.gif
examples/org.eclipse.swt.examples.ole.win32/icons/forward_nav.gif
examples/org.eclipse.swt.examples.ole.win32/icons/home_nav.gif
examples/org.eclipse.swt.examples.ole.win32/icons/refresh_nav.gif
examples/org.eclipse.swt.examples.ole.win32/icons/search_nav.gif
examples/org.eclipse.swt.examples.ole.win32/icons/stop_nav.gif
examples/org.eclipse.swt.examples.ole.win32/icons/webbrowser_example.gif
examples/org.eclipse.swt.examples.ole.win32/plugin.properties
examples/org.eclipse.swt.examples.ole.win32/plugin.xml
examples/org.eclipse.swt.examples.ole.win32/src/import.properties
examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleBrowserView.java
examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java
examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java
examples/org.eclipse.swt.examples.paint/.classpath
examples/org.eclipse.swt.examples.paint/.cvsignore
examples/org.eclipse.swt.examples.paint/.project
examples/org.eclipse.swt.examples.paint/about.html
examples/org.eclipse.swt.examples.paint/build.properties
examples/org.eclipse.swt.examples.paint/doc-html/hglegal2002.htm
examples/org.eclipse.swt.examples.paint/doc-html/ngibmcpy2002.gif
examples/org.eclipse.swt.examples.paint/doc-html/swt_paint_ex.html
examples/org.eclipse.swt.examples.paint/icons/fill_none.gif
examples/org.eclipse.swt.examples.paint/icons/fill_outline.gif
examples/org.eclipse.swt.examples.paint/icons/fill_solid.gif
examples/org.eclipse.swt.examples.paint/icons/linestyle_dash.gif
examples/org.eclipse.swt.examples.paint/icons/linestyle_dashdot.gif
examples/org.eclipse.swt.examples.paint/icons/linestyle_dot.gif
examples/org.eclipse.swt.examples.paint/icons/linestyle_solid.gif
examples/org.eclipse.swt.examples.paint/icons/options_font.gif
examples/org.eclipse.swt.examples.paint/icons/paint_example.gif
examples/org.eclipse.swt.examples.paint/icons/tool_airbrush.gif
examples/org.eclipse.swt.examples.paint/icons/tool_ellipse.gif
examples/org.eclipse.swt.examples.paint/icons/tool_line.gif
examples/org.eclipse.swt.examples.paint/icons/tool_pencil.gif
examples/org.eclipse.swt.examples.paint/icons/tool_polyline.gif
examples/org.eclipse.swt.examples.paint/icons/tool_rectangle.gif
examples/org.eclipse.swt.examples.paint/icons/tool_roundedrectangle.gif
examples/org.eclipse.swt.examples.paint/icons/tool_text.gif
examples/org.eclipse.swt.examples.paint/plugin.properties
examples/org.eclipse.swt.examples.paint/plugin.xml
examples/org.eclipse.swt.examples.paint/src/import.properties
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/AirbrushTool.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/BasicPaintSession.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContainerFigure.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/DragPaintSession.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseFigure.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseTool.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/Figure.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/FigureDrawContext.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineFigure.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineTool.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintPlugin.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSession.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSurface.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintTool.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintView.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PencilTool.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PointFigure.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PolyLineTool.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleFigure.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleTool.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleTool.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SegmentedPaintSession.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidEllipseFigure.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidPolygonFigure.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRectangleFigure.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextFigure.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextTool.java
examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ToolSettings.java
examples/org.eclipse.swt.examples/.classpath
examples/org.eclipse.swt.examples/.cvsignore
examples/org.eclipse.swt.examples/.project
examples/org.eclipse.swt.examples/about.html
examples/org.eclipse.swt.examples/build.properties
examples/org.eclipse.swt.examples/doc-html/hglegal2002.htm
examples/org.eclipse.swt.examples/doc-html/ngibmcpy2002.gif
examples/org.eclipse.swt.examples/doc-html/swt_addressbook_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_controls_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_fileviewer_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_helloworld_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_hoverhelp_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_imageanalyzer_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_javaviewer_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_launcher_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_layout_ex.html
examples/org.eclipse.swt.examples/doc-html/swt_manual_setup.html
examples/org.eclipse.swt.examples/doc-html/swt_texteditor_ex.html
examples/org.eclipse.swt.examples/plugin.properties
examples/org.eclipse.swt.examples/plugin.xml
examples/org.eclipse.swt.examples/src/examples_addressbook.properties
examples/org.eclipse.swt.examples/src/examples_control.properties
examples/org.eclipse.swt.examples/src/examples_fileviewer.properties
examples/org.eclipse.swt.examples/src/examples_helloworld.properties
examples/org.eclipse.swt.examples/src/examples_hoverhelp.properties
examples/org.eclipse.swt.examples/src/examples_images.properties
examples/org.eclipse.swt.examples/src/examples_javaviewer.properties
examples/org.eclipse.swt.examples/src/examples_layout.properties
examples/org.eclipse.swt.examples/src/examples_texteditor.properties
examples/org.eclipse.swt.examples/src/import.properties
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/AddressBook.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/DataEntryDialog.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/FindListener.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/SearchDialog.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/AlignableTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ButtonTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ComboTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CoolBarTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/DialogTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LabelTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ListTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ProgressBarTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/RangeTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SashTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ScrollableTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ShellTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SliderTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TextTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ToolBarTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/bold.bmp
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/bold_mask.bmp
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/closedFolder.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/openFolder.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/red.bmp
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/red_mask.bmp
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/target.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/yellow.bmp
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/yellow_mask.bmp
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/IconCache.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Copy.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Cut.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Delete.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Parent.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Paste.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Print.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Rename.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Search.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/generic_example.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_File.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld1.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld2.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld3.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld4.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld5.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/information.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/warning.gif
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaViewer.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FillLayoutTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/LayoutExample.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/RowLayoutTab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/Tab.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/Images.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue.bmp
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue_mask.bmp
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold.bmp
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold_mask.bmp
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase.bmp
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase_mask.bmp
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green.bmp
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green_mask.bmp
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red.bmp
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red_mask.bmp
tests/org.eclipse.swt.tests/.classpath
tests/org.eclipse.swt.tests/.cvsignore
tests/org.eclipse.swt.tests/.project
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllGraphicsTests.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllTests.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllWidgetTests.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/EmulatedWidgetsTests.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/StyledTextContentSpec.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtJunit.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestCase.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWT.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTError.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTException.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_AnimatedProgress.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BusyIndicator.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CLabel.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolder.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderAdapter.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabItem.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ControlEditor.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_PopupList.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ST.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_SashForm.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ScrolledComposite.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StackLayout.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyleRange.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledTextContent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableEditor.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTree.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeEditor.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeItem.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangeListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangedEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangingEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TreeEditor.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_VerifyKeyListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ViewForm.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_ByteArrayTransfer.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Clipboard.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DND.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSource.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceAdapter.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTarget.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetAdapter.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_FileTransfer.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_RTFTransfer.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TextTransfer.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Transfer.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TransferData.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlAdapter.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusAdapter.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyAdapter.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuAdapter.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseAdapter.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseMoveListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackAdapter.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionAdapter.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellAdapter.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeAdapter.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TypedEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Color.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Cursor.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Device.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_DeviceData.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Drawable.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Font.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontData.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontMetrics.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GCData.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageData.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoader.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderEvent.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_PaletteData.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Point.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_RGB.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Rectangle.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Region.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FillLayout.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridData.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridLayout.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowData.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowLayout.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrintDialog.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_Printer.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrinterData.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_program_Program.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Button.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Canvas.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Caret.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ColorDialog.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolBar.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolItem.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Decorations.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Dialog.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DirectoryDialog.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Event.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FileDialog.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FontDialog.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Group.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Item.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Label.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Layout.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_List.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Listener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Menu.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MenuItem.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MessageBox.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ProgressBar.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Sash.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scale.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ScrollBar.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scrollable.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Shell.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Slider.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Synchronizer.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabFolder.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabItem.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Table.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableColumn.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Text.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolBar.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolItem.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tracker.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TypedListener.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Widget.java
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/check.bmp
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/dot.gif
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.bmp
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.bmp
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/push.bmp
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/radio.bmp
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.bmp
tests/org.eclipse.swt.tests/about.html
tests/org.eclipse.swt.tests/build.properties
tests/org.eclipse.swt.tests/plugin.properties
tests/org.eclipse.swt.tests/plugin.xml
tests/org.eclipse.swt.tests/test.xml
432 files changed, 0 insertions, 56029 deletions
diff --git a/examples/org.eclipse.swt.examples.controls/.classpath b/examples/org.eclipse.swt.examples.controls/.classpath deleted file mode 100755 index 2b023fa1e1..0000000000 --- a/examples/org.eclipse.swt.examples.controls/.classpath +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="var" path="JRE_LIB"/> - <classpathentry kind="var" - path="ECLIPSE_HOME/plugins/org.eclipse.core.runtime_2.0.0/runtime.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.core.runtime_1.9.0/runtimesrc.zip"/> - <classpathentry kind="var" - path="ECLIPSE_HOME/plugins/org.eclipse.ui_2.0.0/workbench.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.ui_1.9.0/workbenchsrc.zip"/> - <classpathentry kind="src" path="/org.eclipse.swt.examples"/> - <classpathentry kind="src" path="/org.eclipse.swt"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/examples/org.eclipse.swt.examples.controls/.cvsignore b/examples/org.eclipse.swt.examples.controls/.cvsignore deleted file mode 100755 index c5e82d7458..0000000000 --- a/examples/org.eclipse.swt.examples.controls/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples.controls/.project b/examples/org.eclipse.swt.examples.controls/.project deleted file mode 100644 index 8ef8047fe2..0000000000 --- a/examples/org.eclipse.swt.examples.controls/.project +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.swt.examples.controls</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.swt</project>
- <project>org.eclipse.swt.examples</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/examples/org.eclipse.swt.examples.controls/about.html b/examples/org.eclipse.swt.examples.controls/about.html deleted file mode 100644 index 9db411aab9..0000000000 --- a/examples/org.eclipse.swt.examples.controls/about.html +++ /dev/null @@ -1,30 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<html> -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>20th June, 2002</p> -<h3>License</h3> -<p>Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>. -For purposes of the CPL, "Program" will mean the Content.</p> - -<h3>Contributions</h3> - -<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise -made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such -Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p> - -<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the -host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available -to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also -providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of -the CPL.</p> - -</body> -</html>
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples.controls/build.properties b/examples/org.eclipse.swt.examples.controls/build.properties deleted file mode 100755 index daf2c0b0be..0000000000 --- a/examples/org.eclipse.swt.examples.controls/build.properties +++ /dev/null @@ -1,10 +0,0 @@ -bin.includes = doc-html/,\
- icons/,\
- plugin.properties,\
- plugin.xml,\
- about.html,\
- *.jar
-
-src.includes = about.html
-
-source.controls.jar = src/
diff --git a/examples/org.eclipse.swt.examples.controls/doc-html/hglegal2002.htm b/examples/org.eclipse.swt.examples.controls/doc-html/hglegal2002.htm deleted file mode 100644 index 74393f08f3..0000000000 --- a/examples/org.eclipse.swt.examples.controls/doc-html/hglegal2002.htm +++ /dev/null @@ -1,14 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2002. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.controls/doc-html/ngibmcpy2002.gif b/examples/org.eclipse.swt.examples.controls/doc-html/ngibmcpy2002.gif Binary files differdeleted file mode 100644 index dd2f444669..0000000000 --- a/examples/org.eclipse.swt.examples.controls/doc-html/ngibmcpy2002.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.controls/doc-html/swt_controls_ex.html b/examples/org.eclipse.swt.examples.controls/doc-html/swt_controls_ex.html deleted file mode 100755 index d4d44a56d0..0000000000 --- a/examples/org.eclipse.swt.examples.controls/doc-html/swt_controls_ex.html +++ /dev/null @@ -1,27 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Controls Example</title>
-</head>
-<body>
-
-<h2>SWT Example - Controls Example</h2>
-
-<p>
-The Controls example is a simple demonstration of common SWT controls.
-It consists of a tab folder where each tab in the folder allows the user
-to interact with a different control.
-The user can change styles and settings and view how this affects the control.
-</p>
-
-<h3>Running the example</h3>
-<p>From the Window menu select Show View --> Other.
-In the Show View dialog, expand SWT Examples and select the
-view named SWT Controls. A view titled SWT Controls will appear in your current perspective.
-</p>
-
-
-<p><a href="hglegal2002.htm"><img SRC="ngibmcpy2002.gif" ALT="Copyright IBM Corporation 2000, 2002. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.controls/icons/controls_example.gif b/examples/org.eclipse.swt.examples.controls/icons/controls_example.gif Binary files differdeleted file mode 100755 index cbdee97066..0000000000 --- a/examples/org.eclipse.swt.examples.controls/icons/controls_example.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.controls/plugin.properties b/examples/org.eclipse.swt.examples.controls/plugin.properties deleted file mode 100755 index 418cd71a1e..0000000000 --- a/examples/org.eclipse.swt.examples.controls/plugin.properties +++ /dev/null @@ -1,16 +0,0 @@ -providerName = Eclipse.org
-plugin.SWTControlsExample.name = SWT Controls Example Plugin
-category.SWTExamples.name = SWT Examples
-view.ControlsExample.name = SWT Controls
-
-launchcategory.SWTViewExamples.name = Workbench Views
-launchcategory.SWTViewExamples.description = \
- A collection of Standard Widget Toolkit examples that run as Views inside the Workbench. \
- These examples will create a new View in the current Perspective.
-
-launchitem.ControlsExample.name = Controls
-launchitem.ControlsExample.description = \
- This example is a simple demonstration of common SWT controls.\n\n\
- It consists of a tab folder where each tab allows the user \
- to interact with a different SWT control. \
- The user can change styles and settings and view how this affects the control.
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples.controls/plugin.xml b/examples/org.eclipse.swt.examples.controls/plugin.xml deleted file mode 100755 index 3b282d4018..0000000000 --- a/examples/org.eclipse.swt.examples.controls/plugin.xml +++ /dev/null @@ -1,54 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<plugin
- id="org.eclipse.swt.examples.controls"
- name="%plugin.SWTControlsExample.name"
- version="2.0.0"
- provider-name="%providerName"
- class="org.eclipse.swt.examples.controls.ControlPlugin">
-
-<!-- Runtime -->
-<!-- Runtime -->
- <runtime>
- <library name="controls.jar"/>
- </runtime>
-<!-- Required plugins -->
- <requires>
- <import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.swt"/>
- <import plugin="org.eclipse.swt.examples"/>
- </requires>
-
-
-<!-- Extension points -->
-<!-- Extensions -->
- <extension
- point="org.eclipse.ui.views">
- <view
- name="%view.ControlsExample.name"
- icon="icons/controls_example.gif"
- category="org.eclipse.swt.examples.category"
- class="org.eclipse.swt.examples.controls.ControlView"
- id="org.eclipse.swt.examples.controls.view">
- </view>
- </extension>
- <extension
- point="org.eclipse.swt.examples.launcher.launchItems">
- <category
- name="%launchcategory.SWTViewExamples.name"
- description="%launchcategory.SWTViewExamples.description"
- id="org.eclipse.swt.examples.launchViewCategory">
- </category>
- <item
- name="%launchitem.ControlsExample.name"
- icon="icons/controls_example.gif"
- description="%launchitem.ControlsExample.description"
- category="org.eclipse.swt.examples.launchViewCategory"
- id="org.eclipse.swt.examples.controls.viewlauncher">
- <view
- viewId="org.eclipse.swt.examples.controls.view">
- </view>
- </item>
- </extension>
-
-</plugin>
diff --git a/examples/org.eclipse.swt.examples.controls/src/import.properties b/examples/org.eclipse.swt.examples.controls/src/import.properties deleted file mode 100644 index 265131a99c..0000000000 --- a/examples/org.eclipse.swt.examples.controls/src/import.properties +++ /dev/null @@ -1,4 +0,0 @@ -# Persist project settings for later import -natures = org.eclipse.jdt.core.javanature; org.eclipse.pde.PluginNature -builders = org.eclipse.jdt.core.javabuilder; org.eclipse.pde.ManifestBuilder; org.eclipse.pde.SchemaBuilder -var.ECLIPSE_PLUGINS = <<ECLIPSE_PLUGINS>> diff --git a/examples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlPlugin.java b/examples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlPlugin.java deleted file mode 100755 index 25bf20ed1b..0000000000 --- a/examples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlPlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.plugin.*;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class ControlPlugin extends AbstractUIPlugin {
- /**
- * The constructor.
- */
- public ControlPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- }
-
- /**
- * Clean up
- */
- public void shutdown() throws CoreException {
- super.shutdown();
- }
-}
diff --git a/examples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlView.java b/examples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlView.java deleted file mode 100755 index a55b7545a5..0000000000 --- a/examples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlView.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.examples.controlexample.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.part.*;
-
-/**
- * <code>Controls</code> is a simple demonstration
- * of the controls defined by SWT. It consists of a workbench
- * view and tab folder where each tab in the folder allows the
- * user to interact with a control.
- *
- * @see ViewPart
- */
-public class ControlView extends ViewPart {
- ControlExample instance = null;
-
- /**
- * Create the example
- *
- * @see ViewPart#createPartControl
- */
- public void createPartControl(Composite frame) {
- instance = new ControlExample(frame);
- }
-
- /**
- * Called when we must grab focus.
- *
- * @see org.eclipse.ui.part.ViewPart#setFocus
- */
- public void setFocus() {
- instance.setFocus();
- }
-
- /**
- * Called when the View is to be disposed
- */
- public void dispose() {
- instance.dispose();
- instance = null;
- super.dispose();
- }
-}
diff --git a/examples/org.eclipse.swt.examples.launcher/.classpath b/examples/org.eclipse.swt.examples.launcher/.classpath deleted file mode 100755 index 57088c82eb..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/.classpath +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="/org.eclipse.swt"/> - <classpathentry kind="src" path="/org.eclipse.swt.examples"/> - <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/> - <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.ui_2.0.0/workbench.jar"/> - <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.core.boot_2.0.0/boot.jar"/> - <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.core.runtime_2.0.0/runtime.jar"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/examples/org.eclipse.swt.examples.launcher/.cvsignore b/examples/org.eclipse.swt.examples.launcher/.cvsignore deleted file mode 100755 index c5e82d7458..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples.launcher/.project b/examples/org.eclipse.swt.examples.launcher/.project deleted file mode 100644 index 3aa0f07860..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/.project +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.swt.examples.launcher</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.swt</project>
- <project>org.eclipse.swt.examples</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/examples/org.eclipse.swt.examples.launcher/about.html b/examples/org.eclipse.swt.examples.launcher/about.html deleted file mode 100644 index 9db411aab9..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/about.html +++ /dev/null @@ -1,30 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<html> -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>20th June, 2002</p> -<h3>License</h3> -<p>Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>. -For purposes of the CPL, "Program" will mean the Content.</p> - -<h3>Contributions</h3> - -<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise -made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such -Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p> - -<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the -host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available -to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also -providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of -the CPL.</p> - -</body> -</html>
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples.launcher/build.properties b/examples/org.eclipse.swt.examples.launcher/build.properties deleted file mode 100755 index 8d7ddf74e0..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/build.properties +++ /dev/null @@ -1,12 +0,0 @@ -bin.includes = doc/,\
- doc-html/,\
- icons/,\
- schema/,\
- plugin.properties,\
- plugin.xml,\
- about.html,\
- *.jar
-
-src.includes = about.html
-
-source.launcher.jar = src/
diff --git a/examples/org.eclipse.swt.examples.launcher/doc-html/hglegal2002.htm b/examples/org.eclipse.swt.examples.launcher/doc-html/hglegal2002.htm deleted file mode 100644 index 74393f08f3..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/doc-html/hglegal2002.htm +++ /dev/null @@ -1,14 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2002. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.launcher/doc-html/ngibmcpy2002.gif b/examples/org.eclipse.swt.examples.launcher/doc-html/ngibmcpy2002.gif Binary files differdeleted file mode 100644 index dd2f444669..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/doc-html/ngibmcpy2002.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.launcher/doc-html/swt_launcher_ex.html b/examples/org.eclipse.swt.examples.launcher/doc-html/swt_launcher_ex.html deleted file mode 100755 index 7a548a1fe5..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/doc-html/swt_launcher_ex.html +++ /dev/null @@ -1,45 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Example Launcher</title>
-</head>
-<body>
-
-<h2>SWT Example Launcher</h2>
-
-<p>
-The Example Launcher is used to launch SWT examples which can either be Workbench Views,
-or Standalone applications.
-</p>
-
-<ul>
-<li>Workbench Views are examples that are integrated into Eclipse. When the Launcher
-starts a Workbench View, it is opened in the currently active perspective.
-<li>Standalone applications are launched in a separate window.
-</ul>
-
-<h3>Running the Example Launcher</h3>
-
-<p>
-From the Window menu, select Show View --> Other.
-In the Show View dialog, expand SWT Examples and select the SWT Example Launcher view.
-A view containing a list of examples will appear in your current perspective.
-Select an example from the list. A brief description of the example is displayed.
-Click on the Run button to launch the example.
-</p>
-
-
-<h3>Details</h3>
-<p>The example launcher view contains a tree list, a text area, and a button.
-The tree list contains a list of all the SWT examples you can choose
-to run. When an example is selected from the tree, the text area
-displays a short description of the example. The selected example can
-be launched by clicking on the Run button. Standalone examples are run in the
-same thread as the workbench's UI but they are not integrated into the perspective.
-The launcher invokes the <code>open()</code> method of the standalone example.
-</p>
-
-<p><a href="hglegal2002.htm"><img SRC="ngibmcpy2002.gif" ALT="Copyright IBM Corporation 2000, 2002. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.launcher/doc/org.eclipse.swt.examples.launcher.launchItems.html b/examples/org.eclipse.swt.examples.launcher/doc/org.eclipse.swt.examples.launcher.launchItems.html deleted file mode 100755 index abef83ef0c..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/doc/org.eclipse.swt.examples.launcher.launchItems.html +++ /dev/null @@ -1,60 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> -<HEAD> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -</HEAD> -<HTML> -<BODY> -<H1><CENTER>Launch Items</CENTER></H1> -<H2>Identifier</H2> -org.eclipse.swt.examples.launcher.launchItems<H2>Description</H2> -This extension point is used to add 'standalone program' and -'Workbench view' -launch items to the Launcher, optionally grouping them into -categories so as to form a multi-tiered hierarchy. -Standalone programs are executed using the platform's event loop. -Workbench views are created within the active Workbench Perspective.<H2>Markup</H2> -<p><samp> <!ELEMENT extension (EMPTY)></samp> -<br><samp> <!ATTLIST extension</samp> -<br><samp> point CDATA #REQUIRED</samp> -<br><samp> id CDATA #IMPLIED</samp> -<br><samp> name CDATA #IMPLIED</samp> -<br><samp> ></samp> -<ul> -<li><b>point</b> - </li><li><b>id</b> - </li><li><b>name</b> - </li></ul> -<p><samp> <!ELEMENT program (EMPTY)></samp> -<br><samp> <!ATTLIST program</samp> -<br><samp> mainClass CDATA #REQUIRED</samp> -<br><samp> pluginId CDATA #REQUIRED</samp> -<br><samp> ></samp> -<ul> -<li><b>mainClass</b> - The fully-qualified name of the class whose main() method is to be launched.</li><li><b>pluginId</b> - The unique id of the Eclipse Platform plugin containing the program.</li></ul> -<p><samp> <!ELEMENT view (EMPTY)></samp> -<br><samp> <!ATTLIST view</samp> -<br><samp> viewId CDATA #REQUIRED</samp> -<br><samp> ></samp> -<ul> -<li><b>viewId</b> - The unique id of the Workbench View to be activated when the item is launched.</li></ul> -<p><samp> <!ELEMENT category (EMPTY)></samp> -<br><samp> <!ATTLIST category</samp> -<br><samp> name CDATA #REQUIRED</samp> -<br><samp> id CDATA #REQUIRED</samp> -<br><samp> category CDATA #IMPLIED</samp> -<br><samp> ></samp> -<ul> -<li><b>name</b> - The localized name of this category.</li><li><b>id</b> - The unique id of this category. Categories with duplicate id's will be discarded.</li><li><b>category</b> - The unique id of the parent category.</li></ul> -<p><samp> <!ELEMENT item (EMPTY)></samp> -<br><samp> <!ATTLIST item</samp> -<br><samp> name CDATA #REQUIRED</samp> -<br><samp> id CDATA #REQUIRED</samp> -<br><samp> category CDATA #IMPLIED</samp> -<br><samp> icon CDATA #IMPLIED</samp> -<br><samp> enabled (true | false) "false""true"</samp> -<br><samp> description CDATA #IMPLIED</samp> -<br><samp> ></samp> -<ul> -<li><b>name</b> - The localized name of this launch item.</li><li><b>id</b> - The unique id of this launch item. Launch items with duplicate id's will be discarded.</li><li><b>category</b> - The unique id of the category this launch item belongs to.</li><li><b>icon</b> - The declaring plugin relative path of an icon to display with this launch item in the Launcher.</li><li><b>enabled</b> - Set to "false" to disable this launch item, or to "true" to enable it (default).</li><li><b>description</b> - The localized plain-text description of this launch item.</li></ul> -<H2>Example</H2> -<H2>API Information</H2> -<H2>Supplied Implementation</H2> -</BODY> -</HTML> diff --git a/examples/org.eclipse.swt.examples.launcher/icons/closedFolder.gif b/examples/org.eclipse.swt.examples.launcher/icons/closedFolder.gif Binary files differdeleted file mode 100755 index beb6ed134c..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/icons/closedFolder.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.launcher/icons/generic_example.gif b/examples/org.eclipse.swt.examples.launcher/icons/generic_example.gif Binary files differdeleted file mode 100755 index f9fb6b0cab..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/icons/generic_example.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.launcher/icons/launcher_example.gif b/examples/org.eclipse.swt.examples.launcher/icons/launcher_example.gif Binary files differdeleted file mode 100755 index 3ab4d32c05..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/icons/launcher_example.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.launcher/icons/openFolder.gif b/examples/org.eclipse.swt.examples.launcher/icons/openFolder.gif Binary files differdeleted file mode 100755 index a9c777343c..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/icons/openFolder.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.launcher/plugin.properties b/examples/org.eclipse.swt.examples.launcher/plugin.properties deleted file mode 100755 index 05c328a5f7..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/plugin.properties +++ /dev/null @@ -1,39 +0,0 @@ -providerName = Eclipse.org
-plugin.SWTLauncherExample.name = SWT Launcher Example Plugin
-category.SWTExamples.name = SWT Examples
-view.LauncherExample.name = SWT Example Launcher
-
-extension-point.launchItems.name = Launch Items
-
-launchcategory.SWTViewExamples.name = Workbench Views
-launchcategory.SWTViewExamples.description = \
- A collection of Standard Widget Toolkit examples that run as Views inside the Workbench. \
- These examples will create a new View in the current Perspective.
-
-launchitem.LauncherExample.name = Launcher
-launchitem.LauncherExample.description = \
- The Example Launcher is used to launch SWT examples which can either be \
- Workbench Views, or Standalone applications.\n\n\
- Workbench Views are examples that are integrated into Eclipse. When the Launcher \
- starts a Workbench View, it is opened in the currently active perspective.\n\n\
- Standalone applications are launched in a separate window.
-
-error.CouldNotLoadResources = Unable to load resources
-error.CouldNotFindRegisteredExtensions = Could Not Find Registered Extensions
-error.IncompleteProgramLaunchItem = Incomplete XML ProgramLaunchItem definition, id = {0}
-error.IncompleteViewLaunchItem = Incomplete XML ViewLaunchItem definition, id = {0}
-error.IncompleteLaunchItem = Incomplete or unrecognized XML LaunchItem definition, id = {0}
-
-launchitem.Null.description = <<no item selected>>
-
-launchitem.Missing.name = <<unnamed>>
-launchitem.Missing.description = <<no description available>>
-
-view.launchGroup.text = Examples
-view.launchButton.text = Run
-view.descriptionGroup.text = Description
-
-run.error.Invocation = A fatal error occurred while launching the program.
-run.error.DoesNotImplementMethod = The class does not implement the open() method.
-run.error.CouldNotFindClass = Could not find the class to run.
-run.error.CouldNotInstantiateClass = Could not instantiate the class to run.
diff --git a/examples/org.eclipse.swt.examples.launcher/plugin.xml b/examples/org.eclipse.swt.examples.launcher/plugin.xml deleted file mode 100755 index 60bcfd84c3..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/plugin.xml +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<plugin
- id="org.eclipse.swt.examples.launcher"
- name="%plugin.SWTLauncherExample.name"
- version="2.0.0"
- provider-name="%providerName"
- class="org.eclipse.swt.examples.launcher.LauncherPlugin">
-
-<!-- Runtime -->
-<!-- Runtime -->
-<!-- Runtime -->
-<!-- Runtime -->
- <runtime>
- <library name="launcher.jar"/>
- </runtime>
-<!-- Required plugins -->
- <requires>
- <import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.swt"/>
- <import plugin="org.eclipse.jdt.launching"/>
- <import plugin="org.eclipse.debug.core"/>
- <import plugin="org.eclipse.core.boot"/>
- <import plugin="org.eclipse.jdt.core"/>
- <import plugin="org.eclipse.swt.examples"/>
- </requires>
-
-
-<!-- Extension points -->
- <extension-point id="launchItems" name="%extension-point.launchItems.name" schema="schema/org.eclipse.swt.examples.launcher.launchItems.exsd"/>
-
-<!-- Extensions -->
- <extension
- id="application"
- point="org.eclipse.core.runtime.applications">
- <application>
- <run
- name="%launchitem.LauncherApplication.name"
- class="org.eclipse.swt.examples.launcher.LauncherApplication">
- </run>
- </application>
- </extension>
- <extension
- point="org.eclipse.ui.views">
- <category
- name="%category.SWTExamples.name"
- id="org.eclipse.swt.examples.category">
- </category>
- <view
- name="%view.LauncherExample.name"
- icon="icons/launcher_example.gif"
- category="org.eclipse.swt.examples.category"
- class="org.eclipse.swt.examples.launcher.LauncherView"
- id="org.eclipse.swt.examples.launcher.view">
- </view>
- </extension>
- <extension
- point="org.eclipse.swt.examples.launcher.launchItems">
- <category
- name="%launchcategory.SWTViewExamples.name"
- description="%launchcategory.SWTViewExamples.description"
- id="org.eclipse.swt.examples.launchViewCategory">
- </category>
- <item
- name="%launchitem.LauncherExample.name"
- enabled="false"
- icon="icons/launcher_example.gif"
- description="%launchitem.LauncherExample.description"
- category="org.eclipse.swt.examples.launchViewCategory"
- id="org.eclipse.swt.examples.launcher.viewlauncher">
- <view
- viewId="org.eclipse.swt.examples.launcher.view">
- </view>
- </item>
- </extension>
-
-</plugin>
diff --git a/examples/org.eclipse.swt.examples.launcher/schema/org.eclipse.swt.examples.launcher.launchItems.exsd b/examples/org.eclipse.swt.examples.launcher/schema/org.eclipse.swt.examples.launcher.launchItems.exsd deleted file mode 100644 index c91ddc5b9c..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/schema/org.eclipse.swt.examples.launcher.launchItems.exsd +++ /dev/null @@ -1,195 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.swt.examples.launcher">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.swt.examples.launcher" id="launchItems" name="Launch Items"/>
- </appInfo>
- <documentation>
- This extension point is used to add 'standalone program' and -'Workbench view' -launch items to the Launcher, optionally grouping them into -categories so as to form a multi-tiered hierarchy. -Standalone programs are executed using the platform's event loop. -Workbench views are created within the active Workbench Perspective.
- </documentation>
-</annotation>
-
- <element name="extension">
- <complexType>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="program">
- <annotation>
- <documentation>
- Specifies a "Standalone Program" for a launch item to run.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="mainClass" type="string" use="required">
- <annotation>
- <documentation>
- The fully-qualified name of the class whose main() method is to be launched.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="pluginId" type="string" use="required">
- <annotation>
- <documentation>
- The unique id of the Eclipse Platform plugin containing the program.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="view">
- <annotation>
- <documentation>
- Specifies a "Workbench View" for a launch item to activate.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="viewId" type="string" use="required">
- <annotation>
- <documentation>
- The unique id of the Workbench View to be activated when the item is launched.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="category">
- <annotation>
- <documentation>
- Specifies a launch item category heading.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- The localized name of this category.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- The unique id of this category. Categories with duplicate id's will be discarded.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="category" type="string">
- <annotation>
- <documentation>
- The unique id of the parent category.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="item">
- <annotation>
- <documentation>
- Specifies a launch item.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- The localized name of this launch item.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- The unique id of this launch item. Launch items with duplicate id's will be discarded.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="category" type="string">
- <annotation>
- <documentation>
- The unique id of the category this launch item belongs to.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="icon" type="string">
- <annotation>
- <documentation>
- The declaring plugin relative path of an icon to display with this launch item in the Launcher.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="enabled" type="boolean" use="default" value="true">
- <annotation>
- <documentation>
- Set to "false" to disable this launch item, or to "true" to enable it (default).
- </documentation>
- </annotation>
- </attribute>
- <attribute name="description" type="string">
- <annotation>
- <documentation>
- The localized plain-text description of this launch item.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
-</schema>
diff --git a/examples/org.eclipse.swt.examples.launcher/src/import.properties b/examples/org.eclipse.swt.examples.launcher/src/import.properties deleted file mode 100644 index 265131a99c..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/src/import.properties +++ /dev/null @@ -1,4 +0,0 @@ -# Persist project settings for later import -natures = org.eclipse.jdt.core.javanature; org.eclipse.pde.PluginNature -builders = org.eclipse.jdt.core.javabuilder; org.eclipse.pde.ManifestBuilder; org.eclipse.pde.SchemaBuilder -var.ECLIPSE_PLUGINS = <<ECLIPSE_PLUGINS>> diff --git a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemDescriptor.java b/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemDescriptor.java deleted file mode 100755 index da9553d512..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemDescriptor.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.eclipse.swt.examples.launcher;
/*
* Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
*/
import java.net.*;
import org.eclipse.swt.graphics.*; -
/**
* ItemDescriptor collects information about a launch item.
*/ -class ItemDescriptor {
- private String id; - private String name; - private String description;
private Image icon;
private String view;
private String mainType;
private String pluginId;
- - /** - * Constructs an ItemDescriptor. - * - * @param id the id - * @param name the name - * @param description the description
* @param icon the icon - * @param view the host view may be null if it is a standalone application
* @param mainType the fully qualified class name to run may be null if it is a view
* @param pluginId the name of the plugin which contains the main class - */ - public ItemDescriptor(String id, String name, String description, - Image icon, String view, String mainType, String pluginId) { - this.id = id; - this.name = name; - this.description = description;
this.icon = icon; - this.view = view;
this.mainType = mainType;
this.pluginId = pluginId; - } - - /** - * Returns the ID for this program. - * - * @return the user-specified ID for this program - */ - public String getId() { - return id; - } - - /** - * Returns the translated name for the program. - * - * @return the name of the program - */ - public String getName() { - return name; - } - - /** - * Returns a short description for the program. - * - * @return a newline-delimited string describing the program, null if no description is available - */ - public String getDescription() { - return description; - } -
/**
* Returns an icon for this descriptor
*
* @returns an icon, null if the item is a folder
*/
public Image getIcon() {
return icon;
}
- /** - * Returns the host view for the program. - * - * @return the host view, null if the item is a standalone program. - */ - public String getView () {
return view;
}
/**
* Returns the fully qualified class to run
* for the program.
*
* @return the class to run for the program.
*/
public String getMainType () {
return mainType;
}
/**
* Returns the name of the plugin that contains the program.
*
* @return the name of the plugin that contains the program.
*/
public String getPluginId () {
return pluginId;
}
/**
* Determines if an item is a folder.
*
* @return true if the item is a folder
*/
public boolean isFolder() {
return (mainType == null && view == null);
} - - /** - * Determines the equality of descriptors. - * - * @return true if this.getId().equalsIgnoreCase(other.getId()) - */ - public boolean equals(Object other) {
if (other instanceof ItemDescriptor) { - ItemDescriptor otherDescriptor = (ItemDescriptor) other; - return getId().equalsIgnoreCase(otherDescriptor.getId()); - } - return false; - }
/**
* Produces a hashcode.
*
* @return the hashcode
*/
public int hashCode() {
return id.toUpperCase().hashCode();
} -} diff --git a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemTreeNode.java b/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemTreeNode.java deleted file mode 100755 index 9f6717e43c..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemTreeNode.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.eclipse.swt.examples.launcher; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -/** - * Internal class used to store tree structures of ItemDescriptors - */ -class ItemTreeNode { - private ItemTreeNode nextSibling; - private ItemTreeNode firstChild; - private ItemDescriptor descriptor; - - /** - * Constructs a leaf ItemTreeNode with a given descriptor. - * - * @param descriptor the descriptor - */ - public ItemTreeNode(ItemDescriptor descriptor) { - this.descriptor = descriptor; - } - - /** - * Adds a node to the Tree in sorted order by name. - * - * @param node the node to add. Note that node.nextSibling must be null - */ - public void addSortedNode(ItemTreeNode node) { - if (firstChild == null) { - firstChild = node; - } else if (firstChild.descriptor.getName().compareTo(node.descriptor.getName()) > 0) { - node.nextSibling = firstChild; - firstChild = node; - } else { - ItemTreeNode cursor; - for (cursor = firstChild; cursor.nextSibling != null; cursor = cursor.nextSibling) { - ItemTreeNode sibling = cursor.nextSibling; - if (sibling.descriptor.getName().compareTo(node.descriptor.getName()) > 0) break; - } - node.nextSibling = cursor.nextSibling; - cursor.nextSibling = node; - } - } - - /** - * Returns the descriptor for this node. - * - * @return the descriptor - */ - public ItemDescriptor getDescriptor() { - return descriptor; - } - - /** - * Returns the next sibling of this node. - * - * @return the next sibling, or null if none - */ - public ItemTreeNode getNextSibling() { - return nextSibling; - } - - /** - * Returns the first child of this node. - * - * @return the first child, or null if none - */ - public ItemTreeNode getFirstChild() { - return firstChild; - } -} diff --git a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherPlugin.java b/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherPlugin.java deleted file mode 100755 index 21a680140a..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherPlugin.java +++ /dev/null @@ -1,379 +0,0 @@ -package org.eclipse.swt.examples.launcher;
-
-/*
- * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;
import org.eclipse.core.runtime.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.ui.plugin.*;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class LauncherPlugin extends AbstractUIPlugin {
- //The shared instance.
- private static LauncherPlugin plugin;
- private static ResourceBundle resourceBundle;
-
- private static final String
- LAUNCH_ITEMS_POINT_ID = "org.eclipse.swt.examples.launcher.launchItems",
- LAUNCH_ITEMS_XML_CATEGORY = "category",
- LAUNCH_ITEMS_XML_ITEM = "item",
- LAUNCH_ITEMS_XML_ITEM_ICON = "icon",
- LAUNCH_ITEMS_XML_ITEM_DESCRIPTION = "description",
- LAUNCH_ITEMS_XML_PROGRAM = "program",
- LAUNCH_ITEMS_XML_PROGRAM_PLUGIN = "pluginId",
- LAUNCH_ITEMS_XML_PROGRAM_CLASS = "mainClass",
- LAUNCH_ITEMS_XML_VIEW = "view",
- LAUNCH_ITEMS_XML_VIEW_VIEWID = "viewId",
- LAUNCH_ITEMS_XML_ATTRIB_ID = "id",
- LAUNCH_ITEMS_XML_ATTRIB_NAME = "name",
- LAUNCH_ITEMS_XML_ATTRIB_ENABLED = "enabled",
- LAUNCH_ITEMS_XML_ATTRIB_CATEGORY = "category",
- LAUNCH_ITEMS_XML_VALUE_TRUE = "true",
- LAUNCH_ITEMS_XML_VALUE_FALSE = "false";
-
- static final int
- liClosedFolder = 0,
- liOpenFolder = 1,
- liGenericExample = 2;
- static final String[] imageLocations = {
- "icons/closedFolder.gif",
- "icons/openFolder.gif",
- "icons/generic_example.gif" };
- static Image images[];
-
- /**
- * Constructs the LauncherPlugin.
- */
- public LauncherPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- plugin = this;
- resourceBundle = descriptor.getResourceBundle();
- }
-
- /**
- * Clean up
- */
- public void shutdown() throws CoreException {
- super.shutdown();
- freeResources();
- }
-
- /**
- * Returns the shared instance.
- */
- public static LauncherPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Loads the resources
- */
- public static void initResources() {
- if (images == null) {
- images = new Image[imageLocations.length];
-
- for (int i = 0; i < imageLocations.length; ++i) {
- images[i] = getImageFromPlugin(plugin.getDescriptor(), imageLocations[i]);
- if (images[i] == null) {
- freeResources();
- logError(getResourceString("error.CouldNotLoadResources"), null);
- throw new IllegalStateException();
- }
- }
- }
- }
-
- /**
- * Frees the resources
- */
- public static void freeResources() {
- if (images != null) {
- for (int i = 0; i < images.length; ++i) {
- final Image image = images[i];
- if (image != null) image.dispose();
- }
- images = null;
- }
- }
-
- /**
- * Log an error to the ILog for this plugin
- *
- * @param message the localized error message text
- * @param exception the associated exception, or null
- */
- public static void logError(String message, Throwable exception) {
- plugin.getLog().log(new Status(IStatus.ERROR, plugin.getDescriptor().getUniqueIdentifier(),
- 0, message, exception));
- }
-
- /**
- * Returns a string from the resource bundle.
- * We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- public static String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Returns a string from the resource bundle and binds it
- * with the given arguments. If the key is not found,
- * return the key.
- */
- public static String getResourceString(String key, Object[] args) {
- try {
- return MessageFormat.format(getResourceString(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Constructs a list of available programs from registered extensions.
- *
- * @return an ItemTreeNode representing the root of a tree of items (the root is not to be displayed)
- */
- public static ItemTreeNode getLaunchItemTree() {
- ItemTreeNode categoryTree =
- new ItemTreeNode(new ItemDescriptor("<<Root>>", "<<Root>>", null, null, null, null, null));
-
- // get the platform's public plugin registry
- IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
- // retrieve all configuration elements registered at our launchItems extension-point
- IConfigurationElement[] configurationElements =
- pluginRegistry.getConfigurationElementsFor(LAUNCH_ITEMS_POINT_ID);
-
- if (configurationElements == null || configurationElements.length == 0) {
- logError(getResourceString("error.CouldNotFindRegisteredExtensions"), null);
- return categoryTree;
- }
-
- /* Collect all launch categories -- coalesce those with same ID */
- HashMap idMap = new HashMap();
- for (int i = 0; i < configurationElements.length; ++i) {
- final IConfigurationElement ce = configurationElements[i];
- final String ceName = ce.getName();
- final String attribId = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_ID, null);
-
- if (idMap.containsKey(attribId)) continue;
- if (ceName.equalsIgnoreCase(LAUNCH_ITEMS_XML_CATEGORY)) {
- final String attribName = getItemName(ce);
- ItemDescriptor theDescriptor = new ItemDescriptor(attribId, attribName,
- getItemDescription(ce), null, null, null, null);
- idMap.put(attribId, new ItemTreeNode(theDescriptor));
- }
- }
-
- /* Generate launch category hierarchy */
- Set tempIdSet = new HashSet(); // used to prevent duplicates from being entered into the tree
- for (int i = 0; i < configurationElements.length; ++i) {
- final IConfigurationElement ce = configurationElements[i];
- final String ceName = ce.getName();
- final String attribId = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_ID, null);
-
- if (tempIdSet.contains(attribId)) continue;
- if (ceName.equalsIgnoreCase(LAUNCH_ITEMS_XML_CATEGORY)) {
- final ItemTreeNode theNode = (ItemTreeNode) idMap.get(attribId);
- addItemByCategory(ce, categoryTree, theNode, idMap);
- tempIdSet.add(attribId);
- }
- }
-
- /* Generate program tree */
- for (int i = 0; i < configurationElements.length; ++i) {
- final IConfigurationElement ce = configurationElements[i];
- final String ceName = ce.getName();
- final String attribId = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_ID, null);
-
- if (idMap.containsKey(attribId)) continue;
- if (ceName.equalsIgnoreCase(LAUNCH_ITEMS_XML_CATEGORY)) {
- // ignore
- } else if (ceName.equalsIgnoreCase(LAUNCH_ITEMS_XML_ITEM)) {
- final String enabled = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_ENABLED,
- LAUNCH_ITEMS_XML_VALUE_TRUE);
- if (enabled.equalsIgnoreCase(LAUNCH_ITEMS_XML_VALUE_FALSE)) continue;
- ItemDescriptor theDescriptor = createItemDescriptor(ce, attribId);
-
- if (theDescriptor != null) {
- final ItemTreeNode theNode = new ItemTreeNode(theDescriptor);
- addItemByCategory(ce, categoryTree, theNode, idMap);
- idMap.put(attribId, theNode);
- }
- }
- }
- return categoryTree;
- }
-
-
- /**
- * Adds an item to the category tree.
- */
- private static void addItemByCategory(IConfigurationElement ce, ItemTreeNode root,
- ItemTreeNode theNode, HashMap idMap) {
- final String attribCategory = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_CATEGORY, null);
-
- // locate the parent node
- ItemTreeNode parentNode = null;
- if (attribCategory != null) {
- parentNode = (ItemTreeNode) idMap.get(attribCategory);
- }
- if (parentNode == null) parentNode = root;
-
- // add the item
- parentNode.addSortedNode(theNode);
- }
-
- /**
- * Creates an ItemDescriptor from an XML definition.
- *
- * @param ce the IConfigurationElement describing the item
- * @param attribId the attribute id
- * @return a new ItemDescriptor, or null if an error occurs
- */
- private static ItemDescriptor createItemDescriptor(IConfigurationElement ce, String attribId) {
- final String attribName = getItemName(ce);
- final Image attribIcon = getItemIcon(ce);
- final String attribDescription = getItemDescription(ce);
-
- IConfigurationElement viewCE = getItemElement(ce, LAUNCH_ITEMS_XML_VIEW);
- if (viewCE != null) {
- //Item is a view
- final String attribView = getItemAttribute(viewCE, LAUNCH_ITEMS_XML_VIEW_VIEWID, null);
- if (attribView == null) {
- logError(getResourceString("error.IncompleteViewLaunchItem",
- new Object[] { attribId } ), null);
- return null;
- }
- return new ItemDescriptor(attribId, attribName, attribDescription,
- attribIcon, attribView, null, null);
- } else {
- //Item is a standalone
- IConfigurationElement programCE = getItemElement(ce, LAUNCH_ITEMS_XML_PROGRAM);
- if (programCE != null) {
- final String attribPluginId = getItemAttribute(programCE, LAUNCH_ITEMS_XML_PROGRAM_PLUGIN, null);
- final String attribClass = getItemAttribute(programCE, LAUNCH_ITEMS_XML_PROGRAM_CLASS, null);
- if (attribClass == null || attribPluginId == null) {
- logError(getResourceString("error.IncompleteProgramLaunchItem",
- new Object[] { attribId } ), null);
- return null;
- }
- return new ItemDescriptor(attribId, attribName, attribDescription,
- attribIcon, null, attribClass, attribPluginId);
- } else {
- logError(getResourceString("error.IncompleteLaunchItem",
- new Object[] { attribId } ), null);
- return null;
- }
- }
- }
-
- /**
- * Returns the first instance of a particular child XML element.
- *
- * @param ce the IConfigurationElement parent
- * @param element the name of the element to fetch
- * @return the element's IConfigurationElement, or null if not found
- */
- private static IConfigurationElement getItemElement(IConfigurationElement ce, String element) {
- IConfigurationElement[] elementCEs = ce.getChildren(element);
- return (elementCEs != null && elementCEs.length != 0) ? elementCEs[0] : null;
- }
-
- /**
- * Returns the value of an XML attribute for an item.
- *
- * @param ce the IConfigurationElement describing the item
- * @param attribute the attribute to fetch
- * @param defaultValue the value to return if the attribute is not found
- * @return the attribute value
- */
- private static String getItemAttribute(IConfigurationElement ce, String attribute, String defaultValue) {
- String value = ce.getAttribute(attribute);
- return (value != null) ? value : defaultValue;
- }
-
- /**
- * Returns the description string given the IConfigurationElement for an item.
- *
- * @param ce the IConfigurationElement describing the item
- * @return a newline-delimited string that describes this item, or null if none
- */
- private static String getItemDescription(IConfigurationElement ce) {
- String description = getItemAttribute(ce, LAUNCH_ITEMS_XML_ITEM_DESCRIPTION, "");
- return (description.length() == 0) ? null : description;
- }
-
- /**
- * Returns the name of an item.
- *
- * @param ce the IConfigurationElement describing the item
- * @return the attribute value
- */
- private static String getItemName(IConfigurationElement ce) {
- return getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_NAME,
- getResourceString("launchitem.Missing.name"));
- }
-
-
- /**
- * Returns the icon for an item.
- *
- * @param ce the IConfigurationElement describing the item
- * @return an icon
- */
- private static Image getItemIcon(IConfigurationElement ce) {
- String iconPath = getItemAttribute(ce, LAUNCH_ITEMS_XML_ITEM_ICON, "");
- if (iconPath.length() != 0) {
- Image icon = getImageFromPlugin(ce.getDeclaringExtension().getDeclaringPluginDescriptor(),
- iconPath);
- if (icon != null) {
- Image[] newImages = new Image[images.length + 1];
- System.arraycopy(images, 0, newImages, 0, images.length);
- newImages[images.length] = icon;
- images = newImages;
- return icon;
- }
- }
- return images[liGenericExample];
- }
-
- /**
- * Gets an image from a path relative to the plugin install directory.
- *
- * @param pd the plugin descriptor for the plugin with the image
- * @param iconPath the path relative to the install directory
- * @return the image, or null if not found
- */
- private static Image getImageFromPlugin(IPluginDescriptor pd, String iconPath) {
- InputStream is = null;
- try {
- URL installUrl = pd.getInstallURL();
- URL url = new URL(installUrl, iconPath);
- is = url.openConnection().getInputStream();
- ImageData source = new ImageData(is);
- ImageData mask = source.getTransparencyMask();
- Image image = new Image(null, source, mask);
- return image;
- } catch (Throwable ex) {
- return null;
- } finally {
- try {
- if (is != null) is.close();
- } catch (IOException e) {
- }
- }
- }
-}
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherView.java b/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherView.java deleted file mode 100755 index 3047da9396..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherView.java +++ /dev/null @@ -1,230 +0,0 @@ -package org.eclipse.swt.examples.launcher;
-
-/*
- * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.examples.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.*;
-import java.lang.reflect.*;
-
-/**
- * Launcher uses <code>org.eclipse.swt</code>
- * to launch the other registered examples.
- *
- * @see ViewPart
- */
-public class LauncherView extends ViewPart {
- private Shell workbenchShell;
-
- private Tree launchTree;
- private Text descriptionText;
- private Button runButton;
-
- /**
- * Constructs a LauncherView.
- */
- public LauncherView() {
- LauncherPlugin.initResources();
- }
-
- /**
- * Creates the example.
- *
- * @see ViewPart#createPartControl
- */
- public void createPartControl(Composite parent) {
- workbenchShell = getSite().getShell();
- parent.setLayout(new SplitLayout());
-
- Group launchGroup = new Group(parent, SWT.NULL);
- launchGroup.setText(LauncherPlugin.getResourceString("view.launchGroup.text"));
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- launchGroup.setLayout(gridLayout);
-
- launchTree = new Tree(launchGroup, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- gridData.horizontalSpan = 2;
- launchTree.setLayoutData(gridData);
- launchTree.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- final ItemDescriptor item = getSelectedItem();
- setDescriptionByItem(item);
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- final ItemDescriptor item = getSelectedItem();
- setDescriptionByItem(item);
- launchItem(getSelectedItem());
- }
- });
- launchTree.addTreeListener(new TreeListener() {
- public void treeCollapsed(TreeEvent event) {
- final TreeItem item = (TreeItem) event.item;
- if (item == null) return;
- item.setImage(LauncherPlugin.images[LauncherPlugin.liClosedFolder]);
- }
- public void treeExpanded(TreeEvent event) {
- final TreeItem item = (TreeItem) event.item;
- if (item == null) return;
- item.setImage(LauncherPlugin.images[LauncherPlugin.liOpenFolder]);
- }
- });
-
- runButton = new Button(launchGroup, SWT.PUSH);
- runButton.setText(LauncherPlugin.getResourceString("view.launchButton.text"));
- runButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- launchItem(getSelectedItem());
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- }
- });
-
- Group descriptionGroup = new Group(parent, SWT.NULL);
- descriptionGroup.setText(LauncherPlugin.getResourceString("view.descriptionGroup.text"));
- descriptionGroup.setLayout(new FillLayout());
-
- descriptionText = new Text(descriptionGroup, SWT.MULTI | SWT.BORDER |
- SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY);
-
- setDescriptionByItem(null);
- setItemDescriptors(LauncherPlugin.getLaunchItemTree());
- }
-
- /**
- * Called when we must grab focus.
- *
- * @see org.eclipse.ui.part.ViewPart#setFocus
- */
- public void setFocus() {
- launchTree.setFocus();
- runButton.getShell().setDefaultButton(runButton);
- }
-
- /**
- * Called when the View is to be disposed
- */
- public void dispose() {
- workbenchShell = null;
- launchTree = null;
- descriptionText = null;
- runButton = null;
- super.dispose();
- }
-
- /**
- * Installs a new launch list.
- *
- * @param newRoot the new tree of launch items for the UI
- */
- public void setItemDescriptors(final ItemTreeNode newRoot) {
- if (workbenchShell == null) return;
- workbenchShell.getDisplay().syncExec(new Runnable() {
- public void run() {
- if ((launchTree == null) || (launchTree.isDisposed())) return;
- launchTree.removeAll();
-
- for (ItemTreeNode node = newRoot.getFirstChild(); node != null;
- node = node.getNextSibling()) {
- doNode(node, new TreeItem(launchTree, SWT.NONE)); // top-level TreeItem
- }
- }
- private void addGroup(TreeItem parent, ItemTreeNode node) {
- for (;node != null; node = node.getNextSibling()) {
- doNode(node, new TreeItem(parent, SWT.NONE)); // TreeItem at depth > 0
- }
- }
- private void doNode(ItemTreeNode node, TreeItem treeItem) {
- final ItemDescriptor item = node.getDescriptor();
- treeItem.setText(item.getName());
- treeItem.setData(item);
- if (node.getDescriptor().isFolder()) {
- treeItem.setExpanded(false);
- treeItem.setImage(LauncherPlugin.images[LauncherPlugin.liClosedFolder]);
- } else {
- treeItem.setImage(node.getDescriptor().getIcon());
- }
- addGroup(treeItem, node.getFirstChild());
- }
- });
- }
-
- /**
- * Runs the specified launch item.
- *
- * @param itemDescriptor the launch item to execute
- */
- private void launchItem(ItemDescriptor itemDescriptor) {
- /* Case 1: The launch item is a view */
- String pluginViewId = itemDescriptor.getView ();
- if (pluginViewId != null) {
- final IWorkbenchPart workbenchPart = this;
- final IWorkbenchPartSite workbenchPartSite = workbenchPart.getSite();
- final IWorkbenchPage workbenchPage = workbenchPartSite.getPage();
- try {
- workbenchPage.showView(pluginViewId);
- } catch (PartInitException e) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.Invocation"), e);
- }
- return;
- }
- /* Case 2: The launch item is a standalone program */
- if (workbenchShell == null) return;
- try {
- Class cl = Class.forName(itemDescriptor.getMainType());
- Display display = workbenchShell.getDisplay();
- Object exampleInstance = cl.newInstance();
- Method openMethod = cl.getDeclaredMethod("open", new Class[] {Display.class});
- openMethod.invoke(exampleInstance, new Object[] {display});
- } catch (NoSuchMethodException e) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.DoesNotImplementMethod"), null);
- } catch (ClassNotFoundException e) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.CouldNotFindClass"), e);
- } catch (Exception e) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.CouldNotInstantiateClass"), e);
- }
- }
-
- /**
- * Obtains the selected launch item.
- *
- * @return the currently selected ItemDescriptor
- */
- private ItemDescriptor getSelectedItem() {
- final TreeItem[] selections = launchTree.getSelection();
- if (selections.length == 0) return null;
- final ItemDescriptor itemDescriptor = (ItemDescriptor) selections[0].getData();
- return itemDescriptor;
- }
-
- /**
- * Sets the currently visible description text to reflect that of a particular ItemDescriptor.
- *
- * @param itemDescriptor the launch item whose description is to be displayed, or null if none
- */
- private void setDescriptionByItem(ItemDescriptor itemDescriptor) {
- String description;
- if (itemDescriptor == null) {
- description = LauncherPlugin.getResourceString("launchitem.Null.description");
- if (runButton != null) runButton.setEnabled(false);
- } else {
- description = itemDescriptor.getDescription();
- if (description == null)
- description = LauncherPlugin.getResourceString("launchitem.Missing.description");
- if (runButton != null) {
- runButton.setEnabled(itemDescriptor.getView() != null || itemDescriptor.getMainType() != null);
- }
- }
- descriptionText.setText(description);
- }
-}
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/SplitLayout.java b/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/SplitLayout.java deleted file mode 100755 index 636b5eb715..0000000000 --- a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/SplitLayout.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.eclipse.swt.examples.launcher;
/*
* (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
*/
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
/**
* A Layout class that automatically switches from a horizontal split to a vertical
* split layout to accomodate changing size conditions.
*
* Later on we might improve this class to take into account the "preferred" size of
* the widgets.
*/
-public class SplitLayout extends Layout {
private static final int
splitHorizontally = 0,
splitVertically = 1;
private int splitDirection = splitHorizontally;
public int spacing = 3;
public int marginTop = 3;
- public int marginLeft = 3;
public int marginRight = 3;
public int marginBottom = 3;
/**
- * Creates a new layout
- */
- public SplitLayout() {
}
-
/**
* @see Layout#computeSize(Composite, int, int, boolean)
*/
protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
if (wHint == SWT.DEFAULT) {
if (hHint == SWT.DEFAULT) {
Point hSplitSize = computeHSplitSize(composite, wHint, hHint, flushCache);
Point vSplitSize = computeVSplitSize(composite, wHint, hHint, false);
int hSplitArea = hSplitSize.x * hSplitSize.y;
int vSplitArea = vSplitSize.x * vSplitSize.y;
// Choose direction consuming least area
if (hSplitArea < vSplitArea) {
splitDirection = splitHorizontally;
return hSplitSize;
} else {
splitDirection = splitVertically;
return vSplitSize;
}
} else {
// Constrained in height: split vertically
splitDirection = splitVertically;
return computeVSplitSize(composite, wHint, hHint, flushCache);
}
} else {
if (hHint == SWT.DEFAULT) {
// Constrained in width: split horizontally
splitDirection = splitHorizontally;
return computeHSplitSize(composite, wHint, hHint, flushCache);
} else {
if (hHint < wHint) {
splitDirection = splitVertically;
return computeVSplitSize(composite, wHint, hHint, flushCache);
} else {
splitDirection = splitHorizontally;
return computeHSplitSize(composite, wHint, hHint, flushCache);
}
}
}
}
- /**
- * @see Layout#layout(Composite, boolean)
- */
- protected void layout(Composite composite, boolean flushCache) {
Rectangle clientArea = composite.getClientArea();
computeSize(composite, clientArea.width, clientArea.height, false);
Control[] children = composite.getChildren();
clientArea.x += marginLeft;
clientArea.y += marginTop;
clientArea.width -= marginRight + marginLeft;
clientArea.height -= marginBottom + marginTop;
Point position = new Point(clientArea.x, clientArea.y);
for (int i = 0; i < children.length; ++i) {
final Control child = children[i];
final Rectangle bounds;
if (splitDirection == splitHorizontally) {
int height = clientArea.height / children.length;
bounds = new Rectangle(position.x, position.y, clientArea.width, height);
position.y += height + spacing;
} else {
int width = clientArea.width / children.length;
bounds = new Rectangle(position.x, position.y, width, clientArea.height);
position.x += width + spacing;
}
bounds.width = Math.max(bounds.width, 0);
bounds.height = Math.max(bounds.height, 0);
child.setBounds(bounds);
}
}
-
private Point computeHSplitSize(Composite composite, int wHint, int hHint, boolean flushCache) {
Point size = new Point(marginLeft + marginRight, marginTop + marginBottom);
Control[] children = composite.getChildren();
for (int i = 0; i < children.length; ++i) {
final Control child = children[i];
Point childSize = child.computeSize(wHint, hHint, flushCache);
size.x = Math.max(size.x, childSize.x);
size.y += childSize.y + spacing;
}
return size;
}
private Point computeVSplitSize(Composite composite, int wHint, int hHint, boolean flushCache) {
Point size = new Point(marginLeft + marginRight, marginTop + marginBottom);
Control[] children = composite.getChildren();
for (int i = 0; i < children.length; ++i) {
final Control child = children[i];
Point childSize = child.computeSize(wHint, hHint, flushCache);
size.x += childSize.x + spacing;
size.y = Math.max(size.y, childSize.y);
}
return size;
}
}
diff --git a/examples/org.eclipse.swt.examples.layouts/.classpath b/examples/org.eclipse.swt.examples.layouts/.classpath deleted file mode 100644 index 06c910362d..0000000000 --- a/examples/org.eclipse.swt.examples.layouts/.classpath +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="var" path="JRE_LIB"/> - <classpathentry kind="var" - path="ECLIPSE_HOME/plugins/org.eclipse.core.runtime_2.0.0/runtime.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.core.runtime_2.0.0/runtimesrc.zip"/> - <classpathentry kind="var" - path="ECLIPSE_HOME/plugins/org.eclipse.ui_2.0.0/workbench.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.ui_2.0.0/workbenchsrc.zip"/> - <classpathentry kind="src" path="/org.eclipse.swt.examples"/> - <classpathentry kind="src" path="/org.eclipse.swt"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/examples/org.eclipse.swt.examples.layouts/.cvsignore b/examples/org.eclipse.swt.examples.layouts/.cvsignore deleted file mode 100644 index c5e82d7458..0000000000 --- a/examples/org.eclipse.swt.examples.layouts/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples.layouts/.project b/examples/org.eclipse.swt.examples.layouts/.project deleted file mode 100644 index cbc0d66613..0000000000 --- a/examples/org.eclipse.swt.examples.layouts/.project +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.swt.examples.layouts</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.swt</project>
- <project>org.eclipse.swt.examples</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/examples/org.eclipse.swt.examples.layouts/about.html b/examples/org.eclipse.swt.examples.layouts/about.html deleted file mode 100644 index 9db411aab9..0000000000 --- a/examples/org.eclipse.swt.examples.layouts/about.html +++ /dev/null @@ -1,30 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<html> -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>20th June, 2002</p> -<h3>License</h3> -<p>Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>. -For purposes of the CPL, "Program" will mean the Content.</p> - -<h3>Contributions</h3> - -<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise -made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such -Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p> - -<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the -host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available -to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also -providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of -the CPL.</p> - -</body> -</html>
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples.layouts/build.properties b/examples/org.eclipse.swt.examples.layouts/build.properties deleted file mode 100644 index a6d8f5e768..0000000000 --- a/examples/org.eclipse.swt.examples.layouts/build.properties +++ /dev/null @@ -1,10 +0,0 @@ -bin.includes = doc-html/,\ - icons/,\ - plugin.properties,\ - plugin.xml,\ - about.html,\ - *.jar - -src.includes = about.html - -source.layouts.jar = src/ diff --git a/examples/org.eclipse.swt.examples.layouts/doc-html/hglegal2002.htm b/examples/org.eclipse.swt.examples.layouts/doc-html/hglegal2002.htm deleted file mode 100644 index 74393f08f3..0000000000 --- a/examples/org.eclipse.swt.examples.layouts/doc-html/hglegal2002.htm +++ /dev/null @@ -1,14 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2002. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.layouts/doc-html/ngibmcpy2002.gif b/examples/org.eclipse.swt.examples.layouts/doc-html/ngibmcpy2002.gif Binary files differdeleted file mode 100644 index dd2f444669..0000000000 --- a/examples/org.eclipse.swt.examples.layouts/doc-html/ngibmcpy2002.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.layouts/doc-html/swt_layout_ex.html b/examples/org.eclipse.swt.examples.layouts/doc-html/swt_layout_ex.html deleted file mode 100644 index c6c28b8068..0000000000 --- a/examples/org.eclipse.swt.examples.layouts/doc-html/swt_layout_ex.html +++ /dev/null @@ -1,29 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Layout Overview</title>
-</head>
-<body>
-
-<h2>SWT Example - Layout Overview</h2>
-
-<p>
-This example is a simple demonstration of common SWT layouts.
-It consists of a tab folder where each tab allows the
-user to interact with a different SWT layout.
-The user can insert widgets into a layout and set the values of the layout data
-using a property sheet. When the user has a suitable arrangement, code can be
-generated by clicking on the Code button.
-</p>
-
-<h3>Running the example</h3>
-
-<p>From the Window menu select Show View --> Other.
-In the Show View dialog, expand SWT Examples and select the
-view named SWT Layouts. A view titled SWT Layouts will appear in your current perspective.
-</p>
-
-<p><a href="hglegal2002.htm"><img SRC="ngibmcpy2002.gif" ALT="Copyright IBM Corporation 2000, 2002. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples.layouts/icons/layouts_example.gif b/examples/org.eclipse.swt.examples.layouts/icons/layouts_example.gif Binary files differdeleted file mode 100644 index d945dde53b..0000000000 --- a/examples/org.eclipse.swt.examples.layouts/icons/layouts_example.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.layouts/plugin.properties b/examples/org.eclipse.swt.examples.layouts/plugin.properties deleted file mode 100644 index 2e18a431a5..0000000000 --- a/examples/org.eclipse.swt.examples.layouts/plugin.properties +++ /dev/null @@ -1,18 +0,0 @@ -providerName = Eclipse.org -plugin.SWTLayoutExample.name = SWT Layout Example Plugin -category.SWTExamples.name = SWT Examples -view.LayoutExample.name = SWT Layouts - -launchcategory.SWTViewExamples.name = Workbench Views -launchcategory.SWTViewExamples.description = \ - A collection of Standard Widget Toolkit examples that run as Views inside the Workbench. \ - These examples will create a new View in the current Perspective. - -launchitem.LayoutExample.name = Layouts -launchitem.LayoutExample.description = \ - This example is a simple demonstration of common SWT layouts. \n\n\ - It consists of a tab folder where each tab allows the \ - user to interact with a different SWT layout.\ - The user can insert widgets into a layout and set the values of the layout data \ - using a property sheet. When the user has a suitable arrangement, code can be \ - generated by clicking on the Code button. diff --git a/examples/org.eclipse.swt.examples.layouts/plugin.xml b/examples/org.eclipse.swt.examples.layouts/plugin.xml deleted file mode 100644 index 00d4c4dde4..0000000000 --- a/examples/org.eclipse.swt.examples.layouts/plugin.xml +++ /dev/null @@ -1,54 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<plugin - id="org.eclipse.swt.examples.layouts" - name="%plugin.SWTLayoutExample.name" - version="2.0.0" - provider-name="%providerName" - class="org.eclipse.swt.examples.layouts.LayoutPlugin"> - -<!-- Runtime --> -<!-- Runtime --> - <runtime> - <library name="layouts.jar"/> - </runtime> -<!-- Required plugins --> - <requires> - <import plugin="org.eclipse.core.runtime"/> - <import plugin="org.eclipse.ui"/> - <import plugin="org.eclipse.swt"/> - <import plugin="org.eclipse.swt.examples"/> - </requires> - - -<!-- Extension points --> -<!-- Extensions --> - <extension - point="org.eclipse.ui.views"> - <view - name="%view.LayoutExample.name" - icon="icons/layouts_example.gif" - category="org.eclipse.swt.examples.category" - class="org.eclipse.swt.examples.layouts.LayoutView" - id="org.eclipse.swt.examples.layouts.view"> - </view> - </extension> - <extension - point="org.eclipse.swt.examples.launcher.launchItems"> - <category - name="%launchcategory.SWTViewExamples.name" - description="%launchcategory.SWTViewExamples.description" - id="org.eclipse.swt.examples.launchViewCategory"> - </category> - <item - name="%launchitem.LayoutExample.name" - icon="icons/layouts_example.gif" - description="%launchitem.LayoutExample.description" - category="org.eclipse.swt.examples.launchViewCategory" - id="org.eclipse.swt.examples.layouts.viewlauncher"> - <view - viewId="org.eclipse.swt.examples.layouts.view"> - </view> - </item> - </extension> - -</plugin> diff --git a/examples/org.eclipse.swt.examples.layouts/src/import.properties b/examples/org.eclipse.swt.examples.layouts/src/import.properties deleted file mode 100644 index 265131a99c..0000000000 --- a/examples/org.eclipse.swt.examples.layouts/src/import.properties +++ /dev/null @@ -1,4 +0,0 @@ -# Persist project settings for later import -natures = org.eclipse.jdt.core.javanature; org.eclipse.pde.PluginNature -builders = org.eclipse.jdt.core.javabuilder; org.eclipse.pde.ManifestBuilder; org.eclipse.pde.SchemaBuilder -var.ECLIPSE_PLUGINS = <<ECLIPSE_PLUGINS>> diff --git a/examples/org.eclipse.swt.examples.layouts/src/org/eclipse/swt/examples/layouts/LayoutPlugin.java b/examples/org.eclipse.swt.examples.layouts/src/org/eclipse/swt/examples/layouts/LayoutPlugin.java deleted file mode 100644 index 2a0312a2d1..0000000000 --- a/examples/org.eclipse.swt.examples.layouts/src/org/eclipse/swt/examples/layouts/LayoutPlugin.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.eclipse.swt.examples.layouts; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.core.runtime.*; -import org.eclipse.ui.plugin.*; - -/** - * The main plugin class to be used in the desktop. - */ -public class LayoutPlugin extends AbstractUIPlugin { - /** - * The constructor. - */ - public LayoutPlugin(IPluginDescriptor descriptor) { - super(descriptor); - } - - /** - * Clean up - */ - public void shutdown() throws CoreException { - super.shutdown(); - } -} diff --git a/examples/org.eclipse.swt.examples.layouts/src/org/eclipse/swt/examples/layouts/LayoutView.java b/examples/org.eclipse.swt.examples.layouts/src/org/eclipse/swt/examples/layouts/LayoutView.java deleted file mode 100644 index 3ab737a279..0000000000 --- a/examples/org.eclipse.swt.examples.layouts/src/org/eclipse/swt/examples/layouts/LayoutView.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.eclipse.swt.examples.layouts; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.examples.layoutexample.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.ui.part.*; - -/** - * <code>Layouts</code> is a simple demonstration - * of the layouts defined by SWT. It consists of a workbench - * view and tab folder where each tab in the folder allows the - * user to interact with a layout. - * - * @see ViewPart - */ -public class LayoutView extends ViewPart { - LayoutExample instance = null; - - /** - * Create the example - * - * @see ViewPart#createPartControl - */ - public void createPartControl(Composite frame) { - instance = new LayoutExample(frame); - } - - /** - * Called when we must grab focus. - * - * @see org.eclipse.ui.part.ViewPart#setFocus - */ - public void setFocus() { - instance.setFocus(); - } - - /** - * Called when the View is to be disposed - */ - public void dispose() { - instance.dispose(); - instance = null; - super.dispose(); - } -} diff --git a/examples/org.eclipse.swt.examples.ole.win32/.classpath b/examples/org.eclipse.swt.examples.ole.win32/.classpath deleted file mode 100755 index c964daee95..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/.classpath +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="var" path="JRE_LIB"/> - <classpathentry kind="var" - path="ECLIPSE_HOME/plugins/org.eclipse.core.runtime_2.0.0/runtime.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.core.runtime_2.0.0/runtimesrc.zip"/> - <classpathentry kind="var" - path="ECLIPSE_HOME/plugins/org.eclipse.ui_2.0.0/workbench.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.ui_2.0.0/workbenchsrc.zip"/> - <classpathentry kind="src" path="/org.eclipse.swt"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/examples/org.eclipse.swt.examples.ole.win32/.cvsignore b/examples/org.eclipse.swt.examples.ole.win32/.cvsignore deleted file mode 100755 index c5e82d7458..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples.ole.win32/.project b/examples/org.eclipse.swt.examples.ole.win32/.project deleted file mode 100644 index b160136cdd..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/.project +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.swt.examples.ole.win32</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.swt</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/examples/org.eclipse.swt.examples.ole.win32/about.html b/examples/org.eclipse.swt.examples.ole.win32/about.html deleted file mode 100644 index 9db411aab9..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/about.html +++ /dev/null @@ -1,30 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<html> -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>20th June, 2002</p> -<h3>License</h3> -<p>Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>. -For purposes of the CPL, "Program" will mean the Content.</p> - -<h3>Contributions</h3> - -<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise -made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such -Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p> - -<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the -host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available -to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also -providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of -the CPL.</p> - -</body> -</html>
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples.ole.win32/build.properties b/examples/org.eclipse.swt.examples.ole.win32/build.properties deleted file mode 100755 index ac90c6ffa3..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/build.properties +++ /dev/null @@ -1,10 +0,0 @@ -bin.includes = doc-html/,\
- icons/,\
- plugin.properties,\
- plugin.xml,\
- about.html,\
- *.jar
-
-src.includes = about.html
-
-source.olewin32.jar = src/
diff --git a/examples/org.eclipse.swt.examples.ole.win32/doc-html/hglegal2002.htm b/examples/org.eclipse.swt.examples.ole.win32/doc-html/hglegal2002.htm deleted file mode 100644 index 74393f08f3..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/doc-html/hglegal2002.htm +++ /dev/null @@ -1,14 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2002. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.ole.win32/doc-html/ngibmcpy2002.gif b/examples/org.eclipse.swt.examples.ole.win32/doc-html/ngibmcpy2002.gif Binary files differdeleted file mode 100644 index dd2f444669..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/doc-html/ngibmcpy2002.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.ole.win32/doc-html/swt_ole_ex.html b/examples/org.eclipse.swt.examples.ole.win32/doc-html/swt_ole_ex.html deleted file mode 100755 index 58e43dde41..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/doc-html/swt_ole_ex.html +++ /dev/null @@ -1,34 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - OLE Web Browser</title>
-</head>
-<body>
-
-<h2>Example - OLE Web Browser</h2>
-
-<p>
-This example demonstrates how to embed an Active X control into an SWT application or an Eclipse view.
-<p>
-</p>
-When the view is opened, it will create an instance of the Windows Internet Explorer
-control. The OLE Web Browser has
-Back and Forward buttons to take you to recently visited pages. The browser also contains
-a Home button to take you to the web browser's home page, a Stop button which stops the
-current transfer, a Search button which will search for text typed in the Address text field, and
-a Refresh button which re-draws the contents of the currently displayed page. There is also a
-Go button which, when clicked, will attempt to load the page specified in the Address field.
-</p>
-
-<h3>Running the example</h3>
-
-<p>
-From the Window menu select Show View --> Other.
-In the Show View dialog, expand SWT Examples and select
-the view named OLE Web Browser (Win32). A view containing a web browser will appear.
-</p>
-
-<p><a href="hglegal2002.htm"><img SRC="ngibmcpy2002.gif" ALT="Copyright IBM Corporation 2000, 2002. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.ole.win32/icons/backward_nav.gif b/examples/org.eclipse.swt.examples.ole.win32/icons/backward_nav.gif Binary files differdeleted file mode 100755 index 5fcf41b783..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/icons/backward_nav.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.ole.win32/icons/forward_nav.gif b/examples/org.eclipse.swt.examples.ole.win32/icons/forward_nav.gif Binary files differdeleted file mode 100755 index 3b9b6af9b1..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/icons/forward_nav.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.ole.win32/icons/home_nav.gif b/examples/org.eclipse.swt.examples.ole.win32/icons/home_nav.gif Binary files differdeleted file mode 100755 index 77a2306ed2..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/icons/home_nav.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.ole.win32/icons/refresh_nav.gif b/examples/org.eclipse.swt.examples.ole.win32/icons/refresh_nav.gif Binary files differdeleted file mode 100755 index e270e18bde..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/icons/refresh_nav.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.ole.win32/icons/search_nav.gif b/examples/org.eclipse.swt.examples.ole.win32/icons/search_nav.gif Binary files differdeleted file mode 100755 index 73ac91bddb..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/icons/search_nav.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.ole.win32/icons/stop_nav.gif b/examples/org.eclipse.swt.examples.ole.win32/icons/stop_nav.gif Binary files differdeleted file mode 100755 index 653d347b57..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/icons/stop_nav.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.ole.win32/icons/webbrowser_example.gif b/examples/org.eclipse.swt.examples.ole.win32/icons/webbrowser_example.gif Binary files differdeleted file mode 100755 index 895e22110d..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/icons/webbrowser_example.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.ole.win32/plugin.properties b/examples/org.eclipse.swt.examples.ole.win32/plugin.properties deleted file mode 100755 index 82d8e49fe5..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/plugin.properties +++ /dev/null @@ -1,50 +0,0 @@ -providerName = Eclipse.org
-plugin.SWTOLEExample.name = SWT OLE Example Plugin (Win32)
-category.SWTExamples.name = SWT Examples
-view.OLEWebBrowserExample.name = OLE Web Browser (Win32)
-
-launchcategory.SWTWin32OnlyExamples.name = Win32 only
-launchcategory.SWTWin32OnlyExamples.description = \
- A collection of Standard Widget Toolkit examples for Windows systems only.
-
-launchitem.OLEWebBrowserExample.name = OLE Web Browser
-launchitem.OLEWebBrowserExample.description = \
- This example demonstrates how to embed an Active X control into an SWT application or an Eclipse view.\n\n\
- When the view is opened, it will create an instance of the Windows Internet Explorer \
- control. The OLE Web Browser has \
- Back and Forward buttons to take you to recently visited pages. The browser also contains \
- a Home button to take you to the web browser's home page, a Stop button which stops the \
- current transfer, a Search button which will search for text typed in the Address text field, and \
- a Refresh button which re-draws the contents of the currently displayed page. There is also a \
- Go button which, when clicked, will attempt to load the page specified in the Address field.
-
-browser.Back.text = Backward
-browser.Back.tooltip = Go to previous Web site in the history list
-
-browser.Forward.text = Forward
-browser.Forward.tooltip = Go to next Web site in the history list
-
-browser.Home.text = Home
-browser.Home.tooltip = Go to home Web site
-
-browser.Stop.text = Stop
-browser.Stop.tooltip = Stop loading current Web site
-
-browser.Refresh.text = Refresh
-browser.Refresh.tooltip = Refresh current Web site
-
-browser.Search.text = Search
-browser.Search.tooltip = Search the Web
-
-browser.Address.label = Address :
-
-browser.Go.text = Go
-
-browser.State.Uninitialized.text = Not ready.
-browser.State.Loading.text = Loading Web site...
-browser.State.Loaded.text = Ready.
-browser.State.Interactive.text = Loading Web site...
-browser.State.Complete.text = Done.
-
-error.CouldNotLoadResources = Unable to load resources
-error.CouldNotCreateBrowserControl = Unable to create <<Browser Control>>
diff --git a/examples/org.eclipse.swt.examples.ole.win32/plugin.xml b/examples/org.eclipse.swt.examples.ole.win32/plugin.xml deleted file mode 100755 index 5ab84a6a0d..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/plugin.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!-- File written by PDE 1.0 -->
-<plugin
- id="org.eclipse.swt.examples.ole.win32"
- name="%plugin.SWTOLEExample.name"
- version="2.0.0"
- provider-name="%providerName"
- class="org.eclipse.swt.examples.ole.win32.OlePlugin">
-<!-- Required plugins -->
-<requires>
- <import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.swt"/>
-</requires>
-
-<!-- Runtime -->
-<!-- Runtime -->
-<runtime>
- <library name="olewin32.jar"/>
-</runtime>
-
-<!-- Extensions -->
-<!-- Extension points -->
-<extension
- point="org.eclipse.ui.views">
- <view
- name="%view.OLEWebBrowserExample.name"
- icon="icons/webbrowser_example.gif"
- category="org.eclipse.swt.examples.category"
- class="org.eclipse.swt.examples.ole.win32.OleBrowserView"
- id="org.eclipse.swt.examples.ole.win32.browserView">
- </view>
-</extension>
-<extension
- point="org.eclipse.swt.examples.launcher.launchItems">
- <category
- name="%launchcategory.SWTWin32OnlyExamples.name"
- description="%launchcategory.SWTWin32OnlyExamples.description"
- id="org.eclipse.swt.examples.launchWin32OnlyCategory">
- </category>
- <item
- name="%launchitem.OLEWebBrowserExample.name"
- icon="icons/webbrowser_example.gif"
- description="%launchitem.OLEWebBrowserExample.description"
- category="org.eclipse.swt.examples.launchWin32OnlyCategory"
- id="org.eclipse.swt.examples.ole.win32.viewlauncher">
- <view
- viewId="org.eclipse.swt.examples.ole.win32.browserView">
- </view>
- </item>
-</extension>
-</plugin>
diff --git a/examples/org.eclipse.swt.examples.ole.win32/src/import.properties b/examples/org.eclipse.swt.examples.ole.win32/src/import.properties deleted file mode 100644 index 265131a99c..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/src/import.properties +++ /dev/null @@ -1,4 +0,0 @@ -# Persist project settings for later import -natures = org.eclipse.jdt.core.javanature; org.eclipse.pde.PluginNature -builders = org.eclipse.jdt.core.javabuilder; org.eclipse.pde.ManifestBuilder; org.eclipse.pde.SchemaBuilder -var.ECLIPSE_PLUGINS = <<ECLIPSE_PLUGINS>> diff --git a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleBrowserView.java b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleBrowserView.java deleted file mode 100755 index 7a2a0066cc..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleBrowserView.java +++ /dev/null @@ -1,356 +0,0 @@ -package org.eclipse.swt.examples.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.ole.win32.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.ui.part.*;
-
-/**
- * Ole uses <code>org.eclipse.swt</code> to demonstrate Win32 OLE / ActiveX
- * integration.
- *
- * @see ViewPart
- */
-public class OleBrowserView extends ViewPart {
-
- private Composite displayArea;
-
- private OleFrame webFrame;
- private OleWebBrowser webBrowser;
- private Text webUrl;
- private OleControlSite webControlSite;
- private ProgressBar webProgress;
- private Label webStatus;
- private Button webNavigateButton;
-
- private ToolItem webCommandBackward;
- private ToolItem webCommandForward;
- private ToolItem webCommandHome;
- private ToolItem webCommandStop;
- private ToolItem webCommandRefresh;
- private ToolItem webCommandSearch;
-
- private boolean activated = false;
-
- /**
- * Constructs the OLE browser view.
- */
- public OleBrowserView() {
- OlePlugin.initResources();
- }
-
- /**
- * Creates the example.
- *
- * @see ViewPart#createPartControl
- */
- public void createPartControl(Composite parent) {
- displayArea = new Composite(parent, SWT.NONE);
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- displayArea.setLayout(gridLayout);
-
- createToolbar();
- createBrowserFrame();
- createStatusArea();
- createBrowserControl();
- }
-
- /**
- * Cleanup
- */
- public void dispose() {
- if (activated) {
- webControlSite.deactivateInPlaceClient();
- activated = false;
- }
- if (webBrowser != null) webBrowser.dispose();
- webBrowser = null;
- super.dispose();
- }
-
- /**
- * Called when we must grab focus.
- *
- * @see org.eclipse.ui.part.ViewPart#setFocus
- */
- public void setFocus() {
- webUrl.setFocus();
- }
-
- /**
- * Creates the Web browser toolbar.
- */
- private void createToolbar() {
- // Add a toolbar
- ToolBar bar = new ToolBar(displayArea, SWT.NONE);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.horizontalSpan = 3;
- bar.setLayoutData(gridData);
-
- // Add a button to navigate backwards through previously visited web sites
- webCommandBackward = new ToolItem(bar, SWT.NONE);
- webCommandBackward.setToolTipText(OlePlugin.getResourceString("browser.Back.tooltip"));
- webCommandBackward.setText(OlePlugin.getResourceString("browser.Back.text"));
- webCommandBackward.setImage(OlePlugin.images[OlePlugin.biBack]);
- webCommandBackward.setEnabled(false);
- webCommandBackward.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.GoBack();
- }
- });
-
- // Add a button to navigate forward through previously visited web sites
- webCommandForward = new ToolItem(bar, SWT.NONE);
- webCommandForward.setToolTipText(OlePlugin.getResourceString("browser.Forward.tooltip"));
- webCommandForward.setText(OlePlugin.getResourceString("browser.Forward.text"));
- webCommandForward.setImage(OlePlugin.images[OlePlugin.biForward]);
- webCommandForward.setEnabled(false);
- webCommandForward.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.GoForward();
- }
- });
-
- // Add a separator
- new ToolItem(bar, SWT.SEPARATOR);
-
- // Add a button to navigate to the Home page
- webCommandHome = new ToolItem(bar, SWT.NONE);
- webCommandHome.setToolTipText(OlePlugin.getResourceString("browser.Home.tooltip"));
- webCommandHome.setText(OlePlugin.getResourceString("browser.Home.text"));
- webCommandHome.setImage(OlePlugin.images[OlePlugin.biHome]);
- webCommandHome.setEnabled(false);
- webCommandHome.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.GoHome();
- }
- });
-
- // Add a button to abort web page loading
- webCommandStop = new ToolItem(bar, SWT.NONE);
- webCommandStop.setToolTipText(OlePlugin.getResourceString("browser.Stop.tooltip"));
- webCommandStop.setText(OlePlugin.getResourceString("browser.Stop.text"));
- webCommandStop.setImage(OlePlugin.images[OlePlugin.biStop]);
- webCommandStop.setEnabled(false);
- webCommandStop.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.Stop();
- }
- });
-
- // Add a button to refresh the current web page
- webCommandRefresh = new ToolItem(bar, SWT.NONE);
- webCommandRefresh.setToolTipText(OlePlugin.getResourceString("browser.Refresh.tooltip"));
- webCommandRefresh.setText(OlePlugin.getResourceString("browser.Refresh.text"));
- webCommandRefresh.setImage(OlePlugin.images[OlePlugin.biRefresh]);
- webCommandRefresh.setEnabled(false);
- webCommandRefresh.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.Refresh();
- }
- });
-
- // Add a separator
- new ToolItem(bar, SWT.SEPARATOR);
-
- // Add a button to search the web
- webCommandSearch = new ToolItem(bar, SWT.NONE);
- webCommandSearch.setToolTipText(OlePlugin.getResourceString("browser.Search.tooltip"));
- webCommandSearch.setText(OlePlugin.getResourceString("browser.Search.text"));
- webCommandSearch.setImage(OlePlugin.images[OlePlugin.biSearch]);
- webCommandSearch.setEnabled(false);
- webCommandSearch.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.GoSearch();
- }
- });
-
- // Add a text area for Users to enter a url
- Composite addressBar = new Composite(displayArea, SWT.NONE);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- gridData.horizontalSpan = 3;
- addressBar.setLayoutData(gridData);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- addressBar.setLayout(gridLayout);
-
- Label addressLabel = new Label(addressBar, SWT.NONE);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
- addressLabel.setLayoutData(gridData);
- addressLabel.setText(OlePlugin.getResourceString("browser.Address.label"));
- addressLabel.setFont(OlePlugin.browserFont);
-
- webUrl = new Text(addressBar, SWT.SINGLE | SWT.BORDER);
- webUrl.setFont(OlePlugin.browserFont);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- webUrl.setLayoutData(gridData);
- webUrl.addFocusListener(new FocusAdapter() {
- public void focusGained(FocusEvent e) {
- webNavigateButton.getShell().setDefaultButton(webNavigateButton);
- }
- });
-
- // Add a button to navigate to the web site specified in the Text area defined above
- webNavigateButton = new Button(addressBar, SWT.PUSH);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
- webNavigateButton.setLayoutData(gridData);
- webNavigateButton.setText(OlePlugin.getResourceString("browser.Go.text"));
- webNavigateButton.setFont(OlePlugin.browserFont);
- webNavigateButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- if (webBrowser == null) return;
- webBrowser.Navigate(webUrl.getText());
- }
- });
- }
-
- /**
- * Creates the Web browser OleFrame.
- */
- private void createBrowserFrame() {
- // Every control must have an associated OleFrame:
- webFrame = new OleFrame(displayArea, SWT.NONE);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- gridData.horizontalSpan = 3;
- webFrame.setLayoutData(gridData);
- }
-
- /**
- * Creates the Web browser status area.
- */
- private void createStatusArea() {
- // Add a progress bar to display downloading progress information
- webProgress = new ProgressBar(displayArea, SWT.BORDER);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.BEGINNING;
- gridData.verticalAlignment = GridData.FILL;
- webProgress.setLayoutData(gridData);
-
- // Add a label for displaying status messages as they are received from the control
- webStatus = new Label(displayArea, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- gridData.horizontalSpan = 2;
- webStatus.setLayoutData(gridData);
- webStatus.setFont(OlePlugin.browserFont);
- }
-
- /**
- * Creates Web browser control.
- */
- private void createBrowserControl() {
- try {
- // Create an Automation object for access to extended capabilities
- webControlSite = new OleControlSite(webFrame, SWT.NONE, "Shell.Explorer");
- OleAutomation oleAutomation = new OleAutomation(webControlSite);
- webBrowser = new OleWebBrowser(oleAutomation);
- } catch (SWTException ex) {
- // Creation may have failed because control is not installed on machine
- Label label = new Label(webFrame, SWT.BORDER);
- OlePlugin.logError(OlePlugin.getResourceString("error.CouldNotCreateBrowserControl"), ex);
- label.setText(OlePlugin.getResourceString("error.CouldNotCreateBrowserControl"));
- return;
- }
-
- // Respond to ProgressChange events by updating the Progress bar
- webControlSite.addEventListener(OleWebBrowser.ProgressChange, new OleListener() {
- public void handleEvent(OleEvent event) {
- Variant progress = event.arguments[0];
- Variant maxProgress = event.arguments[1];
- if (progress == null || maxProgress == null)
- return;
- webProgress.setMaximum(maxProgress.getInt());
- webProgress.setSelection(progress.getInt());
- }
- });
-
- // Respond to StatusTextChange events by updating the Status Text label
- webControlSite.addEventListener(OleWebBrowser.StatusTextChange, new OleListener() {
- public void handleEvent(OleEvent event) {
- Variant statusText = event.arguments[0];
- if (statusText == null) return;
- String text = statusText.getString();
- if (text != null)
- webStatus.setText(text);
- }
- });
-
- // Listen for changes to the ready state and print out the current state
- webControlSite.addPropertyListener(OleWebBrowser.DISPID_READYSTATE, new OleListener() {
- public void handleEvent(OleEvent event) {
- if (event.detail == OLE.PROPERTY_CHANGING) return;
- int state = webBrowser.getReadyState();
- switch (state) {
- case OleWebBrowser.READYSTATE_UNINITIALIZED:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Uninitialized.text"));
- webCommandBackward.setEnabled(false);
- webCommandForward.setEnabled(false);
- webCommandHome.setEnabled(false);
- webCommandRefresh.setEnabled(false);
- webCommandStop.setEnabled(false);
- webCommandSearch.setEnabled(false);
- break;
- case OleWebBrowser.READYSTATE_LOADING:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Loading.text"));
- webCommandHome.setEnabled(true);
- webCommandRefresh.setEnabled(true);
- webCommandStop.setEnabled(true);
- webCommandSearch.setEnabled(true);
- break;
- case OleWebBrowser.READYSTATE_LOADED:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Loaded.text"));
- webCommandStop.setEnabled(true);
- break;
- case OleWebBrowser.READYSTATE_INTERACTIVE:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Interactive.text"));
- webCommandStop.setEnabled(true);
- break;
- case OleWebBrowser.READYSTATE_COMPLETE:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Complete.text"));
- webCommandStop.setEnabled(false);
- break;
- }
- }
- });
-
- // Listen for changes to the active command states
- webControlSite.addEventListener(OleWebBrowser.CommandStateChange, new OleListener() {
- public void handleEvent(OleEvent event) {
- if (event.type != OleWebBrowser.CommandStateChange) return;
- final int commandID =
- (event.arguments[0] != null) ? event.arguments[0].getInt() : 0;
- final boolean commandEnabled =
- (event.arguments[1] != null) ? event.arguments[1].getBoolean() : false;
-
- switch (commandID) {
- case OleWebBrowser.CSC_NAVIGATEBACK:
- webCommandBackward.setEnabled(commandEnabled);
- break;
- case OleWebBrowser.CSC_NAVIGATEFORWARD:
- webCommandForward.setEnabled(commandEnabled);
- break;
- }
- }
- });
-
- // in place activate the ActiveX control
- activated = (webControlSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE) == OLE.S_OK);
- if (activated) webBrowser.GoHome();
- }
-}
diff --git a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java deleted file mode 100755 index 478c97be2f..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.eclipse.swt.examples.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;
import org.eclipse.core.runtime.*;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.ui.plugin.*;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class OlePlugin extends AbstractUIPlugin {
- //The shared instance.
- private static OlePlugin plugin;
- private static ResourceBundle resourceBundle;
-
- static final int
- biBack = 0,
- biForward = 1,
- biHome = 2,
- biStop = 3,
- biRefresh = 4,
- biSearch = 5;
- static final String[] imageLocations = {
- "icons/backward_nav.gif",
- "icons/forward_nav.gif",
- "icons/home_nav.gif",
- "icons/stop_nav.gif",
- "icons/refresh_nav.gif",
- "icons/search_nav.gif" };
- static Image images[];
- static Font browserFont;
-
- /**
- * Constructs an OLE plugin.
- */
- public OlePlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- plugin = this;
- resourceBundle = descriptor.getResourceBundle();
- }
-
- /**
- * Clean up
- */
- public void shutdown() throws CoreException {
- super.shutdown();
- freeResources();
- }
-
- /**
- * Returns the shared instance.
- */
- public static OlePlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns a string from the resource bundle.
- * We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- public static String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Returns a string from the resource bundle and binds it
- * with the given arguments. If the key is not found,
- * return the key.
- */
- public static String getResourceString(String key, Object[] args) {
- try {
- return MessageFormat.format(getResourceString(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Log an error to the ILog for this plugin
- *
- * @param message the localized error message text
- * @param exception the associated exception, or null
- */
- public static void logError(String message, Throwable exception) {
- plugin.getLog().log(new Status(IStatus.ERROR, plugin.getDescriptor().getUniqueIdentifier(),
- 0, message, exception));
- }
-
- /**
- * Loads the resources.
- */
- public static void initResources() {
- if (images == null) {
- images = new Image[imageLocations.length];
-
- for (int i = 0; i < imageLocations.length; ++i) {
- images[i] = getImageFromPlugin(plugin.getDescriptor(), imageLocations[i]);
- if (images[i] == null) {
- freeResources();
- logError(getResourceString("error.CouldNotLoadResources"), null);
- throw new IllegalStateException();
- }
- }
- }
- if (browserFont == null) {
- try {
- browserFont = new Font (null, "MS Sans Serif", 8, SWT.NULL);
- } catch (Throwable ex) {
- }
- }
- if (images == null || browserFont == null) {
- freeResources();
- logError(getResourceString("error.CouldNotLoadResources"), null);
- throw new IllegalStateException();
- }
- }
-
- /**
- * Frees the resources
- */
- public static void freeResources() {
- if (images != null) {
- for (int i = 0; i < images.length; ++i) {
- final Image image = images[i];
- if (image != null) image.dispose();
- }
- images = null;
- }
- if (browserFont != null) browserFont.dispose ();
- browserFont = null;
- }
-
- /**
- * Gets an image from a path relative to the plugin install directory.
- *
- * @param pd the plugin descriptor for the plugin with the image
- * @param iconPath the path relative to the install directory
- * @return the image, or null if not found
- */
- private static Image getImageFromPlugin(IPluginDescriptor pd, String iconPath) {
- InputStream is = null;
- try {
- URL installUrl = pd.getInstallURL();
- URL url = new URL(installUrl, iconPath);
- is = url.openConnection().getInputStream();
- ImageData source = new ImageData(is);
- ImageData mask = source.getTransparencyMask();
- Image image = new Image(null, source, mask);
- return image;
- } catch (Throwable ex) {
- return null;
- } finally {
- try {
- if (is != null) is.close();
- } catch (IOException e) {
- }
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java deleted file mode 100755 index e3f5b763b2..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java +++ /dev/null @@ -1,253 +0,0 @@ -package org.eclipse.swt.examples.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.ole.win32.*;
-
-/**
- * Wrapper for an OleAutomation object used to send commands
- * to a Win32 "Shell.Explorer" OLE control.
- *
- * Instances of this class manage the setup, typical use and teardown of
- * a simple web browser.
- */
-class OleWebBrowser {
- /* See the Windows Platform SDK documentation for more information about the
- * OLE control used here and its usage.
- */
- // Generated from typelib filename: shdocvw.dll
-
- // Constants for WebBrowser CommandStateChange
- public static final int CSC_UPDATECOMMANDS = -1;
- public static final int CSC_NAVIGATEFORWARD = 1;
- public static final int CSC_NAVIGATEBACK = 2;
-
- // COnstants for Web Browser ReadyState
- public static final int READYSTATE_UNINITIALIZED = 0;
- public static final int READYSTATE_LOADING = 1;
- public static final int READYSTATE_LOADED = 2;
- public static final int READYSTATE_INTERACTIVE = 3;
- public static final int READYSTATE_COMPLETE = 4;
-
- // Web Browser Control Events
- public static final int BeforeNavigate = 100; // Fired when a new hyperlink is being navigated to.
- public static final int NavigateComplete = 101; // Fired when the document being navigated to becomes visible and enters the navigation stack.
- public static final int StatusTextChange = 102; // Statusbar text changed.
- public static final int ProgressChange = 108; // Fired when download progress is updated.
- public static final int DownloadComplete = 104; // Download of page complete.
- public static final int CommandStateChange = 105; // The enabled state of a command changed
- public static final int DownloadBegin = 106; // Download of a page started.
- public static final int NewWindow = 107; // Fired when a new window should be created.
- public static final int TitleChange = 113; // Document title changed.
- public static final int FrameBeforeNavigate = 200; // Fired when a new hyperlink is being navigated to in a frame.
- public static final int FrameNavigateComplete = 201; // Fired when a new hyperlink is being navigated to in a frame.
- public static final int FrameNewWindow = 204; // Fired when a new window should be created.
- public static final int Quit = 103; // Fired when application is quiting.
- public static final int WindowMove = 109; // Fired when window has been moved.
- public static final int WindowResize = 110; // Fired when window has been sized.
- public static final int WindowActivate = 111; // Fired when window has been activated.
- public static final int PropertyChange = 112; // Fired when the PutProperty method has been called.
-
- // Web Browser properties
- public static final int DISPID_READYSTATE = -525;
-
- private OleAutomation oleAutomation;
-
- /**
- * Creates a Web browser control.
- * <p>
- * Typical use:<br>
- * <code>
- * OleControlSite oleControlSite = new OleControlSite(oleFrame, style, "Shell.Explorer");<br>
- * OleAutomation oleAutomation = new OleAutomation(oleControlSite);<br>
- * OleWebBrowser webBrowser = new OleWebBrowser(oleControlSite, oleAutomation);<br>
- * </code>
- *
- * @param oleAutomation the OleAutomation object for this control.
- * @param oleControlSite the OleControlSite object for this control.
- */
- public OleWebBrowser(OleAutomation oleAutomation) {
- this.oleAutomation = oleAutomation;
- }
-
-
- /**
- * Disposes of the Web browser control.
- */
- public void dispose() {
- if (oleAutomation != null) oleAutomation.dispose();
- oleAutomation = null;
- }
-
- /*
- * Interact with the Control via OLE Automation
- *
- * Note: You can hard code the DISPIDs if you know them beforehand
- * this is of course the fastest way, but you increase coupling
- * to the control.
- */
-
- /**
- * Returns the current web page title.
- *
- * @return the current web page title String
- */
- public String getLocationName() {
- // dispid=210, type=PROPGET, name="LocationName"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"LocationName"});
- int dispIdMember = rgdispid[0];
- Variant pVarResult = oleAutomation.getProperty(dispIdMember);
- if (pVarResult == null) return null;
- return pVarResult.getString();
- }
-
- /**
- * Returns the current URL.
- *
- * @return the current URL String
- */
- public String getLocationURL() {
- // dispid=211, type=PROPGET, name="LocationURL"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"LocationURL"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.getProperty(dispIdMember);
- if (pVarResult == null) return null;
- return pVarResult.getString();
- }
-
- /**
- * Returns the current state of the control.
- *
- * @return the current state of the control, one of:
- * READYSTATE_UNINITIALIZED;
- * READYSTATE_LOADING;
- * READYSTATE_LOADED;
- * READYSTATE_INTERACTIVE;
- * READYSTATE_COMPLETE.
- */
- public int getReadyState() {
- // dispid=4294966771, type=PROPGET, name="ReadyState"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"ReadyState"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.getProperty(dispIdMember);
- if (pVarResult == null) return -1;
- return pVarResult.getInt();
- }
-
- /**
- * Navigates backwards through previously visited web sites.
- *
- * @return the platform-defined result code for the "GoBack" method invocation
- */
- public int GoBack() {
-
- // dispid=100, type=METHOD, name="GoBack"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"GoBack"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.invoke(dispIdMember);
- if (pVarResult == null) return 0;
- return pVarResult.getInt();
- }
-
- /**
- * Navigates backwards through previously visited web sites.
- *
- * @return the platform-defined result code for the "GoForward" method invocation
- */
- public int GoForward() {
-
- // dispid=101, type=METHOD, name="GoForward"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"GoForward"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.invoke(dispIdMember);
- if (pVarResult == null) return 0;
- return pVarResult.getInt();
- }
-
- /**
- * Navigates to home page.
- *
- * @return the platform-defined result code for the "GoHome" method invocation
- */
- public int GoHome() {
- // dispid=102, type=METHOD, name="GoHome"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"GoHome"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.invoke(dispIdMember);
- if (pVarResult == null) return 0;
- return pVarResult.getInt();
- }
-
- /**
- * Navigates to user-specified Web search gateway.
- *
- * @return the platform-defined result code for the "GoSearch" method invocation
- */
- public int GoSearch() {
- // dispid=103, type=METHOD, name="GoSearch"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"GoSearch"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.invoke(dispIdMember);
- if (pVarResult == null) return 0;
- return pVarResult.getInt();
- }
-
- /**
- * Navigates to a particular URL.
- *
- * @return the platform-defined result code for the "Navigate" method invocation
- */
- public int Navigate(String url) {
- // dispid=104, type=METHOD, name="Navigate"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"Navigate", "URL"});
- int dispIdMember = rgdispid[0];
-
- Variant[] rgvarg = new Variant[1];
- rgvarg[0] = new Variant(url);
- int[] rgdispidNamedArgs = new int[1];
- rgdispidNamedArgs[0] = rgdispid[1]; // identifier of argument
- Variant pVarResult = oleAutomation.invoke(dispIdMember, rgvarg, rgdispidNamedArgs);
-
- if (pVarResult == null) return 0;
- return pVarResult.getInt();
- }
-
- /**
- * Refreshes the currently viewed page.
- *
- * @return the platform-defined result code for the "Refresh" method invocation
- */
- public void Refresh(){
- // dispid= 4294966746, type=METHOD, name="Refresh"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"Refresh"});
- int dispIdMember = rgdispid[0];
-
- oleAutomation.invokeNoReply(dispIdMember);
- }
-
- /**
- * Aborts loading of the currnet page.
- *
- * @return the platform-defined result code for the "Stop" method invocation
- */
- public void Stop() {
- // dispid=106, type=METHOD, name="Stop"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"Stop"});
- int dispIdMember = rgdispid[0];
-
- Variant pVarResult = oleAutomation.invoke(dispIdMember);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/.classpath b/examples/org.eclipse.swt.examples.paint/.classpath deleted file mode 100755 index 17114032b2..0000000000 --- a/examples/org.eclipse.swt.examples.paint/.classpath +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="var" path="JRE_LIB"/> - <classpathentry kind="src" path="/org.eclipse.swt"/> - <classpathentry kind="var" - path="ECLIPSE_HOME/plugins/org.eclipse.core.runtime_2.0.0/runtime.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.core.runtime_2.0.0/runtimesrc.zip"/> - <classpathentry kind="var" - path="ECLIPSE_HOME/plugins/org.eclipse.ui_2.0.0/workbench.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.ui_2.0.0/workbenchsrc.zip"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/examples/org.eclipse.swt.examples.paint/.cvsignore b/examples/org.eclipse.swt.examples.paint/.cvsignore deleted file mode 100755 index c5e82d7458..0000000000 --- a/examples/org.eclipse.swt.examples.paint/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples.paint/.project b/examples/org.eclipse.swt.examples.paint/.project deleted file mode 100644 index 3cb7c3ea6d..0000000000 --- a/examples/org.eclipse.swt.examples.paint/.project +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.swt.examples.paint</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.swt</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/examples/org.eclipse.swt.examples.paint/about.html b/examples/org.eclipse.swt.examples.paint/about.html deleted file mode 100644 index 9db411aab9..0000000000 --- a/examples/org.eclipse.swt.examples.paint/about.html +++ /dev/null @@ -1,30 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<html> -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>20th June, 2002</p> -<h3>License</h3> -<p>Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>. -For purposes of the CPL, "Program" will mean the Content.</p> - -<h3>Contributions</h3> - -<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise -made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such -Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p> - -<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the -host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available -to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also -providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of -the CPL.</p> - -</body> -</html>
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples.paint/build.properties b/examples/org.eclipse.swt.examples.paint/build.properties deleted file mode 100755 index db39eb3db8..0000000000 --- a/examples/org.eclipse.swt.examples.paint/build.properties +++ /dev/null @@ -1,10 +0,0 @@ -bin.includes = doc-html/,\
- icons/,\
- plugin.properties,\
- plugin.xml,\
- about.html,\
- *.jar
-
-src.includes = about.html
-
-source.paint.jar = src/
diff --git a/examples/org.eclipse.swt.examples.paint/doc-html/hglegal2002.htm b/examples/org.eclipse.swt.examples.paint/doc-html/hglegal2002.htm deleted file mode 100644 index 74393f08f3..0000000000 --- a/examples/org.eclipse.swt.examples.paint/doc-html/hglegal2002.htm +++ /dev/null @@ -1,14 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2002. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.paint/doc-html/ngibmcpy2002.gif b/examples/org.eclipse.swt.examples.paint/doc-html/ngibmcpy2002.gif Binary files differdeleted file mode 100644 index dd2f444669..0000000000 --- a/examples/org.eclipse.swt.examples.paint/doc-html/ngibmcpy2002.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.paint/doc-html/swt_paint_ex.html b/examples/org.eclipse.swt.examples.paint/doc-html/swt_paint_ex.html deleted file mode 100755 index 3aa1edab34..0000000000 --- a/examples/org.eclipse.swt.examples.paint/doc-html/swt_paint_ex.html +++ /dev/null @@ -1,36 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Paint Tool</title>
-</head>
-<body>
-
-<h2>SWT Example - Paint Tool</h2>
-
-<p>
-This example demonstrates the use of SWT graphics operations in the form of a
-rudimentary bitmap painting program. The Airbrush Tool implementation also
-demonstrates a mechanism for managing timed GUI operations in the background
-that are triggered by user input.
-</p>
-<p>
-Select a tool with which to draw in the drawing area. There are a number of tools
-to choose from on the toolbar. To change the color selection, click on a color in the
-palette below the drawing area: left-click for the foreground color, right-click for the
-background color.
-</p>
-<p>
-Uses SWT's GC and FontDialog, and JFace's InputDialog and action set support.
-</p>
-
-<h3>Running the example</h3>
-
-<p>From the Window menu select Show View --> Other.
-In the Show View dialog, expand SWT Examples and select the
-view named Paint. A view titled Paint will appear in your current perspective.
-</p>
-
-<p><a href="hglegal2002.htm"><img SRC="ngibmcpy2002.gif" ALT="Copyright IBM Corporation 2000, 2002. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.paint/icons/fill_none.gif b/examples/org.eclipse.swt.examples.paint/icons/fill_none.gif Binary files differdeleted file mode 100755 index d26dd584e7..0000000000 --- a/examples/org.eclipse.swt.examples.paint/icons/fill_none.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.paint/icons/fill_outline.gif b/examples/org.eclipse.swt.examples.paint/icons/fill_outline.gif Binary files differdeleted file mode 100755 index c6ccfee10e..0000000000 --- a/examples/org.eclipse.swt.examples.paint/icons/fill_outline.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.paint/icons/fill_solid.gif b/examples/org.eclipse.swt.examples.paint/icons/fill_solid.gif Binary files differdeleted file mode 100755 index cb34e64a30..0000000000 --- a/examples/org.eclipse.swt.examples.paint/icons/fill_solid.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dash.gif b/examples/org.eclipse.swt.examples.paint/icons/linestyle_dash.gif Binary files differdeleted file mode 100644 index fb57bb38b7..0000000000 --- a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dash.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dashdot.gif b/examples/org.eclipse.swt.examples.paint/icons/linestyle_dashdot.gif Binary files differdeleted file mode 100644 index 322968c30b..0000000000 --- a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dashdot.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dot.gif b/examples/org.eclipse.swt.examples.paint/icons/linestyle_dot.gif Binary files differdeleted file mode 100644 index 4937ccb06d..0000000000 --- a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dot.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.paint/icons/linestyle_solid.gif b/examples/org.eclipse.swt.examples.paint/icons/linestyle_solid.gif Binary files differdeleted file mode 100644 index 70a57ce2c4..0000000000 --- a/examples/org.eclipse.swt.examples.paint/icons/linestyle_solid.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.paint/icons/options_font.gif b/examples/org.eclipse.swt.examples.paint/icons/options_font.gif Binary files differdeleted file mode 100755 index 965fe08560..0000000000 --- a/examples/org.eclipse.swt.examples.paint/icons/options_font.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.paint/icons/paint_example.gif b/examples/org.eclipse.swt.examples.paint/icons/paint_example.gif Binary files differdeleted file mode 100755 index c48d9a9567..0000000000 --- a/examples/org.eclipse.swt.examples.paint/icons/paint_example.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_airbrush.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_airbrush.gif Binary files differdeleted file mode 100755 index a310edddb2..0000000000 --- a/examples/org.eclipse.swt.examples.paint/icons/tool_airbrush.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_ellipse.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_ellipse.gif Binary files differdeleted file mode 100755 index dc2142f8e2..0000000000 --- a/examples/org.eclipse.swt.examples.paint/icons/tool_ellipse.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_line.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_line.gif Binary files differdeleted file mode 100755 index 2ff819f129..0000000000 --- a/examples/org.eclipse.swt.examples.paint/icons/tool_line.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_pencil.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_pencil.gif Binary files differdeleted file mode 100755 index f16a234c13..0000000000 --- a/examples/org.eclipse.swt.examples.paint/icons/tool_pencil.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_polyline.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_polyline.gif Binary files differdeleted file mode 100755 index aa384e9b30..0000000000 --- a/examples/org.eclipse.swt.examples.paint/icons/tool_polyline.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_rectangle.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_rectangle.gif Binary files differdeleted file mode 100755 index d26dd584e7..0000000000 --- a/examples/org.eclipse.swt.examples.paint/icons/tool_rectangle.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_roundedrectangle.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_roundedrectangle.gif Binary files differdeleted file mode 100755 index bf845d7602..0000000000 --- a/examples/org.eclipse.swt.examples.paint/icons/tool_roundedrectangle.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_text.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_text.gif Binary files differdeleted file mode 100755 index 0d7457ffa3..0000000000 --- a/examples/org.eclipse.swt.examples.paint/icons/tool_text.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples.paint/plugin.properties b/examples/org.eclipse.swt.examples.paint/plugin.properties deleted file mode 100755 index 7ec46f1cde..0000000000 --- a/examples/org.eclipse.swt.examples.paint/plugin.properties +++ /dev/null @@ -1,124 +0,0 @@ -providerName = Eclipse.org
-plugin.SWTPaintExample.name = SWT Paint Example Plugin
-category.SWTExamples.name = SWT Examples
-view.PaintExample.name = Paint
-
-launchcategory.SWTViewExamples.name = Workbench Views
-launchcategory.SWTViewExamples.description = \
- A collection of Standard Widget Toolkit examples that run as Views inside the Workbench. \
- These examples will create a new View in the current Perspective.
-
-launchitem.PaintExample.name = Paint
-launchitem.PaintExample.description = \
- This example demonstrates the use of SWT graphics operations in the form of a \
- rudimentary bitmap painting program. The Airbrush Tool implementation also \
- demonstrates a mechanism for managing timed GUI operations in the background \
- that are triggered by user input.\n\n\
- Select a tool with which to draw in the drawing area. There are a number of tools \
- to choose from on the toolbar. To change the color selection, click on a color in the \
- palette below the drawing area: left-click for the foreground color, right-click for the \
- background color.\n\n\
- Uses SWT's GC and FontDialog, and JFace's InputDialog and action set support.
-
-menu.Tools.label = Tools
-menu.Options.label = Options
-
-tool.Pencil.label = Pencil
-tool.Pencil.tooltip = Pencil tool
-tool.Pencil.image = icons/tool_pencil.gif
-tool.Pencil.description = Selects the Pencil tool.
-
-tool.Airbrush.label = Airbrush
-tool.Airbrush.tooltip = Airbrush tool
-tool.Airbrush.image = icons/tool_airbrush.gif
-tool.Airbrush.description = Selects the Airbrush tool.
-
-tool.Line.label = Line
-tool.Line.tooltip = Line tool
-tool.Line.image = icons/tool_line.gif
-tool.Line.description = Selects the Line tool.
-
-tool.PolyLine.label = Polygon
-tool.PolyLine.tooltip = Polygon tool
-tool.PolyLine.image = icons/tool_polyline.gif
-tool.PolyLine.description = Selects the PolyLine tool.
-
-tool.Rectangle.label = Rectangle
-tool.Rectangle.tooltip = Rectangle tool
-tool.Rectangle.image = icons/tool_rectangle.gif
-tool.Rectangle.description = Selects the Rectangle tool.
-
-tool.Ellipse.label = Ellipse
-tool.Ellipse.tooltip = Ellipse tool
-tool.Ellipse.image = icons/tool_ellipse.gif
-tool.Ellipse.description = Selects the Ellipse tool.
-
-tool.RoundedRectangle.label = Rounded Rectangle
-tool.RoundedRectangle.tooltip = Rounded Rectangle
-tool.RoundedRectangle.image = icons/tool_roundedrectangle.gif
-tool.RoundedRectangle.description = Selects the Rounded Rectangle tool.
-
-tool.Text.label = Text
-tool.Text.tooltip = Text tool
-tool.Text.image = icons/tool_text.gif
-tool.Text.description = Selects the Text tool.
-tool.Text.settings.defaulttext = Hello!
-tool.Text.dialog.title = Text Tool Settings
-tool.Text.dialog.message = Please enter the new text string to be painted.
-
-tool.Null.label = <none>
-
-fill.None.label = No Fill
-fill.None.tooltip = No fill mode
-fill.None.image = icons/fill_none.gif
-fill.None.description = Selects No Fill mode.
-
-fill.Outline.label = Outline Fill
-fill.Outline.tooltip = Outline fill mode
-fill.Outline.image = icons/fill_outline.gif
-fill.Outline.description = Selects Outline Fill mode.
-
-fill.Solid.label = Solid Fill
-fill.Solid.tooltip = Solid fill mode
-fill.Solid.image = icons/fill_solid.gif
-fill.Solid.description = Selects Solid Fill mode.
-
-linestyle.Solid.label = Solid Line
-linestyle.Solid.tooltip = Solid line style
-linestyle.Solid.image = icons/linestyle_solid.gif
-linestyle.Solid.description = Select Solid Line style.
-
-linestyle.Dot.label = Dotted Line
-linestyle.Dot.tooltip = Dotted line style
-linestyle.Dot.image = icons/linestyle_dot.gif
-linestyle.Dot.description = Select Dotted Line style.
-
-linestyle.Dash.label = Dashed Line
-linestyle.Dash.tooltip = Dashed line style
-linestyle.Dash.image = icons/linestyle_dash.gif
-linestyle.Dash.description = Select Dashed Line style.
-
-linestyle.DashDot.label = Dash-Dot Line
-linestyle.DashDot.tooltip = Dash-Dot line style
-linestyle.DashDot.image = icons/linestyle_dashdot.gif
-linestyle.DashDot.description = Select Dash-Dot Line style.
-
-options.Font.label = Text Tool Font
-options.Font.tooltip = Select Text Tool font
-options.Font.image = icons/options_font.gif
-options.Font.description = Selects Text Tool font.
-options.Font.dialog.title = Text Tool Font
-
-settings.AirbrushRadius.text = Airbrush Radius
-settings.AirbrushIntensity.text = Airbrush Intensity
-
-session.Null.message = Select a tool...
-session.ContinuousPaint.message = Click and drag to draw...
-session.DragInteractivePaint.message = Click and drag to preview, release to draw, right-click to cancel...
-session.SegmentedInteractivePaint.message.anchorMode = Click to set anchor...
-session.SegmentedInteractivePaint.message.interactiveMode = Click to draw, double-click to close figure, right-click to cancel...
-session.Text.message = Click to draw text, right-click to edit text...
-
-status.Coord.format = ({0}, {1})
-status.CoordRange.format = ({0}, {1}) - ({2}, {3})
-status.Bar.format = {0} : {1} {2}
diff --git a/examples/org.eclipse.swt.examples.paint/plugin.xml b/examples/org.eclipse.swt.examples.paint/plugin.xml deleted file mode 100755 index bb6348b6b6..0000000000 --- a/examples/org.eclipse.swt.examples.paint/plugin.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<plugin
- id="org.eclipse.swt.examples.paint"
- name="%plugin.SWTPaintExample.name"
- version="2.0.0"
- provider-name="%providerName"
- class="org.eclipse.swt.examples.paint.PaintPlugin">
-
-<!-- Runtime -->
- <runtime>
- <library name="paint.jar"/>
- </runtime>
-<!-- Required plugins -->
- <requires>
- <import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.swt"/>
- </requires>
-
-
-<!-- Extension points -->
-<!-- Extensions -->
- <extension
- point="org.eclipse.ui.views">
- <view
- name="%view.PaintExample.name"
- icon="icons/paint_example.gif"
- category="org.eclipse.swt.examples.category"
- class="org.eclipse.swt.examples.paint.PaintView"
- id="org.eclipse.swt.examples.paint.view">
- </view>
- </extension>
- <extension
- point="org.eclipse.swt.examples.launcher.launchItems">
- <category
- name="%launchcategory.SWTViewExamples.name"
- description="%launchcategory.SWTViewExamples.description"
- id="org.eclipse.swt.examples.launchViewCategory">
- </category>
- <item
- name="%launchitem.PaintExample.name"
- icon="icons/paint_example.gif"
- description="%launchitem.PaintExample.description"
- category="org.eclipse.swt.examples.launchViewCategory"
- id="org.eclipse.swt.examples.paint.viewlauncher">
- <view
- viewId="org.eclipse.swt.examples.paint.view">
- </view>
- </item>
- </extension>
-
-</plugin>
diff --git a/examples/org.eclipse.swt.examples.paint/src/import.properties b/examples/org.eclipse.swt.examples.paint/src/import.properties deleted file mode 100644 index 265131a99c..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/import.properties +++ /dev/null @@ -1,4 +0,0 @@ -# Persist project settings for later import -natures = org.eclipse.jdt.core.javanature; org.eclipse.pde.PluginNature -builders = org.eclipse.jdt.core.javabuilder; org.eclipse.pde.ManifestBuilder; org.eclipse.pde.SchemaBuilder -var.ECLIPSE_PLUGINS = <<ECLIPSE_PLUGINS>> diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/AirbrushTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/AirbrushTool.java deleted file mode 100755 index b6884de51a..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/AirbrushTool.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import java.util.Random;
import org.eclipse.swt.graphics.*;
-
-/**
- * An airbrush tool.
- */
-public class AirbrushTool extends ContinuousPaintSession implements PaintTool {
- private ToolSettings settings;
- private Random random;
- private int cachedRadiusSquared;
- private int cachedNumPoints;
-
- /**
- * Constructs a Tool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public AirbrushTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- random = new Random();
- setRetriggerTimer(10);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- // compute things we need to know for drawing
- settings = toolSettings;
- cachedRadiusSquared = settings.airbrushRadius * settings.airbrushRadius;
- cachedNumPoints = 314 * settings.airbrushIntensity * cachedRadiusSquared / 250000;
- if (cachedNumPoints == 0 && settings.airbrushIntensity != 0)
- cachedNumPoints = 1;
- }
-
- /**
- * Returns the name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.Airbrush.label");
- }
-
- /*
- * Template method for drawing
- */
- protected void render(Point point) {
- // Draws a bunch (cachedNumPoints) of random pixels within a specified circle (cachedRadiusSquared).
- ContainerFigure cfig = new ContainerFigure();
-
- for (int i = 0; i < cachedNumPoints; ++i) {
- int randX, randY;
- do {
- randX = (int) ((random.nextDouble() - 0.5) * settings.airbrushRadius * 2.0);
- randY = (int) ((random.nextDouble() - 0.5) * settings.airbrushRadius * 2.0);
- } while (randX * randX + randY * randY > cachedRadiusSquared);
- cfig.add(new PointFigure(settings.commonForegroundColor, point.x + randX, point.y + randY));
- }
- getPaintSurface().drawFigure(cfig);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/BasicPaintSession.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/BasicPaintSession.java deleted file mode 100755 index 1a7e3942b6..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/BasicPaintSession.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-public abstract class BasicPaintSession implements PaintSession {
- /**
* The paint surface
*/
private PaintSurface paintSurface;
/**
* Constructs a PaintSession.
*
* @param paintSurface the drawing surface to use
*/
protected BasicPaintSession(PaintSurface paintSurface) {
this.paintSurface = paintSurface;
}
/**
- * Returns the paint surface associated with this paint session.
*
* @return the associated PaintSurface
*/
public PaintSurface getPaintSurface() {
return paintSurface;
}
}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContainerFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContainerFigure.java deleted file mode 100755 index 8416429f6a..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContainerFigure.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * Container for Figure objects with stacking preview mechanism.
- */
-public class ContainerFigure extends Figure {
- private static final int INITIAL_ARRAY_SIZE = 16;
-
- Figure[] objectStack = null;
- int nextIndex = 0;
-
- /**
- * Constructs an empty Container
- */
- public ContainerFigure() {
- }
- /**
- * Adds an object to the container for later drawing.
- *
- * @param object the object to add to the drawing list
- */
- public void add(Figure object) {
- if (objectStack == null) {
- objectStack = new Figure[INITIAL_ARRAY_SIZE];
- } else if (objectStack.length <= nextIndex) {
- Figure[] newObjectStack = new Figure[objectStack.length * 2];
- System.arraycopy(objectStack, 0, newObjectStack, 0, objectStack.length);
- objectStack = newObjectStack;
- }
- objectStack[nextIndex] = object;
- ++nextIndex;
- }
- /**
- * Determines if the container is empty.
- * @return true if the container is empty
- */
- public boolean isEmpty() {
- return nextIndex == 0;
- }
- /**
- * Adds an object to the container and draws its preview then updates the supplied preview state.
- *
- * @param object the object to add to the drawing list
- * @param gc the GC to draw on
- * @param offset the offset to add to virtual coordinates to get display coordinates
- * @param rememberedState the state returned by a previous drawPreview() or addAndPreview()
- * using this Container, may be null if there was no such previous call
- * @return object state that must be passed to erasePreview() later to erase this object
- */
-// public Object addAndPreview(Figure object, GC gc, Point offset, Object rememberedState) {
-// Object[] stateStack = (Object[]) rememberedState;
-// if (stateStack == null) {
-// stateStack = new Object[INITIAL_ARRAY_SIZE];
-// } else if (stateStack.length <= nextIndex) {
-// Object[] newStateStack = new Object[stateStack.length * 2];
-// System.arraycopy(stateStack, 0, newStateStack, 0, stateStack.length);
-// stateStack = newStateStack;
-// }
-// add(object);
-// stateStack[nextIndex - 1] = object.drawPreview(gc, offset);
-// return stateStack;
-// }
- /**
- * Clears the container.
- * <p>
- * Note that erasePreview() cannot be called after this point to erase any previous
- * drawPreview()'s.
- * </p>
- */
- public void clear() {
- while (--nextIndex > 0) objectStack[nextIndex] = null;
- nextIndex = 0;
- }
- public void draw(FigureDrawContext fdc) {
- for (int i = 0; i < nextIndex; ++i) objectStack[i].draw(fdc);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- for (int i = 0; i < nextIndex; ++i) objectStack[i].addDamagedRegion(fdc, region);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java deleted file mode 100755 index f5efcb789d..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java +++ /dev/null @@ -1,228 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
-
-/**
- * The superclass for paint tools that draw continuously along the path
- * traced by the mouse's movement while the button is depressed
- */
-public abstract class ContinuousPaintSession extends BasicPaintSession {
- /**
- * True if a click-drag is in progress.
- */
- private boolean dragInProgress = false;
-
- /**
- * A cached Point array for drawing.
- */
- private Point[] points = new Point[] { new Point(-1, -1), new Point(-1, -1) };
-
- /**
- * The time to wait between retriggers in milliseconds.
- */
- private int retriggerInterval = 0;
-
- /**
- * The currently valid RetriggerHandler
- */
- protected Runnable retriggerHandler = null;
-
- /**
- * Constructs a ContinuousPaintSession.
- *
- * @param paintSurface the drawing surface to use
- */
- protected ContinuousPaintSession(PaintSurface paintSurface) {
- super(paintSurface);
- }
-
- /**
- * Sets the retrigger timer.
- * <p>
- * After the timer elapses, if the mouse is still hovering over the same point with the
- * drag button pressed, a new render order is issued and the timer is restarted.
- * </p>
- * @param interval the time in milliseconds to wait between retriggers, 0 to disable
- */
- public void setRetriggerTimer(int interval) {
- retriggerInterval = interval;
- }
-
- /**
- * Activates the tool.
- */
- public void beginSession() {
- getPaintSurface().
- setStatusMessage(PaintPlugin.getResourceString("session.ContinuousPaint.message"));
- dragInProgress = false;
- }
-
- /**
- * Deactivates the tool.
- */
- public void endSession() {
- abortRetrigger();
- }
-
- /**
- * Aborts the current operation.
- */
- public void resetSession() {
- abortRetrigger();
- }
-
- /**
- * Handles a mouseDown event.
- *
- * @param event the mouse event detail information
- */
- public final void mouseDown(MouseEvent event) {
- if (event.button != 1) return;
- if (dragInProgress) return; // spurious event
- dragInProgress = true;
-
- points[0].x = event.x;
- points[0].y = event.y;
- render(points[0]);
- prepareRetrigger();
- }
-
- /**
- * Handles a mouseDoubleClick event.
- *
- * @param event the mouse event detail information
- */
- public final void mouseDoubleClick(MouseEvent event) {
- }
-
- /**
- * Handles a mouseUp event.
- *
- * @param event the mouse event detail information
- */
- public final void mouseUp(MouseEvent event) {
- if (event.button != 1) return;
- if (! dragInProgress) return; // spurious event
- abortRetrigger();
- mouseSegmentFinished(event);
- dragInProgress = false;
- }
-
- /**
- * Handles a mouseMove event.
- *
- * @param event the mouse event detail information
- */
- public final void mouseMove(MouseEvent event) {
- final PaintSurface ps = getPaintSurface();
- ps.setStatusCoord(ps.getCurrentPosition());
- if (! dragInProgress) return;
- mouseSegmentFinished(event);
- prepareRetrigger();
- }
-
- /**
- * Handle a rendering segment
- *
- * @param event the mouse event detail information
- */
- private final void mouseSegmentFinished(MouseEvent event) {
- if (points[0].x == -1) return; // spurious event
- if (points[0].x != event.x || points[0].y != event.y) {
- // draw new segment
- points[1].x = event.x;
- points[1].y = event.y;
- renderContinuousSegment();
- }
- }
-
- /**
- * Draws a continuous segment from points[0] to points[1].
- * Assumes points[0] has been drawn already.
- *
- * @post points[0] will refer to the same point as points[1]
- */
- protected void renderContinuousSegment() {
- /* A lazy but effective line drawing algorithm */
- final int dX = points[1].x - points[0].x;
- final int dY = points[1].y - points[0].y;
- int absdX = Math.abs(dX);
- int absdY = Math.abs(dY);
-
- if ((dX == 0) && (dY == 0)) return;
-
- if (absdY > absdX) {
- final int incfpX = (dX << 16) / absdY;
- final int incY = (dY > 0) ? 1 : -1;
- int fpX = points[0].x << 16; // X in fixedpoint format
-
- while (--absdY >= 0) {
- points[0].y += incY;
- points[0].x = (fpX += incfpX) >> 16;
- render(points[0]);
- }
- if (points[0].x == points[1].x) return;
- points[0].x = points[1].x;
- } else {
- final int incfpY = (dY << 16) / absdX;
- final int incX = (dX > 0) ? 1 : -1;
- int fpY = points[0].y << 16; // Y in fixedpoint format
-
- while (--absdX >= 0) {
- points[0].x += incX;
- points[0].y = (fpY += incfpY) >> 16;
- render(points[0]);
- }
- if (points[0].y == points[1].y) return;
- points[0].y = points[1].y;
- }
- render(points[0]);
- }
-
- /**
- * Prepare the retrigger timer
- */
- private final void prepareRetrigger() {
- if (retriggerInterval > 0) {
- /*
- * timerExec() provides a lightweight mechanism for running code at intervals from within
- * the event loop when timing accuracy is not important.
- *
- * Since it is not possible to cancel a timerExec(), we remember the Runnable that is
- * active in order to distinguish the valid one from the stale ones. In practice,
- * if the interval is 1/100th of a second, then creating a few hundred new RetriggerHandlers
- * each second will not cause a significant performance hit.
- */
- Display display = getPaintSurface().getDisplay();
- retriggerHandler = new Runnable() {
- public void run() {
- if (retriggerHandler == this) {
- render(points[0]);
- prepareRetrigger();
- }
- }
- };
- display.timerExec(retriggerInterval, retriggerHandler);
- }
- }
-
- /**
- * Aborts the retrigger timer
- */
- private final void abortRetrigger() {
- retriggerHandler = null;
- }
-
- /**
- * Template method: Renders a point.
- * @param point, the point to render
- */
- protected abstract void render(Point point);
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/DragPaintSession.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/DragPaintSession.java deleted file mode 100755 index 728f1707a1..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/DragPaintSession.java +++ /dev/null @@ -1,131 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.*;
-
-/**
- * The superclass for paint tools that use click-drag-release motions to
- * draw objects.
- */
-public abstract class DragPaintSession extends BasicPaintSession {
- /**
- * True if a click-drag is in progress
- */
- private boolean dragInProgress = false;
-
- /**
- * The position of the first click in a click-drag
- */
- private Point anchorPosition = new Point(-1, -1);
-
- /**
- * A temporary point
- */
- private Point tempPosition = new Point(-1, -1);
-
- /**
- * Constructs a PaintSession.
- *
- * @param getPaintSurface() the drawing surface to use
- */
- protected DragPaintSession(PaintSurface paintSurface) {
- super(paintSurface);
- }
-
- /**
- * Activates the tool.
- */
- public void beginSession() {
- getPaintSurface().
- setStatusMessage(PaintPlugin.getResourceString("session.DragInteractivePaint.message"));
- anchorPosition.x = -1;
- dragInProgress = false;
- }
-
- /**
- * Deactivates the tool.
- */
- public void endSession() {
- }
-
- /**
- * Resets the tool.
- * Aborts any operation in progress.
- */
- public void resetSession() {
- getPaintSurface().clearRubberbandSelection();
- anchorPosition.x = -1;
- dragInProgress = false;
- }
-
- /**
- * Handles a mouseDown event.
- *
- * @param event the mouse event detail information
- */
- public void mouseDown(MouseEvent event) {
- if (event.button != 1) return;
- if (dragInProgress) return; // spurious event
- dragInProgress = true;
-
- anchorPosition.x = event.x;
- anchorPosition.y = event.y;
- }
-
- /**
- * Handles a mouseDoubleClick event.
- *
- * @param event the mouse event detail information
- */
- public void mouseDoubleClick(MouseEvent event) {
- }
-
- /**
- * Handles a mouseUp event.
- *
- * @param event the mouse event detail information
- */
- public void mouseUp(MouseEvent event) {
- if (event.button != 1) {
- resetSession(); // abort if right or middle mouse button pressed
- return;
- }
- if (! dragInProgress) return; // spurious event
- dragInProgress = false;
- if (anchorPosition.x == -1) return; // spurious event
-
- getPaintSurface().commitRubberbandSelection();
- }
-
- /**
- * Handles a mouseMove event.
- *
- * @param event the mouse event detail information
- */
- public void mouseMove(MouseEvent event) {
- final PaintSurface ps = getPaintSurface();
- if (! dragInProgress) {
- ps.setStatusCoord(ps.getCurrentPosition());
- return;
- }
- ps.setStatusCoordRange(anchorPosition, ps.getCurrentPosition());
- ps.clearRubberbandSelection();
- tempPosition.x = event.x;
- tempPosition.y = event.y;
- ps.addRubberbandSelection(createFigure(anchorPosition, tempPosition));
- }
-
- /**
- * Template Method: Creates a Figure for drawing rubberband entities and the final product
- *
- * @param anchor the anchor point
- * @param cursor the point marking the current pointer location
- */
- protected abstract Figure createFigure(Point anchor, Point cursor);
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseFigure.java deleted file mode 100755 index 27eedb39b5..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseFigure.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Ellipse object
- */
-public class EllipseFigure extends Figure {
- private Color foregroundColor, backgroundColor;
- private int lineStyle, x1, y1, x2, y2;
- /**
- * Constructs an Ellipse
- * These objects are defined by any two diametrically opposing corners of a box
- * bounding the ellipse.
- *
- * @param color the color for this object
- * @param lineStyle the line style for this object
- * @param x1 the virtual X coordinate of the first corner
- * @param y1 the virtual Y coordinate of the first corner
- * @param x2 the virtual X coordinate of the second corner
- * @param y2 the virtual Y coordinate of the second corner
- */
- public EllipseFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2) {
- this.foregroundColor = foregroundColor;
- this.backgroundColor = backgroundColor;
- this.lineStyle = lineStyle;
- this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- }
- public void draw(FigureDrawContext fdc) {
- Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setForeground(foregroundColor);
- fdc.gc.setBackground(backgroundColor);
- fdc.gc.setLineStyle(lineStyle);
- fdc.gc.drawOval(r.x, r.y, r.width - 1, r.height - 1);
- fdc.gc.setLineStyle(SWT.LINE_SOLID);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseTool.java deleted file mode 100755 index 3b3f11f2d9..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseTool.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A drawing tool.
- */
-public class EllipseTool extends DragPaintSession implements PaintTool {
- private ToolSettings settings;
-
- /**
- * Constructs a EllipseTool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public EllipseTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.Ellipse.label");
- }
-
- /*
- * Template methods for drawing
- */
- protected Figure createFigure(Point a, Point b) {
- ContainerFigure container = new ContainerFigure();
- if (settings.commonFillType != ToolSettings.ftNone)
- container.add(new SolidEllipseFigure(settings.commonBackgroundColor, a.x, a.y, b.x, b.y));
- if (settings.commonFillType != ToolSettings.ftSolid)
- container.add(new EllipseFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
- a.x, a.y, b.x, b.y));
- return container;
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/Figure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/Figure.java deleted file mode 100755 index be049d1700..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/Figure.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * Superinterface for all drawing objects.
- * All drawing objects know how to render themselved to the screen and can draw a
- * temporary version of themselves for previewing the general appearance of the
- * object onscreen before it gets committed.
- */
-public abstract class Figure {
- /**
- * Draws this object.
- *
- * @param fdc a parameter block specifying drawing-related information
- */
- public abstract void draw(FigureDrawContext fdc);
-
- /**
- * Computes the damaged screen region caused by drawing this object (imprecise), then
- * appends it to the supplied region.
- *
- * @param fdc a parameter block specifying drawing-related information
- * @param region a region to which additional damage areas will be added
- */
- public abstract void addDamagedRegion(FigureDrawContext fdc, Region region);
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/FigureDrawContext.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/FigureDrawContext.java deleted file mode 100644 index 4c08aa86cd..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/FigureDrawContext.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.graphics.*;
-
-public class FigureDrawContext {
- /*
- * <p>
- * The GC must be set up as follows
- * (it will be returned to this state upon completion of drawing operations)
- * <ul>
- * <li>setXORMode(false)
- * </ul>
- * </p>
- */
- public GC gc = null;
- public int xOffset = 0, yOffset = 0; // substract to get GC coords
- public int xScale = 1, yScale = 1;
-
- public Rectangle toClientRectangle(int x1, int y1, int x2, int y2) {
- return new Rectangle(
- Math.min(x1, x2) * xScale - xOffset,
- Math.min(y1, y2) * yScale - yOffset,
- (Math.abs(x2 - x1) + 1) * xScale,
- (Math.abs(y2 - y1) + 1) * yScale);
- }
- public Point toClientPoint(int x, int y) {
- return new Point(x * xScale - xOffset, y * yScale - yOffset);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineFigure.java deleted file mode 100755 index f7b0605cb0..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineFigure.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Line object
- */
-public class LineFigure extends Figure {
- private Color foregroundColor, backgroundColor;
- private int lineStyle, x1, y1, x2, y2;
- /**
- * Constructs a Line
- * These objects are defined by their two end-points.
- *
- * @param color the color for this object
- * @param lineStyle the line style for this object
- * @param x1 the virtual X coordinate of the first end-point
- * @param y1 the virtual Y coordinate of the first end-point
- * @param x2 the virtual X coordinate of the second end-point
- * @param y2 the virtual Y coordinate of the second end-point
- */
- public LineFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2) {
- this.foregroundColor = foregroundColor;
- this.backgroundColor = backgroundColor;
- this.lineStyle = lineStyle;
- this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- }
- public void draw(FigureDrawContext fdc) {
- Point p1 = fdc.toClientPoint(x1, y1);
- Point p2 = fdc.toClientPoint(x2, y2);
- fdc.gc.setForeground(foregroundColor);
- fdc.gc.setBackground(backgroundColor);
- fdc.gc.setLineStyle(lineStyle);
- fdc.gc.drawLine(p1.x, p1.y, p2.x, p2.y);
- fdc.gc.setLineStyle(SWT.LINE_SOLID);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineTool.java deleted file mode 100755 index f919965c86..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineTool.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A line drawing tool
- */
-public class LineTool extends DragPaintSession implements PaintTool {
- private ToolSettings settings;
-
- /**
- * Constructs a LineTool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public LineTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.Line.label");
- }
-
- /*
- * Template methods for drawing
- */
- protected Figure createFigure(Point a, Point b) {
- return new LineFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
- a.x, a.y, b.x, b.y);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintPlugin.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintPlugin.java deleted file mode 100755 index e4da0cf02f..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintPlugin.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.plugin.*;
-
-import java.text.*;
-import java.util.*;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class PaintPlugin extends AbstractUIPlugin {
- //The shared instance.
- private static PaintPlugin plugin;
- private static ResourceBundle resourceBundle;
-
- /**
- * Constructs the Paint plugin.
- */
- public PaintPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- plugin = this;
- resourceBundle = descriptor.getResourceBundle();
- }
-
- /**
- * Returns the shared instance.
- */
- public static PaintPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Log an error to the ILog for this plugin
- *
- * @param message the localized error message text
- * @param exception the associated exception, or null
- */
- public static void logError(String message, Throwable exception) {
- plugin.getLog().log(new Status(IStatus.ERROR, plugin.getDescriptor().getUniqueIdentifier(),
- 0, message, exception));
- }
-
- /**
- * Returns a string from the resource bundle.
- * We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- public static String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Returns a string from the resource bundle and binds it
- * with the given arguments. If the key is not found,
- * return the key.
- */
- public static String getResourceString(String key, Object[] args) {
- try {
- return MessageFormat.format(getResourceString(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSession.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSession.java deleted file mode 100755 index a5a43d03cc..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSession.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.events.*;
-
-/**
- * Manages an interactive paint session.
- * Note that the coordinates received via the listener interfaces are virtualized to zero-origin
- * relative to the painting surface.
- */
-public interface PaintSession extends MouseListener, MouseMoveListener {
- /**
- * Returns the paint surface associated with this paint session
- *
- * @return the associated PaintSurface
- */
- public PaintSurface getPaintSurface();
-
- /**
- * Activates the session.
- *
- * Note: When overriding this method, call super.beginSession() at method start.
- */
- public abstract void beginSession();
-
- /**
- * Deactivates the session.
- *
- * Note: When overriding this method, call super.endSession() at method exit.
- */
- public abstract void endSession();
-
- /**
- * Resets the session.
- * Aborts any operation in progress.
- *
- * Note: When overriding this method, call super.resetSession() at method exit.
- */
- public abstract void resetSession();
-
-
- /**
- * Returns the name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName();
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSurface.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSurface.java deleted file mode 100755 index f9fd2064a2..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSurface.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.eclipse.swt.examples.paint;
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
-
/**
* Manages a simple drawing surface.
*/
-public class PaintSurface {
private Point currentPosition = new Point(0, 0);
- private Canvas paintCanvas;
private PaintSession paintSession;
private Image image;
private Image paintImage; // buffer for refresh blits
private int imageWidth, imageHeight;
private int visibleWidth, visibleHeight;
private FigureDrawContext displayFDC = new FigureDrawContext();
private FigureDrawContext imageFDC = new FigureDrawContext();
private FigureDrawContext paintFDC = new FigureDrawContext();
/* Rubberband */
private ContainerFigure rubberband = new ContainerFigure();
// the active rubberband selection
private int rubberbandHiddenNestingCount = 0;
// always >= 0, if > 0 rubberband has been hidden
/* Status */
private Text statusText;
private String statusActionInfo, statusMessageInfo, statusCoordInfo;
/**
* Constructs a PaintSurface.
* <p>
* paintCanvas must have SWT.NO_REDRAW_RESIZE and SWT.NO_BACKGROUND styles,
* and may have SWT.V_SCROLL and/or SWT.H_SCROLL.
* </p>
* @param paintCanvas the Canvas object in which to render
* @param paintStatus the PaintStatus object to use for providing user feedback
* @param fillColor the color to fill the canvas with initially
*/
- public PaintSurface(Canvas paintCanvas, Text statusText, Color fillColor) {
this.paintCanvas = paintCanvas;
this.statusText = statusText;
clearStatus();
/* Set up the drawing surface */
Rectangle displayRect = paintCanvas.getDisplay().getClientArea();
imageWidth = displayRect.width;
imageHeight = displayRect.height;
image = new Image(paintCanvas.getDisplay(), imageWidth, imageHeight);
imageFDC.gc = new GC(image);
imageFDC.gc.setBackground(fillColor);
imageFDC.gc.fillRectangle(0, 0, imageWidth, imageHeight);
displayFDC.gc = new GC(paintCanvas);
/* Initialize the session */
setPaintSession(null);
/* Add our listeners */
paintCanvas.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
displayFDC.gc.dispose();
}
});
paintCanvas.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent event) {
processMouseEventCoordinates(event);
if (paintSession != null) paintSession.mouseDown(event);
}
public void mouseUp(MouseEvent event) {
processMouseEventCoordinates(event);
if (paintSession != null) paintSession.mouseUp(event);
}
public void mouseDoubleClick(MouseEvent event) {
processMouseEventCoordinates(event);
if (paintSession != null) paintSession.mouseDoubleClick(event);
}
});
paintCanvas.addMouseMoveListener(new MouseMoveListener() {
public void mouseMove(MouseEvent event) {
processMouseEventCoordinates(event);
if (paintSession != null) paintSession.mouseMove(event);
}
});
paintCanvas.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent event) {
if (rubberband.isEmpty()) {
// Nothing to merge, so we just refresh
event.gc.drawImage(image,
displayFDC.xOffset + event.x, displayFDC.yOffset + event.y, event.width, event.height,
event.x, event.y, event.width, event.height);
} else {
/*
* Avoid flicker when merging overlayed objects by constructing the image on
* a backbuffer first, then blitting it to the screen.
*/
// Check that the backbuffer is large enough
if (paintImage != null) {
Rectangle rect = paintImage.getBounds();
if ((event.width + event.x > rect.width) ||
(event.height + event.y > rect.height)) {
paintFDC.gc.dispose();
paintImage.dispose();
paintImage = null;
}
}
if (paintImage == null) {
Display display = getDisplay();
Rectangle rect = display.getClientArea();
paintImage = new Image(display,
Math.max(rect.width, event.width + event.x),
Math.max(rect.height, event.height + event.y));
paintFDC.gc = new GC(paintImage);
}
// Setup clipping and the FDC
Region clipRegion = new Region();
event.gc.getClipping(clipRegion);
paintFDC.gc.setClipping(clipRegion);
clipRegion.dispose();
paintFDC.xOffset = displayFDC.xOffset;
paintFDC.yOffset = displayFDC.yOffset;
paintFDC.xScale = displayFDC.xScale;
paintFDC.yScale = displayFDC.yScale;
// Merge the overlayed objects into the image, then blit
paintFDC.gc.drawImage(image,
displayFDC.xOffset + event.x, displayFDC.yOffset + event.y, event.width, event.height,
event.x, event.y, event.width, event.height);
rubberband.draw(paintFDC);
event.gc.drawImage(paintImage,
event.x, event.y, event.width, event.height,
event.x, event.y, event.width, event.height);
}
}
});
paintCanvas.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent event) {
handleResize();
}
});
/* Set up the paint canvas scroll bars */
ScrollBar horizontal = paintCanvas.getHorizontalBar();
horizontal.setVisible(true);
horizontal.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
scrollHorizontally((ScrollBar)event.widget);
}
});
ScrollBar vertical = paintCanvas.getVerticalBar();
vertical.setVisible(true);
vertical.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
scrollVertically((ScrollBar)event.widget);
}
});
handleResize();
}
/**
* Disposes of the PaintSurface's resources.
*/
public void dispose() {
imageFDC.gc.dispose();
image.dispose();
if (paintImage != null) {
paintImage.dispose();
paintFDC.gc.dispose();
}
currentPosition = null;
paintCanvas = null;
paintSession = null;
image = null;
paintImage = null;
displayFDC = null;
imageFDC = null;
paintFDC = null;
rubberband = null;
statusText = null;
statusActionInfo = null;
statusMessageInfo = null;
statusCoordInfo = null;
}
/**
* Called when we must grab focus.
*/
public void setFocus() {
paintCanvas.setFocus();
}
/**
* Returns the Display on which the PaintSurface resides.
* @return the Display
*/
public Display getDisplay() {
return paintCanvas.getDisplay();
}
/**
* Returns the Shell in which the PaintSurface resides.
* @return the Shell
*/
public Shell getShell() {
return paintCanvas.getShell();
}
/**
- * Sets the current paint session.
* <p>
- * If oldPaintSession != paintSession calls oldPaintSession.end()
* and paintSession.begin()
* </p>
*
- * @param paintSession the paint session to activate; null to disable all sessions
- */
- public void setPaintSession(PaintSession paintSession) {
- if (this.paintSession != null) {
if (this.paintSession == paintSession) return;
- this.paintSession.endSession();
}
- this.paintSession = paintSession;
- clearStatus();
if (paintSession != null) {
setStatusAction(paintSession.getDisplayName());
paintSession.beginSession();
} else {
setStatusAction(PaintPlugin.getResourceString("tool.Null.label"));
setStatusMessage(PaintPlugin.getResourceString("session.Null.message"));
}
}
-
- /**
- * Returns the current paint session.
- *
- * @return the current paint session, null if none is active
- */
- public PaintSession getPaintSession() {
- return paintSession;
- }
-
/**
* Returns the current paint tool.
*
* @return the current paint tool, null if none is active (though some other session
* might be)
*/
public PaintTool getPaintTool() {
return (paintSession != null && paintSession instanceof PaintTool) ?
(PaintTool)paintSession : null;
}
/**
* Returns the current position in an interactive operation.
*
* @return the last known position of the pointer
*/
public Point getCurrentPosition() {
return currentPosition;
}
/**
* Draws a Figure object to the screen and to the backing store permanently.
*
* @param object the object to draw onscreen
*/
public void drawFigure(Figure object) {
object.draw(imageFDC);
object.draw(displayFDC);
}
/**
* Adds a Figure object to the active rubberband selection.
* <p>
* This object will be drawn to the screen as a preview and refreshed appropriately
* until the selection is either cleared or committed.
* </p>
*
* @param object the object to add to the selection
*/
public void addRubberbandSelection(Figure object) {
rubberband.add(object);
if (! isRubberbandHidden()) object.draw(displayFDC);
}
/**
* Clears the active rubberband selection.
* <p>
* Erases any rubberband objects on the screen then clears the selection.
* </p>
*/
public void clearRubberbandSelection() {
if (! isRubberbandHidden()) {
Region region = new Region();
rubberband.addDamagedRegion(displayFDC, region);
Rectangle r = region.getBounds();
paintCanvas.redraw(r.x, r.y, r.width, r.height, true);
region.dispose();
}
rubberband.clear();
}
/**
* Commits the active rubberband selection.
* <p>
* Redraws any rubberband objects on the screen as permanent objects then clears the selection.
* </p>
*/
public void commitRubberbandSelection() {
rubberband.draw(imageFDC);
if (isRubberbandHidden()) rubberband.draw(displayFDC);
rubberband.clear();
}
/**
* Hides the rubberband (but does not eliminate it).
* <p>
* Increments by one the rubberband "hide" nesting count. The rubberband
* is hidden from view (but remains active) if it wasn't already hidden.
* </p>
*/
public void hideRubberband() {
if (rubberbandHiddenNestingCount++ <= 0) {
Region region = new Region();
rubberband.addDamagedRegion(displayFDC, region);
Rectangle r = region.getBounds();
paintCanvas.redraw(r.x, r.y, r.width, r.height, true);
region.dispose();
}
}
/**
* Shows (un-hides) the rubberband.
* <p>
* Decrements by one the rubberband "hide" nesting count. The rubberband
* is only made visible when showRubberband() has been called once for each
* previous hideRubberband(). It is not permitted to call showRubberband() if
* the rubber band is not presently hidden.
* </p>
*/
public void showRubberband() {
if (rubberbandHiddenNestingCount <= 0)
throw new IllegalStateException("rubberbandHiddenNestingCount > 0");
if (--rubberbandHiddenNestingCount == 0) {
rubberband.draw(displayFDC);
}
}
/**
* Determines if the rubberband is hidden.
*
* @return true iff the rubber is hidden
*/
public boolean isRubberbandHidden() {
return rubberbandHiddenNestingCount > 0;
}
/**
* Handles a horizontal scroll event
*
* @param scrollbar the horizontal scroll bar that posted this event
*/
public void scrollHorizontally(ScrollBar scrollBar) {
if (image == null) return;
if (imageWidth > visibleWidth) {
final int oldOffset = displayFDC.xOffset;
final int newOffset = Math.min(scrollBar.getSelection(), imageWidth - visibleWidth);
if (oldOffset != newOffset) {
paintCanvas.update();
displayFDC.xOffset = newOffset;
paintCanvas.scroll(Math.max(oldOffset - newOffset, 0), 0, Math.max(newOffset - oldOffset, 0), 0,
visibleWidth, visibleHeight, false);
}
}
}
/**
* Handles a vertical scroll event
*
* @param scrollbar the vertical scroll bar that posted this event
*/
public void scrollVertically(ScrollBar scrollBar) {
if (image == null) return;
if (imageHeight > visibleHeight) {
final int oldOffset = displayFDC.yOffset;
final int newOffset = Math.min(scrollBar.getSelection(), imageHeight - visibleHeight);
if (oldOffset != newOffset) {
paintCanvas.update();
displayFDC.yOffset = newOffset;
paintCanvas.scroll(0, Math.max(oldOffset - newOffset, 0), 0, Math.max(newOffset - oldOffset, 0),
visibleWidth, visibleHeight, false);
}
}
}
/**
* Handles resize events
*/
private void handleResize() {
paintCanvas.update();
Rectangle visibleRect = paintCanvas.getClientArea();
visibleWidth = visibleRect.width;
visibleHeight = visibleRect.height;
ScrollBar horizontal = paintCanvas.getHorizontalBar();
if (horizontal != null) {
displayFDC.xOffset = Math.min(horizontal.getSelection(), imageWidth - visibleWidth);
if (imageWidth <= visibleWidth) {
horizontal.setEnabled(false);
horizontal.setSelection(0);
} else {
final int max = imageWidth - visibleWidth;
horizontal.setEnabled(true);
horizontal.setValues(displayFDC.xOffset, 0, imageWidth, visibleWidth,
8, visibleWidth);
}
}
ScrollBar vertical = paintCanvas.getVerticalBar();
if (vertical != null) {
displayFDC.yOffset = Math.min(vertical.getSelection(), imageHeight - visibleHeight);
if (imageHeight <= visibleHeight) {
vertical.setEnabled(false);
vertical.setSelection(0);
} else {
final int max = imageHeight - visibleHeight;
vertical.setEnabled(true);
vertical.setValues(displayFDC.yOffset, 0, imageHeight, visibleHeight,
8, visibleHeight);
}
}
}
/**
* Virtualizes MouseEvent coordinates and stores the current position.
*/
private void processMouseEventCoordinates(MouseEvent event) {
currentPosition.x = event.x =
Math.min(Math.max(event.x, 0), visibleWidth - 1) + displayFDC.xOffset;
currentPosition.y = event.y =
Math.min(Math.max(event.y, 0), visibleHeight - 1) + displayFDC.yOffset;
}
/**
* Clears the status bar.
*/
public void clearStatus() {
statusActionInfo = "";
statusMessageInfo = "";
statusCoordInfo = "";
updateStatus();
}
/**
* Sets the status bar action text.
*
* @param action the action in progress, null to clear
*/
public void setStatusAction(String action) {
statusActionInfo = (action != null) ? action : "";
updateStatus();
}
/**
* Sets the status bar message text.
*
* @param message the message to display, null to clear
*/
public void setStatusMessage(String message) {
statusMessageInfo = (message != null) ? message : "";
updateStatus();
}
/**
* Sets the coordinates in the status bar.
*
* @param coord the coordinates to display, null to clear
*/
public void setStatusCoord(Point coord) {
statusCoordInfo = (coord != null) ? PaintPlugin.getResourceString("status.Coord.format", new Object[]
{ new Integer(coord.x), new Integer(coord.y)}) : "";
updateStatus();
}
/**
* Sets the coordinate range in the status bar.
*
* @param a the "from" coordinate, must not be null
* @param b the "to" coordinate, must not be null
*/
public void setStatusCoordRange(Point a, Point b) {
statusCoordInfo = PaintPlugin.getResourceString("status.CoordRange.format", new Object[]
{ new Integer(a.x), new Integer(a.y), new Integer(b.x), new Integer(b.y)});
updateStatus();
}
/**
* Updates the display.
*/
private void updateStatus() {
statusText.setText(
PaintPlugin.getResourceString("status.Bar.format", new Object[]
{ statusActionInfo, statusMessageInfo, statusCoordInfo }));
}
}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintTool.java deleted file mode 100755 index da27e96033..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintTool.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.eclipse.swt.examples.paint;
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
public interface PaintTool extends PaintSession {
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings);
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintView.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintView.java deleted file mode 100755 index 174de42e8d..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintView.java +++ /dev/null @@ -1,496 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.resource.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.*;
-
-import java.net.*;
-import java.util.*;
-
-/**
- * The view for the paint application.
- * All rendering happens inside the area created by createPartControl().
- *
- * @see ViewPart
- */
-public class PaintView extends ViewPart {
- private Display workbenchDisplay;
-
- // current active settings
- private ToolSettings toolSettings;
-
- // paint surface for drawing
- private PaintSurface paintSurface;
-
- // map action ids to useful data
- private HashMap /* of String to PaintTool */ paintToolMap;
- private HashMap /* of String to Integer */ paintFillTypeMap;
- private HashMap /* of String to Integer */ paintLineStyleMap;
-
- /** UI data **/
- // handle of currently active tool IAction on the UI
- private IAction activeToolAction;
- // handle of currently active filltype IAction on the UI
- private IAction activeFillTypeAction;
- // handle of currently active linetype IAction on the UI
- private IAction activeLineStyleAction;
-
- // handle of active foreground color box Canvas widget
- private Canvas activeForegroundColorCanvas;
- // handle of active background color box Canvas widget
- private Canvas activeBackgroundColorCanvas;
-
- private static final int numPaletteRows = 3;
- private static final int numPaletteCols = 50;
-
- // shared data
- private Color paintColorBlack, paintColorWhite; // alias for paintColors[0] and [1]
- private Color[] paintColors;
- private Font paintDefaultFont; // do not free
-
- /**
- * Constructs a Paint view.
- */
- public PaintView() {
- }
-
- /**
- * Cleanup
- */
- public void dispose() {
- if (paintSurface != null) paintSurface.dispose();
- if (paintColors != null) {
- for (int i = 0; i < paintColors.length; ++i) {
- final Color color = paintColors[i];
- if (color != null) color.dispose();
- }
- }
- paintDefaultFont = null;
- paintColors = null;
- paintSurface = null;
- super.dispose();
- }
-
- /**
- * Called when we must grab focus.
- *
- * @see org.eclipse.ui.part.ViewPart#setFocus
- */
- public void setFocus() {
- paintSurface.setFocus();
- }
-
- /**
- * Creates the example.
- *
- * @see ViewPart#createPartControl
- */
- public void createPartControl(Composite parent) {
- /*** Initialize shared data ***/
- workbenchDisplay = parent.getDisplay();
-
- paintColorWhite = new Color(workbenchDisplay, 255, 255, 255);
- paintColorBlack = new Color(workbenchDisplay, 0, 0, 0);
-
- paintDefaultFont = workbenchDisplay.getSystemFont();
-
- paintColors = new Color[numPaletteCols * numPaletteRows];
- paintColors[0] = paintColorBlack;
- paintColors[1] = paintColorWhite;
- for (int i = 2; i < paintColors.length; i++) {
- paintColors[i] = new Color(workbenchDisplay,
- ((i*7)%255),((i*23)%255), ((i*51)%255));
- }
-
- toolSettings = new ToolSettings();
- toolSettings.commonForegroundColor = paintColorBlack;
- toolSettings.commonBackgroundColor = paintColorWhite;
- toolSettings.commonFont = paintDefaultFont;
-
- /*** Add toolbar contributions ***/
- final IActionBars actionBars = getViewSite().getActionBars();
- IToolBarManager toolbarManager = actionBars.getToolBarManager();
-
- toolbarManager.add(new GroupMarker("group.tools"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Pencil"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Airbrush"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Line"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.PolyLine"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Rectangle"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.RoundedRectangle"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Ellipse"));
- toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Text"));
- toolbarManager.add(new Separator());
- toolbarManager.add(new GroupMarker("group.options.fill"));
- toolbarManager.appendToGroup("group.options.fill", new SelectFillTypeAction("fill.None"));
- toolbarManager.appendToGroup("group.options.fill", new SelectFillTypeAction("fill.Outline"));
- toolbarManager.appendToGroup("group.options.fill", new SelectFillTypeAction("fill.Solid"));
- toolbarManager.add(new Separator());
- toolbarManager.add(new GroupMarker("group.options.linestyle"));
- toolbarManager.appendToGroup("group.options.linestyle", new SelectLineStyleAction("linestyle.Solid"));
- toolbarManager.appendToGroup("group.options.linestyle", new SelectLineStyleAction("linestyle.Dash"));
- toolbarManager.appendToGroup("group.options.linestyle", new SelectLineStyleAction("linestyle.Dot"));
- toolbarManager.appendToGroup("group.options.linestyle", new SelectLineStyleAction("linestyle.DashDot"));
- toolbarManager.add(new Separator());
- toolbarManager.add(new GroupMarker("group.options"));
- toolbarManager.appendToGroup("group.options", new SelectFontAction("options.Font"));
- actionBars.updateActionBars();
-
- /*** Build GUI ***/
- createGUI(parent);
-
- /*** Set defaults ***/
- setPaintToolByID("tool.Pencil");
- setFillTypeByID("fill.None");
- setLineStyleByID("linestyle.Solid");
- setForegroundColor(paintColorBlack);
- setBackgroundColor(paintColorWhite);
- }
-
- /**
- * Creates the GUI.
- */
- private void createGUI(Composite parent) {
- GridLayout gridLayout;
- GridData gridData;
-
- /*** Create principal GUI layout elements ***/
- Composite displayArea = new Composite(parent, SWT.NONE);
- gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- displayArea.setLayout(gridLayout);
-
- // Creating these elements here avoids the need to instantiate the GUI elements
- // in strict layout order. The natural layout ordering is an artifact of using
- // SWT layouts, but unfortunately it is not the same order as that required to
- // instantiate all of the non-GUI application elements to satisfy referential
- // dependencies. It is possible to reorder the initialization to some extent, but
- // this can be very tedious.
-
- // paint canvas
- final Canvas paintCanvas = new Canvas(displayArea, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL |
- SWT.NO_REDRAW_RESIZE | SWT.NO_BACKGROUND);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- paintCanvas.setLayoutData(gridData);
- paintCanvas.setBackground(paintColorWhite);
-
- // color selector frame
- final Composite colorFrame = new Composite(displayArea, SWT.NONE);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- colorFrame.setLayoutData(gridData);
-
- // tool settings frame
- final Composite toolSettingsFrame = new Composite(displayArea, SWT.NONE);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- toolSettingsFrame.setLayoutData(gridData);
-
- // status text
- final Text statusText = new Text(displayArea, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- statusText.setLayoutData(gridData);
-
- /*** Create the remaining application elements inside the principal GUI layout elements ***/
- // paintSurface
- paintSurface = new PaintSurface(paintCanvas, statusText, paintColorWhite);
-
- // paintToolMap
- paintToolMap = new HashMap();
- paintToolMap.put("tool.Pencil", new PencilTool(toolSettings, paintSurface));
- paintToolMap.put("tool.Airbrush", new AirbrushTool(toolSettings, paintSurface));
- paintToolMap.put("tool.Line", new LineTool(toolSettings, paintSurface));
- paintToolMap.put("tool.PolyLine", new PolyLineTool(toolSettings, paintSurface));
- paintToolMap.put("tool.Rectangle", new RectangleTool(toolSettings, paintSurface));
- paintToolMap.put("tool.RoundedRectangle", new RoundedRectangleTool(toolSettings, paintSurface));
- paintToolMap.put("tool.Ellipse", new EllipseTool(toolSettings, paintSurface));
- paintToolMap.put("tool.Text", new TextTool(toolSettings, paintSurface));
- paintToolMap.put("tool.Null", null);
-
- // paintFillTypeMap
- paintFillTypeMap = new HashMap();
- paintFillTypeMap.put("fill.None", new Integer(ToolSettings.ftNone));
- paintFillTypeMap.put("fill.Outline", new Integer(ToolSettings.ftOutline));
- paintFillTypeMap.put("fill.Solid", new Integer(ToolSettings.ftSolid));
-
- // paintLineStyleMap
- paintLineStyleMap = new HashMap();
- paintLineStyleMap.put("linestyle.Solid", new Integer(SWT.LINE_SOLID));
- paintLineStyleMap.put("linestyle.Dash", new Integer(SWT.LINE_DASH));
- paintLineStyleMap.put("linestyle.Dot", new Integer(SWT.LINE_DOT));
- paintLineStyleMap.put("linestyle.DashDot", new Integer(SWT.LINE_DASHDOT));
-
- // colorFrame
- gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- colorFrame.setLayout(gridLayout);
-
- // activeForegroundColorCanvas, activeBackgroundColorCanvas
- activeForegroundColorCanvas = new Canvas(colorFrame, SWT.BORDER);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gridData.heightHint = 24;
- gridData.widthHint = 24;
- activeForegroundColorCanvas.setLayoutData(gridData);
-
- activeBackgroundColorCanvas = new Canvas(colorFrame, SWT.BORDER);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gridData.heightHint = 24;
- gridData.widthHint = 24;
- activeBackgroundColorCanvas.setLayoutData(gridData);
-
- // paletteCanvas
- final Canvas paletteCanvas = new Canvas(colorFrame, SWT.BORDER | SWT.NO_BACKGROUND);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.heightHint = 24;
- paletteCanvas.setLayoutData(gridData);
- paletteCanvas.addListener(SWT.MouseDown, new Listener() {
- public void handleEvent(Event e) {
- Rectangle bounds = paletteCanvas.getClientArea();
- Color color = getColorAt(bounds, e.x, e.y);
-
- if (e.button == 1) setForegroundColor(color);
- else setBackgroundColor(color);
- }
- private Color getColorAt(Rectangle bounds, int x, int y) {
- if (bounds.height <= 1 && bounds.width <= 1) return paintColorWhite;
- final int row = (y - bounds.y) * numPaletteRows / bounds.height;
- final int col = (x - bounds.x) * numPaletteCols / bounds.width;
- return paintColors[Math.min(Math.max(row * numPaletteCols + col, 0), paintColors.length - 1)];
- }
- });
- Listener refreshListener = new Listener() {
- public void handleEvent(Event e) {
- if (e.gc == null) return;
- Rectangle bounds = paletteCanvas.getClientArea();
- for (int row = 0; row < numPaletteRows; ++row) {
- for (int col = 0; col < numPaletteCols; ++col) {
- final int x = bounds.width * col / numPaletteCols;
- final int y = bounds.height * row / numPaletteRows;
- final int width = Math.max(bounds.width * (col + 1) / numPaletteCols - x, 1);
- final int height = Math.max(bounds.height * (row + 1) / numPaletteRows - y, 1);
- e.gc.setBackground(paintColors[row * numPaletteCols + col]);
- e.gc.fillRectangle(bounds.x + x, bounds.y + y, width, height);
- }
- }
- }
- };
- paletteCanvas.addListener(SWT.Resize, refreshListener);
- paletteCanvas.addListener(SWT.Paint, refreshListener);
- //paletteCanvas.redraw();
-
- // toolSettingsFrame
- gridLayout = new GridLayout();
- gridLayout.numColumns = 4;
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- toolSettingsFrame.setLayout(gridLayout);
-
- Label label = new Label(toolSettingsFrame, SWT.NONE);
- label.setText(PaintPlugin.getResourceString("settings.AirbrushRadius.text"));
-
- final Scale airbrushRadiusScale = new Scale(toolSettingsFrame, SWT.HORIZONTAL);
- airbrushRadiusScale.setMinimum(5);
- airbrushRadiusScale.setMaximum(50);
- airbrushRadiusScale.setSelection(toolSettings.airbrushRadius);
- airbrushRadiusScale.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
- airbrushRadiusScale.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- toolSettings.airbrushRadius = airbrushRadiusScale.getSelection();
- updateToolSettings();
- }
- });
-
- label = new Label(toolSettingsFrame, SWT.NONE);
- label.setText(PaintPlugin.getResourceString("settings.AirbrushIntensity.text"));
-
- final Scale airbrushIntensityScale = new Scale(toolSettingsFrame, SWT.HORIZONTAL);
- airbrushIntensityScale.setMinimum(1);
- airbrushIntensityScale.setMaximum(100);
- airbrushIntensityScale.setSelection(toolSettings.airbrushIntensity);
- airbrushIntensityScale.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
- airbrushIntensityScale.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- toolSettings.airbrushIntensity = airbrushIntensityScale.getSelection();
- updateToolSettings();
- }
- });
- }
-
- /**
- * Notifies the tool that its settings have changed.
- */
- private void updateToolSettings() {
- final PaintTool activePaintTool = paintSurface.getPaintTool();
- if (activePaintTool == null) return;
-
- activePaintTool.endSession();
- activePaintTool.set(toolSettings);
- activePaintTool.beginSession();
- }
-
- /**
- * Sets the tool foreground color.
- *
- * @param color the new color to use
- */
- public void setForegroundColor(Color color) {
- if (activeForegroundColorCanvas != null)
- activeForegroundColorCanvas.setBackground(color);
- toolSettings.commonForegroundColor = color;
- updateToolSettings();
- }
-
- /**
- * Set the tool background color.
- *
- * @param color the new color to use
- */
- public void setBackgroundColor(Color color) {
- if (activeBackgroundColorCanvas != null)
- activeBackgroundColorCanvas.setBackground(color);
- toolSettings.commonBackgroundColor = color;
- updateToolSettings();
- }
-
- /**
- * Selects a tool given its ID.
- */
- public void setPaintToolByID(String id) {
- activeToolAction = handleRadioAction(activeToolAction, id);
-
- final PaintTool paintTool = (PaintTool) paintToolMap.get(id);
- paintSurface.setPaintSession(paintTool);
- updateToolSettings();
- }
-
- /**
- * Selects a filltype given its ID.
- */
- public void setFillTypeByID(String id) {
- activeFillTypeAction = handleRadioAction(activeFillTypeAction, id);
-
- final Integer fillType = (Integer) paintFillTypeMap.get(id);
- toolSettings.commonFillType = fillType.intValue();
- updateToolSettings();
- }
-
- /**
- * Selects line type given its ID.
- */
- public void setLineStyleByID(String id) {
- activeLineStyleAction = handleRadioAction(activeLineStyleAction, id);
-
- final Integer lineType = (Integer) paintLineStyleMap.get(id);
- toolSettings.commonLineStyle = lineType.intValue();
- updateToolSettings();
- }
-
- /**
- * Gets the IAction for an ID belonging to a set of mutually exclusive actions, and
- * toggles the old action off if necessary.
- */
- private IAction handleRadioAction(IAction oldAction, String id) {
- IAction action = getActionByID(id);
- if (action != null) {
- if (oldAction != null) oldAction.setChecked(false);
- if (! action.isChecked()) action.setChecked(true);
- return action;
- }
- return oldAction;
- }
-
- /**
- * Gets the IAction representing the UI toolbar button with the specified ID.
- */
- private IAction getActionByID(String id) {
- final IActionBars actionBars = getViewSite().getActionBars();
- IToolBarManager toolbarManager = actionBars.getToolBarManager();
- ActionContributionItem contributionItem = (ActionContributionItem) toolbarManager.find(id);
- if (contributionItem == null) return null;
- return contributionItem.getAction();
- }
-
- /**
- * Returns the Display.
- *
- * @return the display we're using
- */
- public Display getDisplay() {
- return workbenchDisplay;
- }
-
- /**
- * Action set glue.
- */
- abstract class PaintAction extends Action {
- public PaintAction(String id) {
- super();
- setId(id);
-
- try {
- final URL installUrl = PaintPlugin.getDefault().getDescriptor().getInstallURL();
- final URL imageUrl = new URL(installUrl, PaintPlugin.getResourceString(id + ".image"));
- setImageDescriptor(ImageDescriptor.createFromURL(imageUrl));
- } catch (MalformedURLException e) {
- PaintPlugin.logError("", e);
- }
-
- setText(PaintPlugin.getResourceString(id + ".label"));
- setToolTipText(PaintPlugin.getResourceString(id + ".tooltip"));
- setDescription(PaintPlugin.getResourceString(id + ".description"));
- }
- }
- class SelectPaintToolAction extends PaintAction {
- public SelectPaintToolAction(String id) { super(id); }
- public int getStyle() { return IAction.AS_CHECK_BOX; }
- public void run() { setPaintToolByID(getId()); }
-
- }
- class SelectFillTypeAction extends PaintAction {
- public SelectFillTypeAction(String id) { super(id); }
- public int getStyle() { return IAction.AS_CHECK_BOX; }
- public void run() { setFillTypeByID(getId()); }
- }
- class SelectLineStyleAction extends PaintAction {
- public SelectLineStyleAction(String id) { super(id); }
- public int getStyle() { return IAction.AS_CHECK_BOX; }
- public void run() { setLineStyleByID(getId()); }
- }
- class SelectFontAction extends PaintAction {
- public SelectFontAction(String id) { super(id); }
- public int getStyle() { return IAction.AS_PUSH_BUTTON; }
- public void run() {
- FontDialog fontDialog = new FontDialog(paintSurface.getShell(), SWT.PRIMARY_MODAL);
- FontData[] fontDatum = toolSettings.commonFont.getFontData();
- if (fontDatum != null && fontDatum.length > 0) {
- fontDialog.setFontData(fontDatum[0]);
- }
- fontDialog.setText(PaintPlugin.getResourceString("options.Font.dialog.title"));
-
- paintSurface.hideRubberband();
- FontData fontData = fontDialog.open();
- paintSurface.showRubberband();
- if (fontData != null) {
- try {
- Font font = new Font(workbenchDisplay, fontData);
- toolSettings.commonFont = font;
- updateToolSettings();
- } catch (SWTException e) {
- }
- }
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PencilTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PencilTool.java deleted file mode 100755 index 4f8ee2fd3b..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PencilTool.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import java.util.Random;
import org.eclipse.swt.graphics.*;
-
-/**
- * A pencil tool.
- */
-public class PencilTool extends ContinuousPaintSession implements PaintTool {
- private ToolSettings settings;
-
- /**
- * Constructs a pencil tool.
- *
- * @param toolSettings the new tool settings
- * @param getPaintSurface() the PaintSurface we will render on.
- */
- public PencilTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns the name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.Pencil.label");
- }
-
- /*
- * Template method for drawing
- */
- public void render(final Point point) {
- final PaintSurface ps = getPaintSurface();
- ps.drawFigure(new PointFigure(settings.commonForegroundColor, point.x, point.y));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PointFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PointFigure.java deleted file mode 100644 index 07fedbd352..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PointFigure.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Point object
- */
-public class PointFigure extends Figure {
- private Color color;
- private int x, y;
- /**
- * Constructs a Point
- *
- * @param color the color for this object
- * @param x the virtual X coordinate of the first end-point
- * @param y the virtual Y coordinate of the first end-point
- */
- public PointFigure(Color color, int x, int y) {
- this.color = color; this.x = x; this.y = y;
- }
- public void draw(FigureDrawContext fdc) {
- Point p = fdc.toClientPoint(x, y);
- fdc.gc.setBackground(color);
- fdc.gc.fillRectangle(p.x, p.y, 1, 1);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x, y, x, y));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PolyLineTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PolyLineTool.java deleted file mode 100755 index f2db962fd0..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PolyLineTool.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A polyline drawing tool.
- */
-public class PolyLineTool extends SegmentedPaintSession implements PaintTool {
- private ToolSettings settings;
-
- /**
- * Constructs a PolyLineTool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public PolyLineTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns the name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.PolyLine.label");
- }
-
- /*
- * Template methods for drawing
- */
- protected Figure createFigure(Point[] points, int numPoints, boolean closed) {
- ContainerFigure container = new ContainerFigure();
- if (closed && settings.commonFillType != ToolSettings.ftNone && numPoints >= 3) {
- container.add(new SolidPolygonFigure(settings.commonBackgroundColor, points, numPoints));
- }
- if (! closed || settings.commonFillType != ToolSettings.ftSolid || numPoints < 3) {
- for (int i = 0; i < numPoints - 1; ++i) {
- final Point a = points[i];
- final Point b = points[i + 1];
- container.add(new LineFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
- a.x, a.y, b.x, b.y));
- }
- if (closed) {
- final Point a = points[points.length - 1];
- final Point b = points[0];
- container.add(new LineFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
- a.x, a.y, b.x, b.y));
- }
- }
- return container;
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleFigure.java deleted file mode 100755 index a2b4625fe6..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleFigure.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Rectangle object
- */
-public class RectangleFigure extends Figure {
- private Color foregroundColor, backgroundColor;
- private int lineStyle, x1, y1, x2, y2;
- /**
- * Constructs a Rectangle
- * These objects are defined by any two diametrically opposing corners.
- *
- * @param color the color for this object
- * @param lineStyle the line style for this object
- * @param x1 the virtual X coordinate of the first corner
- * @param y1 the virtual Y coordinate of the first corner
- * @param x2 the virtual X coordinate of the second corner
- * @param y2 the virtual Y coordinate of the second corner
- */
- public RectangleFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2) {
- this.foregroundColor = foregroundColor;
- this.backgroundColor = backgroundColor;
- this.lineStyle = lineStyle;
- this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- }
- public void draw(FigureDrawContext fdc) {
- Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setForeground(foregroundColor);
- fdc.gc.setBackground(backgroundColor);
- fdc.gc.setLineStyle(lineStyle);
- fdc.gc.drawRectangle(r.x, r.y, r.width - 1, r.height - 1);
- fdc.gc.setLineStyle(SWT.LINE_SOLID);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleTool.java deleted file mode 100755 index 2da6fa3296..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleTool.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A drawing tool.
- */
-public class RectangleTool extends DragPaintSession implements PaintTool {
- private ToolSettings settings;
-
- /**
- * Constructs a RectangleTool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public RectangleTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.Rectangle.label");
- }
-
- /*
- * Template method for drawing
- */
- protected Figure createFigure(Point a, Point b) {
- switch (settings.commonFillType) {
- default:
- case ToolSettings.ftNone:
- return new RectangleFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
- a.x, a.y, b.x, b.y);
- case ToolSettings.ftSolid:
- return new SolidRectangleFigure(settings.commonBackgroundColor, a.x, a.y, b.x, b.y);
- case ToolSettings.ftOutline: {
- ContainerFigure container = new ContainerFigure();
- container.add(new SolidRectangleFigure(settings.commonBackgroundColor, a.x, a.y, b.x, b.y));
- container.add(new RectangleFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
- a.x, a.y, b.x, b.y));
- return container;
- }
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java deleted file mode 100755 index 2dd0bfd29c..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Rectangle object
- */
-public class RoundedRectangleFigure extends Figure {
- private Color foregroundColor, backgroundColor;
- private int lineStyle, x1, y1, x2, y2, diameter;
- /**
- * Constructs a Rectangle
- * These objects are defined by any two diametrically opposing corners.
- *
- * @param color the color for this object
- * @param lineStyle the line style for this object
- * @param x1 the virtual X coordinate of the first corner
- * @param y1 the virtual Y coordinate of the first corner
- * @param x2 the virtual X coordinate of the second corner
- * @param y2 the virtual Y coordinate of the second corner
- * @param diameter the diameter of curvature of all four corners
- */
- public RoundedRectangleFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2, int diameter) {
- this.foregroundColor = foregroundColor;
- this.backgroundColor = backgroundColor;
- this.lineStyle = lineStyle;
- this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- this.diameter = diameter;
- }
- public void draw(FigureDrawContext fdc) {
- Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setForeground(foregroundColor);
- fdc.gc.setBackground(backgroundColor);
- fdc.gc.setLineStyle(lineStyle);
- fdc.gc.drawRoundRectangle(r.x, r.y, r.width - 1, r.height - 1, diameter, diameter);
- fdc.gc.setLineStyle(SWT.LINE_SOLID);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleTool.java deleted file mode 100755 index beec38ec56..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleTool.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A drawing tool.
- */
-public class RoundedRectangleTool extends DragPaintSession implements PaintTool {
- private ToolSettings settings;
-
- /**
- * Constructs a RoundedRectangleTool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public RoundedRectangleTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.RoundedRectangle.label");
- }
-
- /*
- * Template methods for drawing
- */
- protected Figure createFigure(Point a, Point b) {
- ContainerFigure container = new ContainerFigure();
- if (settings.commonFillType != ToolSettings.ftNone)
- container.add(new SolidRoundedRectangleFigure(settings.commonBackgroundColor,
- a.x, a.y, b.x, b.y, settings.roundedRectangleCornerDiameter));
- if (settings.commonFillType != ToolSettings.ftSolid)
- container.add(new RoundedRectangleFigure(settings.commonForegroundColor, settings.commonBackgroundColor,
- settings.commonLineStyle, a.x, a.y, b.x, b.y, settings.roundedRectangleCornerDiameter));
- return container;
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SegmentedPaintSession.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SegmentedPaintSession.java deleted file mode 100755 index d1697eb2eb..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SegmentedPaintSession.java +++ /dev/null @@ -1,155 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-
-import java.util.*;
-
-/**
- * The superclass for paint tools that contruct objects from individually
- * picked segments.
- */
-public abstract class SegmentedPaintSession extends BasicPaintSession {
- /**
- * The set of control points making up the segmented selection
- */
- private Vector /* of Point */ controlPoints = new Vector();
-
- /**
- * The previous figure (so that we can abort with right-button)
- */
- private Figure previousFigure = null;
-
- /**
- * The current figure (so that we can abort with right-button)
- */
- private Figure currentFigure = null;
-
- /**
- * Constructs a PaintSession.
- *
- * @param paintSurface the drawing surface to use
- */
- protected SegmentedPaintSession(PaintSurface paintSurface) {
- super(paintSurface);
- }
-
- /**
- * Activates the tool.
- */
- public void beginSession() {
- getPaintSurface().setStatusMessage(PaintPlugin.getResourceString(
- "session.SegmentedInteractivePaint.message.anchorMode"));
- previousFigure = null;
- currentFigure = null;
- controlPoints.clear();
- }
-
- /**
- * Deactivates the tool.
- */
- public void endSession() {
- getPaintSurface().clearRubberbandSelection();
- if (previousFigure != null) getPaintSurface().drawFigure(previousFigure);
- }
-
- /**
- * Resets the tool.
- * Aborts any operation in progress.
- */
- public void resetSession() {
- getPaintSurface().clearRubberbandSelection();
- if (previousFigure != null) getPaintSurface().drawFigure(previousFigure);
-
- getPaintSurface().setStatusMessage(PaintPlugin.getResourceString(
- "session.SegmentedInteractivePaint.message.anchorMode"));
- previousFigure = null;
- currentFigure = null;
- controlPoints.clear();
- }
-
- /**
- * Handles a mouseDown event.
- *
- * @param event the mouse event detail information
- */
- public void mouseDown(MouseEvent event) {
- if (event.button != 1) return;
-
- getPaintSurface().setStatusMessage(PaintPlugin.getResourceString(
- "session.SegmentedInteractivePaint.message.interactiveMode"));
- previousFigure = currentFigure;
-
- if (controlPoints.size() > 0) {
- final Point lastPoint = (Point) controlPoints.elementAt(controlPoints.size() - 1);
- if (lastPoint.x == event.x || lastPoint.y == event.y) return; // spurious event
- }
- controlPoints.add(new Point(event.x, event.y));
- }
-
- /**
- * Handles a mouseDoubleClick event.
- *
- * @param event the mouse event detail information
- */
- public void mouseDoubleClick(MouseEvent event) {
- if (event.button != 1) return;
- if (controlPoints.size() >= 2) {
- getPaintSurface().clearRubberbandSelection();
- previousFigure = createFigure(
- (Point[]) controlPoints.toArray(new Point[controlPoints.size()]),
- controlPoints.size(), true);
- }
- resetSession();
- }
-
- /**
- * Handles a mouseUp event.
- *
- * @param event the mouse event detail information
- */
- public void mouseUp(MouseEvent event) {
- if (event.button != 1) {
- resetSession(); // abort if right or middle mouse button pressed
- return;
- }
- }
-
- /**
- * Handles a mouseMove event.
- *
- * @param event the mouse event detail information
- */
- public void mouseMove(MouseEvent event) {
- final PaintSurface ps = getPaintSurface();
- if (controlPoints.size() == 0) {
- ps.setStatusCoord(ps.getCurrentPosition());
- return; // spurious event
- } else {
- ps.setStatusCoordRange((Point) controlPoints.elementAt(controlPoints.size() - 1),
- ps.getCurrentPosition());
- }
-
- ps.clearRubberbandSelection();
- Point[] points = (Point[]) controlPoints.toArray(new Point[controlPoints.size() + 1]);
- points[controlPoints.size()] = ps.getCurrentPosition();
- currentFigure = createFigure(points, points.length, false);
- ps.addRubberbandSelection(currentFigure);
- }
-
- /**
- * Template Method: Creates a Figure for drawing rubberband entities and the final product
- *
- * @param points the array of control points
- * @param numPoints the number of valid points in the array (n >= 2)
- * @param closed true if the user double-clicked on the final control point
- */
- protected abstract Figure createFigure(Point[] points, int numPoints, boolean closed);
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidEllipseFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidEllipseFigure.java deleted file mode 100755 index 123417fd5e..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidEllipseFigure.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Solid Ellipse object
- */
-public class SolidEllipseFigure extends Figure {
- private Color color;
- private int x1, y1, x2, y2;
- /**
- * Constructs a SolidEllipse
- * These objects are defined by any two diametrically opposing corners of a box
- * bounding the ellipse.
- *
- * @param color the color for this object
- * @param x1 the virtual X coordinate of the first corner
- * @param y1 the virtual Y coordinate of the first corner
- * @param x2 the virtual X coordinate of the second corner
- * @param y2 the virtual Y coordinate of the second corner
- */
- public SolidEllipseFigure(Color color, int x1, int y1, int x2, int y2) {
- this.color = color; this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- }
- public void draw(FigureDrawContext fdc) {
- Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setBackground(color);
- fdc.gc.fillOval(r.x, r.y, r.width, r.height);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidPolygonFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidPolygonFigure.java deleted file mode 100755 index 30b47100b4..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidPolygonFigure.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Line object
- */
-public class SolidPolygonFigure extends Figure {
- private Color color;
- private int[] points;
- /**
- * Constructs a SolidPolygon
- * These objects are defined by a sequence of vertices.
- *
- * @param color the color for this object
- * @param vertices the array of vertices making up the polygon
- * @param numPoint the number of valid points in the array (n >= 3)
- */
- public SolidPolygonFigure(Color color, Point[] vertices, int numPoints) {
- this.color = color;
- this.points = new int[numPoints * 2];
- for (int i = 0; i < numPoints; ++i) {
- points[i * 2] = vertices[i].x;
- points[i * 2 + 1] = vertices[i].y;
- }
- }
- public void draw(FigureDrawContext fdc) {
- int[] drawPoints = new int[points.length];
- for (int i = 0; i < points.length; i += 2) {
- drawPoints[i] = points[i] * fdc.xScale - fdc.xOffset;
- drawPoints[i + 1] = points[i + 1] * fdc.yScale - fdc.yOffset;
- }
- fdc.gc.setBackground(color);
- fdc.gc.fillPolygon(drawPoints);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- int xmin = Integer.MAX_VALUE, ymin = Integer.MAX_VALUE;
- int xmax = Integer.MIN_VALUE, ymax = Integer.MIN_VALUE;
-
- for (int i = 0; i < points.length; i += 2) {
- if (points[i] < xmin) xmin = points[i];
- if (points[i] > xmax) xmax = points[i];
- if (points[i+1] < ymin) ymin = points[i+1];
- if (points[i+1] > ymax) ymax = points[i+1];
- }
- region.add(fdc.toClientRectangle(xmin, ymin, xmax, ymax));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRectangleFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRectangleFigure.java deleted file mode 100755 index 9f2d7b64a3..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRectangleFigure.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D SolidRectangle object
- */
-public class SolidRectangleFigure extends Figure {
- private Color color;
- private int x1, y1, x2, y2;
- /**
- * Constructs a SolidRectangle
- * These objects are defined by any two diametrically opposing corners.
- *
- * @param color the color for this object
- * @param x1 the virtual X coordinate of the first corner
- * @param y1 the virtual Y coordinate of the first corner
- * @param x2 the virtual X coordinate of the second corner
- * @param y2 the virtual Y coordinate of the second corner
- */
- public SolidRectangleFigure(Color color, int x1, int y1, int x2, int y2) {
- this.color = color; this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- }
- public void draw(FigureDrawContext fdc) {
- Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setBackground(color);
- fdc.gc.fillRectangle(r.x, r.y, r.width, r.height);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java deleted file mode 100755 index de07824310..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D SolidRectangle object
- */
-public class SolidRoundedRectangleFigure extends Figure {
- private Color color;
- private int x1, y1, x2, y2, diameter;
- /**
- * Constructs a SolidRectangle
- * These objects are defined by any two diametrically opposing corners.
- *
- * @param color the color for this object
- * @param x1 the virtual X coordinate of the first corner
- * @param y1 the virtual Y coordinate of the first corner
- * @param x2 the virtual X coordinate of the second corner
- * @param y2 the virtual Y coordinate of the second corner
- * @param diameter the diameter of curvature of all four corners
- */
- public SolidRoundedRectangleFigure(Color color, int x1, int y1, int x2, int y2, int diameter) {
- this.color = color; this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
- this.diameter = diameter;
- }
- public void draw(FigureDrawContext fdc) {
- Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2);
- fdc.gc.setBackground(color);
- fdc.gc.fillRoundRectangle(r.x, r.y, r.width, r.height, diameter, diameter);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- region.add(fdc.toClientRectangle(x1, y1, x2, y2));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextFigure.java deleted file mode 100755 index 9317772e94..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextFigure.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Rectangle object
- */
-public class TextFigure extends Figure {
- private Color color;
- private Font font;
- private String text;
- private int x, y;
- /**
- * Constructs a TextFigure
- *
- * @param color the color for this object
- * @param font the font for this object
- * @param text the text to draw, tab and new-line expansion is performed
- * @param x the virtual X coordinate of the top-left corner of the text bounding box
- * @param y the virtual Y coordinate of the top-left corner of the text bounding box
- */
- public TextFigure(Color color, Font font, String text, int x, int y) {
- this.color = color; this.font = font; this.text = text; this.x = x; this.y = y;
- }
- public void draw(FigureDrawContext fdc) {
- Point p = fdc.toClientPoint(x, y);
- fdc.gc.setFont(font);
- fdc.gc.setForeground(color);
- fdc.gc.drawText(text, p.x, p.y, true);
- }
- public void addDamagedRegion(FigureDrawContext fdc, Region region) {
- Font oldFont = fdc.gc.getFont();
- fdc.gc.setFont(font);
- Point textExtent = fdc.gc.textExtent(text);
- fdc.gc.setFont(oldFont);
- region.add(fdc.toClientRectangle(x, y, x + textExtent.x, y + textExtent.y));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextTool.java deleted file mode 100755 index 1b7c8b171e..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextTool.java +++ /dev/null @@ -1,124 +0,0 @@ -package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * A text drawing tool.
- */
-public class TextTool extends BasicPaintSession implements PaintTool {
- private ToolSettings settings;
- private String drawText = PaintPlugin.getResourceString("tool.Text.settings.defaulttext");
-
- /**
- * Constructs a PaintTool.
- *
- * @param toolSettings the new tool settings
- * @param paintSurface the PaintSurface we will render on.
- */
- public TextTool(ToolSettings toolSettings, PaintSurface paintSurface) {
- super(paintSurface);
- set(toolSettings);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- settings = toolSettings;
- }
-
- /**
- * Returns name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.Text.label");
- }
-
- /**
- * Activates the tool.
- */
- public void beginSession() {
- getPaintSurface().setStatusMessage(PaintPlugin.getResourceString(
- "session.Text.message"));
- }
-
- /**
- * Deactivates the tool.
- */
- public void endSession() {
- getPaintSurface().clearRubberbandSelection();
- }
-
- /**
- * Aborts the current operation.
- */
- public void resetSession() {
- getPaintSurface().clearRubberbandSelection();
- }
-
- /**
- * Handles a mouseDown event.
- *
- * @param event the mouse event detail information
- */
- public void mouseDown(MouseEvent event) {
- if (event.button == 1) {
- // draw with left mouse button
- getPaintSurface().commitRubberbandSelection();
- } else {
- // set text with right mouse button
- getPaintSurface().clearRubberbandSelection();
- InputDialog inputDialog = new InputDialog(getPaintSurface().getShell(),
- PaintPlugin.getResourceString("tool.Text.dialog.title"),
- PaintPlugin.getResourceString("tool.Text.dialog.message"),
- drawText, null);
- inputDialog.setBlockOnOpen(true);
- inputDialog.open();
- if (inputDialog.getReturnCode() == InputDialog.OK) drawText = inputDialog.getValue();
- inputDialog.close();
- }
- }
-
- /**
- * Handles a mouseDoubleClick event.
- *
- * @param event the mouse event detail information
- */
- public void mouseDoubleClick(MouseEvent event) {
- }
-
- /**
- * Handles a mouseUp event.
- *
- * @param event the mouse event detail information
- */
- public void mouseUp(MouseEvent event) {
- }
-
- /**
- * Handles a mouseMove event.
- *
- * @param event the mouse event detail information
- */
- public void mouseMove(MouseEvent event) {
- final PaintSurface ps = getPaintSurface();
- ps.setStatusCoord(ps.getCurrentPosition());
- ps.clearRubberbandSelection();
- ps.addRubberbandSelection(
- new TextFigure(settings.commonForegroundColor, settings.commonFont,
- drawText, event.x, event.y));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ToolSettings.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ToolSettings.java deleted file mode 100755 index 6c5aee8e72..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ToolSettings.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.eclipse.swt.examples.paint;
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
-
/**
* Tool Settings objects group tool-related configuration information.
*/
-public class ToolSettings {
- public static final int ftNone = 0, ftOutline = 1, ftSolid = 2;
/**
- * commonForegroundColor: current tool foreground colour
- */
- public Color commonForegroundColor;
-
- /**
- * commonBackgroundColor: current tool background colour
- */
- public Color commonBackgroundColor;
-
/**
* commonFont: current font
*/
public Font commonFont;
/**
* commonFillType: current fill type
* <p>One of ftNone, ftOutline, ftSolid.</p>
*/
public int commonFillType = ftNone;
/**
* commonLineStyle: current line type
*/
public int commonLineStyle = SWT.LINE_SOLID;
- /**
- * airbrushRadius: coverage radius in pixels
- */
- public int airbrushRadius = 10;
-
- /**
- * airbrushIntensity: average surface area coverage in region defined by radius per "jot"
- */
- public int airbrushIntensity = 30;
/**
* roundedRectangleCornerDiameter: the diameter of curvature of corners in a rounded rectangle
*/
public int roundedRectangleCornerDiameter = 16;
}
diff --git a/examples/org.eclipse.swt.examples/.classpath b/examples/org.eclipse.swt.examples/.classpath deleted file mode 100755 index 07ce282125..0000000000 --- a/examples/org.eclipse.swt.examples/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="var" path="JRE_LIB"/> - <classpathentry kind="src" path="/org.eclipse.swt"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/examples/org.eclipse.swt.examples/.cvsignore b/examples/org.eclipse.swt.examples/.cvsignore deleted file mode 100755 index c5e82d7458..0000000000 --- a/examples/org.eclipse.swt.examples/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples/.project b/examples/org.eclipse.swt.examples/.project deleted file mode 100644 index 7dfd92eb80..0000000000 --- a/examples/org.eclipse.swt.examples/.project +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.swt.examples</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.swt</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/examples/org.eclipse.swt.examples/about.html b/examples/org.eclipse.swt.examples/about.html deleted file mode 100644 index 9db411aab9..0000000000 --- a/examples/org.eclipse.swt.examples/about.html +++ /dev/null @@ -1,30 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<html> -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>20th June, 2002</p> -<h3>License</h3> -<p>Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>. -For purposes of the CPL, "Program" will mean the Content.</p> - -<h3>Contributions</h3> - -<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise -made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such -Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p> - -<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the -host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available -to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also -providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of -the CPL.</p> - -</body> -</html>
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples/build.properties b/examples/org.eclipse.swt.examples/build.properties deleted file mode 100755 index 62ce80a8a4..0000000000 --- a/examples/org.eclipse.swt.examples/build.properties +++ /dev/null @@ -1,9 +0,0 @@ -bin.includes = doc-html/,\
- plugin.properties,\
- plugin.xml,\
- about.html,\
- swtexamples.jar
-
-src.includes = about.html
-
-source.swtexamples.jar = src/
diff --git a/examples/org.eclipse.swt.examples/doc-html/hglegal2002.htm b/examples/org.eclipse.swt.examples/doc-html/hglegal2002.htm deleted file mode 100644 index 74393f08f3..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/hglegal2002.htm +++ /dev/null @@ -1,14 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2002. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/doc-html/ngibmcpy2002.gif b/examples/org.eclipse.swt.examples/doc-html/ngibmcpy2002.gif Binary files differdeleted file mode 100644 index dd2f444669..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/ngibmcpy2002.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_addressbook_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_addressbook_ex.html deleted file mode 100755 index d1fa10c281..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/swt_addressbook_ex.html +++ /dev/null @@ -1,31 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Address Book Example</title>
-</head>
-<body>
-
-<h2>SWT Standalone Example - Address Book</h2>
-
-<p>
-The AddressBook example shows how the Table control can be used to
-present information in a tabular format. The application can save and load data
-from a file, sort the entries, and search for strings within the fields.
-</p>
-
-<h3>Running the example</h3>
-<p>
-Follow the <a href="swt_manual_setup.html">Manual Setup</a>
-instructions to install and run the example from your workspace.
-</p>
-<p>
-The "Main" class is <code>org.eclipse.swt.examples.addressbook.AddressBook</code>.
-</p>
-<p>
-This example can also be run using the <a href="swt_launcher_ex.html">Example Launcher</a>.
-Select the Address Book item from the Standalone category and click Run.
-</p>
-<p><a href="hglegal2002.htm"><img SRC="ngibmcpy2002.gif" ALT="Copyright IBM Corporation 2000, 2002. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_controls_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_controls_ex.html deleted file mode 100644 index 857c2dc029..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/swt_controls_ex.html +++ /dev/null @@ -1,30 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> - <title>SWT - Controls Overview</title> -</head> -<body> - -<h2>SWT Standalone Example - Controls Example</h2> - -<p> -The Controls example is a simple demonstration of common SWT controls. -It consists of a tab folder where each tab in the folder allows the user -to interact with a different control. -The user can change styles and settings and view how this affects the control. -</p> - -<h3>Running the example</h3> -<p> -Follow the <a href="swt_manual_setup.html">Manual Setup</a> -instructions to install and run the example from your workspace. -</p> -<p> -The "Main" class is <code>org.eclipse.swt.examples.controlexample.ControlExample</code>. -</p> - - -<p><a href="hglegal2002.htm"><img SRC="ngibmcpy2002.gif" ALT="Copyright IBM Corporation 2000, 2002. All Rights Reserved." BORDER=0 height=12 width=195></a></p> -</body> -</html> diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_fileviewer_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_fileviewer_ex.html deleted file mode 100755 index e02dbba816..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/swt_fileviewer_ex.html +++ /dev/null @@ -1,33 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - File Viewer Example</title>
-</head>
-<body>
-
-<h2>SWT Standalone Example - File Viewer</h2>
-
-<p>
-The File Viewer example shows how a simple application can be implemented using SWT.
-This application provides the ability to navigate files and folders and manipulate them via Drag and Drop.
-It includes the use of alternate threads for long actions and demonstrates the use of the Tree,
-Table, Toolbar and Program.
-</p>
-
-<h3>Running the example</h3>
-<p>
-Follow the <a href="swt_manual_setup.html">Manual Setup</a>
-instructions to install and run the example from your workspace.
-</p>
-<p>
-The "Main" class is <code>org.eclipse.swt.examples.fileviewer.FileViewer</code>.
-</p>
-<p>
-This example can also be run using the <a href="swt_launcher_ex.html">Example Launcher</a>.
-Select the File Viewer item from the Standalone category and click Run.
-</p>
-
-<p><a href="hglegal2002.htm"><img SRC="ngibmcpy2002.gif" ALT="Copyright IBM Corporation 2000, 2002. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_helloworld_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_helloworld_ex.html deleted file mode 100755 index 7d28d19068..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/swt_helloworld_ex.html +++ /dev/null @@ -1,61 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Hello World Examples</title>
-</head>
-<body>
-
-<h2>SWT Standalone Example - Hello World</h2>
-
-<p>
-The Hello World examples are a set of introductory examples to show how to get started
-creating an application with SWT. They cover creating a shell, using event listeners,
-processing events in an event loop, using layouts, and drawing with a Graphic Context.
-</p>
-
-<h4>Hello World 1</h4>
-<p>
-This example demonstrates how to open a Shell and process the events.
-</p>
-
-<h4>Hello World 2</h4>
-<p>
-This example builds on HelloWorld1 and demonstrates how to display a Label inside the Shell.
-</p>
-
-<h4>Hello World 3</h4>
-<p>
-This example builds on HelloWorld2 and demonstrates how to resize the Label
-when the Shell resizes using a Listener mechanism.
-</p>
-
-<h4>Hello World 4</h4>
-<p>
-This example builds on HelloWorld2 and demonstrates how to resize the Label
-when the Shell resizes using a Layout.
-</p>
-
-<h4>Hello World 5</h4>
-<p>
-This example builds on HelloWorld1 and demonstrates how to draw directly
-on an SWT Control using a graphic context.
-</p>
-
-<h3>Running the example</h3>
-
-<p>
-Follow the <a href="swt_manual_setup.html">Manual Setup</a>
-instructions to install and run the example from your workspace.
-</p>
-<p>
-The "Main" class is <code>org.eclipse.swt.examples.helloworld.HelloWorld[1-5]</code>.
-</p>
-<p>
-This example can also be run using the <a href="swt_launcher_ex.html">Example Launcher</a>.
-Select the Hello World item from the Standalone category and click Run.
-</p>
-
-<p><a href="hglegal2002.htm"><img SRC="ngibmcpy2002.gif" ALT="Copyright IBM Corporation 2000, 2002. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_hoverhelp_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_hoverhelp_ex.html deleted file mode 100755 index 90c562d86f..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/swt_hoverhelp_ex.html +++ /dev/null @@ -1,37 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Hover Help Example</title>
-</head>
-<body>
-
-<h2>SWT Standalone Example - Hover Help</h2>
-
-<p>
-The Hover Help example shows how to implement custom tooltips and hover help support
-on a number of different SWT controls including Buttons, TableItems, ToolItems and TreeItems.
-The example implements its own tooltip and hover help support.
-To see the custom tooltips in action, hover over an item or button in the UI.
-Notice that images appear in the left-hand corner of the tooltip.
-To see the custom hover help in action, hover over an item or button in the UI until
-the tooltip is displayed. Without moving the mouse, hit F1. A new Shell will pop up with the
-extended hover help information for the UI element in question.
-</p>
-
-<h3>Running the example</h3>
-<p>
-Follow the <a href="swt_manual_setup.html">Manual Setup</a>
-instructions to install and run the example from your workspace.
-</p>
-<p>
-The "Main" class is <code>org.eclipse.swt.examples.hoverhelp.HoverHelp</code>.
-</p>
-<p>
-This example can also be run using the <a href="swt_launcher_ex.html">Example Launcher</a>.
-Select the Hover Help item from the Standalone category and click Run.
-</p>
-
-<p><a href="hglegal2002.htm"><img SRC="ngibmcpy2002.gif" ALT="Copyright IBM Corporation 2000, 2002. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_imageanalyzer_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_imageanalyzer_ex.html deleted file mode 100755 index 740deef24c..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/swt_imageanalyzer_ex.html +++ /dev/null @@ -1,57 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Image Analyzer Example</title>
-</head>
-<body>
-
-<h2>SWT Standalone Example - Image Analyzer</h2>
-
-<p>
-The ImageAnalyzer opens image files and displays the visual contents of the file along with a
-summary of the data in the image file.
-The user can make adjustments to various elements of the image such as scaling and Alpha
-blending and can save these changes to a file.
-</p>
-<p>
-The ImageAnalyzer will load and display image files of type GIF, JPEG, BMP, ICO, and PNG.
-To open a file, use the File --> Open... menu item, and select the image file in the FileDialog.
-If the file is an interlaced GIF or PNG or a progressive JPEG, and Incremental Display is selected,
-then the ImageAnalyzer displays the image increments as they are being loaded.
-If the file contains an animated GIF, then the Next, Previous, and Animate buttons become enabled,
-and they can be used to cycle through the images in the file, or animate them. If a GIF defines a background color,
-as many animated GIFs do, selecting Background will use the GIF's background color.
-If the image has transparency (possible with GIF, PNG, or ICO), then selecting Display Mask will draw the image's transparency
-mask to the right of the image. You can change the background color of the ImageAnalyzer to see the transparency work.
-To turn off the transparency, deselect Display Transparency.
-After an image is loaded, it can be scaled or have alpha transparency applied, using the Scale and Alpha-K combos,
-and the Alpha menu. File --> Reopen restores scaling and Alpha to their default values and reloads the current image file.
-File --> Save As... can be used to save the currently loaded image to another type of image file. If the image has transparency,
-File --> Save Mask As... saves the image's transparency mask.
-</p>
-<p>
-When SWT loads an image file, an instance of org.eclipse.swt.graphics.ImageData is created. (In the case of an ICO file or
-multi-image GIF, an array of ImageData instances is created). The ImageAnalyzer displays all of the data stored in the ImageData
-instance(s) for the currently loaded image file, including the pixel data. Hovering over a pixel in the image display will show the RGB
-color data for that pixel. For certain images (particularly animated GIFs) additional data is stored in the org.eclipse.swt.graphics.ImageLoader
-instance used to load the image. The ImageAnalyzer displays this data as well.
-</p>
-
-<h3>Running the example</h3>
-
-<p>
-Follow the <a href="swt_manual_setup.html">Manual Setup</a>
-instructions to install and run the example from your workspace.
-</p>
-<p>
-The "Main" class is <code>org.eclipse.swt.examples.imageanalyzer.ImageAnalyzer</code>.
-</p>
-<p>
-This example can also be run using the <a href="swt_launcher_ex.html">Example Launcher</a>.
-Select the Image Analyzer item from the Standalone category and click Run.
-</p>
-
-<p><a href="hglegal2002.htm"><img SRC="ngibmcpy2002.gif" ALT="Copyright IBM Corporation 2000, 2002. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_javaviewer_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_javaviewer_ex.html deleted file mode 100755 index 38cbf17fae..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/swt_javaviewer_ex.html +++ /dev/null @@ -1,33 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Java Syntax Viewer Example</title>
-</head>
-<body>
-
-<h2>SWT Standalone Example - Java Syntax Viewer</h2>
-
-<p>
-This example demonstrates how to implement a user-defined line styler for the StyledText widget.
-The example provides a typical editor interface.
-To see the effect of the line styler, open a *.java file.
-When the contents of the file are displayed in the editor area, notice that the keywords have been highlighted.
-</p>
-
-<h3>Running the example</h3>
-<p>
-Follow the <a href="swt_manual_setup.html">Manual Setup</a>
-instructions to install and run the example from your workspace.
-</p>
-<p>
-The "Main" class is <code>org.eclipse.swt.examples.javaviewer.JavaViewer</code>.
-</p>
-<p>
-This example can also be run using the <a href="swt_launcher_ex.html">Example Launcher</a>.
-Select the Java Syntax Viewer item from the Standalone category and click Run.
-</p>
-
-<p><a href="hglegal2002.htm"><img SRC="ngibmcpy2002.gif" ALT="Copyright IBM Corporation 2000, 2002. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_launcher_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_launcher_ex.html deleted file mode 100644 index 34651dafbc..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/swt_launcher_ex.html +++ /dev/null @@ -1,55 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> - <title>SWT - Example Launcher</title> -</head> -<body> - -<h2>SWT Example Launcher</h2> - -<p> -The Example Launcher is used to launch SWT examples which can either be Workbench Views, -or Standalone applications. -</p> - -<ul> -<li>Workbench Views are examples that are integrated into Eclipse. When the Launcher -starts a Workbench View, it is opened in the currently active perspective. -<li>Standalone applications are launched in a separate window. -</ul> - -<p> -For information on how to run the standalone examples without the SWT Example Launcher, -refer to <a href="swt_manual_setup.html">Manual Setup</a>. -</p> -<p> -The SWT workbench view examples can also be launched directly without using the SWT Example -Launcher. SWT workbench view examples can be found under the SWT Examples category of the -Show Views dialog. -</p> - -<h3>Running the Example Launcher</h3> - -<p> -From the Window menu, select Show View --> Other. -In the Show View dialog, expand SWT Examples and select the SWT Example Launcher view. -A view containing a list of examples will appear in your current perspective. -Select an example from the list. A brief description of the example is displayed. -Click on the Run button to launch the example. -</p> - - -<h3>Details</h3> -<p>The example launcher view contains a tree list, a text area, and a button. -The tree list contains a list of all the SWT examples you can choose -to run. When an example is selected from the tree, the text area -displays a short description of the example. The selected example can -be launched by clicking on the Run button. Standalone examples are run in the -same thread as the workbench's UI but they are not integrated into the perspective. -The launcher invokes the <code>open()</code> method of the standalone example. -</p> - -<p><a href="hglegal2002.htm"><img SRC="ngibmcpy2002.gif" ALT="Copyright IBM Corporation 2000, 2002. All Rights Reserved." BORDER=0 height=12 width=195></a></p> -</body> -</html> diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_layout_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_layout_ex.html deleted file mode 100644 index 573fb9aeda..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/swt_layout_ex.html +++ /dev/null @@ -1,31 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> - <title>SWT - Layout Example</title> -</head> -<body> - -<h2>SWT Standalone Example - Layout Example</h2> - -<p> -This example is a simple demonstration of common SWT layouts. -It consists of a tab folder where each tab in the folder allows the -user to interact with a different SWT layout. -The user can insert widgets into a layout and set the values of the layout data -using a property sheet. When the user has a suitable arrangement, code can be -generated by clicking on the Code button. -</p> - -<h3>Running the example</h3> -<p> -Follow the <a href="swt_manual_setup.html">Manual Setup</a> -instructions to install and run the example from your workspace. -</p> -<p> -The "Main" class is <code>org.eclipse.swt.examples.layoutexample.LayoutExample</code>. -</p> - -<p><a href="hglegal2002.htm"><img SRC="ngibmcpy2002.gif" ALT="Copyright IBM Corporation 2000, 2002. All Rights Reserved." BORDER=0 height=12 width=195></a></p> -</body> -</html>
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_manual_setup.html b/examples/org.eclipse.swt.examples/doc-html/swt_manual_setup.html deleted file mode 100755 index 494db66122..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/swt_manual_setup.html +++ /dev/null @@ -1,117 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT Standalone Examples Setup</title>
-</head>
-<body>
-
-<h2>SWT Standalone Examples Setup</h2>
-
-<h3>Importing Example Source</h3>
-
-<p>
-*** In the following description, substitute the location in which you installed Eclipse for INSTALLDIR ***
-</p>
-
-<p>Import the example code and all its required resources into your workspace:</p>
-
-<ol>
-<li>Create a Java Project called "SWT Examples".
-<li>Select the project "SWT Examples" in the Packages view.
-<li>Select the File --> Import menu. Select Zip File. Click on Next.
-<li>Locate the source zip file for the SWT examples. For example:
- <ul>
- <li><b>win32: </b><code>INSTALLDIR\eclipse\plugins\org.eclipse.swt.examples_2.0.0\swtexamplessrc.zip</code>
- <li><b>*nix: </b><code>INSTALLDIR/eclipse/plugins/org.eclipse.swt.examples_2.0.0/swtexamplessrc.zip</code>
- </ul>
-<li>Click on Finish.
-<li>Select the File --> Import menu. In the Import dialog, select Zip File. Click on Next.
-<li>Locate the jar file for the SWT examples. For example:
- <ul>
- <li><b>win32: </b><code>INSTALLDIR\eclipse\plugins\org.eclipse.swt.examples_2.0.0\swtexamples.jar</code>
- <li><b>*nix: </b><code>INSTALLDIR/eclipse/plugins/org.eclipse.swt.examples_2.0.0/swtexamples.jar</code>
- </ul>
-<li>Expand the top level directory of the zip file (/). <b>Uncheck "org" and "META-INF"</b>.
-<li>Click on Finish.
-</ol>
-
-<p>Now you need to compile the SWT examples. In order to do this, you must add the SWT jar(s) to
-the compile path:</p>
-<ol>
-<li>Select the project "SWT Examples" in the Packages view and from the pop up menu select Properties.
-<li>Select the Java Build Path item.
-<li>Go to the Libraries tab.
-<li>Click on the Add External JARS... button.
-<li>Locate the swt jar for the platform on which you wish to run:<br>
- <ul>
- <li><b>win32: </b><code>INSTALLDIR\eclipse\plugins\org.eclipse.swt.win32_2.0.0\ws\win32\swt.jar</code>
- <li><b>gtk: </b><code>INSTALLDIR/eclipse/plugins/org.eclipse.swt.gtk_2.0.0/ws/gtk/swt.jar</code>
- <li><b>motif: </b><code>INSTALLDIR/eclipse/plugins/org.eclipse.swt.motif_2.0.0/ws/motif/swt.jar</code>
- <li><b>photon: </b><code>INSTALLDIR/eclipse/plugins/org.eclipse.swt.photon_2.0.0/ws/photon/swt.jar</code>
- </ul>
-<li>Click on OK.
-</ol>
-<p><b>NOTE:</b> For some platforms (such as GTK), more than one jar is required to run SWT (on
-GTK there is a swt.jar and a swt-pi.jar file). In this case, all the required jars must
-be added to the class path. This is done by repeating the steps above for each jar file.
-All jar files are located in the same directory/folder.</p>
-
-<p>At this point your SWT examples should be compiled without any errors. Check the Task
-view for errors. If you get an error like "<code>java.lang.Object</code> not found" it means
-you have not configured a JRE. Go to the Window --> Preferences dialog.
-Select Java --> Installed JREs and ensure that a JRE is installed
-and that the path to the JRE is correct.</p>
-
-<h3><a NAME="Run"></a>Running the Example</h3>
-
-<p>Now you have to configure Eclipse to run the example. This requires putting the SWT
-JNI libraries on the library path so that the VM can find them:
-
-<ol>
-<li>Open the Java Perspective.
-<li>In the Packages view, select the Main class that you want to run.
- For example, the Main class for the Address Book example is
- <code>org.eclipse.swt.examples.addressbook.AddressBook</code>.
-<li>SelectRun --> Run... from the main menu.
-<li>In the Launch Configurations dialog that appears, select Java Application and click
- on the New button.
-<li>Fill in the Name, Project and Main class fields according to the example you wish to run.
-<li>Select the Arguments tab. In the VM Arguements area specify the location of the SWT
- library depending on your target platform as follows:
- <ul>
- <li><b>win32: </b><code>-Djava.library.path=INSTALLDIR\plugins\org.eclipse.swt.win32_2.0.0\os\win32\x86</code>
- <li><b>linux gtk: </b><code>-Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.gtk_2.0.0/os/linux/x86</code>
- <li><b>linux motif: </b><code>-Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.motif_2.0.0/os/linux/x86</code>
- <li><b>solaris motif: </b><code>-Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.motif_2.0.0/os/solaris/sparc</code>
- <li><b>aix motif: </b><code>-Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.motif_2.0.0/os/aix/ppc</code>
- <li><b>hpux motif: </b><code>-Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.motif_2.0.0/os/hpux/PA_RISC</code>
- <li><b>photon qnx: </b><code>-Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.photon_2.0.0/os/qnx/x86</code>
- </ul>
-<li>Click on the Run button.
-</ol>
-
-
-<h3>Examples Overview</h3>
-<p>
-Consult the documentation of each individual example for the names of
-its Main class and additional details.
-</p>
-<p>
-The following examples are included in the <code>swtexamples.jar</code>:
-</p>
-<ul>
-<li><a href="swt_addressbook_ex.html">Address Book</a>
-<li><a href="swt_controls_ex.html">Controls</a>
-<li><a href="swt_fileviewer_ex.html">File Viewer</a>
-<li><a href="swt_helloworld_ex.html">Hello World [1-5]</a>
-<li><a href="swt_hoverhelp_ex.html">Hover Help</a>
-<li><a href="swt_imageanalyzer_ex.html">Image Analyzer</a>
-<li><a href="swt_javaviewer_ex.html">Java Viewer</a>
-<li><a href="swt_layout_ex.html">Layout</a>
-<li><a href="swt_texteditor_ex.html">Text Editor</a>
-</ul>
-
-<p><br><a href="hglegal2002.htm"><img SRC="ngibmcpy2002.gif" ALT="Copyright IBM Corporation 2000, 2002. All Rights Reserved." BORDER=0 height=12 width=195></a>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_texteditor_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_texteditor_ex.html deleted file mode 100755 index b467489ca8..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/swt_texteditor_ex.html +++ /dev/null @@ -1,35 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Text Editor Example</title>
-</head>
-<body>
-
-<h2>SWT Standalone Example - Text Editor</h2>
-
-<p>
-This example demonstrates how to use the StyledText widget to implement
-a text editor with formatting support.
-The example has a typical text editor interface.
-The Edit menu contains Cut, Copy, Paste and Set Font items and the toolbar
-provides a bold text toggle, three colour tools that operate on the current
-selection, and a reset to defaults button that also operates on the current selection.
-</p>
-
-<h3>Running the example</h3>
-<p>
-Follow the <a href="swt_manual_setup.html">Manual Setup</a>
-instructions to install and run the example from your workspace.
-</p>
-<p>
-The "Main" class is <code>org.eclipse.swt.examples.texteditor.TextEditor</code>.
-</p>
-<p>
-This example can also be run using the <a href="swt_launcher_ex.html">Example Launcher</a>.
-Select the Text Editor item from the Standalone category and click Run.
-</p>
-
-<p><a href="hglegal2002.htm"><img SRC="ngibmcpy2002.gif" ALT="Copyright IBM Corporation 2000, 2002. All Rights Reserved." BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/plugin.properties b/examples/org.eclipse.swt.examples/plugin.properties deleted file mode 100755 index 6382611aed..0000000000 --- a/examples/org.eclipse.swt.examples/plugin.properties +++ /dev/null @@ -1,113 +0,0 @@ -providerName = Eclipse.org
-plugin.SWTStandaloneExampleSet.name = SWT Standalone Examples Plugin
-
-launchcategory.SWTStandaloneExamples.name = Standalone
-launchcategory.SWTStandaloneExamples.description = \
- A collection of Standard Widget Toolkit examples that run independant \
- of the Eclipse Platform.
-
-launchitem.AddressBook.name = Address Book
-launchitem.AddressBook.description = \
- The AddressBook example shows how the Table control can be used to \
- present information in a tabular format.\n\n\
- The application can save and load data from a file, sort the entries, and \
- search for strings within the fields.
-
-launchitem.ControlExample.name = SWT Controls Example
-launchitem.ControlExample.description = \
- The Controls example is a simple demonstration of common SWT controls. \n\n\
- It consists of a tab folder where each tab in the folder allows the user \
- to interact with a different control. \
- The user can change styles and settings and view how this affects the control.
-
-launchitem.FileViewer.name = File Viewer
-launchitem.FileViewer.description = \
- The File Viewer example shows how a simple application can be implemented using SWT.\n\n\
- This application provides the ability to navigate files and folders and manipulate them via Drag and Drop. \
- It includes the use of alternate threads for long actions and demonstrates the use of the Tree, \
- Table, Toolbar and Program.
-
-launchitem.HoverHelp.name = Hover Help
-launchitem.HoverHelp.description = \
- The Hover Help example shows how to implement custom tooltips and hover help support \
- on a number of different SWT controls including Buttons, TableItems, ToolItems and TreeItems.\n\n\
- The example implements its own tooltip and hover help support. \
- To see the custom tooltips in action, hover over an item or button in the UI. \
- An image appears in the left-hand corner of the tooltip.\n\n\
- To see the custom hover help in action, hover over an item or button in the UI until \
- the tooltip is displayed. Without moving the mouse, hit F1. A new Shell will pop up with the \
- extended hover help information for the UI element in question
-
-launchitem.HelloWorld1.name = Hello World (1)
-launchitem.HelloWorld1.description = \
- This example demonstrates how to open a Shell and process the events.
-
-launchitem.HelloWorld2.name = Hello World (2)
-launchitem.HelloWorld2.description = \
- This example builds on HelloWorld1 and demonstrates how to display a Label inside the Shell.
-
-launchitem.HelloWorld3.name = Hello World (3)
-launchitem.HelloWorld3.description = \
- This example builds on HelloWorld2 and demonstrates how to resize the Label \
- when the Shell resizes using a Listener mechanism.
-
-launchitem.HelloWorld4.name = Hello World (4)
-launchitem.HelloWorld4.description = \
- This example builds on HelloWorld2 and demonstrates how to resize the Label \
- when the Shell resizes using a Layout.
-
-launchitem.HelloWorld5.name = Hello World (5)
-launchitem.HelloWorld5.description = \
- This example builds on HelloWorld1 and demonstrates how to draw directly on an SWT Control using a graphic context.
-
-launchitem.ImageAnalyzer.name = Image Analyzer
-launchitem.ImageAnalyzer.description = \
- The ImageAnalyzer opens image files and displays the visual contents of the file along with a \
- summary of the data in the image file.\n\n\
- The user can make adjustments to various elements of the image such as scaling and Alpha \
- blending and can save these changes to a file.\n\n\
- The ImageAnalyzer will load and display image files of type GIF, JPEG, BMP, ICO, and PNG. \
- To open a file, use the File->Open... menu item, and select the image file in the FileDialog.\n\n\
- If the file is an interlaced GIF or PNG or a progressive JPEG, and Incremental Display is selected, \
- then the ImageAnalyzer displays the image increments as they are being loaded.\n\n\
- If the file contains an animated GIF, then the Next, Previous, and Animate buttons become enabled, \
- and they can be used to cycle through the images in the file, or animate them. If a GIF defines a background color, \
- as many animated GIFs do, selecting Background will use the GIF's background color.\n\n\
- If the image has transparency (possible with GIF, PNG, or ICO), then selecting Display Mask will draw the image's transparency \
- mask to the right of the image. You can change the background color of the ImageAnalyzer to see the transparency work. \
- To turn off the transparency, deselect Display Transparency.\n\n\
- After an image is loaded, it can be scaled or have alpha transparency applied, using the Scale and Alpha-K combos, \
- and the Alpha menu. File->Reopen restores scaling and Alpha to their default values and reloads the current image file.\n\n\
- File->Save As... can be used to save the currently loaded image to another type of image file. If the image has transparency, \
- File->Save Mask As... saves the image's transparency mask.\n\n\
- When SWT loads an image file, an instance of org.eclipse.swt.graphics.ImageData is created. (In the case of an ICO file or \
- multi-image GIF, an array of ImageData instances is created). The ImageAnalyzer displays all of the data stored in the ImageData \
- instance(s) for the currently loaded image file, including the pixel data. Hovering over a pixel in the image display will show the RGB \
- color data for that pixel. For certain images (particularly animated GIFs) additional data is stored in the org.eclipse.swt.graphics.ImageLoader \
- instance used to load the image. The ImageAnalyzer displays this data as well.
-
-launchitem.JavaViewer.name = Java Syntax Viewer
-launchitem.JavaViewer.description = \
- This example demonstrates how to implement a user-defined line styler for the StyledText widget.\n\n\
- The example provides a typical editor interface. \
- To see the effect of the line styler, open a *.java file. \
- When the contents of the file are displayed in the editor area, notice that the keywords have been highlighted.
-
-launchitem.LayoutExample.name = Layout Example
-launchitem.LayoutExample.description = \
- This example is a simple demonstration of common SWT layouts. \n\n\
- It consists of a tab folder where each tab in the folder allows the \
- user to interact with a different SWT layout. \
- The user can insert widgets into a layout and set the values of the layout data \
- using a property sheet. When the user has a suitable arrangement, code can be \
- generated by clicking on the Code button.
-
-launchitem.TextEditor.name = Text Editor
-launchitem.TextEditor.description = \
- This example demonstrates how to use the StyledText widget to implement \
- a text editor with formatting support.\n\n\
- The example has a typical text editor interface. \
- The Edit menu contains Cut, Copy, Paste and Set Font items and the toolbar \
- provides a bold text toggle, three colour tools that operate on the current \
- selection, and a reset to defaults button that also operates on the current selection.
-
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples/plugin.xml b/examples/org.eclipse.swt.examples/plugin.xml deleted file mode 100755 index 036817dddf..0000000000 --- a/examples/org.eclipse.swt.examples/plugin.xml +++ /dev/null @@ -1,141 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!-- File written by PDE 1.0 -->
-<plugin
- id="org.eclipse.swt.examples"
- name="%plugin.SWTStandaloneExampleSet.name"
- version="2.0.0"
- provider-name="%providerName"
- class="">
-<!-- Required plugins -->
-<requires>
- <import plugin="org.eclipse.swt"/>
-</requires>
-
-<!-- Runtime -->
-<runtime>
- <library name="swtexamples.jar">
- <export name="*"/>
- </library>
-</runtime>
-
-<!-- Extensions -->
-<!-- Extension points -->
-<extension
- point="org.eclipse.swt.examples.launcher.launchItems">
- <category
- name="%launchcategory.SWTStandaloneExamples.name"
- description="%launchcategory.SWTStandaloneExamples.description"
- id="org.eclipse.swt.examples.launchStandaloneCategory">
- </category>
- <item
- name="%launchitem.AddressBook.name"
- description="%launchitem.AddressBook.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.addressbook.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.addressbook.AddressBook">
- </program>
- </item>
- <item
- name="%launchitem.FileViewer.name"
- description="%launchitem.FileViewer.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.fileviewer.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.fileviewer.FileViewer">
- </program>
- </item>
- <item
- name="%launchitem.HoverHelp.name"
- description="%launchitem.HoverHelp.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.hoverhelp.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.hoverhelp.HoverHelp">
- </program>
- </item>
- <item
- name="%launchitem.HelloWorld1.name"
- description="%launchitem.HelloWorld1.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.helloworld1.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.helloworld.HelloWorld1">
- </program>
- </item>
- <item
- name="%launchitem.HelloWorld2.name"
- description="%launchitem.HelloWorld2.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.helloworld2.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.helloworld.HelloWorld2">
- </program>
- </item>
- <item
- name="%launchitem.HelloWorld3.name"
- description="%launchitem.HelloWorld3.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.helloworld3.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.helloworld.HelloWorld3">
- </program>
- </item>
- <item
- name="%launchitem.HelloWorld4.name"
- description="%launchitem.HelloWorld4.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.helloworld4.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.helloworld.HelloWorld4">
- </program>
- </item>
- <item
- name="%launchitem.HelloWorld5.name"
- description="%launchitem.HelloWorld5.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.helloworld5.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.helloworld.HelloWorld5">
- </program>
- </item>
- <item
- name="%launchitem.ImageAnalyzer.name"
- description="%launchitem.ImageAnalyzer.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.imageanalyzer.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.imageanalyzer.ImageAnalyzer">
- </program>
- </item>
- <item
- name="%launchitem.JavaViewer.name"
- description="%launchitem.JavaViewer.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.javaviewer.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.javaviewer.JavaViewer">
- </program>
- </item>
- <item
- name="%launchitem.TextEditor.name"
- description="%launchitem.TextEditor.description"
- category="org.eclipse.swt.examples.launchStandaloneCategory"
- id="org.eclipse.swt.examples.texteditor.standalonelauncher">
- <program
- pluginId="org.eclipse.swt.examples"
- mainClass="org.eclipse.swt.examples.texteditor.TextEditor">
- </program>
- </item>
-</extension>
-</plugin>
diff --git a/examples/org.eclipse.swt.examples/src/examples_addressbook.properties b/examples/org.eclipse.swt.examples/src/examples_addressbook.properties deleted file mode 100644 index b416bed826..0000000000 --- a/examples/org.eclipse.swt.examples/src/examples_addressbook.properties +++ /dev/null @@ -1,59 +0,0 @@ -Last_name = Last Name -First_name = First Name -Business_phone = Business Phone -Home_phone = Home Phone -Email = Email -Fax = Fax -Close_save = The address book contents have changed.\nDo you want to save the changes? -New_title = Untitled -Column = Column: -Book_extension = .adr -Book_filter_name = Address Books -All_filter_name = All Files -File = File -Does_not_exist = does not exist. -File_not_found = File not found: -IO_error_read = IO error reading text file: -IO_error_write = IO error writing text file: -IO_error_close = IO error closing text file: -Title_bar = Address Book - -Save_as_title = Save As -Query_overwrite = already exists.\nDo you want to replace it? -File_menu_title = &File -New_contact = &New Contact\tCtrl+N -Edit_contact = &Edit Contact\tCtrl+E -New_address_book = New Address &Book\tCtrl+B -Open_address_book = &Open Address Book\tCtrl+O -Save_address_book = &Save Address Book\tCtrl+S -Save_book_as = Save &Address Book As -Exit = E&xit -Edit_menu_title = &Edit -Edit = &Edit\tCtrl+E -Copy = &Copy\tCtrl+C -Paste = &Paste\tCtrl+V -Delete = De&lete\tDel -Sort = &Sort -Search_menu_title = &Search -Find = &Find...\tCtrl+F -Find_next = Find &Next...\tF3 -Pop_up_new = &New -Pop_up_edit = &Edit -Pop_up_copy = &Copy -Pop_up_paste = &Paste -Pop_up_delete = &Delete -Pop_up_find = &Find... -Help_menu_title = &Help -About = &About Address Book... -About_1 = About -About_2 = \nversion 1.0 -OK = OK -Cancel = Cancel -Search_dialog_title = Find -Dialog_find_what = Fi&nd what: -Dialog_match_case = Match &case -Dialog_match_word = Match &whole word -Dialog_direction = Direction -Dialog_dir_up = &Up -Dialog_dir_down = &Down -Dialog_find = &Find -Cannot_find = Cannot find
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples/src/examples_control.properties b/examples/org.eclipse.swt.examples/src/examples_control.properties deleted file mode 100644 index 029a28659e..0000000000 --- a/examples/org.eclipse.swt.examples/src/examples_control.properties +++ /dev/null @@ -1,138 +0,0 @@ -error.CouldNotLoadResources = Unable to load resources -window.title = SWT Controls - -Text_Buttons = Text Buttons -Size = Size -Alignment = Alignment -Left = Left -Right = Right -Up = Up -Down = Down -Center = Center -One = One -Two = Two -Three = Three -Image_Buttons = Image Buttons -Control_Example = Control Example -Parameters = Parameters -State = State -Enabled = Enabled -Visible = Visible -Preferred = Preferred -Styles = Styles -Text_Labels = Text Labels -Image_Labels = Image Labels -One_Two_Three = One Two Three -Text_ToolBar = Text ToolBar -Image_ToolBar = Image ToolBar -Maximum = Maximum -Minimum = Minimum -Selection = Selection -Increment = Increment -Page_Increment = Page Increment -Thumb = Thumb -Tree_With_Images = Tree With Images -Dialog_Type = Dialog Type -Create_Dialog = Create Dialog -Button_Styles = Button Styles -Icon_Styles = Icon Styles -Modal_Styles = Modal Styles -File_Dialog_Styles = File Dialog Styles -Item_Styles = Item Styles -Dialog_Result = Dialog Result -ColorDialog = ColorDialog -DirectoryDialog = DirectoryDialog -FileDialog = FileDialog -FontDialog = FontDialog -PrintDialog = PrintDialog -MessageBox = MessageBox -Multi_line = A multi line text widget. -Example_string = The quick brown fox jumps over the lazy dog. -Header_Visible = Header Visible -Lines_Visible = Lines Visible -Locked = Locked -Node_1 = Node 1 -Node_2 = Node 2 -Node_3 = Node 3 -Node_4 = Node 4 -Node_1_1 = Node 1.1 -Node_2_1 = Node 2.1 -Node_3_1 = Node 3.1 -Node_2_2 = Node 2.2 -Node_2_2_1 = Node 2.2.1 -Parent = Parent -No_Parent = No Parent -Decoration_Styles = Decoration Styles -Create_Shell = Create Shell -Close_All_Shells = Close All Shells -Push = Push -Radio = Radio -Check = Check -Drop_Down = Drop Down -Images_failed = Warning: Failed to load images -readme_txt = readme.txt -Index = Index: -Title = Title: -Result = Result: {0} -FilterName_0 = Text Files -FilterName_1 = Batch Files -FilterName_2 = Doc Files -TableTitle_0 = Name -TableTitle_1 = Type -TableTitle_2 = Size -TableTitle_3 = Modified -TableLine0_0 = <empty> -TableLine0_1 = classes -TableLine0_2 = 0 -TableLine0_3 = today -TableLine1_0 = <empty> -TableLine1_1 = databases -TableLine1_2 = 2556 -TableLine1_3 = <empty> -TableLine2_0 = <empty> -TableLine2_1 = images -TableLine2_2 = 91571 -TableLine2_3 = yesterday -ListData0_0 = Line 1 -ListData0_1 = Line 2 -ListData0_2 = Line 3 -ListData0_3 = Line 4 -ListData0_4 = Line 5 -ListData0_5 = Line 6 -ListData0_6 = Line 7 -ListData0_7 = Line 8 -ListData0_8 = Longest Line In List -ListData1_0 = Apples -ListData1_1 = Oranges -ListData1_2 = Bananas -ListData1_3 = Grapefruit -ListData1_4 = Peaches -ListData1_5 = Kiwi -ListData1_6 = Apricots -ListData1_7 = Strawberries -ListData1_8 = The Longest String -DropDownData_0 = Apples -DropDownData_1 = Oranges -DropDownData_2 = -DropDownData_3 = Grapefruit -DropDownData_4 = Peaches -DropDownData_5 = Kiwi -DropDownData_6 = -DropDownData_7 = Strawberries -DropDownData_8 = The Longest String -Slider_and_Scale = Slider and Scale -Colors = Colors and Font -Item_Colors = Item Colors -Background_Color = Background Color -Foreground_Color = Foreground Color -Item_Background_Color = Item Background Color -Item_Foreground_Color = Item Foreground Color -Font = Set Font -Wrap_Text = Jack and Jill went up the hill to fetch a pail of water, \ - Jack fell down and broke his crown and Jill came tumbling after! -Foreground_Style = Foreground Style -Background_Style = Background Style -StyledText_Styles = StyledText Styles -StyledText_Style_Instructions = Select text, then style. -Bold = Bold -Fill = Horizontal Fill diff --git a/examples/org.eclipse.swt.examples/src/examples_fileviewer.properties b/examples/org.eclipse.swt.examples/src/examples_fileviewer.properties deleted file mode 100644 index 3fc373efdf..0000000000 --- a/examples/org.eclipse.swt.examples/src/examples_fileviewer.properties +++ /dev/null @@ -1,59 +0,0 @@ -Title = SWT FileViewer - {0} - -menu.File.text = &File -menu.File.Close.text = &Close -menu.File.SimulateOnly.text = Simulate File Operations -menu.Help.text = &Help -menu.Help.About.text = &About - -tool.Cut.tiptext = Cut -tool.Copy.tiptext = Copy -tool.Delete.tiptext = Delete -tool.Parent.tiptext = Parent -tool.Paste.tiptext = Paste -tool.Print.tiptext = Print -tool.Refresh.tiptext = Refresh -tool.Rename.tiptext = Rename -tool.Search.tiptext = Search - -details.AllFolders.text = All Folders -details.ContentsOf.text = Contents of ''{0}'' -details.FileSize.text = {0} bytes -details.DirNumberOfObjects.text = {0} object(s) -details.NumberOfSelectedFiles.text = {0} object(s) selected - -table.Name.title = Name -table.Size.title = Size -table.Type.title = Type -table.Modified.title = Modified - -filetype.Unknown = {0} File -filetype.None = File -filetype.Folder = Folder -filesize.KB = {0} kb - -dialog.About.title = About SWT FileViewer -dialog.About.description = SWT FileViewer\n\nVersion: 0.9\n\nRunning on: {0} - -dialog.NotImplemented.title = Not Implemented -dialog.ActionNotImplemented.description = Sorry! The action you selected has not been implemented. - -dialog.FailedCopy.title = Copy Files Error -dialog.FailedCopy.description = An error occured while trying to copy "{0}" to "{1}". - -dialog.FailedDelete.title = Delete Files Error -dialog.FailedDelete.description = An error occured while trying to delete "{0}". - -progressDialog.cancelButton.text = Cancel -progressDialog.Copy.title = Copy Files -progressDialog.Copy.description = Copying files. -progressDialog.Copy.operation = Copying... {0} -progressDialog.Move.title = Move Files -progressDialog.Move.description = Moving files. -progressDialog.Delete.operation = Deleting... {0} - -simulate.CopyFromTo.text = Simulated copy from "{0}" to "{1}". -simulate.DirectoriesCreated.text = Simulated directories created for "{0}". -simulate.Delete.text = Simulated delete of "{0}". - -error.FailedLaunch.message = Could not launch "{0}" diff --git a/examples/org.eclipse.swt.examples/src/examples_helloworld.properties b/examples/org.eclipse.swt.examples/src/examples_helloworld.properties deleted file mode 100644 index 2db6671c37..0000000000 --- a/examples/org.eclipse.swt.examples/src/examples_helloworld.properties +++ /dev/null @@ -1 +0,0 @@ -Hello_world = Hello World
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples/src/examples_hoverhelp.properties b/examples/org.eclipse.swt.examples/src/examples_hoverhelp.properties deleted file mode 100644 index b1e118e3fa..0000000000 --- a/examples/org.eclipse.swt.examples/src/examples_hoverhelp.properties +++ /dev/null @@ -1,16 +0,0 @@ -error.CouldNotLoadResources = Unable to load resources : {0} - -ToolItem.text = ToolItem {0} -ToolItem.tooltip = Tooltip for {0}. Try F1 on me. -ToolItem.help = Help text for {0}. - -TableItem.text = TableItem {0} -TableItem.tooltip = Tooltip for {0}. Try F1 on me. -TableItem.help = Help text for {0}. - -TreeItem.text = TreeItem {0} -TreeItem.tooltip = Tooltip for {0}. Try F1 on me. -TreeItem.help = Help text for {0}. - -Hello.text = Hello -Hello.tooltip = Greetings! diff --git a/examples/org.eclipse.swt.examples/src/examples_images.properties b/examples/org.eclipse.swt.examples/src/examples_images.properties deleted file mode 100644 index 3f1d7b7384..0000000000 --- a/examples/org.eclipse.swt.examples/src/examples_images.properties +++ /dev/null @@ -1,101 +0,0 @@ -Image_analyzer = Image Analyzer -None = None -White = White -Black = Black -Red = Red -Green = Green -Blue = Blue -X_scale = X Scale -Y_scale = Y Scale -Alpha_K = Alpha-K -Display = Display -Incremental = Incremental -Transparent = Transparent -Transparent_lc = transparent -Mask = Mask -Background = Background -Animation = Animation -Previous = < &Previous -Next = &Next > -Animate = &Animate -Type_initial = Type: -Type_string = Type: {0} -Type_index = Type: {0} [{1,number,integer} of {2,number,integer}] -Size_initial = Size: -Size_value = Size: {0,number,integer} x {1,number,integer} -Depth_initial = Depth: -Depth_value = Depth: {0} -Transparent_pixel_initial = Transparent pixel: -Transparent_pixel_value = Transparent pixel: {0} -Time_to_load_initial = Time to load: -Time_to_load_value = Time to load: {0} ms -Animation_size_initial = Animation size: -Animation_size_value = Animation size: {0,number,integer} x {1,number,integer} -Background_pixel_initial = Background pixel: -Background_pixel_value = Background pixel: {0} -Image_location_initial = Image location: -Image_location_value = Image location: ({0,number,integer}, {1,number,integer}) -Disposal_initial = Disposal: -Disposal_value = Disposal: {0,number,integer} ({1}) -Delay_initial = Delay: -Delay_value = Delay: {0,number,integer} ms (using {1,number,integer} ms) -Delay_used = Delay: {0,number,integer} ms -Repeats_initial = Repeats: -Repeats_value = Repeats: {0,number,integer} -Repeats_forever = Repeats: {0,number,integer} (forever) -Palette_initial = Palette: -Palette_direct = Palette: Direct -Palette_value = Palette size: {0,number,integer} -Pixel_data_initial = Pixel data: -Pixel_data_value = Pixel data: Bytes per line: {0,number,integer} \ - Scanline pad: {1,number,integer} {2} -File = &File -OpenFile = &Open File...\tCtrl+O -OpenURL = Open &URL...\tCtrl+U -Reopen = &Reopen -Save = &Save\tCtrl+S -Save_as = Save &As... -Save_mask_as = Save &Mask As... -Print = &Print\tCtrl+P -Exit = E&xit -Alpha = Alpha -OpenURLDialog = Open URL -EnterURL = Enter the URL for an image (bmp, gif, ico, jpg, jpeg, png): -All_images = All Image Files -Loading_lc = loading -Saving_lc = saving -Unknown_extension = Unknown file extension: {0}\nPlease use bmp, gif, ico, \ - jpg, jpeg, or png. -Overwrite = Overwrite {0}? -Analyzer_on = Image Analyzer on: {0} -Reloading_lc = reloading -Color_at = Image color at ({0,number,integer}, {1,number,integer}) \ - index {2,number,integer} (0x{3}) is {4} -Color_at_trans = Image color at ({0,number,integer}, {1,number,integer}) \ - index {2,number,integer} (0x{3}) is {4} (transparent) -Creating_image = Creating image # {0,number,integer} from -OK = OK -Cancel = Cancel -Stop = &Stop -Creating_from = Creating image read from -Palette_direct = Palette: Direct -Palette_size = Palette size: {0,number,integer} -Bytes_per_line = Bytes per line: -Scanline_pad = Scanline pad: -Printing_error = Printing error: -Error = Error {0} file\n{1}\n\n -Pixels_per_byte = pixels per byte -Byte_per_pixel = byte per pixel -Bytes_per_pixel = bytes per pixel -Unsupported_lc = unsupported -None_lc = none -Background_lc = background -Previous_lc = previous -Unspecified_lc = unspecified -Unknown_ac = UNKNOWN -Forever_lc = forever -Depth_info = Depth: {0,number,integer} -- {1} -One_byte = 1 byte per pixel -Multi_bytes = {0,number,integer} bytes per pixel -Multi_pixels = {0,number,integer} pixels per byte {1} -Max_length_string = Transparent pixel: -1 (none)
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples/src/examples_javaviewer.properties b/examples/org.eclipse.swt.examples/src/examples_javaviewer.properties deleted file mode 100644 index 8c589d1470..0000000000 --- a/examples/org.eclipse.swt.examples/src/examples_javaviewer.properties +++ /dev/null @@ -1,7 +0,0 @@ -Open_menuitem=&Open -Close_menuitem=&Close -File_menuitem=&File -Window_title=SWT Java Viewer -Err_file_no_exist=File {0} does not exist. -Err_file_io=IO error reading file:\n{0} -Err_file_not_found=File not found:\n{0}
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples/src/examples_layout.properties b/examples/org.eclipse.swt.examples/src/examples_layout.properties deleted file mode 100644 index 5861297461..0000000000 --- a/examples/org.eclipse.swt.examples/src/examples_layout.properties +++ /dev/null @@ -1,41 +0,0 @@ -window.title = SWT Layouts - -Add = &Add -Delete = &Delete -Clear = &Clear -Children = Children -Type = Type -Layout = Layout -Preferred_Size = Preferred Size -Code = C&ode -Generated_Code = Generated Code -Parameters = Parameters -Properties = Properties -Margins = Margins -Margins_Spacing = Margins and Spacing -Columns = Columns -Attach_Edit = Edit -Left_Attachment = Edit Left Attachment -Right_Attachment = Edit Right Attachment -Top_Attachment = Edit Top Attachment -Bottom_Attachment = Edit Bottom Attachment -Position = Position -Control = Control -Offset = Offset [+/-] -Item = Item {0} -Combo_Index = Combo {0} -Group_Index = Group {0} -Label_Index = Label {0} -Button_Index = Button {0} -StyledText_Index = StyledText {0} -Text_Index = Text {0} -OK = OK -Cancel = Cancel -Edit = &Edit -Select_All = Select &All\tCtrl+A -Copy = &Copy\tCtrl+C -Exit = E&xit -Name_Title = Enter Names -Name_Label = Enter names for your controls -Invalid_Name = Invalid Name - Please enter valid variable names for your controls -Default = Default
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples/src/examples_texteditor.properties b/examples/org.eclipse.swt.examples/src/examples_texteditor.properties deleted file mode 100644 index e53ce09e38..0000000000 --- a/examples/org.eclipse.swt.examples/src/examples_texteditor.properties +++ /dev/null @@ -1,6 +0,0 @@ -Cut_menuitem=Cu&t\tCtrl+X -Copy_menuitem=&Copy\tCtrl+C -Paste_menuitem=&Paste\tCtrl+V -Window_title=SWT Text Editor -Font_menuitem=Set &Font... -Edit_menuitem=&Edit
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples/src/import.properties b/examples/org.eclipse.swt.examples/src/import.properties deleted file mode 100644 index 97c82204c2..0000000000 --- a/examples/org.eclipse.swt.examples/src/import.properties +++ /dev/null @@ -1,16 +0,0 @@ -# Persist project settings for later import -natures = org.eclipse.jdt.core.javanature; org.eclipse.pde.PluginNature -builders = org.eclipse.jdt.core.javabuilder; org.eclipse.pde.ManifestBuilder; org.eclipse.pde.SchemaBuilder -var.ECLIPSE_PLUGINS = <<ECLIPSE_PLUGINS>> -vmargs.org/eclipse/swt/examples/addressbook/AddressBook.java%AddressBook = "-Djava.library.path=<<SWT_LIBRARY_PATH>>" -vmargs.org/eclipse/swt/examples/controlexample/ControlExample.java%ControlExample = "-Djava.library.path=<<SWT_LIBRARY_PATH>>" -vmargs.org/eclipse/swt/examples/fileviewer/FileViewer.java%FileViewer = "-Djava.library.path=<<SWT_LIBRARY_PATH>>" -vmargs.org/eclipse/swt/examples/helloworld/HelloWorld1.java%HelloWorld1 = "-Djava.library.path=<<SWT_LIBRARY_PATH>>" -vmargs.org/eclipse/swt/examples/helloworld/HelloWorld2.java%HelloWorld2 = "-Djava.library.path=<<SWT_LIBRARY_PATH>>" -vmargs.org/eclipse/swt/examples/helloworld/HelloWorld3.java%HelloWorld3 = "-Djava.library.path=<<SWT_LIBRARY_PATH>>" -vmargs.org/eclipse/swt/examples/helloworld/HelloWorld4.java%HelloWorld4 = "-Djava.library.path=<<SWT_LIBRARY_PATH>>" -vmargs.org/eclipse/swt/examples/helloworld/HelloWorld5.java%HelloWorld5 = "-Djava.library.path=<<SWT_LIBRARY_PATH>>" -vmargs.org/eclipse/swt/examples/hoverhelp/HoverHelp.java%HoverHelp = "-Djava.library.path=<<SWT_LIBRARY_PATH>>" -vmargs.org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java%ImageAnalyzer = "-Djava.library.path=<<SWT_LIBRARY_PATH>>" -vmargs.org/eclipse/swt/examples/javaviewer/JavaViewer.java%JavaViewer = "-Djava.library.path=<<SWT_LIBRARY_PATH>>" -vmargs.org/eclipse/swt/examples/texteditor/TextEditor.java%TextEditor = "-Djava.library.path=<<SWT_LIBRARY_PATH>>" diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/AddressBook.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/AddressBook.java deleted file mode 100755 index 33697edfdf..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/AddressBook.java +++ /dev/null @@ -1,857 +0,0 @@ -package org.eclipse.swt.examples.addressbook;
-
-/*
- * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-/* Imports */
-import java.io.*;
-import java.util.*;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * AddressBookExample is an example that uses <code>org.eclipse.swt</code>
- * libraries to implement a simple address book. This application has
- * save, load, sorting, and searching functions common
- * to basic address books.
- */
-public class AddressBook {
-
- private static ResourceBundle resAddressBook = ResourceBundle.getBundle("examples_addressbook");
- private Shell shell;
-
- private Table table;
- private SearchDialog searchDialog;
-
- private File file;
- private boolean isModified;
-
- private String[] copyBuffer;
-
- private static final String DELIMITER = "\t";
- private static final String[] columnNames = {resAddressBook.getString("Last_name"),
- resAddressBook.getString("First_name"),
- resAddressBook.getString("Business_phone"),
- resAddressBook.getString("Home_phone"),
- resAddressBook.getString("Email"),
- resAddressBook.getString("Fax")};
-
-public static void main(String[] args) {
- Display display = new Display();
- AddressBook application = new AddressBook();
- Shell shell = application.open(display);
- while(!shell.isDisposed()){
- if(!display.readAndDispatch())
- display.sleep();
- }
- display.dispose();
-}
-public Shell open(Display display) {
- shell = new Shell(display);
- shell.setLayout(new FillLayout());
- shell.addShellListener(new ShellAdapter() {
- public void shellClosed(ShellEvent e) {
- e.doit = closeAddressBook();
- }
- });
-
- createMenuBar();
-
- searchDialog = new SearchDialog(shell);
- searchDialog.setSearchAreaNames(columnNames);
- searchDialog.setSearchAreaLabel(resAddressBook.getString("Column"));
- searchDialog.addFindListener(new FindListener () {
- public boolean find() {
- return findEntry();
- }
- });
-
- table = new Table(shell, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
- table.setHeaderVisible(true);
- table.setMenu(createPopUpMenu());
- table.addSelectionListener(new SelectionAdapter() {
- public void widgetDefaultSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length > 0) editEntry(items[0]);
- }
- });
- for(int i = 0; i < columnNames.length; i++) {
- TableColumn column = new TableColumn(table, SWT.NONE);
- column.setText(columnNames[i]);
- column.setWidth(150);
- final int columnIndex = i;
- column.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- sort(columnIndex);
- }
- });
- }
-
- newAddressBook();
-
- shell.setSize(table.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, 300);
- shell.open();
- return shell;
-}
-
-private boolean closeAddressBook() {
- if(isModified) {
- //ask user if they want to save current address book
- MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.YES | SWT.NO | SWT.CANCEL);
- box.setText(shell.getText());
- box.setMessage(resAddressBook.getString("Close_save"));
-
- int choice = box.open();
- if(choice == SWT.CANCEL) {
- return false;
- } else if(choice == SWT.YES) {
- if (!save()) return false;
- }
- }
-
- TableItem[] items = table.getItems();
- for (int i = 0; i < items.length; i ++) {
- items[i].dispose();
- }
-
- return true;
-}
-/**
- * Creates the menu at the top of the shell where most
- * of the programs functionality is accessed.
- *
- * @return The <code>Menu</code> widget that was created
- */
-private Menu createMenuBar() {
- Menu menuBar = new Menu(shell, SWT.BAR);
- shell.setMenuBar(menuBar);
-
- //create each header and subMenu for the menuBar
- createFileMenu(menuBar);
- createEditMenu(menuBar);
- createSearchMenu(menuBar);
- createHelpMenu(menuBar);
-
- return menuBar;
-}
-
-/**
- * Converts an encoded <code>String</code> to a String array representing a table entry.
- */
-private String[] decodeLine(String line) {
- if(line == null) return null;
-
- String[] parsedLine = new String[table.getColumnCount()];
- for(int i = 0; i < parsedLine.length - 1; i++) {
- String newString = "";
- int index = line.indexOf(DELIMITER);
- if (index > -1) {
- parsedLine[i] = line.substring(0, index);
- line = line.substring(index + DELIMITER.length(), line.length());
- } else {
- return null;
- }
- }
-
- if (line.indexOf(DELIMITER) != -1) return null;
-
- parsedLine[parsedLine.length - 1] = line;
-
- return parsedLine;
-}
-private void displayError(String msg) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- box.setMessage(msg);
- box.open();
-}
-private void editEntry(TableItem item) {
- DataEntryDialog dialog = new DataEntryDialog(shell);
- dialog.setLabels(columnNames);
- String[] values = new String[table.getColumnCount()];
- for (int i = 0; i < values.length; i++) {
- values[i] = item.getText(i);
- }
- dialog.setValues(values);
- values = dialog.open();
- if (values != null) {
- item.setText(values);
- isModified = true;
- }
-}
-private String encodeLine(String[] tableItems) {
- String line = "";
- for (int i = 0; i < tableItems.length - 1; i++) {
- line += tableItems[i] + DELIMITER;
- }
- line += tableItems[tableItems.length - 1] + "\n";
-
- return line;
-}
-private boolean findEntry() {
- Cursor waitCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
-
- boolean matchCase = searchDialog.getMatchCase();
- boolean matchWord = searchDialog.getMatchWord();
- String searchString = searchDialog.getSearchString();
- int column = searchDialog.getSelectedSearchArea();
-
- searchString = matchCase ? searchString : searchString.toLowerCase();
-
- boolean found = false;
- if (searchDialog.getSearchDown()) {
- for(int i = table.getSelectionIndex() + 1; i < table.getItemCount(); i++) {
- if (found = findMatch(searchString, table.getItem(i), column, matchWord, matchCase)){
- table.setSelection(i);
- break;
- }
- }
- } else {
- for(int i = table.getSelectionIndex() - 1; i > -1; i--) {
- if (found = findMatch(searchString, table.getItem(i), column, matchWord, matchCase)){
- table.setSelection(i);
- break;
- }
- }
- }
-
- shell.setCursor(null);
- if (waitCursor != null)
- waitCursor.dispose();
-
- return found;
-}
-private boolean findMatch(String searchString, TableItem item, int column, boolean matchWord, boolean matchCase) {
-
- String tableText = matchCase ? item.getText(column) : item.getText(column).toLowerCase();
- if (matchWord) {
- if (tableText != null && tableText.equals(searchString)) {
- return true;
- }
-
- } else {
- if(tableText!= null && tableText.indexOf(searchString) != -1) {
- return true;
- }
- }
- return false;
-}
-private void newAddressBook() {
- shell.setText(resAddressBook.getString("Title_bar") + resAddressBook.getString("New_title"));
- file = null;
- isModified = false;
-}
-private void newEntry() {
- DataEntryDialog dialog = new DataEntryDialog(shell);
- dialog.setLabels(columnNames);
- String[] data = dialog.open();
- if (data != null) {
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(data);
- isModified = true;
- }
-}
-
-private void openAddressBook() {
- FileDialog fileDialog = new FileDialog(shell, SWT.OPEN);
-
- fileDialog.setFilterExtensions(new String[] {"*.adr;", "*.*"});
- fileDialog.setFilterNames(new String[] {resAddressBook.getString("Book_filter_name") + " (*.adr)",
- resAddressBook.getString("All_filter_name") + " (*.*)"});
- fileDialog.open();
- String name = fileDialog.getFileName();
-
- if(name == null) return;
-
- File file = new File(fileDialog.getFilterPath(), name);
- if (!file.exists()) {
- displayError(resAddressBook.getString("File")+file.getName()+" "+resAddressBook.getString("Does_not_exist"));
- return;
- }
-
- Cursor waitCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
-
- FileReader fileReader = null;
- BufferedReader bufferedReader = null;
- String[] data = new String[0];
- try {
- fileReader = new FileReader(file.getAbsolutePath());
- bufferedReader = new BufferedReader(fileReader);
- String nextLine = bufferedReader.readLine();
- while (nextLine != null){
- String[] newData = new String[data.length + 1];
- System.arraycopy(data, 0, newData, 0, data.length);
- newData[data.length] = nextLine;
- data = newData;
- nextLine = bufferedReader.readLine();
- }
- } catch(FileNotFoundException e) {
- displayError(resAddressBook.getString("File_not_found") + "\n" + file.getName());
- return;
- } catch (IOException e ) {
- displayError(resAddressBook.getString("IO_error_read") + "\n" + file.getName());
- return;
- } finally {
-
- shell.setCursor(null);
- waitCursor.dispose();
-
- if(fileReader != null) {
- try {
- fileReader.close();
- } catch(IOException e) {
- displayError(resAddressBook.getString("IO_error_close") + "\n" + file.getName());
- return;
- }
- }
- }
-
- String[][] tableInfo = new String[data.length][table.getColumnCount()];
- for (int i = 0; i < data.length; i++) {
- tableInfo[i] = decodeLine(data[i]);
- }
-
- Arrays.sort(tableInfo, new RowComparator(0));
-
- for (int i = 0; i < tableInfo.length; i++) {
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(tableInfo[i]);
- }
- shell.setText(resAddressBook.getString("Title_bar")+fileDialog.getFileName());
- isModified = false;
- this.file = file;
-}
-private boolean save() {
- if(file == null) return saveAs();
-
- Cursor waitCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
-
- TableItem[] items = table.getItems();
- String[] lines = new String[items.length];
- for(int i = 0; i < items.length; i++) {
- String[] itemText = new String[table.getColumnCount()];
- for (int j = 0; j < itemText.length; j++) {
- itemText[j] = items[i].getText(j);
- }
- lines[i] = encodeLine(itemText);
- }
-
- FileWriter fileWriter = null;
- try {
- fileWriter = new FileWriter(file.getAbsolutePath(), false);
- for (int i = 0; i < lines.length; i++) {
- fileWriter.write(lines[i]);
- }
- } catch(FileNotFoundException e) {
- displayError(resAddressBook.getString("File_not_found") + "\n" + file.getName());
- return false;
- } catch(IOException e ) {
- displayError(resAddressBook.getString("IO_error_write") + "\n" + file.getName());
- return false;
- } finally {
- shell.setCursor(null);
- waitCursor.dispose();
-
- if(fileWriter != null) {
- try {
- fileWriter.close();
- } catch(IOException e) {
- displayError(resAddressBook.getString("IO_error_close") + "\n" + file.getName());
- return false;
- }
- }
- }
-
- shell.setText(resAddressBook.getString("Title_bar")+file.getName());
- isModified = false;
- return true;
-}
-private boolean saveAs() {
-
- FileDialog saveDialog = new FileDialog(shell, SWT.SAVE);
- saveDialog.setFilterExtensions(new String[] {"*.adr;", "*.*"});
- saveDialog.setFilterNames(new String[] {"Address Books (*.adr)", "All Files "});
-
- saveDialog.open();
- String name = saveDialog.getFileName();
-
- if(name.equals("")) return false;
-
- if(name.indexOf(".adr") != name.length() - 4) {
- name += ".adr";
- }
-
- File file = new File(saveDialog.getFilterPath(), name);
- if(file.exists()) {
- MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.YES | SWT.NO);
- box.setText(resAddressBook.getString("Save_as_title"));
- box.setMessage(resAddressBook.getString("File") + file.getName()+" "+resAddressBook.getString("Query_overwrite"));
- if(box.open() != SWT.YES) {
- return false;
- }
- }
- this.file = file;
- return save();
-}
-private void sort(int column) {
- if(table.getItemCount() <= 1) return;
-
- TableItem[] items = table.getItems();
- String[][] data = new String[items.length][table.getColumnCount()];
- for(int i = 0; i < items.length; i++) {
- for(int j = 0; j < table.getColumnCount(); j++) {
- data[i][j] = items[i].getText(j);
- }
- }
-
- Arrays.sort(data, new RowComparator(column));
-
- for (int i = 0; i < data.length; i++) {
- items[i].setText(data[i]);
- }
-
-}
-/**
- * Creates all the items located in the File submenu and
- * associate all the menu items with their appropriate
- * functions.
- *
- * @param menuBar Menu
- * the <code>Menu</code> that file contain
- * the File submenu.
- */
-private void createFileMenu(Menu menuBar) {
- //File menu.
- MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
- item.setText(resAddressBook.getString("File_menu_title"));
- Menu menu = new Menu(shell, SWT.DROP_DOWN);
- item.setMenu(menu);
- /**
- * Adds a listener to handle enabling and disabling
- * some items in the Edit submenu.
- */
- menu.addMenuListener(new MenuAdapter() {
- public void menuShown(MenuEvent e) {
- Menu menu = (Menu)e.widget;
- MenuItem[] items = menu.getItems();
- items[1].setEnabled(table.getSelectionCount() != 0); // edit contact
- items[5].setEnabled((file != null) && isModified); // save
- items[6].setEnabled(table.getItemCount() != 0); // save as
- }
- });
-
-
- //File -> New Contact
- MenuItem subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("New_contact"));
- subItem.setAccelerator(SWT.CTRL + 'N');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- newEntry();
- }
- });
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Edit_contact"));
- subItem.setAccelerator(SWT.CTRL + 'E');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- editEntry(items[0]);
- }
- });
-
-
- new MenuItem(menu, SWT.SEPARATOR);
-
- //File -> New Address Book
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("New_address_book"));
- subItem.setAccelerator(SWT.CTRL + 'B');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- closeAddressBook();
- newAddressBook();
- }
- });
-
- //File -> Open
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Open_address_book"));
- subItem.setAccelerator(SWT.CTRL + 'O');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- closeAddressBook();
- openAddressBook();
- }
- });
-
- //File -> Save.
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Save_address_book"));
- subItem.setAccelerator(SWT.CTRL + 'S');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- save();
- }
- });
-
- //File -> Save As.
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Save_book_as"));
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- saveAs();
- }
- });
-
-
- new MenuItem(menu, SWT.SEPARATOR);
-
- //File -> Exit.
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Exit"));
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- shell.close();
- }
- });
-}
-
-/**
- * Creates all the items located in the Edit submenu and
- * associate all the menu items with their appropriate
- * functions.
- *
- * @param menuBar Menu
- * the <code>Menu</code> that file contain
- * the Edit submenu.
- *
- * @see #createSortMenu()
- */
-private MenuItem createEditMenu(Menu menuBar) {
- //Edit menu.
- MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
- item.setText(resAddressBook.getString("Edit_menu_title"));
- Menu menu = new Menu(shell, SWT.DROP_DOWN);
- item.setMenu(menu);
-
- /**
- * Add a listener to handle enabling and disabling
- * some items in the Edit submenu.
- */
- menu.addMenuListener(new MenuAdapter() {
- public void menuShown(MenuEvent e) {
- Menu menu = (Menu)e.widget;
- MenuItem[] items = menu.getItems();
- int count = table.getSelectionCount();
- items[0].setEnabled(count != 0); // edit
- items[1].setEnabled(count != 0); // copy
- items[2].setEnabled(copyBuffer != null); // paste
- items[3].setEnabled(count != 0); // delete
- items[5].setEnabled(table.getItemCount() != 0); // sort
- }
- });
-
- //Edit -> Edit
- MenuItem subItem = new MenuItem(menu, SWT.CASCADE);
- subItem.setText(resAddressBook.getString("Edit"));
- subItem.setAccelerator(SWT.CTRL + 'E');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- editEntry(items[0]);
- }
- });
-
- //Edit -> Copy
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Copy"));
- subItem.setAccelerator(SWT.CTRL + 'C');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- copyBuffer = new String[table.getColumnCount()];
- for (int i = 0; i < copyBuffer.length; i++) {
- copyBuffer[i] = items[0].getText(i);
- }
- }
- });
-
- //Edit -> Paste
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Paste"));
- subItem.setAccelerator(SWT.CTRL + 'V');
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (copyBuffer == null) return;
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(copyBuffer);
- isModified = true;
- }
- });
-
- //Edit -> Delete
- subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("Delete"));
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- items[0].dispose();
- isModified = true; }
- });
-
- new MenuItem(menu, SWT.SEPARATOR);
-
- //Edit -> Sort(Cascade)
- subItem = new MenuItem(menu, SWT.CASCADE);
- subItem.setText(resAddressBook.getString("Sort"));
- Menu submenu = createSortMenu();
- subItem.setMenu(submenu);
-
- return item;
-
-}
-
-/**
- * Creates all the items located in the Sort cascading submenu and
- * associate all the menu items with their appropriate
- * functions.
- *
- * @return Menu
- * The cascading menu with all the sort menu items on it.
- */
-private Menu createSortMenu() {
- Menu submenu = new Menu(shell, SWT.DROP_DOWN);
- MenuItem subitem;
- for(int i = 0; i < columnNames.length; i++) {
- subitem = new MenuItem (submenu, SWT.NULL);
- subitem.setText(columnNames [i]);
- final int column = i;
- subitem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- sort(column);
- }
- });
-
- }
-
- return submenu;
-}
-
-/**
- * Creates all the items located in the Search submenu and
- * associate all the menu items with their appropriate
- * functions.
- *
- * @param menuBar Menu
- * the <code>Menu</code> that file contain
- * the Search submenu.
- */
-private void createSearchMenu(Menu menuBar) {
- //Search menu.
- MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
- item.setText(resAddressBook.getString("Search_menu_title"));
- Menu searchMenu = new Menu(shell, SWT.DROP_DOWN);
- item.setMenu(searchMenu);
-
- //Search -> Find...
- item = new MenuItem(searchMenu, SWT.NULL);
- item.setText(resAddressBook.getString("Find"));
- item.setAccelerator(SWT.CTRL + 'F');
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- searchDialog.setMatchCase(false);
- searchDialog.setMatchWord(false);
- searchDialog.setSearchDown(true);
- searchDialog.setSearchString("");
- searchDialog.setSelectedSearchArea(0);
- searchDialog.open();
- }
- });
-
- //Search -> Find Next
- item = new MenuItem(searchMenu, SWT.NULL);
- item.setText(resAddressBook.getString("Find_next"));
- item.setAccelerator(SWT.F3);
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- searchDialog.open();
- }
- });
-}
-
-/**
- * Creates all items located in the popup menu and associates
- * all the menu items with their appropriate functions.
- *
- * @return Menu
- * The created popup menu.
- */
-private Menu createPopUpMenu() {
- Menu popUpMenu = new Menu(shell, SWT.POP_UP);
-
- /**
- * Adds a listener to handle enabling and disabling
- * some items in the Edit submenu.
- */
- popUpMenu.addMenuListener(new MenuAdapter() {
- public void menuShown(MenuEvent e) {
- Menu menu = (Menu)e.widget;
- MenuItem[] items = menu.getItems();
- int count = table.getSelectionCount();
- items[2].setEnabled(count != 0); // edit
- items[3].setEnabled(count != 0); // copy
- items[4].setEnabled(copyBuffer != null); // paste
- items[5].setEnabled(count != 0); // delete
- items[7].setEnabled(table.getItemCount() != 0); // find
- }
- });
-
- //New
- MenuItem item = new MenuItem(popUpMenu, SWT.CASCADE);
- item.setText(resAddressBook.getString("Pop_up_new"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- newEntry();
- }
- });
-
- new MenuItem(popUpMenu, SWT.SEPARATOR);
-
- //Edit
- item = new MenuItem(popUpMenu, SWT.CASCADE);
- item.setText(resAddressBook.getString("Pop_up_edit"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- editEntry(items[0]);
- }
- });
-
- //Copy
- item = new MenuItem(popUpMenu, SWT.CASCADE);
- item.setText(resAddressBook.getString("Pop_up_copy"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- copyBuffer = new String[table.getColumnCount()];
- for (int i = 0; i < copyBuffer.length; i++) {
- copyBuffer[i] = items[0].getText(i);
- }
- }
- });
-
- //Paste
- item = new MenuItem(popUpMenu, SWT.CASCADE);
- item.setText(resAddressBook.getString("Pop_up_paste"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (copyBuffer == null) return;
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(copyBuffer);
- isModified = true;
- }
- });
-
- //Delete
- item = new MenuItem(popUpMenu, SWT.CASCADE);
- item.setText(resAddressBook.getString("Pop_up_delete"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length == 0) return;
- items[0].dispose();
- isModified = true;
- }
- });
-
- new MenuItem(popUpMenu, SWT.SEPARATOR);
-
- //Find...
- item = new MenuItem(popUpMenu, SWT.NULL);
- item.setText(resAddressBook.getString("Pop_up_find"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- searchDialog.open();
- }
- });
-
- return popUpMenu;
-}
-
-/**
- * Creates all the items located in the Help submenu and
- * associate all the menu items with their appropriate
- * functions.
- *
- * @param menuBar Menu
- * the <code>Menu</code> that file contain
- * the Help submenu.
- */
-private void createHelpMenu(Menu menuBar) {
-
- //Help Menu
- MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
- item.setText(resAddressBook.getString("Help_menu_title"));
- Menu menu = new Menu(shell, SWT.DROP_DOWN);
- item.setMenu(menu);
-
- //Help -> About Text Editor
- MenuItem subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("About"));
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- MessageBox box = new MessageBox(shell, SWT.NONE);
- box.setText(resAddressBook.getString("About_1") + shell.getText());
- box.setMessage(shell.getText() + resAddressBook.getString("About_2"));
- box.open();
- }
- });
-}
-
-/**
- * To compare entries (rows) by the given column
- */
-private class RowComparator implements Comparator {
- private int column;
-
- /**
- * Constructs a RowComparator given the column index
- * @param col The index (starting at zero) of the column
- */
- public RowComparator(int col) {
- column = col;
- }
-
- /**
- * Compares two rows (type String[]) using the specified
- * column entry.
- * @param obj1 First row to compare
- * @param obj2 Second row to compare
- * @return negative if obj1 less than obj2, positive if
- * obj1 greater than obj2, and zero if equal.
- */
- public int compare(Object obj1, Object obj2) {
- String[] row1 = (String[])obj1;
- String[] row2 = (String[])obj2;
-
- return row1[column].compareTo(row2[column]);
- }
-}
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/DataEntryDialog.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/DataEntryDialog.java deleted file mode 100755 index 6be9f908bc..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/DataEntryDialog.java +++ /dev/null @@ -1,159 +0,0 @@ -package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-/* Imports */
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.ResourceBundle;
-
-/**
- * DataEntryDialog class uses <code>org.eclipse.swt</code>
- * libraries to implement a dialog that accepts basic personal information that
- * is added to a <code>Table</code> widget or edits a <code>TableItem</code> entry
- * to represent the entered data.
- */
-public class DataEntryDialog {
-
- private static ResourceBundle resAddressBook = ResourceBundle.getBundle("examples_addressbook");
-
- Shell shell;
- String[] values;
- String[] labels;
-
-public DataEntryDialog(Shell parent) {
- shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.PRIMARY_MODAL);
- shell.setLayout(new GridLayout());
-}
-
-private void addTextListener(final Text text) {
- text.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e){
- Integer index = (Integer)(text.getData("index"));
- values[index.intValue()] = text.getText();
- }
- });
-}
-private void createControlButtons() {
- Composite composite = new Composite(shell, SWT.NULL);
- composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- Button okButton = new Button(composite, SWT.PUSH);
- okButton.setText(resAddressBook.getString("OK"));
- okButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- shell.close();
- }
- });
-
- Button cancelButton = new Button(composite, SWT.PUSH);
- cancelButton.setText(resAddressBook.getString("Cancel"));
- cancelButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- values = null;
- shell.close();
- }
- });
-
- shell.setDefaultButton(okButton);
-}
-
-private void createTextWidgets() {
- if (labels == null) return;
-
- Composite composite = new Composite(shell, SWT.NULL);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- GridLayout layout= new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- if (values == null)
- values = new String[labels.length];
-
- for (int i = 0; i < labels.length; i++) {
- Label label = new Label(composite, SWT.RIGHT);
- label.setText(labels[i]);
- Text text = new Text(composite, SWT.BORDER);
- GridData gridData = new GridData();
- gridData.widthHint = 400;
- text.setLayoutData(gridData);
- if (values[i] != null) {
- text.setText(values[i]);
- }
- text.setData("index", new Integer(i));
- addTextListener(text);
- }
-}
-
-public String[] getLabels() {
- return labels;
-}
-public String getTitle() {
- return shell.getText();
-}
-/**
- * Returns the contents of the <code>Text</code> widgets in the dialog in a
- * <code>String</code> array.
- *
- * @return String[]
- * The contents of the text widgets of the dialog.
- * May return null if all text widgets are empty.
- */
-public String[] getValues() {
- return values;
-}
-/**
- * Opens the dialog in the given state. Sets <code>Text</code> widget contents
- * and dialog behaviour accordingly.
- *
- * @param dialogState int
- * The state the dialog should be opened in.
- */
-public String[] open() {
- createTextWidgets();
- createControlButtons();
- shell.pack();
- shell.open();
- Display display = shell.getDisplay();
- while(!shell.isDisposed()){
- if(!display.readAndDispatch())
- display.sleep();
- }
-
- return getValues();
-}
-public void setLabels(String[] labels) {
- this.labels = labels;
-}
-public void setTitle(String title) {
- shell.setText(title);
-}
-/**
- * Sets the values of the <code>Text</code> widgets of the dialog to
- * the values supplied in the parameter array.
- *
- * @param itemInfo String[]
- * The values to which the dialog contents will be set.
- */
-public void setValues(String[] itemInfo) {
- if (labels == null) return;
-
- if (values == null)
- values = new String[labels.length];
-
- int numItems = Math.min(values.length, itemInfo.length);
- for(int i = 0; i < numItems; i++) {
- values[i] = itemInfo[i];
- }
-}
-} diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/FindListener.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/FindListener.java deleted file mode 100755 index ab0f020fa6..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/FindListener.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-public interface FindListener {
-
-public boolean find();
-
-} diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/SearchDialog.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/SearchDialog.java deleted file mode 100755 index 8afb207be0..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/SearchDialog.java +++ /dev/null @@ -1,199 +0,0 @@ -package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-/* Imports */
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-import java.util.ResourceBundle;
-
-/**
- * SearchDialog is a simple class that uses <code>org.eclipse.swt</code>
- * libraries to implement a basic search dialog.
- */
-public class SearchDialog {
-
- private static ResourceBundle resAddressBook = ResourceBundle.getBundle("examples_addressbook");
-
- Shell shell;
- Text searchText;
- Combo searchArea;
- Label searchAreaLabel;
- Button matchCase;
- Button matchWord;
- Button findButton;
- Button down;
- FindListener findHandler;
-
-/**
- * Class constructor that sets the parent shell and the table widget that
- * the dialog will search.
- *
- * @param parent Shell
- * The shell that is the parent of the dialog.
- */
-public SearchDialog(Shell parent) {
- shell = new Shell(parent, SWT.CLOSE | SWT.BORDER | SWT.TITLE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- shell.setLayout(layout);
- shell.setText(resAddressBook.getString("Search_dialog_title"));
- shell.addShellListener(new ShellAdapter(){
- public void shellClosed(ShellEvent e) {
- // don't dispose of the shell, just hide it for later use
- e.doit = false;
- shell.setVisible(false);
- }
- });
-
- Label label = new Label(shell, SWT.LEFT);
- label.setText(resAddressBook.getString("Dialog_find_what"));
- searchText = new Text(shell, SWT.BORDER);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.widthHint = 200;
- searchText.setLayoutData(gridData);
- searchText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- boolean enableFind = (searchText.getCharCount() != 0);
- findButton.setEnabled(enableFind);
- }
- });
-
- searchAreaLabel = new Label(shell, SWT.LEFT);
- searchArea = new Combo(shell, SWT.DROP_DOWN | SWT.READ_ONLY);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.widthHint = 200;
- searchArea.setLayoutData(gridData);
-
- matchCase = new Button(shell, SWT.CHECK);
- matchCase.setText(resAddressBook.getString("Dialog_match_case"));
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- matchCase.setLayoutData(gridData);
-
- matchWord = new Button(shell, SWT.CHECK);
- matchWord.setText(resAddressBook.getString("Dialog_match_word"));
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- matchWord.setLayoutData(gridData);
-
- Group direction = new Group(shell, SWT.NONE);
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- direction.setLayoutData(gridData);
- direction.setLayout (new FillLayout ());
- direction.setText(resAddressBook.getString("Dialog_direction"));
-
- Button up = new Button(direction, SWT.RADIO);
- up.setText(resAddressBook.getString("Dialog_dir_up"));
- up.setSelection(false);
-
- down = new Button(direction, SWT.RADIO);
- down.setText(resAddressBook.getString("Dialog_dir_down"));
- down.setSelection(true);
-
- Composite composite = new Composite(shell, SWT.NONE);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gridData.horizontalSpan = 2;
- composite.setLayoutData(gridData);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth = true;
- composite.setLayout(layout);
-
- findButton = new Button(composite, SWT.PUSH);
- findButton.setText(resAddressBook.getString("Dialog_find"));
- findButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- findButton.setEnabled(false);
- findButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (!findHandler.find()){
- MessageBox box = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK | SWT.PRIMARY_MODAL);
- box.setText(shell.getText());
- box.setMessage(resAddressBook.getString("Cannot_find") + "\"" + searchText.getText() + "\"");
- box.open();
- }
- }
- });
-
- Button cancelButton = new Button(composite, SWT.PUSH);
- cancelButton.setText(resAddressBook.getString("Cancel"));
- cancelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- cancelButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- shell.setVisible(false);
- }
- });
-
- shell.pack();
-}
-public String getSearchAreaLabel(String label) {
- return searchAreaLabel.getText();
-}
-
-public String[] getsearchAreaNames() {
- return searchArea.getItems();
-}
-public boolean getMatchCase() {
- return matchCase.getSelection();
-}
-public boolean getMatchWord() {
- return matchWord.getSelection();
-}
-public String getSearchString() {
- return searchText.getText();
-}
-public boolean getSearchDown(){
- return down.getSelection();
-}
-public int getSelectedSearchArea() {
- return searchArea.getSelectionIndex();
-}
-public void open() {
- if (shell.isVisible()) {
- shell.setFocus();
- } else {
- shell.open();
- }
- searchText.setFocus();
-}
-public void setSearchAreaNames(String[] names) {
- for (int i = 0; i < names.length; i++) {
- searchArea.add(names[i]);
- }
- searchArea.select(0);
-}
-public void setSearchAreaLabel(String label) {
- searchAreaLabel.setText(label);
-}
-public void setMatchCase(boolean match) {
- matchCase.setSelection(match);
-}
-public void setMatchWord(boolean match) {
- matchWord.setSelection(match);
-}
-public void setSearchDown(boolean searchDown){
- down.setSelection(searchDown);
-}
-public void setSearchString(String searchString) {
- searchText.setText(searchString);
-}
-
-public void setSelectedSearchArea(int index) {
- searchArea.select(index);
-}
-public void addFindListener(FindListener listener) {
- this.findHandler = listener;
-}
-public void removeFindListener(FindListener listener) {
- this.findHandler = null;
-}
-} diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/AlignableTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/AlignableTab.java deleted file mode 100755 index 0ae087ce9c..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/AlignableTab.java +++ /dev/null @@ -1,85 +0,0 @@ -package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-/**
- * <code>AlignableTab</code> is the abstract
- * superclass of example controls that can be
- * aligned.
- */
-abstract class AlignableTab extends Tab {
-
- /* Allignment Controls */
- Button leftButton, rightButton, centerButton;
-
- /* Alignment Group */
- Group allignmentGroup;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- AlignableTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Control" group.
- */
- void createControlGroup () {
- super.createControlGroup ();
-
- /* Create the group */
- allignmentGroup = new Group (controlGroup, SWT.NULL);
- allignmentGroup.setLayout (new GridLayout ());
- allignmentGroup.setLayoutData (new GridData(GridData.HORIZONTAL_ALIGN_FILL |
- GridData.VERTICAL_ALIGN_FILL));
- allignmentGroup.setText (ControlExample.getResourceString("Alignment"));
-
- /* Create the controls */
- leftButton = new Button (allignmentGroup, SWT.RADIO);
- leftButton.setText (ControlExample.getResourceString("Left"));
- centerButton = new Button (allignmentGroup, SWT.RADIO);
- centerButton.setText(ControlExample.getResourceString("Center"));
- rightButton = new Button (allignmentGroup, SWT.RADIO);
- rightButton.setText (ControlExample.getResourceString("Right"));
-
- /* Add the listeners */
- SelectionListener selectionListener = new SelectionAdapter () {
- public void widgetSelected(SelectionEvent event) {
- if (!((Button) event.widget).getSelection ()) return;
- setExampleWidgetAlignment ();
- };
- };
- leftButton.addSelectionListener (selectionListener);
- centerButton.addSelectionListener (selectionListener);
- rightButton.addSelectionListener (selectionListener);
- }
-
- /**
- * Sets the alignment of the "Example" widgets.
- */
- abstract void setExampleWidgetAlignment ();
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- Control [] controls = getExampleWidgets ();
- if (controls.length != 0) {
- leftButton.setSelection ((controls [0].getStyle () & SWT.LEFT) != 0);
- centerButton.setSelection ((controls [0].getStyle () & SWT.CENTER) != 0);
- rightButton.setSelection ((controls [0].getStyle () & SWT.RIGHT) != 0);
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ButtonTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ButtonTab.java deleted file mode 100755 index c747b2a255..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ButtonTab.java +++ /dev/null @@ -1,194 +0,0 @@ -package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-/**
- * <code>ButtonTab</code> is the class that
- * demonstrates SWT buttons.
- */
-class ButtonTab extends AlignableTab {
-
- /* Example widgets and groups that contain them */
- Button button1, button2, button3, button4, button5, button6;
- Group textButtonGroup, imageButtonGroup;
-
- /* Allignment widgets added to the "Control" group */
- Button upButton, downButton;
-
- /* Style widgets added to the "Style" group */
- Button pushButton, checkButton, radioButton, toggleButton, arrowButton, flatButton;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ButtonTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Control" group.
- */
- void createControlGroup () {
- super.createControlGroup ();
-
- /* Create the controls */
- upButton = new Button (allignmentGroup, SWT.RADIO);
- upButton.setText (ControlExample.getResourceString("Up"));
- downButton = new Button (allignmentGroup, SWT.RADIO);
- downButton.setText (ControlExample.getResourceString("Down"));
-
- /* Add the listeners */
- SelectionListener selectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- if (!((Button) event.widget).getSelection()) return;
- setExampleWidgetAlignment ();
- };
- };
- upButton.addSelectionListener(selectionListener);
- downButton.addSelectionListener(selectionListener);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for text buttons */
- textButtonGroup = new Group(exampleGroup, SWT.NONE);
- GridLayout gridLayout = new GridLayout ();
- textButtonGroup.setLayout(gridLayout);
- gridLayout.numColumns = 3;
- textButtonGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- textButtonGroup.setText (ControlExample.getResourceString("Text_Buttons"));
-
- /* Create a group for the image buttons */
- imageButtonGroup = new Group(exampleGroup, SWT.NONE);
- gridLayout = new GridLayout();
- imageButtonGroup.setLayout(gridLayout);
- gridLayout.numColumns = 3;
- imageButtonGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- imageButtonGroup.setText (ControlExample.getResourceString("Image_Buttons"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (pushButton.getSelection()) style |= SWT.PUSH;
- if (checkButton.getSelection()) style |= SWT.CHECK;
- if (radioButton.getSelection()) style |= SWT.RADIO;
- if (toggleButton.getSelection()) style |= SWT.TOGGLE;
- if (arrowButton.getSelection()) style |= SWT.ARROW;
- if (flatButton.getSelection()) style |= SWT.FLAT;
- if (borderButton.getSelection()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- button1 = new Button(textButtonGroup, style);
- button1.setText(ControlExample.getResourceString("One"));
- button2 = new Button(textButtonGroup, style);
- button2.setText(ControlExample.getResourceString("Two"));
- button3 = new Button(textButtonGroup, style);
- button3.setText(ControlExample.getResourceString("Three"));
- button4 = new Button(imageButtonGroup, style);
- button4.setImage(instance.images[ControlExample.ciClosedFolder]);
- button5 = new Button(imageButtonGroup, style);
- button5.setImage(instance.images[ControlExample.ciOpenFolder]);
- button6 = new Button(imageButtonGroup, style);
- button6.setImage(instance.images[ControlExample.ciTarget]);
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- pushButton = new Button (styleGroup, SWT.RADIO);
- pushButton.setText("SWT.PUSH");
- checkButton = new Button (styleGroup, SWT.RADIO);
- checkButton.setText ("SWT.CHECK");
- radioButton = new Button (styleGroup, SWT.RADIO);
- radioButton.setText ("SWT.RADIO");
- toggleButton = new Button (styleGroup, SWT.RADIO);
- toggleButton.setText ("SWT.TOGGLE");
- arrowButton = new Button (styleGroup, SWT.RADIO);
- arrowButton.setText ("SWT.ARROW");
- flatButton = new Button (styleGroup, SWT.CHECK);
- flatButton.setText ("SWT.FLAT");
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText ("SWT.BORDER");
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {button1, button2, button3, button4, button5, button6};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return "Button";
- }
-
- /**
- * Sets the alignment of the "Example" widgets.
- */
- void setExampleWidgetAlignment () {
- int allignment = 0;
- if (leftButton.getSelection ()) allignment = SWT.LEFT;
- if (centerButton.getSelection ()) allignment = SWT.CENTER;
- if (rightButton.getSelection ()) allignment = SWT.RIGHT;
- if (upButton.getSelection ()) allignment = SWT.UP;
- if (downButton.getSelection ()) allignment = SWT.DOWN;
- button1.setAlignment (allignment);
- button2.setAlignment (allignment);
- button3.setAlignment (allignment);
- button4.setAlignment (allignment);
- button5.setAlignment (allignment);
- button6.setAlignment (allignment);
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- if (arrowButton.getSelection ()) {
- upButton.setEnabled (true);
- centerButton.setEnabled (false);
- downButton.setEnabled (true);
- } else {
- upButton.setEnabled (false);
- centerButton.setEnabled (true);
- downButton.setEnabled (false);
- }
- upButton.setSelection ((button1.getStyle () & SWT.UP) != 0);
- downButton.setSelection ((button1.getStyle () & SWT.DOWN) != 0);
- pushButton.setSelection ((button1.getStyle () & SWT.PUSH) != 0);
- checkButton.setSelection ((button1.getStyle () & SWT.CHECK) != 0);
- radioButton.setSelection ((button1.getStyle () & SWT.RADIO) != 0);
- toggleButton.setSelection ((button1.getStyle () & SWT.TOGGLE) != 0);
- arrowButton.setSelection ((button1.getStyle () & SWT.ARROW) != 0);
- flatButton.setSelection ((button1.getStyle () & SWT.FLAT) != 0);
- borderButton.setSelection ((button1.getStyle () & SWT.BORDER) != 0);
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ComboTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ComboTab.java deleted file mode 100755 index 1ef694630c..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ComboTab.java +++ /dev/null @@ -1,116 +0,0 @@ -package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class ComboTab extends Tab {
-
- /* Example widgets and groups that contain them */
- Combo combo1;
- Group comboGroup;
-
- /* Style widgets added to the "Style" group */
- Button dropDownButton, readOnlyButton, simpleButton;
-
- static String [] ListData = {ControlExample.getResourceString("ListData0_0"),
- ControlExample.getResourceString("ListData0_1"),
- ControlExample.getResourceString("ListData0_2"),
- ControlExample.getResourceString("ListData0_3"),
- ControlExample.getResourceString("ListData0_4"),
- ControlExample.getResourceString("ListData0_5"),
- ControlExample.getResourceString("ListData0_6"),
- ControlExample.getResourceString("ListData0_7"),
- ControlExample.getResourceString("ListData0_8")};
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ComboTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the combo box */
- comboGroup = new Group (exampleGroup, SWT.NULL);
- comboGroup.setLayout (new GridLayout ());
- comboGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- comboGroup.setText ("Combo");
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (dropDownButton.getSelection ()) style |= SWT.DROP_DOWN;
- if (readOnlyButton.getSelection ()) style |= SWT.READ_ONLY;
- if (simpleButton.getSelection ()) style |= SWT.SIMPLE;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- combo1 = new Combo (comboGroup, style);
- combo1.setItems (ListData);
- if (ListData.length >= 3) {
- combo1.setText(ListData [2]);
- }
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- dropDownButton = new Button (styleGroup, SWT.RADIO);
- dropDownButton.setText ("SWT.DROP_DOWN");
- simpleButton = new Button (styleGroup, SWT.RADIO);
- simpleButton.setText("SWT.SIMPLE");
- readOnlyButton = new Button (styleGroup, SWT.CHECK);
- readOnlyButton.setText ("SWT.READ_ONLY");
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText ("SWT.BORDER");
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {combo1};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return "Combo";
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- dropDownButton.setSelection ((combo1.getStyle () & SWT.DROP_DOWN) != 0);
- simpleButton.setSelection ((combo1.getStyle () & SWT.SIMPLE) != 0);
- readOnlyButton.setSelection ((combo1.getStyle () & SWT.READ_ONLY) != 0);
- borderButton.setSelection ((combo1.getStyle () & SWT.BORDER) != 0);
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java deleted file mode 100755 index 300e4333a7..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java +++ /dev/null @@ -1,179 +0,0 @@ -package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-import java.text.*;
-import java.util.*;
-
-public class ControlExample {
- private static ResourceBundle resourceBundle =
- ResourceBundle.getBundle("examples_control");
- private ShellTab shellTab;
- private TabFolder tabFolder;
-
- static final int
- ciClosedFolder = 0,
- ciOpenFolder = 1,
- ciTarget = 2;
- static final String[] imageLocations = {
- "closedFolder.gif",
- "openFolder.gif",
- "target.gif" };
- Image images[];
-
- /**
- * Creates an instance of a ControlExample embedded inside
- * the supplied parent Composite.
- *
- * @param parent the container of the example
- */
- public ControlExample(Composite parent) {
- initResources();
- tabFolder = new TabFolder (parent, SWT.NULL);
- Tab [] tabs = new Tab [] {
- new ButtonTab (this),
- new ComboTab (this),
- new CoolBarTab (this),
- new DialogTab (this),
- new LabelTab (this),
- new ListTab (this),
- new ProgressBarTab (this),
- new SashTab (this),
- shellTab = new ShellTab(this),
- new SliderTab (this),
- new TableTab (this),
- new TextTab (this),
- new ToolBarTab (this),
- new TreeTab (this),
- };
- for (int i=0; i<tabs.length; i++) {
- TabItem item = new TabItem (tabFolder, SWT.NULL);
- item.setText (tabs [i].getTabText ());
- item.setControl (tabs [i].createTabFolderPage (tabFolder));
- }
- }
-
- /**
- * Grabs input focus.
- */
- public void setFocus() {
- tabFolder.setFocus();
- }
-
- /**
- * Disposes of all resources associated with a particular
- * instance of the ControlExample.
- */
- public void dispose() {
- /*
- * Destroy any shells that may have been created
- * by the Shells tab. When a shell is disposed,
- * all child shells are also disposed. Therefore
- * it is necessary to check for disposed shells
- * in the shells list to avoid disposing a shell
- * twice.
- */
- if (shellTab != null) shellTab.closeAllShells ();
- shellTab = null;
- tabFolder = null;
- freeResources();
- }
-
- /**
- * Invokes as a standalone program.
- */
- public static void main(String[] args) {
- Display display = new Display();
- Shell shell = new Shell(display);
- shell.setLayout(new FillLayout());
- ControlExample instance = new ControlExample(shell);
- shell.setText(getResourceString("window.title"));
- shell.open();
- while (! shell.isDisposed()) {
- if (! display.readAndDispatch()) display.sleep();
- }
- instance.dispose();
- }
-
- /**
- * Gets a string from the resource bundle.
- * We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- static String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Gets a string from the resource bundle and binds it
- * with the given arguments. If the key is not found,
- * return the key.
- */
- static String getResourceString(String key, Object[] args) {
- try {
- return MessageFormat.format(getResourceString(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Loads the resources
- */
- private void initResources() {
- final Class clazz = ControlExample.class;
- if (resourceBundle != null) {
- try {
- if (images == null) {
- images = new Image[imageLocations.length];
-
- for (int i = 0; i < imageLocations.length; ++i) {
- ImageData source = new ImageData(clazz.getResourceAsStream(
- imageLocations[i]));
- ImageData mask = source.getTransparencyMask();
- images[i] = new Image(null, source, mask);
- }
- }
- return;
- } catch (Throwable t) {
- }
- }
- String error = (resourceBundle != null) ?
- getResourceString("error.CouldNotLoadResources") :
- "Unable to load resources";
- freeResources();
- throw new RuntimeException(error);
- }
-
- /**
- * Frees the resources
- */
- private void freeResources() {
- if (images != null) {
- for (int i = 0; i < images.length; ++i) {
- final Image image = images[i];
- if (image != null) image.dispose();
- }
- images = null;
- }
- }
-}
-
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CoolBarTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CoolBarTab.java deleted file mode 100644 index 0758931d03..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/CoolBarTab.java +++ /dev/null @@ -1,426 +0,0 @@ -package org.eclipse.swt.examples.controlexample;
-
-/*
- * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class CoolBarTab extends Tab {
- Button dropDownButton, lockedButton;
-
- /* Example widgets and group that contains them */
- CoolBar coolBar;
- CoolItem pushItem, dropDownItem, radioItem, checkItem;
- Group coolBarGroup;
-
- Point[] sizes;
- int[] wrapIndices;
- int[] order;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- CoolBarTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Display" group.
- */
- void createDisplayGroup () {
- super.createDisplayGroup ();
-
- /* Create display controls specific to this example */
- lockedButton = new Button (displayGroup, SWT.CHECK);
- lockedButton.setText (ControlExample.getResourceString("Locked"));
-
- /* Add the listeners */
- lockedButton.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetLocked ();
- }
- });
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
- coolBarGroup = new Group (exampleGroup, SWT.NULL);
- coolBarGroup.setLayout (new GridLayout ());
- coolBarGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- coolBarGroup.setText ("CoolBar");
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
- int style = 0, itemStyle = 0;
-
- /* Compute the widget style */
- int toolBarStyle = SWT.FLAT;
- if (borderButton.getSelection()) style |= SWT.BORDER;
- if (dropDownButton.getSelection()) itemStyle |= SWT.DROP_DOWN;
-
- /*
- * Create the example widgets.
- */
- coolBar = new CoolBar (coolBarGroup, style);
-
- /* create the push button toolbar */
- ToolBar toolBar = new ToolBar (coolBar, toolBarStyle);
- ToolItem item = new ToolItem (toolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText ("SWT.PUSH");
- item = new ToolItem (toolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciOpenFolder]);
- item.setToolTipText ("SWT.PUSH");
- item = new ToolItem (toolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciTarget]);
- item.setToolTipText ("SWT.PUSH");
- item = new ToolItem (toolBar, SWT.SEPARATOR);
- item = new ToolItem (toolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText ("SWT.PUSH");
- item = new ToolItem (toolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciOpenFolder]);
- item.setToolTipText ("SWT.PUSH");
- pushItem = new CoolItem (coolBar, itemStyle);
- pushItem.setControl (toolBar);
- Point pushSize = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- pushSize = pushItem.computeSize(pushSize.x, pushSize.y);
- pushItem.setSize(pushSize);
- pushItem.setMinimumSize(item.getWidth(), pushSize.y);
- pushItem.addSelectionListener (new CoolItemSelectionListener());
-
- /* create the dropdown toolbar */
- toolBar = new ToolBar (coolBar, toolBarStyle);
- item = new ToolItem (toolBar, SWT.DROP_DOWN);
- item.setImage (instance.images[ControlExample.ciOpenFolder]);
- item.setToolTipText ("SWT.DROP_DOWN");
- item.addSelectionListener (new DropDownSelectionListener());
- item = new ToolItem (toolBar, SWT.DROP_DOWN);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText ("SWT.DROP_DOWN");
- item.addSelectionListener (new DropDownSelectionListener());
- dropDownItem = new CoolItem (coolBar, itemStyle);
- dropDownItem.setControl (toolBar);
- Point dropSize = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- dropSize = dropDownItem.computeSize(dropSize.x, dropSize.y);
- dropDownItem.setSize(dropSize);
- dropDownItem.setMinimumSize(item.getWidth(), dropSize.y);
- dropDownItem.addSelectionListener (new CoolItemSelectionListener());
-
- /* create the radio button toolbar */
- toolBar = new ToolBar (coolBar, toolBarStyle);
- item = new ToolItem (toolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText ("SWT.RADIO");
- item = new ToolItem (toolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText ("SWT.RADIO");
- item = new ToolItem (toolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText ("SWT.RADIO");
- radioItem = new CoolItem (coolBar, itemStyle);
- radioItem.setControl (toolBar);
- Point radioSize = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- radioSize = radioItem.computeSize(radioSize.x, radioSize.y);
- radioItem.setSize(radioSize);
- radioItem.setMinimumSize(item.getWidth(), radioSize.y);
- radioItem.addSelectionListener (new CoolItemSelectionListener());
-
- /* create the check button toolbar */
- toolBar = new ToolBar (coolBar, toolBarStyle);
- item = new ToolItem (toolBar, SWT.CHECK);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText ("SWT.CHECK");
- item = new ToolItem (toolBar, SWT.CHECK);
- item.setImage (instance.images[ControlExample.ciTarget]);
- item.setToolTipText ("SWT.CHECK");
- item = new ToolItem (toolBar, SWT.CHECK);
- item.setImage (instance.images[ControlExample.ciOpenFolder]);
- item.setToolTipText ("SWT.CHECK");
- item = new ToolItem (toolBar, SWT.CHECK);
- item.setImage (instance.images[ControlExample.ciTarget]);
- item.setToolTipText ("SWT.CHECK");
- checkItem = new CoolItem (coolBar, itemStyle);
- checkItem.setControl (toolBar);
- Point checkSize = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- checkSize = checkItem.computeSize(checkSize.x, checkSize.y);
- checkItem.setSize(checkSize);
- checkItem.setMinimumSize(item.getWidth(), checkSize.y);
- checkItem.addSelectionListener (new CoolItemSelectionListener());
-
- /* if we have saved state, restore it */
- if (order != null) {
- coolBar.setItemLayout(order, wrapIndices, sizes);
- /*
- * special case: because setItemLayout will restore the items
- * to the sizes the user left them at, the preferred size may not
- * be the same as the actual size. Thus we must explicitly set
- * the preferred sizes.
- */
- pushItem.setPreferredSize(pushSize);
- dropDownItem.setPreferredSize(dropSize);
- radioItem.setPreferredSize(radioSize);
- checkItem.setPreferredSize(checkSize);
- }
- else {
- coolBar.setWrapIndices(new int[] {1, 3});
- }
-
- /* add a listener to resize the group box to match the coolbar */
- coolBar.addListener(SWT.Resize, new Listener() {
- public void handleEvent(Event event) {
- exampleGroup.layout();
- }
- });
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup();
-
- /* Create the extra widget */
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText ("SWT.BORDER");
- Group itemGroup = new Group(styleGroup, SWT.NONE);
- itemGroup.setLayout (new GridLayout ());
- itemGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- itemGroup.setText(ControlExample.getResourceString("Item_Styles"));
- dropDownButton = new Button (itemGroup, SWT.CHECK);
- dropDownButton.setText ("SWT.DROP_DOWN");
- dropDownButton.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- recreateExampleWidgets ();
- }
- });
- }
-
- /**
- * Disposes the "Example" widgets.
- */
- void disposeExampleWidgets () {
- /* store the state of the toolbar if applicable */
- if (coolBar != null) {
- sizes = coolBar.getItemSizes();
- wrapIndices = coolBar.getWrapIndices();
- order = coolBar.getItemOrder();
- }
- super.disposeExampleWidgets();
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {coolBar};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return "CoolBar";
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- borderButton.setSelection ((coolBar.getStyle () & SWT.BORDER) != 0);
- dropDownButton.setSelection ((coolBar.getItem(0).getStyle () & SWT.DROP_DOWN) != 0);
- setWidgetLocked ();
- }
-
- /**
- * Sets the header visible state of the "Example" widgets.
- */
- void setWidgetLocked () {
- coolBar.setLocked (lockedButton.getSelection ());
- }
-
- /**
- * Listens to widgetSelected() events on SWT.DROP_DOWN type ToolItems
- * and opens/closes a menu when appropriate.
- */
- class DropDownSelectionListener extends SelectionAdapter {
- private Menu menu = null;
- private boolean visible = false;
-
- public void widgetSelected(SelectionEvent event) {
- // Create the menu if it has not already been created
- if (menu == null) {
- // Lazy create the menu.
- Shell shell = tabFolderPage.getShell();
- menu = new Menu(shell);
- for (int i = 0; i < 9; ++i) {
- final String text = ControlExample.getResourceString("DropDownData_" + i);
- if (text.length() != 0) {
- MenuItem menuItem = new MenuItem(menu, SWT.NONE);
- menuItem.setText(text);
- /*
- * Add a menu selection listener so that the menu is hidden
- * when the user selects an item from the drop down menu.
- */
- menuItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setMenuVisible(false);
- }
- });
- } else {
- MenuItem menuItem = new MenuItem(menu, SWT.SEPARATOR);
- }
- }
- }
-
- /**
- * A selection event will be fired when a drop down tool
- * item is selected in the main area and in the drop
- * down arrow. Examine the event detail to determine
- * where the widget was selected.
- */
- if (event.detail == SWT.ARROW) {
- /*
- * The drop down arrow was selected.
- */
- if (visible) {
- // Hide the menu to give the Arrow the appearance of being a toggle button.
- setMenuVisible(false);
- } else {
- // Position the menu below and vertically aligned with the the drop down tool button.
- final ToolItem toolItem = (ToolItem) event.widget;
- final ToolBar toolBar = toolItem.getParent();
-
- Rectangle toolItemBounds = toolItem.getBounds();
- Point point = toolBar.toDisplay(new Point(toolItemBounds.x, toolItemBounds.y));
- menu.setLocation(point.x, point.y + toolItemBounds.height);
- setMenuVisible(true);
- }
- } else {
- /*
- * Main area of drop down tool item selected.
- * An application would invoke the code to perform the action for the tool item.
- */
- }
- }
- private void setMenuVisible(boolean visible) {
- menu.setVisible(visible);
- this.visible = visible;
- }
- }
-
- /**
- * Listens to widgetSelected() events on SWT.DROP_DOWN type CoolItems
- * and opens/closes a menu when appropriate.
- */
- class CoolItemSelectionListener extends SelectionAdapter {
- private Menu menu = null;
-
- public void widgetSelected(SelectionEvent event) {
- /**
- * A selection event will be fired when the cool item
- * is selected by its gripper or if the drop down arrow
- * (or 'chevron') is selected. Examine the event detail
- * to determine where the widget was selected.
- */
- if (event.detail == SWT.ARROW) {
- /* If the popup menu is already up (i.e. user pressed arrow twice),
- * then dispose it.
- */
- if (menu != null) {
- menu.dispose();
- menu = null;
- return;
- }
-
- /* Get the cool item and convert its bounds to display coordinates. */
- CoolItem coolItem = (CoolItem) event.widget;
- Rectangle itemBounds = coolItem.getBounds ();
- Point pt = coolBar.toDisplay(new Point (itemBounds.x, itemBounds.y));
- itemBounds.x = pt.x;
- itemBounds.y = pt.y;
-
- /* Get the toolbar from the cool item. */
- ToolBar toolBar = (ToolBar) coolItem.getControl ();
- ToolItem[] tools = toolBar.getItems ();
- int toolCount = tools.length;
-
- /* Convert the bounds of each tool item to display coordinates,
- * and determine which ones are past the bounds of the cool item.
- */
- int i = 0;
- while (i < toolCount) {
- Rectangle toolBounds = tools[i].getBounds ();
- pt = toolBar.toDisplay(new Point(toolBounds.x, toolBounds.y));
- toolBounds.x = pt.x;
- toolBounds.y = pt.y;
- Rectangle intersection = itemBounds.intersection (toolBounds);
- if (!intersection.equals (toolBounds)) break;
- i++;
- }
-
- /* Create a pop-up menu with items for each of the hidden buttons. */
- menu = new Menu (coolBar);
- for (int j = i; j < toolCount; j++) {
- ToolItem tool = tools[j];
- Image image = tool.getImage();
- if (image == null) {
- new MenuItem (menu, SWT.SEPARATOR);
- } else {
- if ((tool.getStyle() & SWT.DROP_DOWN) != 0) {
- MenuItem menuItem = new MenuItem (menu, SWT.CASCADE);
- menuItem.setImage(image);
- Menu m = new Menu(menu);
- menuItem.setMenu(m);
- for (int k = 0; k < 9; ++k) {
- String text = ControlExample.getResourceString("DropDownData_" + k);
- if (text.length() != 0) {
- MenuItem mi = new MenuItem(m, SWT.NONE);
- mi.setText(text);
- /* Application code to perform the action for the submenu item would go here. */
- } else {
- new MenuItem(m, SWT.SEPARATOR);
- }
- }
- } else {
- MenuItem menuItem = new MenuItem (menu, SWT.NONE);
- menuItem.setImage(image);
- }
- /* Application code to perform the action for the menu item would go here. */
-
- }
- }
-
- /* Display the pop-up menu at the lower left corner of the arrow button.
- * Dispose the menu when the user is done with it.
- */
- pt = coolBar.toDisplay(new Point(event.x, event.y));
- menu.setLocation (pt.x, pt.y);
- menu.setVisible (true);
- Display display = coolBar.getDisplay ();
- while (menu.isVisible ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- if (menu != null) {
- menu.dispose ();
- menu = null;
- }
- }
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/DialogTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/DialogTab.java deleted file mode 100755 index 950f95d5e9..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/DialogTab.java +++ /dev/null @@ -1,442 +0,0 @@ -package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.printing.*;
-import org.eclipse.swt.events.*;
-
-class DialogTab extends Tab {
- /* Example widgets and groups that contain them */
- Group dialogStyleGroup, resultGroup;
- Text textWidget;
-
- /* Style widgets added to the "Style" group */
- Combo dialogCombo;
- Button okButton, cancelButton;
- Button yesButton, noButton;
- Button retryButton;
- Button abortButton, ignoreButton;
- Button iconErrorButton, iconInformationButton, iconQuestionButton;
- Button iconWarningButton, iconWorkingButton;
- Button modelessButton, primaryModalButton, applicationModalButton, systemModalButton;
- Button saveButton, openButton;
-
- static String [] FilterExtensions = {".txt.", ".bat", ".doc"};
- static String [] FilterNames = {ControlExample.getResourceString("FilterName_0"),
- ControlExample.getResourceString("FilterName_1"),
- ControlExample.getResourceString("FilterName_2")};
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- DialogTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Handle a button style selection event.
- *
- * @param event the selection event
- */
- void buttonStyleSelected(SelectionEvent event) {
- /*
- * Only certain combinations of button styles are
- * supported for various dialogs. Make sure the
- * control widget reflects only valid combinations.
- */
- okButton.setEnabled (
- !(yesButton.getSelection () || noButton.getSelection () ||
- retryButton.getSelection () || abortButton.getSelection () ||
- ignoreButton.getSelection ()));
- cancelButton.setEnabled (
- !(abortButton.getSelection () || ignoreButton.getSelection ()));
- yesButton.setEnabled (
- !(okButton.getSelection () || retryButton.getSelection () ||
- abortButton.getSelection () || ignoreButton.getSelection ()));
- noButton.setEnabled (
- !(okButton.getSelection () || retryButton.getSelection () ||
- abortButton.getSelection () || ignoreButton.getSelection ()));
- retryButton.setEnabled (
- !(okButton.getSelection() || yesButton.getSelection() || noButton.getSelection ()));
- abortButton.setEnabled (
- !(okButton.getSelection () || cancelButton.getSelection () ||
- yesButton.getSelection () || noButton.getSelection ()));
- ignoreButton.setEnabled (
- !(okButton.getSelection () || cancelButton.getSelection () |
- yesButton.getSelection () || noButton.getSelection ()));
- }
-
- /**
- * Handle the create button selection event.
- *
- * @param event org.eclipse.swt.events.SelectionEvent
- */
- void createButtonSelected(SelectionEvent event) {
-
- /* Compute the appropriate dialog style */
- int style = SWT.NULL;
- if (okButton.getEnabled () && okButton.getSelection ()) style |= SWT.OK;
- if (cancelButton.getEnabled () && cancelButton.getSelection ()) style |= SWT.CANCEL;
- if (yesButton.getEnabled () && yesButton.getSelection ()) style |= SWT.YES;
- if (noButton.getEnabled () && noButton.getSelection ()) style |= SWT.NO;
- if (retryButton.getEnabled () && retryButton.getSelection ()) style |= SWT.RETRY;
- if (abortButton.getEnabled () && abortButton.getSelection ()) style |= SWT.ABORT;
- if (ignoreButton.getEnabled () && ignoreButton.getSelection ()) style |= SWT.IGNORE;
- if (iconErrorButton.getEnabled () && iconErrorButton.getSelection ()) style |= SWT.ICON_ERROR;
- if (iconInformationButton.getEnabled () && iconInformationButton.getSelection ()) style |= SWT.ICON_INFORMATION;
- if (iconQuestionButton.getEnabled () && iconQuestionButton.getSelection ()) style |= SWT.ICON_QUESTION;
- if (iconWarningButton.getEnabled () && iconWarningButton.getSelection ()) style |= SWT.ICON_WARNING;
- if (iconWorkingButton.getEnabled () && iconWorkingButton.getSelection ()) style |= SWT.ICON_WORKING;
- if (primaryModalButton.getEnabled () && primaryModalButton.getSelection ()) style |= SWT.PRIMARY_MODAL;
- if (applicationModalButton.getEnabled () && applicationModalButton.getSelection ()) style |= SWT.APPLICATION_MODAL;
- if (systemModalButton.getEnabled () && systemModalButton.getSelection ()) style |= SWT.SYSTEM_MODAL;
- if (saveButton.getEnabled () && saveButton.getSelection ()) style |= SWT.SAVE;
- if (openButton.getEnabled () && openButton.getSelection ()) style |= SWT.OPEN;
-
- /* Open the appropriate dialog type */
- String name = dialogCombo.getText ();
- Shell shell = tabFolderPage.getShell ();
-
- if (name.equals (instance.getResourceString("ColorDialog"))) {
- ColorDialog dialog = new ColorDialog (shell ,style);
- dialog.setRGB (new RGB (100, 100, 100));
- dialog.setText (instance.getResourceString("Title"));
- RGB result = dialog.open ();
- textWidget.append (instance.getResourceString("ColorDialog") + Text.DELIMITER);
- textWidget.append (instance.getResourceString("Result", new String [] {"" + result}) + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals (instance.getResourceString("DirectoryDialog"))) {
- DirectoryDialog dialog = new DirectoryDialog (shell, style);
- dialog.setMessage (instance.getResourceString("Example_string"));
- dialog.setText (instance.getResourceString("Title"));
- String result = dialog.open ();
- textWidget.append (instance.getResourceString("DirectoryDialog") + Text.DELIMITER);
- textWidget.append (instance.getResourceString("Result", new String [] {"" + result}) + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals (instance.getResourceString("FileDialog"))) {
- FileDialog dialog = new FileDialog (shell, style);
- dialog.setFileName (instance.getResourceString("readme_txt"));
- dialog.setFilterNames (FilterNames);
- dialog.setFilterExtensions (FilterExtensions);
- dialog.setText (instance.getResourceString("Title"));
- String result = dialog.open();
- textWidget.append (instance.getResourceString("FileDialog") + Text.DELIMITER);
- textWidget.append (instance.getResourceString("Result", new String [] {"" + result}) + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals (instance.getResourceString("FontDialog"))) {
- FontDialog dialog = new FontDialog (shell, style);
- dialog.setText (instance.getResourceString("Title"));
- FontData result = dialog.open ();
- textWidget.append (instance.getResourceString("FontDialog") + Text.DELIMITER);
- textWidget.append (instance.getResourceString("Result", new String [] {"" + result}) + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals (instance.getResourceString("PrintDialog"))) {
- PrintDialog dialog = new PrintDialog (shell, style);
- dialog.setText(instance.getResourceString("Title"));
- PrinterData result = dialog.open ();
- textWidget.append (instance.getResourceString("PrintDialog") + Text.DELIMITER);
- textWidget.append (instance.getResourceString("Result", new String [] {"" + result}) + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals(instance.getResourceString("MessageBox"))) {
- MessageBox dialog = new MessageBox (shell, style);
- dialog.setMessage (instance.getResourceString("Example_string"));
- dialog.setText (instance.getResourceString("Title"));
- int result = dialog.open ();
- textWidget.append (instance.getResourceString("MessageBox") + Text.DELIMITER);
- /*
- * The resulting integer depends on the original
- * dialog style. Decode the result and display it.
- */
- switch (result) {
- case SWT.OK:
- textWidget.append (instance.getResourceString("Result", new String [] {"SWT.OK"}));
- break;
- case SWT.YES:
- textWidget.append (instance.getResourceString("Result", new String [] {"SWT.YES"}));
- break;
- case SWT.NO:
- textWidget.append (instance.getResourceString("Result", new String [] {"SWT.NO"}));
- break;
- case SWT.CANCEL:
- textWidget.append (instance.getResourceString("Result", new String [] {"SWT.CANCEL"}));
- break;
- case SWT.ABORT:
- textWidget.append (instance.getResourceString("Result", new String [] {"SWT.ABORT"}));
- break;
- case SWT.RETRY:
- textWidget.append (instance.getResourceString("Result", new String [] {"SWT.RETRY"}));
- break;
- case SWT.IGNORE:
- textWidget.append (instance.getResourceString("Result", new String [] {"SWT.IGNORE"}));
- break;
- default:
- textWidget.append(instance.getResourceString("Result", new String [] {"" + result}));
- break;
- }
- textWidget.append (Text.DELIMITER + Text.DELIMITER);
- }
- }
-
- /**
- * Creates the "Control" group.
- */
- void createControlGroup () {
- /*
- * Create the "Control" group. This is the group on the
- * left half of each example tab. It consists of the
- * style group, the display group and the size group.
- */
- controlGroup = new Group (tabFolderPage, SWT.NULL);
- GridLayout gridLayout= new GridLayout ();
- controlGroup.setLayout(gridLayout);
- gridLayout.numColumns = 2;
- gridLayout.makeColumnsEqualWidth = true;
- controlGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- controlGroup.setText (instance.getResourceString("Parameters"));
-
- /*
- * Create a group to hold the dialog style combo box and
- * create dialog button.
- */
- dialogStyleGroup = new Group (controlGroup, SWT.NULL);
- dialogStyleGroup.setLayout (new GridLayout ());
- GridData gridData = new GridData (GridData.HORIZONTAL_ALIGN_CENTER);
- gridData.horizontalSpan = 2;
- dialogStyleGroup.setLayoutData (gridData);
- dialogStyleGroup.setText (instance.getResourceString("Dialog_Type"));
- }
-
- /**
- * Creates the "Control" widget children.
- */
- void createControlWidgets () {
-
- /* Create the combo */
- String [] strings = {
- instance.getResourceString("ColorDialog"),
- instance.getResourceString("DirectoryDialog"),
- instance.getResourceString("FileDialog"),
- instance.getResourceString("FontDialog"),
- instance.getResourceString("PrintDialog"),
- instance.getResourceString("MessageBox"),
- };
- dialogCombo = new Combo (dialogStyleGroup, SWT.READ_ONLY);
- dialogCombo.setItems (strings);
- dialogCombo.setText (strings [0]);
-
- /* Create the create dialog button */
- Button createButton = new Button(dialogStyleGroup, SWT.NULL);
- createButton.setText (instance.getResourceString("Create_Dialog"));
- createButton.setLayoutData (new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
-
- /* Create a group for the various dialog button style controls */
- Group buttonStyleGroup = new Group (controlGroup, SWT.NULL);
- buttonStyleGroup.setLayout (new GridLayout ());
- buttonStyleGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- buttonStyleGroup.setText (instance.getResourceString("Button_Styles"));
-
- /* Create the button style buttons */
- okButton = new Button (buttonStyleGroup, SWT.CHECK);
- okButton.setText ("SWT.OK");
- cancelButton = new Button (buttonStyleGroup, SWT.CHECK);
- cancelButton.setText ("SWT.CANCEL");
- yesButton = new Button (buttonStyleGroup, SWT.CHECK);
- yesButton.setText ("SWT.YES");
- noButton = new Button (buttonStyleGroup, SWT.CHECK);
- noButton.setText ("SWT.NO");
- retryButton = new Button (buttonStyleGroup, SWT.CHECK);
- retryButton.setText ("SWT.RETRY");
- abortButton = new Button (buttonStyleGroup, SWT.CHECK);
- abortButton.setText ("SWT.ABORT");
- ignoreButton = new Button (buttonStyleGroup, SWT.CHECK);
- ignoreButton.setText ("SWT.IGNORE");
-
- /* Create a group for the icon style controls */
- Group iconStyleGroup = new Group (controlGroup, SWT.NULL);
- iconStyleGroup.setLayout (new GridLayout ());
- iconStyleGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- iconStyleGroup.setText (instance.getResourceString("Icon_Styles"));
-
- /* Create the icon style buttons */
- iconErrorButton = new Button (iconStyleGroup, SWT.RADIO);
- iconErrorButton.setText ("SWT.ICON_ERROR");
- iconInformationButton = new Button (iconStyleGroup, SWT.RADIO);
- iconInformationButton.setText ("SWT.ICON_INFORMATION");
- iconQuestionButton = new Button (iconStyleGroup, SWT.RADIO);
- iconQuestionButton.setText ("SWT.ICON_QUESTION");
- iconWarningButton = new Button (iconStyleGroup, SWT.RADIO);
- iconWarningButton.setText ("SWT.ICON_WARNING");
- iconWorkingButton = new Button (iconStyleGroup, SWT.RADIO);
- iconWorkingButton.setText ("SWT.ICON_WORKING");
-
- /* Create a group for the modal style controls */
- Group modalStyleGroup = new Group (controlGroup, SWT.NULL);
- modalStyleGroup.setLayout (new GridLayout ());
- modalStyleGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- modalStyleGroup.setText (instance.getResourceString("Modal_Styles"));
-
- /* Create the modal style buttons */
- modelessButton = new Button (modalStyleGroup, SWT.RADIO);
- modelessButton.setText ("SWT.MODELESS");
- primaryModalButton = new Button (modalStyleGroup, SWT.RADIO);
- primaryModalButton.setText ("SWT.PRIMARY_MODAL");
- applicationModalButton = new Button (modalStyleGroup, SWT.RADIO);
- applicationModalButton.setText ("SWT.APPLICATION_MODAL");
- systemModalButton = new Button (modalStyleGroup, SWT.RADIO);
- systemModalButton.setText ("SWT.SYSTEM_MODAL");
-
- /* Create a group for the file dialog style controls */
- Group fileDialogStyleGroup = new Group (controlGroup, SWT.NULL);
- fileDialogStyleGroup.setLayout (new GridLayout ());
- fileDialogStyleGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- fileDialogStyleGroup.setText (instance.getResourceString("File_Dialog_Styles"));
-
- /* Create the file dialog style buttons */
- saveButton = new Button (fileDialogStyleGroup, SWT.RADIO);
- saveButton.setText ("SWT.SAVE");
- openButton = new Button(fileDialogStyleGroup, SWT.RADIO);
- openButton.setText("SWT.OPEN");
-
- /* Add the listeners */
- dialogCombo.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- dialogSelected (event);
- };
- });
- createButton.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- createButtonSelected (event);
- };
- });
- SelectionListener buttonStyleListener = new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- buttonStyleSelected (event);
- };
- };
- okButton.addSelectionListener (buttonStyleListener);
- cancelButton.addSelectionListener (buttonStyleListener);
- yesButton.addSelectionListener (buttonStyleListener);
- noButton.addSelectionListener (buttonStyleListener);
- retryButton.addSelectionListener (buttonStyleListener);
- abortButton.addSelectionListener (buttonStyleListener);
- ignoreButton.addSelectionListener (buttonStyleListener);
-
- /* Set default values for style buttons */
- okButton.setEnabled (false);
- cancelButton.setEnabled (false);
- yesButton.setEnabled (false);
- noButton.setEnabled (false);
- retryButton.setEnabled (false);
- abortButton.setEnabled (false);
- ignoreButton.setEnabled (false);
- iconErrorButton.setEnabled (false);
- iconInformationButton.setEnabled (false);
- iconQuestionButton.setEnabled (false);
- iconWarningButton.setEnabled (false);
- iconWorkingButton.setEnabled (false);
- saveButton.setEnabled (false);
- openButton.setEnabled (false);
- openButton.setSelection (true);
- iconInformationButton.setSelection (true);
- modelessButton.setSelection (true);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /*
- * Create a group for the text widget to display
- * the results returned by the example dialogs.
- */
- resultGroup = new Group (exampleGroup, SWT.NULL);
- resultGroup.setLayout (new GridLayout ());
- resultGroup.setLayoutData (new GridData (GridData.FILL_BOTH));
- resultGroup.setText (instance.getResourceString("Dialog_Result"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
- /*
- * Create a multi lined, scrolled text widget for output.
- */
- textWidget = new Text(resultGroup, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- GridData gridData = new GridData (GridData.FILL_BOTH);
- textWidget.setLayoutData (gridData);
- }
-
- /**
- * Handle a dialog type combo selection event.
- *
- * @param event the selection event
- */
- void dialogSelected (SelectionEvent event) {
-
- /* Enable/Disable the buttons */
- String name = dialogCombo.getText ();
- boolean isMessageBox = name.equals (instance.getResourceString("MessageBox"));
- boolean isFileDialog = name.equals (instance.getResourceString("FileDialog"));
- okButton.setEnabled (isMessageBox);
- cancelButton.setEnabled (isMessageBox);
- yesButton.setEnabled (isMessageBox);
- noButton.setEnabled (isMessageBox);
- retryButton.setEnabled (isMessageBox);
- abortButton.setEnabled (isMessageBox);
- ignoreButton.setEnabled (isMessageBox);
- iconErrorButton.setEnabled (isMessageBox);
- iconInformationButton.setEnabled (isMessageBox);
- iconQuestionButton.setEnabled (isMessageBox);
- iconWarningButton.setEnabled (isMessageBox);
- iconWorkingButton.setEnabled (isMessageBox);
- saveButton.setEnabled (isFileDialog);
- openButton.setEnabled (isFileDialog);
-
- /* Unselect the buttons */
- if (!isMessageBox) {
- okButton.setSelection (false);
- cancelButton.setSelection (false);
- yesButton.setSelection (false);
- noButton.setSelection (false);
- retryButton.setSelection (false);
- abortButton.setSelection (false);
- ignoreButton.setSelection (false);
- }
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [0];
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return "Dialog";
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LabelTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LabelTab.java deleted file mode 100755 index fe21b4dc28..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LabelTab.java +++ /dev/null @@ -1,176 +0,0 @@ -package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class LabelTab extends AlignableTab {
- /* Example widgets and groups that contain them */
- Label label1, label2, label3, label4, label5, label6;
- Group textLabelGroup, imageLabelGroup;
-
- /* Style widgets added to the "Style" group */
- Button separatorButton, wrapButton, horizontalButton, verticalButton, shadowInButton, shadowOutButton;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- LabelTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the text labels */
- textLabelGroup = new Group(exampleGroup, SWT.NULL);
- GridLayout gridLayout = new GridLayout ();
- textLabelGroup.setLayout (gridLayout);
- gridLayout.numColumns = 3;
- textLabelGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- textLabelGroup.setText (ControlExample.getResourceString("Text_Labels"));
-
- /* Create a group for the image labels */
- imageLabelGroup = new Group (exampleGroup, SWT.SHADOW_NONE);
- gridLayout = new GridLayout ();
- imageLabelGroup.setLayout (gridLayout);
- gridLayout.numColumns = 3;
- imageLabelGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- imageLabelGroup.setText (ControlExample.getResourceString("Image_Labels"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (separatorButton.getSelection ()) style |= SWT.SEPARATOR;
- if (wrapButton.getSelection ()) style |= SWT.WRAP;
- if (horizontalButton.getSelection ()) style |= SWT.HORIZONTAL;
- if (verticalButton.getSelection ()) style |= SWT.VERTICAL;
- if (shadowInButton.getSelection ()) style |= SWT.SHADOW_IN;
- if (shadowOutButton.getSelection ()) style |= SWT.SHADOW_OUT;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- label1 = new Label (textLabelGroup, style);
- label1.setText(ControlExample.getResourceString("One"));
- label2 = new Label (textLabelGroup, style);
- label2.setText(ControlExample.getResourceString("Two"));
- label3 = new Label (textLabelGroup, style);
- if (wrapButton.getSelection ()) {
- label3.setText (ControlExample.getResourceString("Wrap_Text"));
- } else {
- label3.setText (ControlExample.getResourceString("Three"));
- }
- label4 = new Label (imageLabelGroup, style);
- label4.setImage (instance.images[ControlExample.ciClosedFolder]);
- label5 = new Label (imageLabelGroup, style);
- label5.setImage (instance.images[ControlExample.ciOpenFolder]);
- label6 = new Label(imageLabelGroup, style);
- label6.setImage (instance.images[ControlExample.ciTarget]);
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- separatorButton = new Button (styleGroup, SWT.CHECK);
- separatorButton.setText ("SWT.SEPARATOR");
- wrapButton = new Button (styleGroup, SWT.CHECK);
- wrapButton.setText ("SWT.WRAP");
- horizontalButton = new Button (styleGroup, SWT.RADIO);
- horizontalButton.setText ("SWT.HORIZONTAL");
- verticalButton = new Button (styleGroup, SWT.RADIO);
- verticalButton.setText ("SWT.VERTICAL");
- Group styleSubGroup = new Group (styleGroup, SWT.NULL);
- styleSubGroup.setLayout (new GridLayout ());
- shadowInButton = new Button (styleSubGroup, SWT.RADIO);
- shadowInButton.setText ("SWT.SHADOW_IN");
- shadowOutButton = new Button (styleSubGroup, SWT.RADIO);
- shadowOutButton.setText ("SWT.SHADOW_OUT");
- borderButton = new Button(styleGroup, SWT.CHECK);
- borderButton.setText("SWT.BORDER");
-
- /* Add the listeners */
- SelectionListener selectionListener = new SelectionAdapter () {
- public void widgetSelected(SelectionEvent event) {
- if ((event.widget.getStyle() & SWT.RADIO) != 0) {
- if (!((Button) event.widget).getSelection ()) return;
- }
- recreateExampleWidgets ();
- };
- };
- shadowInButton.addSelectionListener (selectionListener);
- shadowOutButton.addSelectionListener (selectionListener);
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {label1, label2, label3, label4, label5, label6};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return "Label";
- }
-
- /**
- * Sets the alignment of the "Example" widgets.
- */
- void setExampleWidgetAlignment () {
- int allignment = 0;
- if (leftButton.getSelection ()) allignment = SWT.LEFT;
- if (centerButton.getSelection ()) allignment = SWT.CENTER;
- if (rightButton.getSelection ()) allignment = SWT.RIGHT;
- label1.setAlignment (allignment);
- label2.setAlignment (allignment);
- label3.setAlignment (allignment);
- label4.setAlignment (allignment);
- label5.setAlignment (allignment);
- label6.setAlignment (allignment);
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- boolean isSeparator = (label1.getStyle () & SWT.SEPARATOR) != 0;
- wrapButton.setSelection (!isSeparator && (label1.getStyle () & SWT.WRAP) != 0);
- leftButton.setSelection (!isSeparator && (label1.getStyle () & SWT.LEFT) != 0);
- centerButton.setSelection (!isSeparator && (label1.getStyle () & SWT.CENTER) != 0);
- rightButton.setSelection (!isSeparator && (label1.getStyle () & SWT.RIGHT) != 0);
- shadowInButton.setSelection (isSeparator && (label1.getStyle () & SWT.SHADOW_IN) != 0);
- shadowOutButton.setSelection (!shadowInButton.getSelection ());
- wrapButton.setEnabled (!isSeparator);
- leftButton.setEnabled (!isSeparator);
- centerButton.setEnabled (!isSeparator);
- rightButton.setEnabled (!isSeparator);
- shadowInButton.setEnabled (isSeparator);
- shadowOutButton.setEnabled (isSeparator);
- horizontalButton.setEnabled (isSeparator);
- verticalButton.setEnabled (isSeparator);
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ListTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ListTab.java deleted file mode 100755 index 66c6fb83ae..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ListTab.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class ListTab extends ScrollableTab {
-
- /* Example widgets and groups that contain them */
- List list1;
- Group listGroup;
-
- static String [] ListData1 = {ControlExample.getResourceString("ListData1_0"),
- ControlExample.getResourceString("ListData1_1"),
- ControlExample.getResourceString("ListData1_2"),
- ControlExample.getResourceString("ListData1_3"),
- ControlExample.getResourceString("ListData1_4"),
- ControlExample.getResourceString("ListData1_5"),
- ControlExample.getResourceString("ListData1_6"),
- ControlExample.getResourceString("ListData1_7"),
- ControlExample.getResourceString("ListData1_8")};
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ListTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the list */
- listGroup = new Group (exampleGroup, SWT.NULL);
- listGroup.setLayout (new GridLayout ());
- listGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- listGroup.setText ("List");
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (singleButton.getSelection ()) style |= SWT.SINGLE;
- if (multiButton.getSelection ()) style |= SWT.MULTI;
- if (horizontalButton.getSelection ()) style |= SWT.H_SCROLL;
- if (verticalButton.getSelection ()) style |= SWT.V_SCROLL;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- list1 = new List (listGroup, style);
- list1.setItems (ListData1);
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {list1};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return "List";
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ProgressBarTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ProgressBarTab.java deleted file mode 100755 index 0d69353da9..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ProgressBarTab.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class ProgressBarTab extends RangeTab {
- /* Example widgets and groups that contain them */
- ProgressBar progressBar1;
- Group progressBarGroup;
-
- /* Style widgets added to the "Style" group */
- Button smoothButton;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ProgressBarTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup() {
- super.createExampleGroup ();
-
- /* Create a group for the progress bar */
- progressBarGroup = new Group (exampleGroup, SWT.NULL);
- progressBarGroup.setLayout (new GridLayout ());
- progressBarGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- progressBarGroup.setText ("ProgressBar");
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (horizontalButton.getSelection ()) style |= SWT.HORIZONTAL;
- if (verticalButton.getSelection ()) style |= SWT.VERTICAL;
- if (smoothButton.getSelection ()) style |= SWT.SMOOTH;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- progressBar1 = new ProgressBar (progressBarGroup, style);
- progressBar1.setMaximum (100);
- progressBar1.setSelection (50);
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- smoothButton = new Button (styleGroup, SWT.CHECK);
- smoothButton.setText ("SWT.SMOOTH");
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {progressBar1};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return "ProgressBar";
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- maximumScale.setMaximum (progressBar1.getMaximum ());
- smoothButton.setSelection ((progressBar1.getStyle () & SWT.SMOOTH) != 0);
- }
-
- /**
- * Sets the maximum of the "Example" widgets.
- */
- void setWidgetMaximum () {
- progressBar1.setMaximum (maximumScale.getSelection ());
- updateScales ();
- }
-
- /**
- * Sets the minimim of the "Example" widgets.
- */
- void setWidgetMinimum () {
- progressBar1.setMinimum (minimumScale.getSelection ());
- updateScales ();
- }
-
- /**
- * Sets the selection of the "Example" widgets.
- */
- void setWidgetSelection () {
- progressBar1.setSelection (selectionScale.getSelection ());
- updateScales ();
- }
-
- /**
- * Update the scale widgets to reflect the actual value set
- * on the "Example" widget.
- */
- void updateScales () {
- minimumScale.setSelection (progressBar1.getMinimum ());
- selectionScale.setSelection (progressBar1.getSelection ());
- maximumScale.setSelection (progressBar1.getMaximum ());
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/RangeTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/RangeTab.java deleted file mode 100755 index 4fa0ad1b70..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/RangeTab.java +++ /dev/null @@ -1,179 +0,0 @@ -package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-abstract class RangeTab extends Tab {
- /* Style widgets added to the "Style" group */
- Button horizontalButton, verticalButton;
-
- /* Scale widgets added to the "Control" group */
- Scale minimumScale, selectionScale, maximumScale;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- RangeTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Control" widget children.
- */
- void createControlWidgets () {
- /* Create controls specific to this example */
- createMinimumGroup ();
- createMaximumGroup ();
- createSelectionGroup ();
- }
-
- /**
- * Create a group of widgets to control the maximum
- * attribute of the example widget.
- */
- void createMaximumGroup() {
-
- /* Create the group */
- Group maximumGroup = new Group (controlGroup, SWT.NULL);
- maximumGroup.setLayout (new GridLayout ());
- maximumGroup.setText (ControlExample.getResourceString("Maximum"));
- maximumGroup.setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
-
- /* Create a scale widget */
- maximumScale = new Scale (maximumGroup, SWT.NULL);
- maximumScale.setMaximum (100);
- maximumScale.setSelection (100);
- maximumScale.setPageIncrement (10);
- maximumScale.setIncrement (5);
-
- GridData data = new GridData (GridData.FILL_HORIZONTAL);
- data.widthHint = 100;
- maximumScale.setLayoutData (data);
-
- /* Add the listeners */
- maximumScale.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetMaximum ();
- };
- });
- }
-
- /**
- * Create a group of widgets to control the minimum
- * attribute of the example widget.
- */
- void createMinimumGroup() {
-
- /* Create the group */
- Group minimumGroup = new Group (controlGroup, SWT.NULL);
- minimumGroup.setLayout (new GridLayout ());
- minimumGroup.setText (ControlExample.getResourceString("Minimum"));
- minimumGroup.setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
-
- /* Create a scale widget */
- minimumScale = new Scale (minimumGroup, SWT.NULL);
- minimumScale.setMaximum (100);
- minimumScale.setPageIncrement (10);
- minimumScale.setIncrement (5);
-
- GridData data = new GridData (GridData.FILL_HORIZONTAL);
- data.widthHint = 100;
- minimumScale.setLayoutData (data);
-
- /* Add the listeners */
- minimumScale.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetMinimum ();
- };
- });
-
- }
-
- /**
- * Create a group of widgets to control the selection
- * attribute of the example widget.
- */
- void createSelectionGroup() {
-
- /* Create the group */
- Group selectionGroup = new Group(controlGroup, SWT.NULL);
- selectionGroup.setLayout(new GridLayout());
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- selectionGroup.setLayoutData(gridData);
- selectionGroup.setText(ControlExample.getResourceString("Selection"));
-
- /* Create a scale widget */
- selectionScale = new Scale (selectionGroup, SWT.NULL);
- selectionScale.setMaximum (100);
- selectionScale.setSelection (50);
- selectionScale.setPageIncrement (10);
- selectionScale.setIncrement (5);
-
- GridData data = new GridData (GridData.FILL_HORIZONTAL);
- data.widthHint = 100;
- selectionScale.setLayoutData (data);
-
- /* Add the listeners */
- selectionScale.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- setWidgetSelection ();
- };
- });
-
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- horizontalButton = new Button (styleGroup, SWT.RADIO);
- horizontalButton.setText ("SWT.HORIZONTAL");
- verticalButton = new Button (styleGroup, SWT.RADIO);
- verticalButton.setText ("SWT.VERTICAL");
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText ("SWT.BORDER");
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- setWidgetMinimum ();
- setWidgetMaximum ();
- setWidgetSelection ();
- Control [] controls = getExampleWidgets ();
- if (controls.length != 0){
- horizontalButton.setSelection ((controls [0].getStyle () & SWT.HORIZONTAL) != 0);
- verticalButton.setSelection ((controls [0].getStyle () & SWT.VERTICAL) != 0);
- borderButton.setSelection ((controls [0].getStyle () & SWT.BORDER) != 0);
- }
- }
-
- /**
- * Sets the maximum of the "Example" widgets.
- */
- abstract void setWidgetMaximum ();
-
- /**
- * Sets the minimim of the "Example" widgets.
- */
- abstract void setWidgetMinimum ();
-
- /**
- * Sets the selection of the "Example" widgets.
- */
- abstract void setWidgetSelection ();
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SashTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SashTab.java deleted file mode 100755 index e41a8cc38d..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SashTab.java +++ /dev/null @@ -1,167 +0,0 @@ -package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class SashTab extends Tab {
- /* Example widgets and groups that contain them */
- Sash hSash, vSash;
- List list1, list2, list3;
- Text text;
-
- static String [] ListData0 = {ControlExample.getResourceString("ListData0_0"),
- ControlExample.getResourceString("ListData0_1"),
- ControlExample.getResourceString("ListData0_2"),
- ControlExample.getResourceString("ListData0_3"),
- ControlExample.getResourceString("ListData0_4"),
- ControlExample.getResourceString("ListData0_5"),
- ControlExample.getResourceString("ListData0_6"),
- ControlExample.getResourceString("ListData0_7"),
- ControlExample.getResourceString("ListData0_8")};
-
- static String [] ListData1 = {ControlExample.getResourceString("ListData1_0"),
- ControlExample.getResourceString("ListData1_1"),
- ControlExample.getResourceString("ListData1_2"),
- ControlExample.getResourceString("ListData1_3"),
- ControlExample.getResourceString("ListData1_4"),
- ControlExample.getResourceString("ListData1_5"),
- ControlExample.getResourceString("ListData1_6"),
- ControlExample.getResourceString("ListData1_7"),
- ControlExample.getResourceString("ListData1_8")};
-
- /* Constants */
- static final int SASH_WIDTH = 3;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- SashTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the tab folder page.
- */
- Composite createTabFolderPage (TabFolder tabFolder) {
- /*
- * Create the page. This example does not use layouts.
- */
- tabFolderPage = new Composite(tabFolder, SWT.BORDER);
-
- /* Create the list and text widgets */
- list1 = new List (tabFolderPage, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
- list1.setItems (ListData0);
- list2 = new List (tabFolderPage, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
- list2.setItems (ListData1);
- text = new Text (tabFolderPage, SWT.MULTI | SWT.BORDER);
- text.setText (ControlExample.getResourceString("Multi_line"));
-
- /* Create the sashes */
- vSash = new Sash (tabFolderPage, SWT.VERTICAL);
- hSash = new Sash (tabFolderPage, SWT.HORIZONTAL);
-
- /* Add the listeners */
- hSash.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- if (event.detail != SWT.DRAG) {
- hSash.setBounds (event.x, event.y, event.width, event.height);
- layout ();
- }
- }
- });
- vSash.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- if (event.detail != SWT.DRAG) {
- vSash.setBounds(event.x, event.y, event.width, event.height);
- layout ();
- }
- }
- });
- tabFolderPage.addControlListener (new ControlAdapter () {
- public void controlResized (ControlEvent event) {
- shellResized ();
- }
- });
-
- /*
- * Do not set the bounds of the lists, text and sashes here
- * because this method is run before the widget is opened
- * so we do not know how big the tabComposite is going to be.
- * When the widget is opened a resize event will occur
- * and the contained widgets can be sized accordingly.
- */
- return tabFolderPage;
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return "Sash";
- }
-
- /**
- * Layout the list and text widgets according to the new
- * positions of the sashes..events.SelectionEvent
- */
- void layout () {
-
- Rectangle tabCompositeBounds = tabFolderPage.getClientArea ();
- Rectangle hSashBounds = hSash.getBounds ();
- Rectangle vSashBounds = vSash.getBounds ();
-
- list1.setBounds (0, 0, vSashBounds.x, hSashBounds.y);
- list2.setBounds (vSashBounds.x + vSashBounds.width, 0, tabCompositeBounds.width - (vSashBounds.x + vSashBounds.width), hSashBounds.y);
- text.setBounds (0, hSashBounds.y + hSashBounds.height, tabCompositeBounds.width, tabCompositeBounds.height - (hSashBounds.y + hSashBounds.height));
-
- /**
- * If the horizontal sash has been moved then the vertical
- * sash is either too long or too short and its size must
- * be adjusted.
- */
- vSashBounds.height = hSashBounds.y;
- vSash.setBounds (vSashBounds);
- }
-
- /**
- * Handle the shell resized event.
- */
- void shellResized () {
-
- /* Get the client area for the shell */
- Rectangle tabFolderPageBounds = tabFolderPage.getClientArea ();
-
- /*
- * Make list 1 half the width and half the height of the tab leaving room for the sash.
- * Place list 1 in the top left quadrant of the tab.
- */
- Rectangle list1Bounds = new Rectangle (0, 0, (tabFolderPageBounds.width - SASH_WIDTH) / 2, (tabFolderPageBounds.height - SASH_WIDTH) / 2);
- list1.setBounds (list1Bounds);
-
- /*
- * Make list 2 half the width and half the height of the tab leaving room for the sash.
- * Place list 2 in the top right quadrant of the tab.
- */
- list2.setBounds (list1Bounds.width + SASH_WIDTH, 0, tabFolderPageBounds.width - (list1Bounds.width + SASH_WIDTH), list1Bounds.height);
-
- /*
- * Make the text area the full width and half the height of the tab leaving room for the sash.
- * Place the text area in the bottom half of the tab.
- */
- text.setBounds (0, list1Bounds.height + SASH_WIDTH, tabFolderPageBounds.width, tabFolderPageBounds.height - (list1Bounds.height + SASH_WIDTH));
-
- /* Position the sashes */
- vSash.setBounds (list1Bounds.width, 0, SASH_WIDTH, list1Bounds.height);
- hSash.setBounds (0, list1Bounds.height, tabFolderPageBounds.width, SASH_WIDTH);
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ScrollableTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ScrollableTab.java deleted file mode 100755 index cf7a40576e..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ScrollableTab.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-
-abstract class ScrollableTab extends Tab {
- /* Style widgets added to the "Style" group */
- Button singleButton, multiButton, horizontalButton, verticalButton, borderButton;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ScrollableTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- singleButton = new Button (styleGroup, SWT.RADIO);
- singleButton.setText ("SWT.SINGLE");
- multiButton = new Button (styleGroup, SWT.RADIO);
- multiButton.setText ("SWT.MULTI");
- horizontalButton = new Button (styleGroup, SWT.CHECK);
- horizontalButton.setText ("SWT.H_SCROLL");
- horizontalButton.setSelection(true);
- verticalButton = new Button (styleGroup, SWT.CHECK);
- verticalButton.setText ("SWT.V_SCROLL");
- verticalButton.setSelection(true);
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText ("SWT.BORDER");
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- Control [] controls = getExampleWidgets ();
- if (controls.length != 0){
- singleButton.setSelection ((controls [0].getStyle () & SWT.SINGLE) != 0);
- multiButton.setSelection ((controls [0].getStyle () & SWT.MULTI) != 0);
- horizontalButton.setSelection ((controls [0].getStyle () & SWT.H_SCROLL) != 0);
- verticalButton.setSelection ((controls [0].getStyle () & SWT.V_SCROLL) != 0);
- borderButton.setSelection ((controls [0].getStyle () & SWT.BORDER) != 0);
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ShellTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ShellTab.java deleted file mode 100755 index cb9547aeec..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ShellTab.java +++ /dev/null @@ -1,278 +0,0 @@ -package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class ShellTab extends Tab {
- /* Style widgets added to the "Style" group */
- Button noParentButton, parentButton;
- Button noTrimButton, closeButton, titleButton, minButton, maxButton, borderButton, resizeButton, onTopButton;
- Button createButton, closeAllButton;
- Button modelessButton, primaryModalButton, applicationModalButton, systemModalButton;
- Group parentStyleGroup, modalStyleGroup;
-
- /* Variables used to track the open shells */
- int shellCount = 0;
- Shell [] shells = new Shell [4];
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ShellTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Close all the example shells.
- */
- void closeAllShells() {
- for (int i = 0; i<shellCount; i++) {
- if (shells[i] != null & !shells [i].isDisposed ()) {
- shells [i].dispose();
- }
- }
- shellCount = 0;
- }
-
- /**
- * Handle the Create button selection event.
- *
- * @param event org.eclipse.swt.events.SelectionEvent
- */
- public void createButtonSelected(SelectionEvent event) {
-
- /*
- * Remember the example shells so they
- * can be disposed by the user.
- */
- if (shellCount >= shells.length) {
- Shell [] newShells = new Shell [shells.length + 4];
- System.arraycopy (shells, 0, newShells, 0, shells.length);
- shells = newShells;
- }
-
- /* Compute the shell style */
- int style = SWT.NONE;
- if (noTrimButton.getSelection()) style |= SWT.NO_TRIM;
- if (closeButton.getSelection()) style |= SWT.CLOSE;
- if (titleButton.getSelection()) style |= SWT.TITLE;
- if (minButton.getSelection()) style |= SWT.MIN;
- if (maxButton.getSelection()) style |= SWT.MAX;
- if (borderButton.getSelection()) style |= SWT.BORDER;
- if (resizeButton.getSelection()) style |= SWT.RESIZE;
- if (onTopButton.getSelection()) style |= SWT.ON_TOP;
- if (modelessButton.getSelection()) style |= SWT.MODELESS;
- if (primaryModalButton.getSelection()) style |= SWT.PRIMARY_MODAL;
- if (applicationModalButton.getSelection()) style |= SWT.APPLICATION_MODAL;
- if (systemModalButton.getSelection()) style |= SWT.SYSTEM_MODAL;
-
- /* Create the shell with or without a parent */
- if (noParentButton.getSelection ()) {
- shells [shellCount] = new Shell (style);
- } else {
- Shell shell = tabFolderPage.getShell ();
- shells [shellCount] = new Shell (shell, style);
- }
- Button button = new Button(shells [shellCount], SWT.PUSH);
- button.setBounds(20, 20, 100, 30);
-
- /* Set the size, title and open the shell */
- shells [shellCount].setSize (300, 100);
- shells [shellCount].setText (ControlExample.getResourceString("Title") + shellCount);
- shells [shellCount++].open ();
- }
-
- /**
- * Creates the "Control" group.
- */
- void createControlGroup () {
- /*
- * Create the "Control" group. This is the group on the
- * left half of each example tab. It consists of the
- * style group, the display group and the size group.
- */
- controlGroup = new Group (tabFolderPage, SWT.NULL);
- GridLayout gridLayout= new GridLayout ();
- controlGroup.setLayout (gridLayout);
- gridLayout.numColumns = 1;
- gridLayout.makeColumnsEqualWidth = true;
- controlGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- controlGroup.setText (ControlExample.getResourceString("Parameters"));
-
- /* Create individual groups inside the "Control" group */
- styleGroup = new Group (controlGroup, SWT.NULL);
- gridLayout = new GridLayout ();
- styleGroup.setLayout (gridLayout);
- gridLayout.numColumns = 2;
- gridLayout.makeColumnsEqualWidth = true;
- styleGroup.setLayoutData (new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- styleGroup.setText (ControlExample.getResourceString("Styles"));
-
- /* Create a group for the parent style controls */
- parentStyleGroup = new Group (styleGroup, SWT.NULL);
- parentStyleGroup.setLayout (new GridLayout ());
- GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- parentStyleGroup.setLayoutData (gridData);
- parentStyleGroup.setText (ControlExample.getResourceString("Parent"));
- }
-
- /**
- * Creates the "Control" widget children.
- */
- void createControlWidgets () {
-
- /* Create the parent style buttons */
- noParentButton = new Button (parentStyleGroup, SWT.RADIO);
- noParentButton.setText (ControlExample.getResourceString("No_Parent"));
- parentButton = new Button (parentStyleGroup, SWT.RADIO);
- parentButton.setText (ControlExample.getResourceString("Parent"));
-
- /* Create a group for the decoration style controls */
- Group decorationStyleGroup = new Group(styleGroup, SWT.NULL);
- decorationStyleGroup.setLayout (new GridLayout ());
- GridData gridData = new GridData (GridData.HORIZONTAL_ALIGN_FILL);
- gridData.verticalSpan = 2;
- decorationStyleGroup.setLayoutData (gridData);
- decorationStyleGroup.setText (ControlExample.getResourceString("Decoration_Styles"));
-
- /* Create the decoration style buttons */
- noTrimButton = new Button (decorationStyleGroup, SWT.CHECK);
- noTrimButton.setText ("SWT.NO_TRIM");
- closeButton = new Button (decorationStyleGroup, SWT.CHECK);
- closeButton.setText ("SWT.CLOSE");
- titleButton = new Button (decorationStyleGroup, SWT.CHECK);
- titleButton.setText ("SWT.TITLE");
- minButton = new Button (decorationStyleGroup, SWT.CHECK);
- minButton.setText ("SWT.MIN");
- maxButton = new Button (decorationStyleGroup, SWT.CHECK);
- maxButton.setText ("SWT.MAX");
- borderButton = new Button (decorationStyleGroup, SWT.CHECK);
- borderButton.setText ("SWT.BORDER");
- resizeButton = new Button (decorationStyleGroup, SWT.CHECK);
- resizeButton.setText ("SWT.RESIZE");
- onTopButton = new Button (decorationStyleGroup, SWT.CHECK);
- onTopButton.setText ("SWT.ON_TOP");
-
- /* Create a group for the modal style controls */
- modalStyleGroup = new Group (styleGroup, SWT.NONE);
- modalStyleGroup.setLayout (new GridLayout ());
- modalStyleGroup.setText (ControlExample.getResourceString("Modal_Styles"));
- gridData = new GridData ();
- gridData.verticalAlignment = GridData.FILL;
- modalStyleGroup.setLayoutData(gridData);
-
- /* Create the modal style buttons */
- modelessButton = new Button (modalStyleGroup, SWT.RADIO);
- modelessButton.setText ("SWT.MODELESS");
- primaryModalButton = new Button (modalStyleGroup, SWT.RADIO);
- primaryModalButton.setText ("SWT.PRIMARY_MODAL");
- applicationModalButton = new Button (modalStyleGroup, SWT.RADIO);
- applicationModalButton.setText ("SWT.APPLICATION_MODAL");
- systemModalButton = new Button (modalStyleGroup, SWT.RADIO);
- systemModalButton.setText ("SWT.SYSTEM_MODAL");
-
- /* Create the "create" and "closeAll" buttons */
- createButton = new Button (styleGroup, SWT.NULL);
- gridData = new GridData (GridData.HORIZONTAL_ALIGN_END);
- createButton.setLayoutData (gridData);
- createButton.setText (ControlExample.getResourceString("Create_Shell"));
- closeAllButton = new Button (styleGroup, SWT.NULL);
- gridData = new GridData (GridData.HORIZONTAL_ALIGN_BEGINNING);
- closeAllButton.setText (ControlExample.getResourceString("Close_All_Shells"));
- closeAllButton.setLayoutData (gridData);
-
- /* Add the listeners */
- createButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- createButtonSelected(e);
- };
- });
- closeAllButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- closeAllShells ();
- };
- });
- SelectionListener decorationButtonListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- decorationButtonSelected(event);
- };
- };
- noTrimButton.addSelectionListener (decorationButtonListener);
- closeButton.addSelectionListener (decorationButtonListener);
- titleButton.addSelectionListener (decorationButtonListener);
- minButton.addSelectionListener (decorationButtonListener);
- maxButton.addSelectionListener (decorationButtonListener);
- borderButton.addSelectionListener (decorationButtonListener);
- resizeButton.addSelectionListener (decorationButtonListener);
- applicationModalButton.addSelectionListener (decorationButtonListener);
- systemModalButton.addSelectionListener (decorationButtonListener);
-
- /* Set the default state */
- noParentButton.setSelection (true);
- modelessButton.setSelection (true);
- }
-
- /**
- * Handle a decoration button selection event.
- *
- * @param event org.eclipse.swt.events.SelectionEvent
- */
- public void decorationButtonSelected(SelectionEvent event) {
-
- /* Make sure if the modal style is SWT.APPLICATION_MODAL or
- * SWT.SYSTEM_MODAL the style SWT.CLOSE is also selected.
- * This is to make sure the user can close the shell.
- */
- Button widget = (Button) event.widget;
- if (widget == applicationModalButton || widget == systemModalButton) {
- if (widget.getSelection()) {
- closeButton.setSelection (true);
- noTrimButton.setSelection (false);
- }
- return;
- }
- if (widget == closeButton) {
- if (applicationModalButton.getSelection() || systemModalButton.getSelection()) {
- closeButton.setSelection (true);
- }
- }
- /*
- * Make sure if the No Trim button is selected then
- * all other decoration buttons are deselected.
- */
- if (widget.getSelection() && widget != noTrimButton) {
- noTrimButton.setSelection (false);
- return;
- }
- if (widget.getSelection() && widget == noTrimButton) {
- if (applicationModalButton.getSelection() || systemModalButton.getSelection()) {
- noTrimButton.setSelection (false);
- return;
- }
- closeButton.setSelection (false);
- titleButton.setSelection (false);
- minButton.setSelection (false);
- maxButton.setSelection (false);
- borderButton.setSelection (false);
- resizeButton.setSelection (false);
- return;
- }
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return "Shell";
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SliderTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SliderTab.java deleted file mode 100755 index 45ba2ecafd..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SliderTab.java +++ /dev/null @@ -1,253 +0,0 @@ -package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class SliderTab extends RangeTab {
- /* Example widgets and groups that contain them */
- Scale scale1;
- Slider slider1;
- Group sliderGroup, scaleGroup;
-
- /* Scale widgets added to the "Control" group */
- Scale incrementScale, pageIncrementScale, thumbScale;
-
- /* Flag for setting slider background color */
- boolean defaultColor = true;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- SliderTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Control" widget children.
- */
- void createControlWidgets () {
- super.createControlWidgets ();
- createThumbGroup ();
- createIncrementGroup ();
- createPageIncrementGroup ();
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the slider */
- sliderGroup = new Group (exampleGroup, SWT.NULL);
- sliderGroup.setLayout (new GridLayout ());
- sliderGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- sliderGroup.setText ("Slider");
-
- /* Create a group for the scale */
- scaleGroup = new Group (exampleGroup, SWT.NULL);
- scaleGroup.setLayout (new GridLayout ());
- scaleGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- scaleGroup.setText ("Scale");
-
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (horizontalButton.getSelection ()) style |= SWT.HORIZONTAL;
- if (verticalButton.getSelection ()) style |= SWT.VERTICAL;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- scale1 = new Scale (scaleGroup, style);
- scale1.setMaximum (100);
- scale1.setSelection (50);
- scale1.setIncrement (5);
- scale1.setPageIncrement (10);
- slider1 = new Slider(sliderGroup, style);
- slider1.setMaximum (100);
- slider1.setSelection (50);
- slider1.setIncrement(5);
- slider1.setPageIncrement (10);
- slider1.setThumb (10);
- }
-
- /**
- * Create a group of widgets to control the increment
- * attribute of the example widget.
- */
- void createIncrementGroup() {
-
- /* Create the group */
- Group incrementGroup = new Group (controlGroup, SWT.NULL);
- incrementGroup.setLayout (new GridLayout ());
- incrementGroup.setText (ControlExample.getResourceString("Increment"));
- incrementGroup.setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
-
- /* Create the scale widget */
- incrementScale = new Scale (incrementGroup, SWT.NULL);
- incrementScale.setMaximum (100);
- incrementScale.setSelection (5);
- incrementScale.setPageIncrement (10);
- incrementScale.setIncrement (5);
-
- GridData data = new GridData (GridData.FILL_HORIZONTAL);
- data.widthHint = 100;
- incrementScale.setLayoutData (data);
-
- /* Add the listeners */
- incrementScale.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent e) {
- setWidgetIncrement ();
- };
- });
- }
-
- /**
- * Create a group of widgets to control the page increment
- * attribute of the example widget.
- */
- void createPageIncrementGroup() {
-
- /* Create the group */
- Group pageIncrementGroup = new Group (controlGroup, SWT.NULL);
- pageIncrementGroup.setLayout (new GridLayout ());
- pageIncrementGroup.setText (ControlExample.getResourceString("Page_Increment"));
- pageIncrementGroup.setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
-
- /* Create the scale widget */
- pageIncrementScale = new Scale (pageIncrementGroup, SWT.NULL);
- pageIncrementScale.setMaximum (100);
- pageIncrementScale.setSelection (10);
- pageIncrementScale.setPageIncrement (10);
- pageIncrementScale.setIncrement (5);
-
- GridData data = new GridData (GridData.FILL_HORIZONTAL);
- data.widthHint = 100;
- pageIncrementScale.setLayoutData (data);
-
- /* Add the listeners */
- pageIncrementScale.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetPageIncrement ();
- }
- });
- }
-
- /**
- * Create a group of widgets to control the thumb
- * attribute of the example widget.
- */
- void createThumbGroup() {
-
- /* Create the group */
- Group thumbGroup = new Group (controlGroup, SWT.NULL);
- thumbGroup.setLayout (new GridLayout ());
- thumbGroup.setText (ControlExample.getResourceString("Thumb"));
- thumbGroup.setLayoutData (new GridData (GridData.FILL_HORIZONTAL));
-
- /* Create the scale widget */
- thumbScale = new Scale (thumbGroup, SWT.NULL);
- thumbScale.setMaximum (100);
- thumbScale.setSelection (10);
- thumbScale.setPageIncrement (10);
- thumbScale.setIncrement (5);
-
- GridData data = new GridData (GridData.FILL_HORIZONTAL);
- data.widthHint = 100;
- thumbScale.setLayoutData (data);
-
- /* Add the listeners */
- thumbScale.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetThumb ();
- };
- });
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {scale1, slider1};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlExample.getResourceString("Slider_and_Scale");
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- setWidgetIncrement ();
- setWidgetPageIncrement ();
- setWidgetThumb ();
- }
-
- /**
- * Sets the increment of the "Example" widgets.
- */
- void setWidgetIncrement () {
- slider1.setIncrement (incrementScale.getSelection ());
- scale1.setIncrement (incrementScale.getSelection ());
- }
-
- /**
- * Sets the minimim of the "Example" widgets.
- */
- void setWidgetMaximum () {
- slider1.setMaximum (maximumScale.getSelection ());
- scale1.setMaximum (maximumScale.getSelection ());
- }
-
- /**
- * Sets the minimim of the "Example" widgets.
- */
- void setWidgetMinimum () {
- slider1.setMinimum (minimumScale.getSelection ());
- scale1.setMinimum (minimumScale.getSelection ());
- }
-
- /**
- * Sets the page increment of the "Example" widgets.
- */
- void setWidgetPageIncrement () {
- slider1.setPageIncrement (pageIncrementScale.getSelection ());
- scale1.setPageIncrement (pageIncrementScale.getSelection ());
- }
-
- /**
- * Sets the selection of the "Example" widgets.
- */
- void setWidgetSelection () {
- slider1.setSelection (selectionScale.getSelection ());
- scale1.setSelection (selectionScale.getSelection ());
- }
-
- /**
- * Sets the thumb of the "Example" widgets.
- */
- void setWidgetThumb () {
- slider1.setThumb (thumbScale.getSelection ());
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java deleted file mode 100755 index 1c53bc8d69..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java +++ /dev/null @@ -1,521 +0,0 @@ -package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-/**
- * <code>Tab</code> is the abstract superclass of every page
- * in the example's tab folder. Each page in the tab folder
- * describes a control.
- *
- * A Tab itself is not a control but instead provides a
- * hierarchy with which to share code that is common to
- * every page in the folder.
- *
- * A typical page in a Tab contains a two column composite.
- * The left column contains the "Example" group. The right
- * column contains "Control" group. The "Control" group
- * contains controls that allow the user to interact with
- * the example control. The "Control" group typically
- * contains a "Style", "Display" and "Size" group. Subclasses
- * can override these defaults to augment a group or stop
- * a group from being created.
- */
-abstract class Tab {
- /* Common control buttons */
- Button borderButton, enabledButton, visibleButton;
- Button preferredButton, tooSmallButton, smallButton, largeButton, fillButton;
-
- /* Common groups and composites */
- Composite tabFolderPage;
- Group exampleGroup, controlGroup, displayGroup, sizeGroup, styleGroup, colorGroup;
-
- /* Controlling instance */
- final ControlExample instance;
-
- /* Sizing constants for the "Size" group */
- static final int TOO_SMALL_SIZE = 10;
- static final int SMALL_SIZE = 50;
- static final int LARGE_SIZE = 100;
-
- /* Common controls for the "Colors" group */
- Button backgroundButton, foregroundButton, fontButton;
- Color backgroundColor, foregroundColor;
- Font font;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- Tab(ControlExample instance) {
- this.instance = instance;
- }
-
- /**
- * Creates the "Control" group. The "Control" group
- * is typically the right hand column in the tab.
- */
- void createControlGroup () {
-
- /*
- * Create the "Control" group. This is the group on the
- * left half of each example tab. It consists of the
- * style group, the display group and the size group.
- */
- controlGroup = new Group (tabFolderPage, SWT.NONE);
- GridLayout gridLayout= new GridLayout ();
- controlGroup.setLayout (gridLayout);
- gridLayout.numColumns = 2;
- gridLayout.makeColumnsEqualWidth = true;
- controlGroup.setLayoutData (new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- controlGroup.setText (ControlExample.getResourceString("Parameters"));
-
- /* Create individual groups inside the "Control" group */
- createStyleGroup ();
- createDisplayGroup ();
- createSizeGroup ();
- createColorGroup ();
-
- /*
- * For each Button child in the style group, add a selection
- * listener that will recreate the example controls. If the
- * style group button is a RADIO button, ensure that the radio
- * button is selected before recreating the example controls.
- * When the user selects a RADIO button, the current RADIO
- * button in the group is deselected and the new RADIO button
- * is selected automatically. The listeners are notified for
- * both these operations but typically only do work when a RADIO
- * button is selected.
- */
- SelectionListener selectionListener = new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- if ((event.widget.getStyle () & SWT.RADIO) != 0) {
- if (!((Button) event.widget).getSelection ()) return;
- }
- recreateExampleWidgets ();
- };
- };
- Control [] children = styleGroup.getChildren ();
- for (int i=0; i<children.length; i++) {
- if (children [i] instanceof Button) {
- Button button = (Button) children [i];
- button.addSelectionListener (selectionListener);
- }
- }
- }
-
- /**
- * Creates the "Control" widget children.
- * Subclasses override this method to augment
- * the standard controls created in the "Style",
- * "Display" and "Size" groups.
- */
- void createControlWidgets () {
- }
-
- /**
- * Creates the "Color" group. This is typically
- * a child of the "Control" group. Subclasses override
- * this method to customize and set system colors.
- */
- void createColorGroup () {
- /* Create the group */
- colorGroup = new Group(controlGroup, SWT.NULL);
- colorGroup.setLayout (new GridLayout (2, false));
- colorGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- colorGroup.setText (ControlExample.getResourceString ("Colors"));
- new Label (colorGroup, SWT.NONE).setText (ControlExample.getResourceString ("Foreground_Color"));
- foregroundButton = new Button (colorGroup, SWT.PUSH);
- new Label (colorGroup, SWT.NONE).setText (ControlExample.getResourceString ("Background_Color"));
- backgroundButton = new Button (colorGroup, SWT.PUSH);
- fontButton = new Button (colorGroup, SWT.PUSH);
- fontButton.setText(ControlExample.getResourceString("Font"));
-
- Shell shell = backgroundButton.getShell ();
- final ColorDialog backgroundDialog = new ColorDialog (shell);
- final ColorDialog foregroundDialog = new ColorDialog (shell);
- final FontDialog fontDialog = new FontDialog (shell);
-
- /* Create images to display current colors */
- int imageSize = 12;
- Display display = shell.getDisplay ();
- final Image backgroundImage = new Image (display, imageSize, imageSize);
- final Image foregroundImage = new Image (display, imageSize, imageSize);
-
- /* Add listeners to set the colors and font */
- backgroundButton.setImage(backgroundImage);
- backgroundButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- RGB rgb = backgroundDialog.open();
- if (rgb == null) return;
- Color oldColor = backgroundColor;
- backgroundColor = new Color (backgroundButton.getDisplay(), rgb);
- setExampleWidgetBackground ();
- if (oldColor != null) oldColor.dispose ();
- }
- });
- foregroundButton.setImage(foregroundImage);
- foregroundButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- RGB rgb = foregroundDialog.open();
- if (rgb == null) return;
- Color oldColor = foregroundColor;
- foregroundColor = new Color (foregroundButton.getDisplay(), rgb);
- setExampleWidgetForeground ();
- if (oldColor != null) oldColor.dispose ();
- }
- });
- fontButton.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected (SelectionEvent e) {
- FontData fontData = fontDialog.open ();
- if (fontData == null) return;
- Font oldFont = font;
- font = new Font (fontButton.getDisplay(), fontData);
- setExampleWidgetFont ();
- setExampleWidgetSize ();
- if (oldFont != null) oldFont.dispose ();
- }
- });
- backgroundButton.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- if (backgroundImage != null) backgroundImage.dispose();
- if (foregroundImage != null) foregroundImage.dispose();
- if (backgroundColor != null) backgroundColor.dispose();
- if (foregroundColor != null) foregroundColor.dispose();
- if (font != null) font.dispose();
- backgroundColor = null;
- foregroundColor = null;
- font = null;
- }
- });
- }
-
- /**
- * Creates the "Display" group. This is typically
- * a child of the "Control" group.
- */
- void createDisplayGroup () {
- /* Create the group */
- displayGroup = new Group (controlGroup, SWT.NONE);
- displayGroup.setLayout (new GridLayout ());
- displayGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- displayGroup.setText (ControlExample.getResourceString("State"));
-
- /* Create the controls */
- enabledButton = new Button(displayGroup, SWT.CHECK);
- enabledButton.setText(ControlExample.getResourceString("Enabled"));
- visibleButton = new Button(displayGroup, SWT.CHECK);
- visibleButton.setText(ControlExample.getResourceString("Visible"));
-
- /* Add the listeners */
- enabledButton.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setExampleWidgetEnabled ();
- }
- });
- visibleButton.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setExampleWidgetVisibility ();
- }
- });
-
- /* Set the default state */
- enabledButton.setSelection(true);
- visibleButton.setSelection(true);
- }
-
- /**
- * Creates the "Example" group. The "Example" group
- * is typically the left hand column in the tab.
- */
- void createExampleGroup () {
- exampleGroup = new Group (tabFolderPage, SWT.NONE);
- GridLayout gridLayout = new GridLayout ();
- exampleGroup.setLayout (gridLayout);
- exampleGroup.setLayoutData (new GridData (GridData.FILL_BOTH));
- }
-
- /**
- * Creates the "Example" widget children of the "Example" group.
- * Subclasses override this method to create the particular
- * example control.
- */
- void createExampleWidgets () {
- /* Do nothing */
- }
-
- /**
- * Creates the "Size" group. The "Size" group contains
- * controls that allow the user to change the size of
- * the example widgets.
- */
- void createSizeGroup () {
- /* Create the group */
- sizeGroup = new Group (controlGroup, SWT.NONE);
- sizeGroup.setLayout (new GridLayout());
- sizeGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- sizeGroup.setText (ControlExample.getResourceString("Size"));
-
- /* Create the controls */
-
- /*
- * The preferred size of a widget is the size returned
- * by widget.computeSize (SWT.DEFAULT, SWT.DEFAULT).
- * This size is defined on a widget by widget basis.
- * Many widgets will attempt to display their contents.
- */
- preferredButton = new Button (sizeGroup, SWT.RADIO);
- preferredButton.setText (ControlExample.getResourceString("Preferred"));
- tooSmallButton = new Button (sizeGroup, SWT.RADIO);
- tooSmallButton.setText (TOO_SMALL_SIZE + " X " + TOO_SMALL_SIZE);
- smallButton = new Button(sizeGroup, SWT.RADIO);
- smallButton.setText (SMALL_SIZE + " X " + SMALL_SIZE);
- largeButton = new Button (sizeGroup, SWT.RADIO);
- largeButton.setText (LARGE_SIZE + " X " + LARGE_SIZE);
- fillButton = new Button (sizeGroup, SWT.RADIO);
- fillButton.setText (ControlExample.getResourceString("Fill"));
-
- /* Add the listeners */
- SelectionAdapter selectionListener = new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- if (!((Button) event.widget).getSelection ()) return;
- setExampleWidgetSize ();
- };
- };
- preferredButton.addSelectionListener(selectionListener);
- tooSmallButton.addSelectionListener(selectionListener);
- smallButton.addSelectionListener(selectionListener);
- largeButton.addSelectionListener(selectionListener);
- fillButton.addSelectionListener(selectionListener);
-
- /* Set the default state */
- preferredButton.setSelection (true);
- }
-
- /**
- * Creates the "Style" group. The "Style" group contains
- * controls that allow the user to change the style of
- * the example widgets. Changing a widget "Style" causes
- * the widget to be destroyed and recreated.
- */
- void createStyleGroup () {
- styleGroup = new Group (controlGroup, SWT.NONE);
- styleGroup.setLayout (new GridLayout ());
- styleGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- styleGroup.setText (ControlExample.getResourceString("Styles"));
- }
-
- /**
- * Creates the tab folder page.
- *
- * @param tabFolder org.eclipse.swt.widgets.TabFolder
- * @return the new page for the tab folder
- */
- Composite createTabFolderPage (TabFolder tabFolder) {
- /*
- * Create a two column page.
- */
- tabFolderPage = new Composite (tabFolder, SWT.NULL);
- GridLayout gridLayout = new GridLayout ();
- tabFolderPage.setLayout (gridLayout);
- gridLayout.numColumns = 2;
-
- /* Create the "Example" and "Control" columns */
- createExampleGroup ();
- createControlGroup ();
-
- /* Create the widgets in the two columns */
- createExampleWidgets ();
- createControlWidgets ();
- setExampleWidgetState ();
-
- return tabFolderPage;
- }
-
- /**
- * Disposes the "Example" widgets.
- */
- void disposeExampleWidgets () {
- Control [] controls = getExampleWidgets ();
- for (int i=0; i<controls.length; i++) {
- controls [i].dispose ();
- }
- }
-
- void drawImage (Image image, Color color) {
- GC gc = new GC(image);
- gc.setBackground(color);
- Rectangle bounds = image.getBounds();
- gc.fillRectangle(0, 0, bounds.width, bounds.height);
- gc.drawRectangle(0, 0, bounds.width - 1, bounds.height - 1);
- gc.dispose();
- }
-
- /**
- * Gets the "Example" widget children.
- *
- * @return an array of example widget children
- */
- Control [] getExampleWidgets () {
- return new Control [0];
- }
-
- /**
- * Gets the text for the tab folder item.
- *
- * @return the text for the tab item
- */
- String getTabText () {
- return "";
- }
-
- /**
- * Recreates the "Example" widgets.
- */
- void recreateExampleWidgets () {
- disposeExampleWidgets ();
- createExampleWidgets ();
- setExampleWidgetState ();
- }
-
- /**
- * Sets the background color of the "Example" widgets.
- */
- void setExampleWidgetBackground () {
- if (backgroundButton == null) return;
- Control [] controls = getExampleWidgets ();
- Color color = backgroundColor;
- if (color == null) color = controls [0].getBackground ();
- Image image = backgroundButton.getImage ();
- drawImage (image, color);
- backgroundButton.setImage (image);
- if (backgroundColor == null) return;
- for (int i = 0; i < controls.length; i++) { - Control control = controls[i]; - control.setBackground (backgroundColor);
- }
- }
-
- /**
- * Sets the enabled state of the "Example" widgets.
- */
- void setExampleWidgetEnabled () {
- Control [] controls = getExampleWidgets ();
- for (int i=0; i<controls.length; i++) {
- controls [i].setEnabled (enabledButton.getSelection ());
- }
- }
-
- /**
- * Sets the font of the "Example" widgets.
- */
- void setExampleWidgetFont () {
- if (font == null) return;
- Control [] controls = getExampleWidgets ();
- for (int i = 0; i < controls.length; i++) {
- Control control = controls[i];
- control.setFont(font);
- }
- }
-
- /**
- * Sets the foreground color of the "Example" widgets.
- */
- void setExampleWidgetForeground () {
- if (foregroundButton == null) return;
- Control [] controls = getExampleWidgets ();
- Color color = foregroundColor;
- if (color == null) color = controls [0].getForeground ();
- Image image = foregroundButton.getImage ();
- drawImage (image, color);
- foregroundButton.setImage (image);
- if (foregroundColor == null) return;
- for (int i = 0; i < controls.length; i++) {
- Control control = controls[i];
- control.setForeground (foregroundColor);
- }
- }
-
- /**
- * Sets the size of the "Example" widgets.
- */
- void setExampleWidgetSize () {
- int size = SWT.DEFAULT;
- if (preferredButton == null) return;
- if (preferredButton.getSelection()) size = SWT.DEFAULT;
- if (tooSmallButton.getSelection()) size = TOO_SMALL_SIZE;
- if (smallButton.getSelection()) size = SMALL_SIZE;
- if (largeButton.getSelection()) size = LARGE_SIZE;
- Control [] controls = getExampleWidgets ();
- for (int i=0; i<controls.length; i++) {
- GridData gridData;
- if (fillButton.getSelection()) {
- gridData = new GridData (GridData.FILL_BOTH);
- } else {
- gridData = new GridData ();
- gridData.widthHint = size;
- gridData.heightHint = size;
- }
- controls [i].setLayoutData (gridData);
- }
- /*
- * Force the entire widget tree to layout,
- * even when the child sizes may not have
- * changed.
- */
- int seenCount = 0;
- Composite [] seen = new Composite [4];
- for (int i=0; i<controls.length; i++) {
- Control control = controls [i];
- while (control != exampleGroup) {
- Composite parent = control.getParent ();
- int index = 0;
- while (index < seenCount) {
- if (seen [index] == parent) break;
- index++;
- }
- if (index == seenCount) parent.layout ();
- if (seenCount == seen.length) {
- Composite [] newSeen = new Composite [seen.length + 4];
- System.arraycopy (seen, 0, newSeen, 0, seen.length);
- seen = newSeen;
- }
- seen [seenCount++] = parent;
- control = control.getParent ();
- }
- }
- }
-
- /**
- * Sets the state of the "Example" widgets. Subclasses
- * reimplement this method to set "Example" widget state
- * that is specific to the widget.
- */
- void setExampleWidgetState () {
- setExampleWidgetEnabled ();
- setExampleWidgetVisibility ();
- setExampleWidgetBackground ();
- setExampleWidgetForeground ();
- setExampleWidgetFont ();
- setExampleWidgetSize ();
- }
-
- /**
- * Sets the visibility of the "Example" widgets.
- */
- void setExampleWidgetVisibility () {
- Control [] controls = getExampleWidgets ();
- for (int i=0; i<controls.length; i++) {
- controls [i].setVisible (visibleButton.getSelection ());
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java deleted file mode 100755 index 5be8d9d83c..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java +++ /dev/null @@ -1,290 +0,0 @@ -package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class TableTab extends ScrollableTab {
- /* Example widgets and groups that contain them */
- Table table1;
- Group tableGroup, tableItemGroup;
-
- /* Style widgets added to the "Style" group */
- Button checkButton, fullSelectionButton;
-
- /* Display widgets added to the "Display" group */
- Button headerVisibleButton, linesVisibleButton;
-
- /* Color widgets added to the "Color" group */
- Button itemBackgroundButton, itemForegroundButton;
- Color itemBackgroundColor, itemForegroundColor;
-
- static String [] columnTitles = {ControlExample.getResourceString("TableTitle_0"),
- ControlExample.getResourceString("TableTitle_1"),
- ControlExample.getResourceString("TableTitle_2"),
- ControlExample.getResourceString("TableTitle_3")};
-
- static String [] stringLine0 = {ControlExample.getResourceString("TableLine0_0"),
- ControlExample.getResourceString("TableLine0_1"),
- ControlExample.getResourceString("TableLine0_2"),
- ControlExample.getResourceString("TableLine0_3")};
-
- static String [] stringLine1 = {ControlExample.getResourceString("TableLine1_0"),
- ControlExample.getResourceString("TableLine1_1"),
- ControlExample.getResourceString("TableLine1_2"),
- ControlExample.getResourceString("TableLine1_3")};
-
- static String [] stringLine2 = {ControlExample.getResourceString("TableLine2_0"),
- ControlExample.getResourceString("TableLine2_1"),
- ControlExample.getResourceString("TableLine2_2"),
- ControlExample.getResourceString("TableLine2_3")};
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- TableTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Colors" group.
- */
- void createColorGroup () {
- super.createColorGroup();
-
- tableItemGroup = new Group (colorGroup, SWT.NONE);
- tableItemGroup.setText (ControlExample.getResourceString ("Item_Colors"));
- GridData data = new GridData ();
- data.horizontalSpan = 2;
- tableItemGroup.setLayoutData (data);
- tableItemGroup.setLayout (new GridLayout (2, false));
- new Label (tableItemGroup, SWT.NONE).setText (ControlExample.getResourceString ("Item_Foreground_Color"));
- itemForegroundButton = new Button (tableItemGroup, SWT.PUSH);
- new Label (tableItemGroup, SWT.NONE).setText (ControlExample.getResourceString ("Item_Background_Color"));
- itemBackgroundButton = new Button (tableItemGroup, SWT.PUSH);
-
- Shell shell = itemBackgroundButton.getShell ();
- final ColorDialog backgroundDialog = new ColorDialog (shell);
- final ColorDialog foregroundDialog = new ColorDialog (shell);
-
- int imageSize = 12;
- Display display = shell.getDisplay ();
- final Image itemBackgroundImage = new Image(display, imageSize, imageSize);
- final Image itemForegroundImage = new Image(display, imageSize, imageSize);
-
- /* Add listeners to set the colors and font */
- itemBackgroundButton.setImage(itemBackgroundImage);
- itemBackgroundButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- RGB rgb = backgroundDialog.open();
- if (rgb == null) return;
- Color oldColor = itemBackgroundColor;
- itemBackgroundColor = new Color (itemBackgroundButton.getDisplay(), rgb);
- setItemsBackground ();
- if (oldColor != null) oldColor.dispose ();
- }
- });
- itemForegroundButton.setImage(itemForegroundImage);
- itemForegroundButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- RGB rgb = foregroundDialog.open();
- if (rgb == null) return;
- Color oldColor = itemForegroundColor;
- itemForegroundColor = new Color (itemForegroundButton.getDisplay(), rgb);
- setItemsForeground ();
- if (oldColor != null) oldColor.dispose ();
- }
- });
- itemBackgroundButton.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- if (itemBackgroundImage != null) itemBackgroundImage.dispose();
- if (itemForegroundImage != null) itemForegroundImage.dispose();
- if (itemBackgroundColor != null) itemBackgroundColor.dispose();
- if (itemForegroundColor != null) itemForegroundColor.dispose();
- itemBackgroundColor = null;
- itemForegroundColor = null;
- }
- });
- }
-
- /**
- * Creates the "Display" group.
- */
- void createDisplayGroup () {
- super.createDisplayGroup ();
-
- /* Create display controls specific to this example */
- headerVisibleButton = new Button (displayGroup, SWT.CHECK);
- headerVisibleButton.setText (ControlExample.getResourceString("Header_Visible"));
- linesVisibleButton = new Button (displayGroup, SWT.CHECK);
- linesVisibleButton.setText (ControlExample.getResourceString("Lines_Visible"));
-
- /* Add the listeners */
- headerVisibleButton.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetHeaderVisible ();
- }
- });
- linesVisibleButton.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetLinesVisible ();
- };
- });
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the table */
- tableGroup = new Group (exampleGroup, SWT.NULL);
- tableGroup.setLayout (new GridLayout ());
- tableGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- tableGroup.setText ("Table");
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
- /* Compute the widget style */
- int style = SWT.NONE;
- if (singleButton.getSelection ()) style |= SWT.SINGLE;
- if (multiButton.getSelection ()) style |= SWT.MULTI;
- if (verticalButton.getSelection ()) style |= SWT.V_SCROLL;
- if (horizontalButton.getSelection ()) style |= SWT.H_SCROLL;
- if (checkButton.getSelection ()) style |= SWT.CHECK;
- if (fullSelectionButton.getSelection ()) style |= SWT.FULL_SELECTION;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the table widget */
- table1 = new Table (tableGroup, style);
-
- /* Fill the table with data */
- for (int i = 0; i < columnTitles.length; i++) {
- TableColumn tableColumn = new TableColumn(table1, SWT.NULL);
- tableColumn.setText(columnTitles[i]);
- }
- for (int i=0; i<16; i++) {
- TableItem item = new TableItem (table1, SWT.NULL);
- item.setImage (instance.images [i % 3]);
- switch (i % 3) {
- case 0:
- stringLine0 [0] = ControlExample.getResourceString("Index") + i;
- item.setText(stringLine0);
- break;
- case 1:
- stringLine1 [0] = ControlExample.getResourceString("Index") + i;
- item.setText(stringLine1);
- break;
- case 2:
- stringLine2 [0] = ControlExample.getResourceString("Index") + i;
- item.setText(stringLine2);
- break;
- }
- }
- for (int i = 0; i < columnTitles.length; i++) {
- TableColumn tableColumn = table1.getColumn(i);
- tableColumn.pack();
- }
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- checkButton = new Button (styleGroup, SWT.CHECK);
- checkButton.setText ("SWT.CHECK");
- fullSelectionButton = new Button (styleGroup, SWT.CHECK);
- fullSelectionButton.setText ("SWT.FULL_SELECTION");
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {table1};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return "Table";
- }
-
- /**
- * Sets the background color of the TableItems.
- */
- void setItemsBackground () {
- if (itemBackgroundButton == null) return;
- Color color = itemBackgroundColor;
- if (color == null) color = table1.getItem (0).getBackground ();
- Image image = itemBackgroundButton.getImage ();
- drawImage (image, color);
- itemBackgroundButton.setImage (image);
- if (itemBackgroundColor == null) return;
- TableItem [] items = table1.getSelection ();
- for (int i = 0; i < items.length; i++) {
- items [i].setBackground (itemBackgroundColor);
- }
- }
-
- /**
- * Sets the foreground color of the TableItems.
- */
- void setItemsForeground () {
- if (itemForegroundButton == null) return;
- Color color = itemForegroundColor;
- if (color == null) color = table1.getItem (0).getForeground ();
- Image image = itemForegroundButton.getImage ();
- drawImage (image, color);
- itemForegroundButton.setImage (image);
- if (itemForegroundColor == null) return;
- TableItem [] items = table1.getSelection ();
- for (int i = 0; i < items.length; i++) {
- items [i].setForeground (itemForegroundColor);
- }
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- setItemsBackground ();
- setItemsForeground ();
- setWidgetHeaderVisible ();
- setWidgetLinesVisible ();
- checkButton.setSelection ((table1.getStyle () & SWT.CHECK) != 0);
- fullSelectionButton.setSelection ((table1.getStyle () & SWT.FULL_SELECTION) != 0);
- }
-
- /**
- * Sets the header visible state of the "Example" widgets.
- */
- void setWidgetHeaderVisible () {
- table1.setHeaderVisible (headerVisibleButton.getSelection ());
- }
-
- /**
- * Sets the lines visible state of the "Example" widgets.
- */
- void setWidgetLinesVisible () {
- table1.setLinesVisible (linesVisibleButton.getSelection ());
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TextTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TextTab.java deleted file mode 100755 index ed84770e33..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TextTab.java +++ /dev/null @@ -1,219 +0,0 @@ -package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.custom.*;
-
-class TextTab extends ScrollableTab {
- /* Example widgets and groups that contain them */
- Text text;
- StyledText styledText;
- Group textGroup, styledTextGroup, styledTextStyleGroup;
-
- /* Style widgets added to the "Style" group */
- Button wrapButton, readOnlyButton;
-
- /* Buttons for adding StyleRanges to StyledText */
- Button boldButton, redButton, yellowButton;
- Image boldImage, redImage, yellowImage;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- TextTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates a bitmap image.
- */
- Image createBitmapImage (Display display, String name) {
- ImageData source = new ImageData(ControlExample.class.getResourceAsStream(name + ".bmp"));
- ImageData mask = new ImageData(ControlExample.class.getResourceAsStream(name + "_mask.bmp"));
- return new Image (display, source, mask);
- }
-
- /**
- * Creates the "Control" widget children.
- */
- void createControlWidgets () {
- super.createControlWidgets ();
-
- /* Add a group for modifying the StyledText widget */
- createStyledTextStyleGroup ();
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the text widget */
- textGroup = new Group (exampleGroup, SWT.NULL);
- textGroup.setLayout (new GridLayout ());
- textGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- textGroup.setText ("Text");
-
- /* Create a group for the styled text widget */
- styledTextGroup = new Group (exampleGroup, SWT.NULL);
- styledTextGroup.setLayout (new GridLayout ());
- styledTextGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- styledTextGroup.setText ("StyledText");
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (singleButton.getSelection ()) style |= SWT.SINGLE;
- if (multiButton.getSelection ()) style |= SWT.MULTI;
- if (horizontalButton.getSelection ()) style |= SWT.H_SCROLL;
- if (verticalButton.getSelection ()) style |= SWT.V_SCROLL;
- if (wrapButton.getSelection ()) style |= SWT.WRAP;
- if (readOnlyButton.getSelection ()) style |= SWT.READ_ONLY;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- text = new Text (textGroup, style);
- text.setText (ControlExample.getResourceString("Example_string") + text.DELIMITER + ControlExample.getResourceString("One_Two_Three"));
- styledText = new StyledText (styledTextGroup, style);
- styledText.setText (ControlExample.getResourceString("Example_string"));
- styledText.append ("\n");
- styledText.append (ControlExample.getResourceString("One_Two_Three"));
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup();
-
- /* Create the extra widgets */
- wrapButton = new Button (styleGroup, SWT.CHECK);
- wrapButton.setText ("SWT.WRAP");
- readOnlyButton = new Button (styleGroup, SWT.CHECK);
- readOnlyButton.setText ("SWT.READ_ONLY");
- }
-
- /**
- * Creates the "StyledText Style" group.
- */
- void createStyledTextStyleGroup () {
- final Display display = controlGroup.getDisplay ();
- styledTextStyleGroup = new Group (controlGroup, SWT.NONE);
- styledTextStyleGroup.setText (ControlExample.getResourceString ("StyledText_Styles"));
- styledTextStyleGroup.setLayout (new GridLayout(2, false));
- styledTextStyleGroup.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_FILL));
-
- /* Get images */
- boldImage = createBitmapImage (display, "bold");
- redImage = createBitmapImage (display, "red");
- yellowImage = createBitmapImage (display, "yellow");
-
- /* Create controls to modify the StyledText */
- Label label = new Label (styledTextStyleGroup, SWT.NONE);
- label.setText (ControlExample.getResourceString ("StyledText_Style_Instructions"));
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- label.setLayoutData(data);
- new Label (styledTextStyleGroup, SWT.NONE).setText (ControlExample.getResourceString ("Bold"));
- boldButton = new Button (styledTextStyleGroup, SWT.PUSH);
- boldButton.setImage (boldImage);
- boldButton.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected (SelectionEvent e) {
- Point sel = styledText.getSelectionRange();
- if ((sel == null) || (sel.y == 0)) return;
- StyleRange style;
- for (int i = sel.x; i<sel.x+sel.y; i++) {
- StyleRange range = styledText.getStyleRangeAtOffset(i);
- if (range == null) {style = new StyleRange(i, 1, null, null, SWT.BOLD);}
- else {style = new StyleRange(i, 1, range.foreground, range.background, SWT.BOLD);};
- styledText.setStyleRange(style);
- }
- styledText.setSelectionRange(sel.x + sel.y, 0);
- }
- });
- new Label (styledTextStyleGroup, SWT.NONE).setText (ControlExample.getResourceString ("Foreground_Style"));
- redButton = new Button (styledTextStyleGroup, SWT.PUSH);
- redButton.setImage (redImage);
- new Label (styledTextStyleGroup, SWT.NONE).setText (ControlExample.getResourceString ("Background_Style"));
- yellowButton = new Button (styledTextStyleGroup, SWT.PUSH);
- yellowButton.setImage (yellowImage);
- SelectionListener colorListener = new SelectionAdapter () {
- public void widgetSelected (SelectionEvent e) {
- Point sel = styledText.getSelectionRange();
- if ((sel == null) || (sel.y == 0)) return;
- Color fg, bg;
- if (e.widget == redButton) {
- fg = display.getSystemColor (SWT.COLOR_RED);
- bg = null;
- } else if (e.widget == yellowButton) {
- fg = null;
- bg = display.getSystemColor (SWT.COLOR_YELLOW);
- } else {
- fg = bg = null;
- }
- StyleRange style;
- for (int i = sel.x; i<sel.x+sel.y; i++) {
- StyleRange range = styledText.getStyleRangeAtOffset(i);
- if (range == null) {
- style = new StyleRange(i, 1, fg, bg, SWT.NORMAL);
- }
- else {
- if (range.foreground != null) fg = range.foreground;
- if (range.background != null) bg = range.background;
- style = new StyleRange(i, 1, fg, bg, range.fontStyle);
- };
- styledText.setStyleRange(style);
- }
- styledText.setSelectionRange(sel.x + sel.y, 0);
- };
- };
- redButton.addSelectionListener(colorListener);
- yellowButton.addSelectionListener(colorListener);
- yellowButton.addDisposeListener(new DisposeListener () {
- public void widgetDisposed (DisposeEvent e) {
- boldImage.dispose();
- redImage.dispose();
- yellowImage.dispose();
- }
- });
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {text, styledText};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return "Text";
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- wrapButton.setSelection ((text.getStyle () & SWT.WRAP) != 0);
- readOnlyButton.setSelection ((text.getStyle () & SWT.READ_ONLY) != 0);
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ToolBarTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ToolBarTab.java deleted file mode 100755 index 0f840cd90f..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ToolBarTab.java +++ /dev/null @@ -1,248 +0,0 @@ -package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class ToolBarTab extends Tab {
- /* Example widgets and groups that contain them */
- ToolBar imageToolBar, textToolBar;
- Group imageToolBarGroup, textToolBarGroup;
-
- /* Style widgets added to the "Style" group */
- Button flatButton, wrapButton;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ToolBarTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the image tool bar */
- imageToolBarGroup = new Group (exampleGroup, SWT.NULL);
- imageToolBarGroup.setLayout (new GridLayout ());
- imageToolBarGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- imageToolBarGroup.setText (ControlExample.getResourceString("Image_ToolBar"));
-
- /* Create a group for the text tool bar */
- textToolBarGroup = new Group (exampleGroup, SWT.NULL);
- textToolBarGroup.setLayout (new GridLayout ());
- textToolBarGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- textToolBarGroup.setText (ControlExample.getResourceString("Text_ToolBar"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (flatButton.getSelection()) style |= SWT.FLAT;
- if (wrapButton.getSelection()) style |= SWT.WRAP;
- if (borderButton.getSelection()) style |= SWT.BORDER;
-
- /*
- * Create the example widgets.
- *
- * A tool bar must consist of all image tool
- * items or all text tool items but not both.
- */
-
- /* Create the image tool bar */
- imageToolBar = new ToolBar (imageToolBarGroup, style);
- ToolItem item = new ToolItem (imageToolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText("SWT.PUSH");
- item = new ToolItem (imageToolBar, SWT.PUSH);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText ("SWT.PUSH");
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciOpenFolder]);
- item.setToolTipText ("SWT.RADIO");
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciOpenFolder]);
- item.setToolTipText ("SWT.RADIO");
- item = new ToolItem (imageToolBar, SWT.CHECK);
- item.setImage (instance.images[ControlExample.ciTarget]);
- item.setToolTipText ("SWT.CHECK");
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText ("SWT.RADIO");
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (instance.images[ControlExample.ciClosedFolder]);
- item.setToolTipText ("SWT.RADIO");
- item = new ToolItem (imageToolBar, SWT.SEPARATOR);
- item.setToolTipText("SWT.SEPARATOR");
- item = new ToolItem (imageToolBar, SWT.DROP_DOWN);
- item.setImage (instance.images[ControlExample.ciTarget]);
- item.setToolTipText ("SWT.DROP_DOWN");
- item.addSelectionListener(new DropDownSelectionListener());
-
- /* Create the text tool bar */
- textToolBar = new ToolBar (textToolBarGroup, style);
- item = new ToolItem (textToolBar, SWT.PUSH);
- item.setText (ControlExample.getResourceString("Push"));
- item.setToolTipText("SWT.PUSH");
- item = new ToolItem (textToolBar, SWT.PUSH);
- item.setText (ControlExample.getResourceString("Push"));
- item.setToolTipText("SWT.PUSH");
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (ControlExample.getResourceString("Radio"));
- item.setToolTipText("SWT.RADIO");
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (ControlExample.getResourceString("Radio"));
- item.setToolTipText("SWT.RADIO");
- item = new ToolItem (textToolBar, SWT.CHECK);
- item.setText (ControlExample.getResourceString("Check"));
- item.setToolTipText("SWT.CHECK");
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (ControlExample.getResourceString("Radio"));
- item.setToolTipText("SWT.RADIO");
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (ControlExample.getResourceString("Radio"));
- item.setToolTipText("SWT.RADIO");
- item = new ToolItem (textToolBar, SWT.SEPARATOR);
- item.setToolTipText("SWT.SEPARATOR");
- item = new ToolItem (textToolBar, SWT.DROP_DOWN);
- item.setText (ControlExample.getResourceString("Drop_Down"));
- item.setToolTipText("SWT.DROP_DOWN");
- item.addSelectionListener(new DropDownSelectionListener());
-
- /*
- * Do not add the selection event for this drop down
- * tool item. Without hooking the event, the drop down
- * widget does nothing special when the drop down area
- * is selected.
- */
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup();
-
- /* Create the extra widgets */
- flatButton = new Button (styleGroup, SWT.CHECK);
- flatButton.setText ("SWT.FLAT");
- wrapButton = new Button (styleGroup, SWT.CHECK);
- wrapButton.setText ("SWT.WRAP");
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText ("SWT.BORDER");
- }
-
- void disposeExampleWidgets () {
- super.disposeExampleWidgets ();
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {imageToolBar, textToolBar};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return "ToolBar";
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- flatButton.setSelection ((imageToolBar.getStyle () & SWT.FLAT) != 0);
- wrapButton.setSelection ((imageToolBar.getStyle () & SWT.WRAP) != 0);
- borderButton.setSelection ((imageToolBar.getStyle () & SWT.BORDER) != 0);
- }
-
- /**
- * Listens to widgetSelected() events on SWT.DROP_DOWN type ToolItems
- * and opens/closes a menu when appropriate.
- */
- class DropDownSelectionListener extends SelectionAdapter {
- private Menu menu = null;
- private boolean visible = false;
-
- public void widgetSelected(SelectionEvent event) {
- // Create the menu if it has not already been created
- if (menu == null) {
- // Lazy create the menu.
- Shell shell = tabFolderPage.getShell();
- menu = new Menu(shell);
- for (int i = 0; i < 9; ++i) {
- final String text = ControlExample.getResourceString("DropDownData_" + i);
- if (text.length() != 0) {
- MenuItem menuItem = new MenuItem(menu, SWT.NONE);
- menuItem.setText(text);
- /*
- * Add a menu selection listener so that the menu is hidden
- * when the user selects an item from the drop down menu.
- */
- menuItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setMenuVisible(false);
- }
- });
- } else {
- MenuItem menuItem = new MenuItem(menu, SWT.SEPARATOR);
- }
- }
- }
-
- /**
- * A selection event will be fired when a drop down tool
- * item is selected in the main area and in the drop
- * down arrow. Examine the event detail to determine
- * where the widget was selected.
- */
- if (event.detail == SWT.ARROW) {
- /*
- * The drop down arrow was selected.
- */
- if (visible) {
- // Hide the menu to give the Arrow the appearance of being a toggle button.
- setMenuVisible(false);
- } else {
- // Position the menu below and vertically aligned with the the drop down tool button.
- final ToolItem toolItem = (ToolItem) event.widget;
- final ToolBar toolBar = toolItem.getParent();
-
- Rectangle toolItemBounds = toolItem.getBounds();
- Point point = toolBar.toDisplay(new Point(toolItemBounds.x, toolItemBounds.y));
- menu.setLocation(point.x, point.y + toolItemBounds.height);
- setMenuVisible(true);
- }
- } else {
- /*
- * Main area of drop down tool item selected.
- * An application would invoke the code to perform the action for the tool item.
- */
- }
- }
- private void setMenuVisible(boolean visible) {
- menu.setVisible(visible);
- this.visible = visible;
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java deleted file mode 100755 index 5a1d224198..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java +++ /dev/null @@ -1,138 +0,0 @@ -package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-class TreeTab extends ScrollableTab {
- /* Example widgets and groups that contain them */
- Tree tree1, tree2;
- Group treeGroup, imageTreeGroup;
-
- /* Style widgets added to the "Style" group */
- Button checkButton;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- TreeTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the text tree */
- treeGroup = new Group (exampleGroup, SWT.NULL);
- treeGroup.setLayout (new GridLayout ());
- treeGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- treeGroup.setText ("Tree");
-
- /* Create a group for the image tree */
- imageTreeGroup = new Group (exampleGroup, SWT.NULL);
- imageTreeGroup.setLayout (new GridLayout ());
- imageTreeGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- imageTreeGroup.setText (ControlExample.getResourceString("Tree_With_Images"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
- /* Compute the widget style */
- int style = SWT.NONE;
- if (singleButton.getSelection()) style |= SWT.SINGLE;
- if (multiButton.getSelection()) style |= SWT.MULTI;
- if (checkButton.getSelection()) style |= SWT.CHECK;
- if (borderButton.getSelection()) style |= SWT.BORDER;
-
- /* Create the text tree */
- tree1 = new Tree (treeGroup, style);
- TreeItem node1 = new TreeItem (tree1, SWT.NULL);
- node1.setText (ControlExample.getResourceString("Node_1"));
- TreeItem node2 = new TreeItem (tree1, SWT.NULL);
- node2.setText (ControlExample.getResourceString("Node_2"));
- TreeItem node3 = new TreeItem (tree1, SWT.NULL);
- node3.setText (ControlExample.getResourceString("Node_3"));
- TreeItem node4 = new TreeItem (tree1, SWT.NULL);
- node4.setText (ControlExample.getResourceString("Node_4"));
- TreeItem node1_1 = new TreeItem (node1, SWT.NULL);
- node1_1.setText (ControlExample.getResourceString("Node_1_1"));
- TreeItem node2_1 = new TreeItem (node2, SWT.NULL);
- node2_1.setText (ControlExample.getResourceString("Node_2_1"));
- TreeItem node3_1 = new TreeItem (node3, SWT.NULL);
- node3_1.setText (ControlExample.getResourceString("Node_3_1"));
- TreeItem node2_2 = new TreeItem (node2, SWT.NULL);
- node2_2.setText (ControlExample.getResourceString("Node_2_2"));
- TreeItem node2_2_1 = new TreeItem (node2_2, SWT.NULL);
- node2_2_1.setText (ControlExample.getResourceString("Node_2_2_1"));
-
- /* Create the image tree */
- tree2 = new Tree (imageTreeGroup, style);
- node1 = new TreeItem (tree2, SWT.NULL);
- node1.setText (ControlExample.getResourceString("Node_1"));
- node1.setImage (instance.images[ControlExample.ciClosedFolder]);
- node2 = new TreeItem (tree2, SWT.NULL);
- node2.setText (ControlExample.getResourceString("Node_2"));
- node2.setImage (instance.images[ControlExample.ciClosedFolder]);
- node3 = new TreeItem (tree2, SWT.NULL);
- node3.setText (ControlExample.getResourceString("Node_3"));
- node3.setImage (instance.images[ControlExample.ciClosedFolder]);
- node4 = new TreeItem (tree2, SWT.NULL);
- node4.setText (ControlExample.getResourceString("Node_4"));
- node4.setImage (instance.images[ControlExample.ciClosedFolder]);
- node1_1 = new TreeItem (node1, SWT.NULL);
- node1_1.setText (ControlExample.getResourceString("Node_1_1"));
- node1_1.setImage (instance.images[ControlExample.ciClosedFolder]);
- node2_1 = new TreeItem (node2, SWT.NULL);
- node2_1.setText (ControlExample.getResourceString("Node_2_1"));
- node2_1.setImage (instance.images[ControlExample.ciClosedFolder]);
- node3_1 = new TreeItem (node3, SWT.NULL);
- node3_1.setText (ControlExample.getResourceString("Node_3_1"));
- node3_1.setImage (instance.images[ControlExample.ciClosedFolder]);
- node2_2 = new TreeItem(node2, SWT.NULL);
- node2_2.setText (ControlExample.getResourceString("Node_2_2"));
- node2_2.setImage (instance.images[ControlExample.ciClosedFolder]);
- node2_2_1 = new TreeItem (node2_2, SWT.NULL);
- node2_2_1.setText (ControlExample.getResourceString("Node_2_2_1"));
- node2_2_1.setImage (instance.images[ControlExample.ciClosedFolder]);
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup();
-
- /* Create the extra widgets */
- checkButton = new Button (styleGroup, SWT.CHECK);
- checkButton.setText ("SWT.CHECK");
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {tree1, tree2};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return "Tree";
- }
-
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/bold.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/bold.bmp Binary files differdeleted file mode 100644 index a3184bb26c..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/bold.bmp +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/bold_mask.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/bold_mask.bmp Binary files differdeleted file mode 100644 index 382751efa3..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/bold_mask.bmp +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/closedFolder.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/closedFolder.gif Binary files differdeleted file mode 100644 index 6660d0b11a..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/closedFolder.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/openFolder.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/openFolder.gif Binary files differdeleted file mode 100644 index fc9943f111..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/openFolder.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/red.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/red.bmp Binary files differdeleted file mode 100644 index 88c63be336..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/red.bmp +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/red_mask.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/red_mask.bmp Binary files differdeleted file mode 100644 index 6ce92645e5..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/red_mask.bmp +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/target.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/target.gif Binary files differdeleted file mode 100644 index 9807ae648d..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/target.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/yellow.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/yellow.bmp Binary files differdeleted file mode 100644 index 631d0690fa..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/yellow.bmp +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/yellow_mask.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/yellow_mask.bmp Binary files differdeleted file mode 100644 index 6ce92645e5..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/yellow_mask.bmp +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java deleted file mode 100755 index 110afa14a0..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java +++ /dev/null @@ -1,1734 +0,0 @@ -package org.eclipse.swt.examples.fileviewer;
-
/*
- * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.program.*;
-import org.eclipse.swt.widgets.*;
-
-import java.io.*;
-import java.text.*;
-import java.util.*;
-
/**
- * File Viewer example
- */
-public class FileViewer {
- private static ResourceBundle resourceBundle = ResourceBundle.getBundle("examples_fileviewer");
-
private final static String DRIVE_A = "a:" + File.separator;
- private final static String DRIVE_B = "b:" + File.separator;
-
- /* UI elements */
- private Display display;
- private Shell shell;
- private ToolBar toolBar;
-
- private Label numObjectsLabel;
- private Label diskSpaceLabel;
-
- private File currentDirectory = null;
- private boolean initial = true;
-
- /* Drag and drop optimizations */
- private boolean isDragging = false; // if this app is dragging
- private boolean isDropping = false; // if this app is dropping
-
- private File[] processedDropFiles = null; // so Drag only deletes what it needs to
- private File[] deferredRefreshFiles = null; // to defer notifyRefreshFiles while we do DND
- private boolean deferredRefreshRequested = false; // to defer notifyRefreshFiles while we do DND
- private ProgressDialog progressDialog = null; // progress dialog for locally-initiated operations
-
- /* Combo view */
- private static final String COMBODATA_ROOTS = "Combo.roots";
- // File[]: Array of files whose paths are currently displayed in the combo
- private static final String COMBODATA_LASTTEXT = "Combo.lastText";
- // String: Previous selection text string
-
- private Combo combo;
-
- /* Tree view */
- private IconCache iconCache = new IconCache();
- private static final String TREEITEMDATA_FILE = "TreeItem.file";
- // File: File associated with tree item
- private static final String TREEITEMDATA_IMAGEEXPANDED = "TreeItem.imageExpanded";
- // Image: shown when item is expanded
- private static final String TREEITEMDATA_IMAGECOLLAPSED = "TreeItem.imageCollapsed";
- // Image: shown when item is collapsed
- private static final String TREEITEMDATA_STUB = "TreeItem.stub";
- // Object: if not present or null then the item has not been populated
-
- private Tree tree;
- private Label treeScopeLabel;
-
- /* Table view */
- private static final DateFormat dateFormat = DateFormat.getDateTimeInstance(
- DateFormat.MEDIUM, DateFormat.MEDIUM);
- private static final String TABLEITEMDATA_FILE = "TableItem.file";
- // File: File associated with table row
- private static final String TABLEDATA_DIR = "Table.dir";
- // File: Currently visible directory
- private static final int[] tableWidths = new int[] {150, 60, 75, 150};
- private final String[] tableTitles = new String [] {
- FileViewer.getResourceString("table.Name.title"),
- FileViewer.getResourceString("table.Size.title"),
- FileViewer.getResourceString("table.Type.title"),
- FileViewer.getResourceString("table.Modified.title")
- };
- private Table table;
- private Label tableContentsOfLabel;
-
- /* Table update worker */
- // Control data
- private final Object workerLock = new Object();
- // Lock for all worker control data and state
- private volatile Thread workerThread = null;
- // The worker's thread
- private volatile boolean workerStopped = false;
- // True if the worker must exit on completion of the current cycle
- private volatile boolean workerCancelled = false;
- // True if the worker must cancel its operations prematurely perhaps due to a state update
-
- // Worker state information -- this is what gets synchronized by an update
- private volatile File workerStateDir = null;
-
- // State information to use for the next cycle
- private volatile File workerNextDir = null;
-
- /* Simulate only flag */
- // when true, disables actual filesystem manipulations and outputs results to standard out
- private boolean simulateOnly = true;
-
- /**
- * Runs main program.
- */
- public static void main (String [] args) {
- Display display = new Display ();
- FileViewer application = new FileViewer();
- Shell shell = application.open(display);
- while (! shell.isDisposed()) {
- if (! display.readAndDispatch()) display.sleep();
- }
- display.dispose();
- }
-
- /**
- * Opens the main program.
- */
- public Shell open(Display display) {
- // Create the window
- this.display = display;
- iconCache.initResources(display);
- shell = new Shell();
- createShellContents();
- notifyRefreshFiles(null);
- shell.addDisposeListener(new DisposeListener () {
- public void widgetDisposed(DisposeEvent e) {
- // Cleanup
- workerStop();
- iconCache.freeResources();
- }
- });
- shell.open();
- return shell;
- }
-
/**
- * Closes the main program.
- */
- void close() {
- workerStop(); // be polite
- shell.close();
- }
-
- /**
- * Returns a string from the resource bundle.
- * We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- static String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Returns a string from the resource bundle and binds it
- * with the given arguments. If the key is not found,
- * return the key.
- */
- static String getResourceString(String key, Object[] args) {
- try {
- return MessageFormat.format(getResourceString(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Construct the UI
- *
- * @param container the ShellContainer managing the Shell we are rendering inside
- */
- private void createShellContents() {
- shell.setText(getResourceString("Title", new Object[] { "" }));
- shell.setImage(iconCache.stockImages[iconCache.shellIcon]);
- Menu bar = new Menu(shell, SWT.BAR);
- shell.setMenuBar(bar);
- createFileMenu(bar);
- createHelpMenu(bar);
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- gridLayout.marginHeight = gridLayout.marginWidth = 0;
- shell.setLayout(gridLayout);
-
- GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gridData.widthHint = 185;
- createComboView(shell, gridData);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gridData.horizontalSpan = 2;
- createToolBar(shell, gridData);
-
- SashForm sashForm = new SashForm(shell, SWT.NONE);
- sashForm.setOrientation(SWT.HORIZONTAL);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- gridData.horizontalSpan = 3;
- sashForm.setLayoutData(gridData);
- createTreeView(sashForm);
- createTableView(sashForm);
- sashForm.setWeights(new int[] { 2, 5 });
-
- numObjectsLabel = new Label(shell, SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- gridData.widthHint = 185;
- numObjectsLabel.setLayoutData(gridData);
-
- diskSpaceLabel = new Label(shell, SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- gridData.horizontalSpan = 2;
- diskSpaceLabel.setLayoutData(gridData);
- }
-
- /**
- * Creates the File Menu.
- *
- * @param parent the parent menu
- */
- private void createFileMenu(Menu parent) {
- Menu menu = new Menu(parent);
- MenuItem header = new MenuItem(parent, SWT.CASCADE);
- header.setText(getResourceString("menu.File.text"));
- header.setMenu(menu);
-
- final MenuItem simulateItem = new MenuItem(menu, SWT.CHECK);
- simulateItem.setText(getResourceString("menu.File.SimulateOnly.text"));
- simulateItem.setSelection(simulateOnly);
- simulateItem.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- simulateOnly = simulateItem.getSelection();
- }
- });
-
- MenuItem item = new MenuItem(menu, SWT.PUSH);
- item.setText(getResourceString("menu.File.Close.text"));
- item.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- close();
- }
- });
- }
-
- /**
- * Creates the Help Menu.
- *
- * @param parent the parent menu
- */
- private void createHelpMenu(Menu parent) {
- Menu menu = new Menu(parent);
- MenuItem header = new MenuItem(parent, SWT.CASCADE);
- header.setText(getResourceString("menu.Help.text"));
- header.setMenu(menu);
-
- MenuItem item = new MenuItem(menu, SWT.PUSH);
- item.setText(getResourceString("menu.Help.About.text"));
- item.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- MessageBox box = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
- box.setText(getResourceString("dialog.About.title"));
- box.setMessage(getResourceString("dialog.About.description",
- new Object[] { System.getProperty("os.name") }));
- box.open();
- }
- });
- }
-
- /**
- * Creates the toolbar
- *
- * @param shell the shell on which to attach the toolbar
- * @param layoutData the layout data
- */
- private void createToolBar(final Shell shell, Object layoutData) {
- toolBar = new ToolBar(shell, SWT.NULL);
- toolBar.setLayoutData(layoutData);
- ToolItem item = new ToolItem(toolBar, SWT.SEPARATOR);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(iconCache.stockImages[iconCache.cmdParent]);
- item.setToolTipText(getResourceString("tool.Parent.tiptext"));
- item.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- doParent();
- }
- });
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(iconCache.stockImages[iconCache.cmdRefresh]);
- item.setToolTipText(getResourceString("tool.Refresh.tiptext"));
- item.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- doRefresh();
- }
- });
- SelectionAdapter unimplementedListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- MessageBox box = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
- box.setText(getResourceString("dialog.NotImplemented.title"));
- box.setMessage(getResourceString("dialog.ActionNotImplemented.description"));
- box.open();
- }
- };
-
- item = new ToolItem(toolBar, SWT.SEPARATOR);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(iconCache.stockImages[iconCache.cmdCut]);
- item.setToolTipText(getResourceString("tool.Cut.tiptext"));
- item.addSelectionListener(unimplementedListener);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(iconCache.stockImages[iconCache.cmdCopy]);
- item.setToolTipText(getResourceString("tool.Copy.tiptext"));
- item.addSelectionListener(unimplementedListener);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(iconCache.stockImages[iconCache.cmdPaste]);
- item.setToolTipText(getResourceString("tool.Paste.tiptext"));
item.addSelectionListener(unimplementedListener);
-
- item = new ToolItem(toolBar, SWT.SEPARATOR);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(iconCache.stockImages[iconCache.cmdDelete]);
- item.setToolTipText(getResourceString("tool.Delete.tiptext"));
- item.addSelectionListener(unimplementedListener);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(iconCache.stockImages[iconCache.cmdRename]);
- item.setToolTipText(getResourceString("tool.Rename.tiptext"));
- item.addSelectionListener(unimplementedListener);
-
- item = new ToolItem(toolBar, SWT.SEPARATOR);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(iconCache.stockImages[iconCache.cmdSearch]);
- item.setToolTipText(getResourceString("tool.Search.tiptext"));
- item.addSelectionListener(unimplementedListener);
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(iconCache.stockImages[iconCache.cmdPrint]);
- item.setToolTipText(getResourceString("tool.Print.tiptext"));
- item.addSelectionListener(unimplementedListener);
- }
-
- /**
- * Creates the combo box view.
- *
- * @param parent the parent control
- */
- private void createComboView(Composite parent, Object layoutData) {
- combo = new Combo(parent, SWT.NONE);
- combo.setLayoutData(layoutData);
- combo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- final File[] roots = (File[]) combo.getData(COMBODATA_ROOTS);
- if (roots == null) return;
- int selection = combo.getSelectionIndex();
- if (selection >= 0 && selection < roots.length) {
- notifySelectedDirectory(roots[selection]);
- }
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- final String lastText = (String) combo.getData(COMBODATA_LASTTEXT);
- String text = combo.getText();
- if (text == null) return;
- if (lastText != null && lastText.equals(text)) return;
- combo.setData(COMBODATA_LASTTEXT, text);
- notifySelectedDirectory(new File(text));
- }
- });
- }
-
- /**
- * Creates the file tree view.
- *
- * @param parent the parent control
- */
- private void createTreeView(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- gridLayout.marginHeight = gridLayout.marginWidth = 2;
- gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;
- composite.setLayout(gridLayout);
-
- treeScopeLabel = new Label(composite, SWT.BORDER);
- treeScopeLabel.setText(FileViewer.getResourceString("details.AllFolders.text"));
- treeScopeLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
-
- tree = new Tree(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
- tree.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
-
- tree.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- final TreeItem[] selection = tree.getSelection();
- if (selection != null && selection.length != 0) {
- TreeItem item = selection[0];
- File file = (File) item.getData(TREEITEMDATA_FILE);
-
- notifySelectedDirectory(file);
- }
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- final TreeItem[] selection = tree.getSelection();
- if (selection != null && selection.length != 0) {
- TreeItem item = selection[0];
- item.setExpanded(true);
- treeExpandItem(item);
- }
- }
- });
- tree.addTreeListener(new TreeAdapter() {
- public void treeExpanded(TreeEvent event) {
- final TreeItem item = (TreeItem) event.item;
- final Image image = (Image) item.getData(TREEITEMDATA_IMAGEEXPANDED);
- if (image != null) item.setImage(image);
- treeExpandItem(item);
- }
- public void treeCollapsed(TreeEvent event) {
- final TreeItem item = (TreeItem) event.item;
- final Image image = (Image) item.getData(TREEITEMDATA_IMAGECOLLAPSED);
- if (image != null) item.setImage(image);
- }
- });
- createTreeDragSource(tree);
- createTreeDropTarget(tree);
- }
-
- /**
- * Creates the Drag & Drop DragSource for items being dragged from the tree.
- *
- * @return the DragSource for the tree
- */
- private DragSource createTreeDragSource(final Tree tree){
- DragSource dragSource = new DragSource(tree, DND.DROP_MOVE | DND.DROP_COPY);
- dragSource.setTransfer(new Transfer[] { FileTransfer.getInstance() });
- dragSource.addDragListener(new DragSourceListener() {
- TreeItem[] dndSelection = null;
- String[] sourceNames = null;
- public void dragStart(DragSourceEvent event){
- dndSelection = tree.getSelection();
- sourceNames = null;
- event.doit = dndSelection.length > 0;
- isDragging = true;
- processedDropFiles = null;
- }
- public void dragFinished(DragSourceEvent event){
- dragSourceHandleDragFinished(event, sourceNames);
- dndSelection = null;
- sourceNames = null;
- isDragging = false;
- processedDropFiles = null;
- handleDeferredRefresh();
- }
- public void dragSetData(DragSourceEvent event){
- if (dndSelection == null || dndSelection.length == 0) return;
- if (! FileTransfer.getInstance().isSupportedType(event.dataType)) return;
-
- sourceNames = new String[dndSelection.length];
- for (int i = 0; i < dndSelection.length; i++) {
- File file = (File) dndSelection[i].getData(TREEITEMDATA_FILE);
- sourceNames[i] = file.getAbsolutePath();
- }
- event.data = sourceNames;
- }
- });
- return dragSource;
- }
-
- /**
- * Creates the Drag & Drop DropTarget for items being dropped onto the tree.
- *
- * @return the DropTarget for the tree
- */
- private DropTarget createTreeDropTarget(final Tree tree) {
- DropTarget dropTarget = new DropTarget(tree, DND.DROP_MOVE | DND.DROP_COPY);
- dropTarget.setTransfer(new Transfer[] { FileTransfer.getInstance() });
- dropTarget.addDropListener(new DropTargetAdapter() {
- public void dragEnter(DropTargetEvent event) {
- isDropping = true;
- }
- public void dragLeave(DropTargetEvent event) {
- isDropping = false;
- handleDeferredRefresh();
- }
- public void dragOver(DropTargetEvent event) {
- dropTargetValidate(event, getTargetFile(event));
- event.feedback |= DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL;
- }
- public void drop(DropTargetEvent event) {
- File targetFile = getTargetFile(event);
- if (dropTargetValidate(event, targetFile))
- dropTargetHandleDrop(event, targetFile);
- }
- private File getTargetFile(DropTargetEvent event) {
- // Determine the target File for the drop
- TreeItem item = tree.getItem(tree.toControl(new Point(event.x, event.y)));
- File targetFile = null;
- if (item != null) {
- // We are over a particular item in the tree, use the item's file
- targetFile = (File) item.getData(TREEITEMDATA_FILE);
- }
- return targetFile;
- }
- });
- return dropTarget;
- }
-
- /**
- * Handles expand events on a tree item.
- *
- * @param item the TreeItem to fill in
- */
- private void treeExpandItem(TreeItem item) {
- shell.setCursor(iconCache.stockCursors[iconCache.cursorWait]);
- final Object stub = item.getData(TREEITEMDATA_STUB);
- if (stub == null) treeRefreshItem(item, true);
- shell.setCursor(iconCache.stockCursors[iconCache.cursorDefault]);
- }
-
- /**
- * Traverse the entire tree and update only what has changed.
- *
- * @param roots the root directory listing
- */
- private void treeRefresh(File[] masterFiles) {
- TreeItem[] items = tree.getItems();
- int masterIndex = 0;
- int itemIndex = 0;
- for (int i = 0; i < items.length; ++i) {
- final TreeItem item = items[i];
- final File itemFile = (File) item.getData(TREEITEMDATA_FILE);
- if ((itemFile == null) || (masterIndex == masterFiles.length)) {
- // remove bad item or placeholder
- item.dispose();
- continue;
- }
- final File masterFile = masterFiles[masterIndex];
- int compare = compareFiles(masterFile, itemFile);
- if (compare == 0) {
- // same file, update it
- treeRefreshItem(item, false);
- ++itemIndex;
- ++masterIndex;
- } else if (compare < 0) {
- // should appear before file, insert it
- TreeItem newItem = new TreeItem(tree, SWT.NULL, itemIndex);
- treeInitVolume(newItem, masterFile);
- new TreeItem(newItem, SWT.NULL); // placeholder child item to get "expand" button
- ++itemIndex;
- ++masterIndex;
- --i;
- } else {
- // should appear after file, delete stale item
- item.dispose();
- }
- }
- for (;masterIndex < masterFiles.length; ++masterIndex) {
- final File masterFile = masterFiles[masterIndex];
- TreeItem newItem = new TreeItem(tree, SWT.NULL);
- treeInitVolume(newItem, masterFile);
- new TreeItem(newItem, SWT.NULL); // placeholder child item to get "expand" button
- }
- }
-
- /**
- * Traverse an item in the tree and update only what has changed.
- *
- * @param dirItem the tree item of the directory
- * @param forcePopulate true iff we should populate non-expanded items as well
- */
- private void treeRefreshItem(TreeItem dirItem, boolean forcePopulate) {
- final File dir = (File) dirItem.getData(TREEITEMDATA_FILE);
-
- if (! forcePopulate && ! dirItem.getExpanded()) {
- // Refresh non-expanded item
- if (dirItem.getData(TREEITEMDATA_STUB) != null) {
- treeItemRemoveAll(dirItem);
- new TreeItem(dirItem, SWT.NULL); // placeholder child item to get "expand" button
- dirItem.setData(TREEITEMDATA_STUB, null);
- }
- return;
- }
- // Refresh expanded item
- dirItem.setData(TREEITEMDATA_STUB, this); // clear stub flag
-
- /* Get directory listing */
- File[] subFiles = (dir != null) ? FileViewer.getDirectoryList(dir) : null;
- if (subFiles == null || subFiles.length == 0) {
- /* Error or no contents */
- treeItemRemoveAll(dirItem);
- dirItem.setExpanded(false);
- return;
- }
-
- /* Refresh sub-items */
- TreeItem[] items = dirItem.getItems();
- final File[] masterFiles = subFiles;
- int masterIndex = 0;
- int itemIndex = 0;
- File masterFile = null;
- for (int i = 0; i < items.length; ++i) {
- while ((masterFile == null) && (masterIndex < masterFiles.length)) {
- masterFile = masterFiles[masterIndex++];
- if (! masterFile.isDirectory()) masterFile = null;
- }
-
- final TreeItem item = items[i];
- final File itemFile = (File) item.getData(TREEITEMDATA_FILE);
- if ((itemFile == null) || (masterFile == null)) {
- // remove bad item or placeholder
- item.dispose();
- continue;
- }
- int compare = compareFiles(masterFile, itemFile);
- if (compare == 0) {
- // same file, update it
- treeRefreshItem(item, false);
- masterFile = null;
- ++itemIndex;
- } else if (compare < 0) {
- // should appear before file, insert it
- TreeItem newItem = new TreeItem(dirItem, SWT.NULL, itemIndex);
- treeInitFolder(newItem, masterFile);
- new TreeItem(newItem, SWT.NULL); // add a placeholder child item so we get the "expand" button
- masterFile = null;
- ++itemIndex;
- --i;
- } else {
- // should appear after file, delete stale item
- item.dispose();
- }
- }
- while ((masterFile != null) || (masterIndex < masterFiles.length)) {
- if (masterFile != null) {
- TreeItem newItem = new TreeItem(dirItem, SWT.NULL);
- treeInitFolder(newItem, masterFile);
- new TreeItem(newItem, SWT.NULL); // add a placeholder child item so we get the "expand" button
- if (masterIndex == masterFiles.length) break;
- }
- masterFile = masterFiles[masterIndex++];
- if (! masterFile.isDirectory()) masterFile = null;
- }
- }
-
- /**
- * Foreign method: removes all children of a TreeItem.
- * @param treeItem the TreeItem
- */
- private static void treeItemRemoveAll(TreeItem treeItem) {
- final TreeItem[] children = treeItem.getItems();
- for (int i = 0; i < children.length; ++i) {
- children[i].dispose();
- }
- }
-
- /**
- * Initializes a folder item.
- *
- * @param item the TreeItem to initialize
- * @param folder the File associated with this TreeItem
- */
- private void treeInitFolder(TreeItem item, File folder) {
- item.setText(folder.getName());
- item.setImage(iconCache.stockImages[iconCache.iconClosedFolder]);
- item.setData(TREEITEMDATA_FILE, folder);
- item.setData(TREEITEMDATA_IMAGEEXPANDED, iconCache.stockImages[iconCache.iconOpenFolder]);
- item.setData(TREEITEMDATA_IMAGECOLLAPSED, iconCache.stockImages[iconCache.iconClosedFolder]);
- }
-
- /**
- * Initializes a volume item.
- *
- * @param item the TreeItem to initialize
- * @param volume the File associated with this TreeItem
- */
- private void treeInitVolume(TreeItem item, File volume) {
- item.setText(volume.getPath());
- item.setImage(iconCache.stockImages[iconCache.iconClosedDrive]);
- item.setData(TREEITEMDATA_FILE, volume);
- item.setData(TREEITEMDATA_IMAGEEXPANDED, iconCache.stockImages[iconCache.iconOpenDrive]);
- item.setData(TREEITEMDATA_IMAGECOLLAPSED, iconCache.stockImages[iconCache.iconClosedDrive]);
- }
-
- /**
- * Creates the file details table.
- *
- * @param parent the parent control
- */
- private void createTableView(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- gridLayout.marginHeight = gridLayout.marginWidth = 2;
- gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;
- composite.setLayout(gridLayout);
- tableContentsOfLabel = new Label(composite, SWT.BORDER);
- tableContentsOfLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
-
- table = new Table(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
- table.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
-
- for (int i = 0; i < tableTitles.length; ++i) {
- TableColumn column = new TableColumn(table, SWT.NONE);
- column.setText(tableTitles[i]);
- column.setWidth(tableWidths[i]);
- }
- table.setHeaderVisible(true);
- table.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- notifySelectedFiles(getSelectedFiles());
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- doDefaultFileAction(getSelectedFiles());
- }
- private File[] getSelectedFiles() {
- final TableItem[] items = table.getSelection();
- final File[] files = new File[items.length];
-
- for (int i = 0; i < items.length; ++i) {
- files[i] = (File) items[i].getData(TABLEITEMDATA_FILE);
- }
- return files;
- }
- });
-
- createTableDragSource(table);
- createTableDropTarget(table);
- }
-
- /**
- * Creates the Drag & Drop DragSource for items being dragged from the table.
- *
- * @return the DragSource for the table
- */
- private DragSource createTableDragSource(final Table table) {
- DragSource dragSource = new DragSource(table, DND.DROP_MOVE | DND.DROP_COPY);
- dragSource.setTransfer(new Transfer[] { FileTransfer.getInstance() });
- dragSource.addDragListener(new DragSourceListener() {
- TableItem[] dndSelection = null;
- String[] sourceNames = null;
- public void dragStart(DragSourceEvent event){
- dndSelection = table.getSelection();
- sourceNames = null;
- event.doit = dndSelection.length > 0;
- isDragging = true;
- }
- public void dragFinished(DragSourceEvent event){
- dragSourceHandleDragFinished(event, sourceNames);
- dndSelection = null;
- sourceNames = null;
- isDragging = false;
- handleDeferredRefresh();
- }
- public void dragSetData(DragSourceEvent event){
- if (dndSelection == null || dndSelection.length == 0) return;
- if (! FileTransfer.getInstance().isSupportedType(event.dataType)) return;
-
- sourceNames = new String[dndSelection.length];
- for (int i = 0; i < dndSelection.length; i++) {
- File file = (File) dndSelection[i].getData(TABLEITEMDATA_FILE);
- sourceNames[i] = file.getAbsolutePath();
- }
- event.data = sourceNames;
- }
- });
- return dragSource;
- }
-
- /**
- * Creates the Drag & Drop DropTarget for items being dropped onto the table.
- *
- * @return the DropTarget for the table
- */
- private DropTarget createTableDropTarget(final Table table){
- DropTarget dropTarget = new DropTarget(table, DND.DROP_MOVE | DND.DROP_COPY);
- dropTarget.setTransfer(new Transfer[] { FileTransfer.getInstance() });
- dropTarget.addDropListener(new DropTargetAdapter() {
- public void dragEnter(DropTargetEvent event) {
- isDropping = true;
- }
- public void dragLeave(DropTargetEvent event) {
- isDropping = false;
- handleDeferredRefresh();
- }
- public void dragOver(DropTargetEvent event) {
- dropTargetValidate(event, getTargetFile(event));
- event.feedback |= DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL;
- }
- public void drop(DropTargetEvent event) {
- File targetFile = getTargetFile(event);
- if (dropTargetValidate(event, targetFile))
- dropTargetHandleDrop(event, targetFile);
- }
- private File getTargetFile(DropTargetEvent event) {
- // Determine the target File for the drop
- TableItem item = table.getItem(table.toControl(new Point(event.x, event.y)));
- File targetFile = null;
- if (item == null) {
- // We are over an unoccupied area of the table.
- // If it is a COPY, we can use the table's root file.
- if (event.detail == DND.DROP_COPY) {
- targetFile = (File) table.getData(TABLEDATA_DIR);
- }
- } else {
- // We are over a particular item in the table, use the item's file
- targetFile = (File) item.getData(TABLEITEMDATA_FILE);
- }
- return targetFile;
- }
- });
- return dropTarget;
- }
-
- /**
- * Notifies the application components that a new current directory has been selected
- *
- * @param dir the directory that was selected, null is ignored
- */
- void notifySelectedDirectory(File dir) {
- if (dir == null) return;
- if (currentDirectory != null && dir.equals(currentDirectory)) return;
- currentDirectory = dir;
- notifySelectedFiles(null);
-
- /* Shell:
- * Sets the title to indicate the selected directory
- */
- shell.setText(getResourceString("Title", new Object[] { currentDirectory.getPath() }));
-
/* Table view:
- * Displays the contents of the selected directory.
- */
- workerUpdate(dir, false);
-
- /* Combo view:
- * Sets the combo box to point to the selected directory.
- */
- final File[] comboRoots = (File[]) combo.getData(COMBODATA_ROOTS);
- int comboEntry = -1;
- if (comboRoots != null) {
- for (int i = 0; i < comboRoots.length; ++i) {
- if (dir.equals(comboRoots[i])) {
- comboEntry = i;
- break;
- }
- }
- }
- if (comboEntry == -1) combo.setText(dir.getPath());
- else combo.select(comboEntry);
-
- /* Tree view:
- * If not already expanded, recursively expands the parents of the specified
- * directory until it is visible.
- */
- Vector /* of File */ path = new Vector();
- // Build a stack of paths from the root of the tree
- while (dir != null) {
- path.add(dir);
- dir = dir.getParentFile();
- }
- // Recursively expand the tree to get to the specified directory
- TreeItem[] items = tree.getItems();
- TreeItem lastItem = null;
- for (int i = path.size() - 1; i >= 0; --i) {
- final File pathElement = (File) path.elementAt(i);
-
- // Search for a particular File in the array of tree items
- // No guarantee that the items are sorted in any recognizable fashion, so we'll
- // just sequential scan. There shouldn't be more than a few thousand entries.
- TreeItem item = null;
- for (int k = 0; k < items.length; ++k) {
- item = items[k];
- if (item.isDisposed()) continue;
- final File itemFile = (File) item.getData(TREEITEMDATA_FILE);
- if (itemFile != null && itemFile.equals(pathElement)) break;
- }
- if (item == null) break;
- lastItem = item;
- if (i != 0 && !item.getExpanded()) {
- treeExpandItem(item);
- item.setExpanded(true);
- }
- items = item.getItems();
- }
- tree.setSelection((lastItem != null) ? new TreeItem[] { lastItem } : new TreeItem[0]);
- }
-
- /**
- * Notifies the application components that files have been selected
- *
- * @param files the files that were selected, null or empty array indicates no active selection
- */
- void notifySelectedFiles(File[] files) {
- /* Details:
- * Update the details that are visible on screen.
- */
- if ((files != null) && (files.length != 0)) {
- numObjectsLabel.setText(getResourceString("details.NumberOfSelectedFiles.text",
- new Object[] { new Integer(files.length) }));
- long fileSize = 0L;
- for (int i = 0; i < files.length; ++i) {
- fileSize += files[i].length();
- }
- diskSpaceLabel.setText(getResourceString("details.FileSize.text",
- new Object[] { new Long(fileSize) }));
- } else {
- // No files selected
- diskSpaceLabel.setText("");
- if (currentDirectory != null) {
- int numObjects = getDirectoryList(currentDirectory).length;
- numObjectsLabel.setText(getResourceString("details.DirNumberOfObjects.text",
- new Object[] { new Integer(numObjects) }));
- } else {
- numObjectsLabel.setText("");
- }
- }
- }
-
- /**
- * Notifies the application components that files must be refreshed
- *
- * @param files the files that need refreshing, empty array is a no-op, null refreshes all
- */
- void notifyRefreshFiles(File[] files) {
- if (files != null && files.length == 0) return;
-
- if ((deferredRefreshRequested) && (deferredRefreshFiles != null) && (files != null)) {
- // merge requests
- File[] newRequest = new File[deferredRefreshFiles.length + files.length];
- System.arraycopy(deferredRefreshFiles, 0, newRequest, 0, deferredRefreshFiles.length);
- System.arraycopy(files, 0, newRequest, deferredRefreshFiles.length, files.length);
- deferredRefreshFiles = newRequest;
- } else {
- deferredRefreshFiles = files;
- deferredRefreshRequested = true;
- }
- handleDeferredRefresh();
- }
-
- /**
- * Handles deferred Refresh notifications (due to Drag & Drop)
- */
- void handleDeferredRefresh() {
- if (isDragging || isDropping || ! deferredRefreshRequested) return;
- if (progressDialog != null) {
- progressDialog.close();
- progressDialog = null;
- }
-
- deferredRefreshRequested = false;
- File[] files = deferredRefreshFiles;
- deferredRefreshFiles = null;
-
- shell.setCursor(iconCache.stockCursors[iconCache.cursorWait]);
-
- /* Table view:
- * Refreshes information about any files in the list and their children.
- */
- boolean refreshTable = false;
- if (files != null) {
- for (int i = 0; i < files.length; ++i) {
- final File file = files[i];
- if (file.equals(currentDirectory)) {
- refreshTable = true;
- break;
- }
- File parentFile = file.getParentFile();
- if ((parentFile != null) && (parentFile.equals(currentDirectory))) {
- refreshTable = true;
- break;
- }
- }
- } else refreshTable = true;
- if (refreshTable) workerUpdate(currentDirectory, true);
-
- /* Combo view:
- * Refreshes the list of roots
- */
- final File[] roots = getRoots();
-
- if (files == null) {
- boolean refreshCombo = false;
- final File[] comboRoots = (File[]) combo.getData(COMBODATA_ROOTS);
-
- if ((comboRoots != null) && (comboRoots.length == roots.length)) {
- for (int i = 0; i < roots.length; ++i) {
- if (! roots[i].equals(comboRoots[i])) {
- refreshCombo = true;
- break;
- }
- }
- } else refreshCombo = true;
-
- if (refreshCombo) {
- combo.removeAll();
- combo.setData(COMBODATA_ROOTS, roots);
- for (int i = 0; i < roots.length; ++i) {
- final File file = roots[i];
- combo.add(file.getPath());
- }
- }
- }
-
- /* Tree view:
- * Refreshes information about any files in the list and their children.
- */
- treeRefresh(roots);
-
- // Remind everyone where we are in the filesystem
- final File dir = currentDirectory;
- currentDirectory = null;
- notifySelectedDirectory(dir);
-
- shell.setCursor(iconCache.stockCursors[iconCache.cursorDefault]);
- }
-
- /**
- * Performs the default action on a set of files.
- *
- * @param files the array of files to process
- */
- void doDefaultFileAction(File[] files) {
- // only uses the 1st file (for now)
- if (files.length == 0) return;
- final File file = files[0];
-
- if (file.isDirectory()) {
- notifySelectedDirectory(file);
- } else {
- final String fileName = file.getAbsolutePath();
- if (! Program.launch(fileName)) {
- MessageBox dialog = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
- dialog.setMessage(getResourceString("error.FailedLaunch.message", new Object[] { fileName }));
- dialog.setText(shell.getText ());
- dialog.open();
- }
- }
- }
-
- /**
- * Navigates to the parent directory
- */
- void doParent() {
- if (currentDirectory == null) return;
- File parentDirectory = currentDirectory.getParentFile();
- notifySelectedDirectory(parentDirectory);
- }
-
- /**
- * Performs a refresh
- */
- void doRefresh() {
- notifyRefreshFiles(null);
- }
-
- /**
- * Validates a drop target as a candidate for a drop operation.
- * <p>
- * Used in dragOver() and dropAccept().<br>
- * Note event.detail is set to DND.DROP_NONE by this method if the target is not valid.
- * </p>
- * @param event the DropTargetEvent to validate
- * @param targetFile the File representing the drop target location
- * under inspection, or null if none
- */
- private boolean dropTargetValidate(DropTargetEvent event, File targetFile) {
- if (targetFile != null && targetFile.isDirectory()) {
- if (event.detail != DND.DROP_COPY && event.detail != DND.DROP_MOVE) {
- event.detail = DND.DROP_MOVE;
- }
- } else {
- event.detail = DND.DROP_NONE;
- }
- return event.detail != DND.DROP_NONE;
- }
-
- /**
- * Handles a drop on a dropTarget.
- * <p>
- * Used in drop().<br>
- * Note event.detail is modified by this method.
- * </p>
- * @param event the DropTargetEvent passed as parameter to the drop() method
- * @param targetFile the File representing the drop target location
- * under inspection, or null if none
- */
- private void dropTargetHandleDrop(DropTargetEvent event, File targetFile) {
- // Get dropped data (an array of filenames)
- if (! dropTargetValidate(event, targetFile)) return;
- final String[] sourceNames = (String[]) event.data;
- if (sourceNames == null) event.detail = DND.DROP_NONE;
- if (event.detail == DND.DROP_NONE) return;
-
- // Open progress dialog
- progressDialog = new ProgressDialog(shell,
- (event.detail == DND.DROP_MOVE) ? ProgressDialog.MOVE : ProgressDialog.COPY);
- progressDialog.setTotalWorkUnits(sourceNames.length);
- progressDialog.open();
-
- // Copy each file
- Vector /* of File */ processedFiles = new Vector();
- for (int i = 0; (i < sourceNames.length) && (! progressDialog.isCancelled()); i++){
- final File source = new File(sourceNames[i]);
- final File dest = new File(targetFile, source.getName());
- if (source.equals(dest)) continue; // ignore if in same location
-
- progressDialog.setDetailFile(source, ProgressDialog.COPY);
- while (! progressDialog.isCancelled()) {
- if (copyFileStructure(source, dest)) {
- processedFiles.add(source);
- break;
- } else if (! progressDialog.isCancelled()) {
- if (event.detail == DND.DROP_MOVE && (!isDragging)) {
- // It is not possible to notify an external drag source that a drop
- // operation was only partially successful. This is particularly a
- // problem for DROP_MOVE operations since unless the source gets
- // DROP_NONE, it will delete the original data including bits that
- // may not have been transferred successfully.
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR | SWT.RETRY | SWT.CANCEL);
- box.setText(getResourceString("dialog.FailedCopy.title"));
- box.setMessage(getResourceString("dialog.FailedCopy.description",
- new Object[] { source, dest }));
- int button = box.open();
- if (button == SWT.CANCEL) {
- i = sourceNames.length;
- event.detail = DND.DROP_NONE;
- break;
- }
- } else {
- // We can recover gracefully from errors if the drag source belongs
- // to this application since it will look at processedDropFiles.
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR | SWT.ABORT | SWT.RETRY | SWT.IGNORE);
- box.setText(getResourceString("dialog.FailedCopy.title"));
- box.setMessage(getResourceString("dialog.FailedCopy.description",
- new Object[] { source, dest }));
- int button = box.open();
- if (button == SWT.ABORT) i = sourceNames.length;
- if (button != SWT.RETRY) break;
- }
- }
- progressDialog.addProgress(1);
- }
- }
- if (isDragging) {
- // Remember exactly which files we processed
- processedDropFiles = ((File[]) processedFiles.toArray(new File[processedFiles.size()]));
- } else {
- progressDialog.close();
- progressDialog = null;
- }
- notifyRefreshFiles(new File[] { targetFile });
- }
-
- /**
- * Handles the completion of a drag on a dragSource.
- * <p>
- * Used in dragFinished().<br>
- * </p>
- * @param event the DragSourceEvent passed as parameter to the dragFinished() method
- * @param sourceNames the names of the files that were dragged (event.data is invalid)
- */
- private void dragSourceHandleDragFinished(DragSourceEvent event, String[] sourceNames) {
- if (sourceNames == null) return;
- if (event.detail != DND.DROP_MOVE) return;
-
- // Get array of files that were actually transferred
- final File[] sourceFiles;
- if (processedDropFiles != null) {
- sourceFiles = processedDropFiles;
- } else {
- sourceFiles = new File[sourceNames.length];
- for (int i = 0; i < sourceNames.length; ++i)
- sourceFiles[i] = new File(sourceNames[i]);
- }
- if (progressDialog == null)
- progressDialog = new ProgressDialog(shell, ProgressDialog.MOVE);
- progressDialog.setTotalWorkUnits(sourceFiles.length);
- progressDialog.setProgress(0);
- progressDialog.open();
-
- // Delete each file
- for (int i = 0; (i < sourceFiles.length) && (! progressDialog.isCancelled()); i++){
- final File source = sourceFiles[i];
- progressDialog.setDetailFile(source, ProgressDialog.DELETE);
- while (! progressDialog.isCancelled()) {
- if (deleteFileStructure(source)) {
- break;
- } else if (! progressDialog.isCancelled()) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR | SWT.ABORT | SWT.RETRY | SWT.IGNORE);
- box.setText(getResourceString("dialog.FailedDelete.title"));
- box.setMessage(getResourceString("dialog.FailedDelete.description",
- new Object[] { source }));
- int button = box.open();
- if (button == SWT.ABORT) i = sourceNames.length;
- if (button == SWT.RETRY) break;
- }
- }
- progressDialog.addProgress(1);
- }
- notifyRefreshFiles(sourceFiles);
- progressDialog.close();
- progressDialog = null;
- }
-
- /**
- * Gets filesystem root entries
- *
- * @return an array of Files corresponding to the root directories on the platform,
- * may be empty but not null
- */
- File[] getRoots() {
- /*
- * On JDK 1.22 only...
- */
- // return File.listRoots();
-
- /*
- * On JDK 1.1.7 and beyond...
- * -- PORTABILITY ISSUES HERE --
- */
- if (System.getProperty ("os.name").indexOf ("Windows") != -1) {
- Vector /* of File */ list = new Vector();
- list.add(new File(DRIVE_A));
- list.add(new File(DRIVE_B));
- for (char i = 'c'; i <= 'z'; ++i) {
- File drive = new File(i + ":" + File.separator);
- if (drive.isDirectory() && drive.exists()) {
- list.add(drive);
- if (initial && i == 'c') {
- currentDirectory = drive;
- initial = false;
- }
- }
- }
- File[] roots = (File[]) list.toArray(new File[list.size()]);
- sortFiles(roots);
- return roots;
- } else {
- File root = new File(File.separator);
- if (initial) {
- currentDirectory = root;
- }
- return new File[] { root };
- }
- }
-
- /**
- * Gets a directory listing
- *
- * @param file the directory to be listed
- * @return an array of files this directory contains, may be empty but not null
- */
- static File[] getDirectoryList(File file) {
- File[] list = file.listFiles();
- if (list == null) return new File[0];
- sortFiles(list);
- return list;
- }
-
- /**
- * Copies a file or entire directory structure.
- *
- * @param oldFile the location of the old file or directory
- * @param newFile the location of the new file or directory
- * @return true iff the operation succeeds without errors
- */
- boolean copyFileStructure(File oldFile, File newFile) {
- if (oldFile == null || newFile == null) return false;
-
- // ensure that newFile is not a child of oldFile or a dupe
- File searchFile = newFile;
- do {
- if (oldFile.equals(searchFile)) return false;
- searchFile = searchFile.getParentFile();
- } while (searchFile != null);
-
- if (oldFile.isDirectory()) {
- /*
- * Copy a directory
- */
- if (progressDialog != null) {
- progressDialog.setDetailFile(oldFile, ProgressDialog.COPY);
- }
- if (simulateOnly) {
- //System.out.println(getResourceString("simulate.DirectoriesCreated.text",
- // new Object[] { newFile.getPath() }));
- } else {
- if (! newFile.mkdirs()) return false;
- }
- File[] subFiles = oldFile.listFiles();
- if (subFiles != null) {
- if (progressDialog != null) {
- progressDialog.addWorkUnits(subFiles.length);
- }
- for (int i = 0; i < subFiles.length; i++) {
- File oldSubFile = subFiles[i];
- File newSubFile = new File(newFile, oldSubFile.getName());
- if (! copyFileStructure(oldSubFile, newSubFile)) return false;
- if (progressDialog != null) {
- progressDialog.addProgress(1);
- if (progressDialog.isCancelled()) return false;
- }
- }
- }
- } else {
- /*
- * Copy a file
- */
- if (simulateOnly) {
- //System.out.println(getResourceString("simulate.CopyFromTo.text",
- // new Object[] { oldFile.getPath(), newFile.getPath() }));
- } else {
- FileReader in = null;
- FileWriter out = null;
- try {
- in = new FileReader(oldFile);
- out = new FileWriter(newFile);
-
- int count;
- while ((count = in.read()) != -1) out.write(count);
- } catch (FileNotFoundException e) {
- return false;
- } catch (IOException e) {
- return false;
- } finally {
- try {
- if (in != null) in.close();
- if (out != null) out.close();
- } catch (IOException e) {
- return false;
- }
- }
- }
- }
- return true;
- }
-
- /**
- * Deletes a file or entire directory structure.
- *
- * @param oldFile the location of the old file or directory
- * @return true iff the operation succeeds without errors
- */
- boolean deleteFileStructure(File oldFile) {
- if (oldFile == null) return false;
- if (oldFile.isDirectory()) {
- /*
- * Delete a directory
- */
- if (progressDialog != null) {
- progressDialog.setDetailFile(oldFile, ProgressDialog.DELETE);
- }
- File[] subFiles = oldFile.listFiles();
- if (subFiles != null) {
- if (progressDialog != null) {
- progressDialog.addWorkUnits(subFiles.length);
- }
- for (int i = 0; i < subFiles.length; i++) {
- File oldSubFile = subFiles[i];
- if (! deleteFileStructure(oldSubFile)) return false;
- if (progressDialog != null) {
- progressDialog.addProgress(1);
- if (progressDialog.isCancelled()) return false;
- }
- }
- }
- }
- if (simulateOnly) {
- //System.out.println(getResourceString("simulate.Delete.text",
- // new Object[] { oldFile.getPath(), oldFile.getPath() }));
- return true;
- } else {
- return oldFile.delete();
- }
- }
-
- /**
- * Sorts files lexicographically by name.
- *
- * @param files the array of Files to be sorted
- */
- static void sortFiles(File[] files) {
- /* Very lazy merge sort algorithm */
- sortBlock(files, 0, files.length - 1, new File[files.length]);
- }
- private static void sortBlock(File[] files, int start, int end, File[] mergeTemp) {
- final int length = end - start + 1;
- if (length < 8) {
- for (int i = end; i > start; --i) {
- for (int j = end; j > start; --j) {
- if (compareFiles(files[j - 1], files[j]) > 0) {
- final File temp = files[j];
- files[j] = files[j-1];
- files[j-1] = temp;
- }
- }
- }
- return;
- }
- final int mid = (start + end) / 2;
- sortBlock(files, start, mid, mergeTemp);
- sortBlock(files, mid + 1, end, mergeTemp);
- int x = start;
- int y = mid + 1;
- for (int i = 0; i < length; ++i) {
- if ((x > mid) || ((y <= end) && compareFiles(files[x], files[y]) > 0)) {
- mergeTemp[i] = files[y++];
- } else {
- mergeTemp[i] = files[x++];
- }
- }
- for (int i = 0; i < length; ++i) files[i + start] = mergeTemp[i];
- }
- private static int compareFiles(File a, File b) {
-// boolean aIsDir = a.isDirectory();
-// boolean bIsDir = b.isDirectory();
-// if (aIsDir && ! bIsDir) return -1;
-// if (bIsDir && ! aIsDir) return 1;
-
- // sort case-sensitive files in a case-insensitive manner
- int compare = a.getName().compareToIgnoreCase(b.getName());
- if (compare == 0) compare = a.getName().compareTo(b.getName());
- return compare;
- }
-
- /*
- * This worker updates the table with file information in the background.
- * <p>
- * Implementation notes:
- * <ul>
- * <li> It is designed such that it can be interrupted cleanly.
- * <li> It uses asyncExec() in some places to ensure that SWT Widgets are manipulated in the
- * right thread. Exclusive use of syncExec() would be inappropriate as it would require a pair
- * of context switches between each table update operation.
- * </ul>
- * </p>
- */
-
- /**
- * Stops the worker and waits for it to terminate.
- */
- void workerStop() {
- if (workerThread == null) return;
- synchronized(workerLock) {
- workerCancelled = true;
- workerStopped = true;
- workerLock.notifyAll();
- }
- while (workerThread != null) {
- if (! display.readAndDispatch()) display.sleep();
- }
- }
-
- /**
- * Notifies the worker that it should update itself with new data.
- * Cancels any previous operation and begins a new one.
- *
- * @param dir the new base directory for the table, null is ignored
- * @param force if true causes a refresh even if the data is the same
- */
- void workerUpdate(File dir, boolean force) {
- if (dir == null) return;
- if ((!force) && (workerNextDir != null) && (workerNextDir.equals(dir))) return;
-
- synchronized(workerLock) {
- workerNextDir = dir;
- workerStopped = false;
- workerCancelled = true;
- workerLock.notifyAll();
- }
- if (workerThread == null) {
- workerThread = new Thread(workerRunnable);
- workerThread.start();
- }
- }
-
- /**
- * Manages the worker's thread
- */
- private final Runnable workerRunnable = new Runnable() {
- public void run() {
- while (! workerStopped) {
- synchronized(workerLock) {
- workerCancelled = false;
- workerStateDir = workerNextDir;
- }
- workerExecute();
- synchronized(workerLock) {
- try {
- if ((!workerCancelled) && (workerStateDir == workerNextDir)) workerLock.wait();
- } catch (InterruptedException e) {
- }
- }
- }
- workerThread = null;
- // wake up UI thread in case it is in a modal loop awaiting thread termination
- // (see workerStop())
- display.wake();
- }
- };
-
- /**
- * Updates the table's contents
- */
- private void workerExecute() {
- File[] dirList;
- // Clear existing information
- display.syncExec(new Runnable() {
- public void run() {
- tableContentsOfLabel.setText(FileViewer.getResourceString("details.ContentsOf.text",
- new Object[] { workerStateDir.getPath() }));
- table.removeAll();
- table.setRedraw(false);
- table.setData(TABLEDATA_DIR, workerStateDir);
- }
- });
- dirList = getDirectoryList(workerStateDir);
-
- for (int i = 0; (! workerCancelled) && (i < dirList.length); i++) {
- final File theFile = dirList[i];
- workerAddFileDetails(dirList[i]);
-
- final boolean doIncrementalRefresh = ((i & 127) == 127);
- if (doIncrementalRefresh) display.syncExec(new Runnable() {
- public void run () {
- // guard against the shell being closed before this runs
- if (shell.isDisposed()) return;
- table.setRedraw(true);
- table.setRedraw(false);
- }
- });
- }
-
- // Allow the table to refresh itself
- display.asyncExec(new Runnable() {
- public void run() {
- // guard against the shell being closed before this runs
- if (shell.isDisposed()) return;
- table.setRedraw(true);
- }
- });
- }
-
- /**
- * Adds a file's detail information to the directory list
- */
- private void workerAddFileDetails(final File file) {
- final String nameString = file.getName();
- final String dateString = dateFormat.format(new Date(file.lastModified()));
- final String sizeString;
- final String typeString;
- final Image iconImage;
-
- if (file.isDirectory()) {
- typeString = getResourceString("filetype.Folder");
- sizeString = "";
- iconImage = iconCache.stockImages[iconCache.iconClosedFolder];
- } else {
- sizeString = getResourceString("filesize.KB",
- new Object[] { new Long((file.length() + 512) / 1024) });
-
- int dot = nameString.lastIndexOf('.');
- if (dot != -1) {
- String extension = nameString.substring(dot);
- Program program = Program.findProgram(extension);
- if (program != null) {
- typeString = program.getName();
- iconImage = iconCache.getIconFromProgram(program);
- } else {
- typeString = getResourceString("filetype.Unknown", new Object[] { extension.toUpperCase() });
- iconImage = iconCache.stockImages[iconCache.iconFile];
- }
- } else {
- typeString = getResourceString("filetype.None");
- iconImage = iconCache.stockImages[iconCache.iconFile];
- }
- }
- final String[] strings = new String[] { nameString, sizeString, typeString, dateString };
-
- display.asyncExec(new Runnable() {
- public void run () {
- // guard against the shell being closed before this runs
- if (shell.isDisposed()) return;
- TableItem tableItem = new TableItem(table, 0);
- tableItem.setText(strings);
- tableItem.setImage(iconImage);
- tableItem.setData(TABLEITEMDATA_FILE, file);
- }
- });
- }
-
- /**
- * Instances of this class manage a progress dialog for file operations.
- */
- class ProgressDialog {
- public final static int COPY = 0;
- public final static int DELETE = 1;
- public final static int MOVE = 2;
-
- Shell shell;
- Label messageLabel, detailLabel;
- ProgressBar progressBar;
- Button cancelButton;
- boolean isCancelled = false;
-
- final String operationKeyName[] = {
- "Copy",
- "Delete",
- "Move"
- };
-
- /**
- * Creates a progress dialog but does not open it immediately.
- *
- * @param parent the parent Shell
- * @param style one of COPY, MOVE
- */
- public ProgressDialog(Shell parent, int style) {
- shell = new Shell(parent, SWT.BORDER | SWT.TITLE | SWT.APPLICATION_MODAL);
- GridLayout gridLayout = new GridLayout();
- shell.setLayout(gridLayout);
- shell.setText(getResourceString("progressDialog." + operationKeyName[style] + ".title"));
- shell.addShellListener(new ShellAdapter() {
- public void shellClosed(ShellEvent e) {
- isCancelled = true;
- }
- });
-
- messageLabel = new Label(shell, SWT.HORIZONTAL);
- messageLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
- messageLabel.setText(getResourceString("progressDialog." + operationKeyName[style] + ".description"));
-
- progressBar = new ProgressBar(shell, SWT.HORIZONTAL | SWT.WRAP);
- progressBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
- progressBar.setMinimum(0);
- progressBar.setMaximum(0);
-
- detailLabel = new Label(shell, SWT.HORIZONTAL);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
- gridData.widthHint = 400;
- detailLabel.setLayoutData(gridData);
-
- cancelButton = new Button(shell, SWT.PUSH);
- cancelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_FILL));
- cancelButton.setText(getResourceString("progressDialog.cancelButton.text"));
- cancelButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- isCancelled = true;
- cancelButton.setEnabled(false);
- }
- });
- }
- /**
- * Sets the detail text to show the filename along with a string
- * representing the operation being performed on that file.
- *
- * @param file the file to be detailed
- * @param operation one of COPY, DELETE
- */
- public void setDetailFile(File file, int operation) {
- String filename = file.getName();
- detailLabel.setText(getResourceString("progressDialog." + operationKeyName[operation] + ".operation",
- new Object[] { file }));
- }
- /**
- * Returns true if the Cancel button was been clicked.
- *
- * @return true if the Cancel button was clicked.
- */
- public boolean isCancelled() {
- return isCancelled;
- }
- /**
- * Sets the total number of work units to be performed.
- *
- * @param work the total number of work units
- */
- public void setTotalWorkUnits(int work) {
- progressBar.setMaximum(work);
- }
- /**
- * Adds to the total number of work units to be performed.
- *
- * @param work the number of work units to add
- */
- public void addWorkUnits(int work) {
- setTotalWorkUnits(progressBar.getMaximum() + work);
- }
- /**
- * Sets the progress of completion of the total work units.
- *
- * @param work the total number of work units completed
- */
- public void setProgress(int work) {
- progressBar.setSelection(work);
- while (display.readAndDispatch()); // enable event processing
- }
- /**
- * Adds to the progress of completion of the total work units.
- *
- * @param work the number of work units completed to add
- */
- public void addProgress(int work) {
- setProgress(progressBar.getSelection() + work);
- }
- /**
- * Opens the dialog.
- */
- public void open() {
- shell.pack();
- final Shell parentShell = (Shell) shell.getParent();
- Rectangle rect = parentShell.getBounds();
- Rectangle bounds = shell.getBounds();
- bounds.x = rect.x + (rect.width - bounds.width) / 2;
- bounds.y = rect.y + (rect.height - bounds.height) / 2;
- shell.setBounds(bounds);
- shell.open();
- }
- /**
- * Closes the dialog and disposes its resources.
- */
- public void close() {
- shell.close();
- shell.dispose();
- shell = null;
- messageLabel = null;
- detailLabel = null;
- progressBar = null;
- cancelButton = null;
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/IconCache.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/IconCache.java deleted file mode 100755 index ac1f2d9acc..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/IconCache.java +++ /dev/null @@ -1,149 +0,0 @@ -package org.eclipse.swt.examples.fileviewer;
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.program.*;
-import org.eclipse.swt.widgets.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Manages icons for the application.
- * This is necessary as we could easily end up creating thousands of icons
- * bearing the same image.
- */
-class IconCache {
- // Stock images
- public final int
- shellIcon = 0,
- iconClosedDrive = 1,
- iconClosedFolder = 2,
- iconFile = 3,
- iconOpenDrive = 4,
- iconOpenFolder = 5,
- cmdCopy = 6,
- cmdCut = 7,
- cmdDelete = 8,
- cmdParent = 9,
- cmdPaste = 10,
- cmdPrint = 11,
- cmdRefresh = 12,
- cmdRename = 13,
- cmdSearch = 14;
- public final String[] stockImageLocations = {
- "generic_example.gif",
- "icon_ClosedDrive.gif",
- "icon_ClosedFolder.gif",
- "icon_File.gif",
- "icon_OpenDrive.gif",
- "icon_OpenFolder.gif",
- "cmd_Copy.gif",
- "cmd_Cut.gif",
- "cmd_Delete.gif",
- "cmd_Parent.gif",
- "cmd_Paste.gif",
- "cmd_Print.gif",
- "cmd_Refresh.gif",
- "cmd_Rename.gif",
- "cmd_Search.gif"
- };
- public Image stockImages[];
-
- // Stock cursors
- public final int
- cursorDefault = 0,
- cursorWait = 1;
- public Cursor stockCursors[];
- // Cached icons
- private Hashtable iconCache; /* map Program to Image */
public IconCache() {
}
- /**
- * Loads the resources
- *
- * @param display the display
- */
- public void initResources(Display display) {
- if (stockImages == null) {
- stockImages = new Image[stockImageLocations.length];
-
- for (int i = 0; i < stockImageLocations.length; ++i) {
- Image image = createStockImage(display, stockImageLocations[i]);
- if (image == null) {
- freeResources();
- throw new IllegalStateException(
- FileViewer.getResourceString("error.CouldNotLoadResources"));
- }
- stockImages[i] = image;
- }
- }
- if (stockCursors == null) {
- stockCursors = new Cursor[] {
- null,
- new Cursor(display, SWT.CURSOR_WAIT)
- };
- }
- iconCache = new Hashtable();
- }
- /**
- * Frees the resources
- */
- public void freeResources() {
- if (stockImages != null) {
- for (int i = 0; i < stockImages.length; ++i) {
- final Image image = stockImages[i];
- if (image != null) image.dispose();
- }
- stockImages = null;
- }
- if (iconCache != null) {
- for (Enumeration it = iconCache.elements(); it.hasMoreElements(); ) {
- Image image = (Image) it.nextElement();
- image.dispose();
- }
- }
- }
- /**
- * Creates a stock image
- *
- * @param display the display
- * @param path the relative path to the icon
- */
- private Image createStockImage(Display display, String path) {
- try {
- InputStream stream = IconCache.class.getResourceAsStream(path);
- if (stream != null) {
- ImageData imageData = new ImageData(stream);
- if (imageData != null) {
- ImageData mask = imageData.getTransparencyMask();
- return new Image(display, imageData, mask);
- }
- }
- } catch (Exception e) {
- }
- return null;
- }
- /**
- * Gets an image for a file associated with a given program
- *
- * @param program the Program
- */
- public Image getIconFromProgram(Program program) {
- Image image = (Image) iconCache.get(program);
- if (image == null) {
- ImageData imageData = program.getImageData();
- if (imageData != null) {
- image = new Image(null, imageData, imageData.getTransparencyMask());
- iconCache.put(program, image);
- } else {
- image = stockImages[iconFile];
- }
- }
- return image;
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Copy.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Copy.gif Binary files differdeleted file mode 100755 index 4274b070ac..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Copy.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Cut.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Cut.gif Binary files differdeleted file mode 100755 index eb948b94b0..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Cut.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Delete.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Delete.gif Binary files differdeleted file mode 100755 index 6f647666d3..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Delete.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Parent.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Parent.gif Binary files differdeleted file mode 100755 index 9b278e6fa8..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Parent.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Paste.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Paste.gif Binary files differdeleted file mode 100755 index 75e0ab2352..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Paste.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Print.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Print.gif Binary files differdeleted file mode 100755 index 4dfa8cd3fa..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Print.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gif Binary files differdeleted file mode 100755 index a063c230ac..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Rename.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Rename.gif Binary files differdeleted file mode 100755 index 25b1325e52..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Rename.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Search.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Search.gif Binary files differdeleted file mode 100755 index 6dc3ebefc9..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Search.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/generic_example.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/generic_example.gif Binary files differdeleted file mode 100755 index f9fb6b0cab..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/generic_example.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gif Binary files differdeleted file mode 100755 index 04e530e37c..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gif Binary files differdeleted file mode 100755 index beb6ed134c..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_File.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_File.gif Binary files differdeleted file mode 100755 index 6b86d07978..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_File.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gif Binary files differdeleted file mode 100755 index 7b2b6334ca..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gif Binary files differdeleted file mode 100755 index a9c777343c..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld1.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld1.java deleted file mode 100755 index 98bcf32e45..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld1.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.eclipse.swt.examples.helloworld;
-
-/*
- * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.widgets.*;
-
-/*
- * This example demonstrates the minimum amount of code required
- * to open an SWT Shell and process the events.
- */
-public class HelloWorld1 {
-
-public static void main (String [] args) {
- Display display = new Display ();
- Shell shell = new HelloWorld1 ().open (display);
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-
-public Shell open (Display display) {
- Shell shell = new Shell (display);
- shell.open ();
- return shell;
-}
-} diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld2.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld2.java deleted file mode 100755 index 454c23e4d1..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld2.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.eclipse.swt.examples.helloworld;
-
-/*
- * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import java.util.ResourceBundle;
-
-/*
- * This example builds on HelloWorld1 and demonstrates the minimum amount
- * of code required to open an SWT Shell with a Label and process the events.
- */
-public class HelloWorld2 {
- private static ResourceBundle resHello = ResourceBundle.getBundle("examples_helloworld");
-
-public static void main (String [] args) {
- Display display = new Display ();
- Shell shell = new HelloWorld2 ().open (display);
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-
-public Shell open (Display display) {
- Shell shell = new Shell (display);
- Label label = new Label (shell, SWT.CENTER);
- label.setText (resHello.getString("Hello_world"));
- label.setBounds (shell.getClientArea ());
- shell.open ();
- return shell;
-}
-} diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld3.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld3.java deleted file mode 100755 index 59bd7582c7..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld3.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.eclipse.swt.examples.helloworld;
-
-/*
- * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-import java.util.ResourceBundle;
-
-/*
- * This example builds on HelloWorld2 and demonstrates how to resize the
- * Label when the Shell resizes using a Listener mechanism.
- */
-public class HelloWorld3 {
- private static ResourceBundle resHello = ResourceBundle.getBundle("examples_helloworld");
-
-public static void main (String [] args) {
- Display display = new Display ();
- Shell shell = new HelloWorld3 ().open (display);
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-
-public Shell open (Display display) {
- final Shell shell = new Shell (display);
- final Label label = new Label (shell, SWT.CENTER);
- label.setText (resHello.getString("Hello_world"));
- label.pack();
- shell.addControlListener(new ControlAdapter() {
- public void controlResized(ControlEvent e) {
- label.setBounds (shell.getClientArea ());
- }
- });
- shell.pack();
- shell.open ();
- return shell;
-}
-} diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld4.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld4.java deleted file mode 100755 index b8cdde8fa8..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld4.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.eclipse.swt.examples.helloworld;
-
-/*
- * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import java.util.ResourceBundle;
-
-/*
- * This example builds on HelloWorld2 and demonstrates how to resize the
- * Label when the Shell resizes using a Layout.
- */
-public class HelloWorld4 {
- private static ResourceBundle resHello = ResourceBundle.getBundle("examples_helloworld");
-
-public static void main (String [] args) {
- Display display = new Display ();
- Shell shell = new HelloWorld4 ().open (display);
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-
-public Shell open (Display display) {
- Shell shell = new Shell (display);
- shell.setLayout(new FillLayout());
- Label label = new Label (shell, SWT.CENTER);
- label.setText (resHello.getString("Hello_world"));
- shell.pack ();
- shell.open ();
- return shell;
-}
-} diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld5.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld5.java deleted file mode 100755 index 9bcd44557a..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld5.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.eclipse.swt.examples.helloworld;
-
-/*
- * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import java.util.ResourceBundle;
-
-/*
- * This example builds on HelloWorld1 and demonstrates how to draw directly
- * on an SWT Control.
- */
-public class HelloWorld5 {
- private static ResourceBundle resHello = ResourceBundle.getBundle("examples_helloworld");
-
-public static void main (String [] args) {
- Display display = new Display ();
- Shell shell = new HelloWorld5 ().open (display);
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-
-public Shell open (Display display) {
- final Color red = new Color(display, 0xFF, 0, 0);
- final Shell shell = new Shell (display);
- shell.addPaintListener(new PaintListener () {
- public void paintControl(PaintEvent event){
- GC gc = event.gc;
- gc.setForeground(red);
- Rectangle rect = shell.getClientArea();
- gc.drawRectangle(rect.x + 10, rect.y + 10, rect.width - 20, rect.height - 20);
- gc.drawString(resHello.getString("Hello_world"), rect.x + 20, rect.y + 20);
- }
- });
- shell.addDisposeListener (new DisposeListener () {
- public void widgetDisposed (DisposeEvent e) {
- red.dispose();
- }
- });
- shell.open ();
- return shell;
-}
-} diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java deleted file mode 100755 index 2d632e0d45..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java +++ /dev/null @@ -1,338 +0,0 @@ -package org.eclipse.swt.examples.hoverhelp;
-
-/*
- * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import java.io.*;
import java.text.*;
import java.util.*;
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
-/**
- * This example demonstrates how to implement hover help feedback
- * using the MouseTrackListener.
- */
-public class HoverHelp {
- private static ResourceBundle resourceBundle = ResourceBundle.getBundle("examples_hoverhelp");;
-
- static final int
- hhiInformation = 0,
- hhiWarning = 1;
- static final String[] imageLocations = {
- "information.gif",
- "warning.gif"
- };
- Image images[];
-
- /**
- * Runs main program.
- */
- public static void main (String [] args) {
- Display display = new Display();
- Shell shell = new HoverHelp().open(display);
- // Event loop
- while (shell != null && ! shell.isDisposed()) {
- if (! display.readAndDispatch()) display.sleep();
- }
- // Cleanup
- display.dispose();
-
- }
-
- /**
- * Opens the main program.
- */
- public Shell open(Display display) {
- // Load the images
- Class clazz = HoverHelp.class;
- try {
- if (images == null) {
- images = new Image[imageLocations.length];
-
- for (int i = 0; i < imageLocations.length; ++i) {
- InputStream stream = clazz.getResourceAsStream(imageLocations[i]);
- ImageData source = new ImageData(stream);
- ImageData mask = source.getTransparencyMask();
- images[i] = new Image(display, source, mask);
- }
- }
- } catch (Exception ex) {
- System.err.println(getResourceString("error.CouldNotLoadResources",
- new Object[] { ex.getMessage() }));
- return null;
- }
-
- // Create the window
- Shell shell = new Shell();
- createPartControl(shell);
- shell.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- /* Free resources */
- if (images != null) {
- for (int i = 0; i < images.length; i++) {
- final Image image = images[i];
- if (image != null) image.dispose();
- }
- images = null;
- }
- }
- });
- shell.pack();
- shell.open();
- return shell;
- }
-
- /**
- * Gets a string from the resource bundle.
- * We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- public String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Gets a string from the resource bundle and binds it
- * with the given arguments. If the key is not found,
- * return the key.
- */
- public String getResourceString(String key, Object[] args) {
- try {
- return MessageFormat.format(getResourceString(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Creates the example
- */
- public void createPartControl(Composite frame) {
- final ToolTipHandler tooltip = new ToolTipHandler(frame.getShell());
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- frame.setLayout(layout);
-
- ToolBar bar = new ToolBar (frame, SWT.BORDER);
- for (int i=0; i<5; i++) {
- ToolItem item = new ToolItem (bar, SWT.PUSH);
- item.setText (getResourceString("ToolItem.text", new Object[] { new Integer(i) }));
- item.setData ("TIP_TEXT", getResourceString("ToolItem.tooltip",
- new Object[] { item.getText() }));
- item.setData ("TIP_HELPTEXTHANDLER", new ToolTipHelpTextHandler() {
- public String getHelpText(Widget widget) {
- Item item = (Item) widget;
- return getResourceString("ToolItem.help", new Object[] { item.getText() });
- }
- });
- }
- GridData gridData = new GridData();
- gridData.horizontalSpan = 3;
- bar.setLayoutData(gridData);
- tooltip.activateHoverHelp(bar);
-
- Table table = new Table (frame, SWT.BORDER);
- for (int i=0; i<4; i++) {
- TableItem item = new TableItem (table, SWT.PUSH);
- item.setText (getResourceString("Item", new Object[] { new Integer(i) }));
- item.setData ("TIP_IMAGE", images[hhiInformation]);
- item.setText (getResourceString("TableItem.text", new Object[] { new Integer(i) }));
- item.setData ("TIP_TEXT", getResourceString("TableItem.tooltip",
- new Object[] { item.getText() }));
- item.setData ("TIP_HELPTEXTHANDLER", new ToolTipHelpTextHandler() {
- public String getHelpText(Widget widget) {
- Item item = (Item) widget;
- return getResourceString("TableItem.help", new Object[] { item.getText() });
- }
- });
- }
- table.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL));
- tooltip.activateHoverHelp(table);
-
- Tree tree = new Tree (frame, SWT.BORDER);
- for (int i=0; i<4; i++) {
- TreeItem item = new TreeItem (tree, SWT.PUSH);
- item.setText (getResourceString("Item", new Object[] { new Integer(i) }));
- item.setData ("TIP_IMAGE", images[hhiWarning]);
- item.setText (getResourceString("TreeItem.text", new Object[] { new Integer(i) }));
- item.setData ("TIP_TEXT", getResourceString("TreeItem.tooltip",
- new Object[] { item.getText() }));
- item.setData ("TIP_HELPTEXTHANDLER", new ToolTipHelpTextHandler() {
- public String getHelpText(Widget widget) {
- Item item = (Item) widget;
- return getResourceString("TreeItem.help", new Object[] { item.getText() });
- }
- });
- }
- tree.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL));
- tooltip.activateHoverHelp(tree);
-
- Button button = new Button (frame, SWT.PUSH);
- button.setText (getResourceString("Hello.text"));
- button.setData ("TIP_TEXT", getResourceString("Hello.tooltip"));
- tooltip.activateHoverHelp(button);
- }
-
- /**
- * Emulated tooltip handler
- * Notice that we could display anything in a tooltip besides text and images.
- * For instance, it might make sense to embed large tables of data or buttons linking
- * data under inspection to material elsewhere, or perform dynamic lookup for creating
- * tooltip text on the fly.
- */
- protected static class ToolTipHandler {
- private Shell parentShell;
- private Shell tipShell;
- private Label tipLabelImage, tipLabelText;
- private Widget tipWidget; // widget this tooltip is hovering over
- private Point tipPosition; // the position being hovered over
-
- /**
- * Creates a new tooltip handler
- *
- * @param parent the parent Shell
- */
- public ToolTipHandler(Shell parent) {
- final Display display = parent.getDisplay();
- this.parentShell = parent;
-
- tipShell = new Shell(parent, SWT.ON_TOP);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- gridLayout.marginWidth = 2;
- gridLayout.marginHeight = 2;
- tipShell.setLayout(gridLayout);
-
- tipShell.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
-
- tipLabelImage = new Label(tipShell, SWT.NONE);
- tipLabelImage.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
- tipLabelImage.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- tipLabelImage.setLayoutData(new GridData(GridData.FILL_HORIZONTAL |
- GridData.VERTICAL_ALIGN_CENTER));
-
- tipLabelText = new Label(tipShell, SWT.NONE);
- tipLabelText.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
- tipLabelText.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- tipLabelText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL |
- GridData.VERTICAL_ALIGN_CENTER));
- }
-
- /**
- * Enables customized hover help for a specified control
- *
- * @control the control on which to enable hoverhelp
- */
- public void activateHoverHelp(final Control control) {
- /*
- * Get out of the way if we attempt to activate the control underneath the tooltip
- */
- control.addMouseListener(new MouseAdapter () {
- public void mouseDown (MouseEvent e) {
- if (tipShell.isVisible()) tipShell.setVisible(false);
- }
- });
-
- /*
- * Trap hover events to pop-up tooltip
- */
- control.addMouseTrackListener(new MouseTrackAdapter () {
- public void mouseExit(MouseEvent e) {
- if (tipShell.isVisible()) tipShell.setVisible(false);
- tipWidget = null;
- }
- public void mouseHover (MouseEvent event) {
- Point pt = new Point (event.x, event.y);
- Widget widget = event.widget;
- if (widget instanceof ToolBar) {
- ToolBar w = (ToolBar) widget;
- widget = w.getItem (pt);
- }
- if (widget instanceof Table) {
- Table w = (Table) widget;
- widget = w.getItem (pt);
- }
- if (widget instanceof Tree) {
- Tree w = (Tree) widget;
- widget = w.getItem (pt);
- }
- if (widget == null) {
- tipShell.setVisible(false);
- tipWidget = null;
- return;
- }
- if (widget == tipWidget) return;
- tipWidget = widget;
- tipPosition = control.toDisplay(pt);
- String text = (String) widget.getData("TIP_TEXT");
- Image image = (Image) widget.getData("TIP_IMAGE");
- tipLabelText.setText(text != null ? text : "");
- tipLabelImage.setImage(image); // accepts null
- tipShell.pack();
- setHoverLocation(tipShell, tipPosition);
- tipShell.setVisible(true);
- }
- });
-
- /*
- * Trap F1 Help to pop up a custom help box
- */
- control.addHelpListener(new HelpListener () {
- public void helpRequested(HelpEvent event) {
- if (tipWidget == null) return;
- ToolTipHelpTextHandler handler = (ToolTipHelpTextHandler)
- tipWidget.getData("TIP_HELPTEXTHANDLER");
- if (handler == null) return;
- String text = handler.getHelpText(tipWidget);
- if (text == null) return;
-
- if (tipShell.isVisible()) {
- tipShell.setVisible(false);
- Shell helpShell = new Shell(parentShell, SWT.SHELL_TRIM);
- helpShell.setLayout(new FillLayout());
- Label label = new Label(helpShell, SWT.NONE);
- label.setText(text);
- helpShell.pack();
- setHoverLocation(helpShell, tipPosition);
- helpShell.open();
- }
- }
- });
- }
-
- /**
- * Sets the location for a hovering shell
- * @param shell the object that is to hover
- * @param position the position of a widget to hover over
- * @return the top-left location for a hovering box
- */
- private void setHoverLocation(Shell shell, Point position) {
- Rectangle displayBounds = shell.getDisplay().getBounds();
- Rectangle shellBounds = shell.getBounds();
- shellBounds.x = Math.max(Math.min(position.x, displayBounds.width - shellBounds.width), 0);
- shellBounds.y = Math.max(Math.min(position.y + 16, displayBounds.height - shellBounds.height), 0);
- shell.setBounds(shellBounds);
- }
- }
-
- /**
- * ToolTip help handler
- */
- protected interface ToolTipHelpTextHandler {
- /**
- * Get help text
- * @param widget the widget that is under help
- * @return a help text string
- */
- public String getHelpText(Widget widget);
- }
-}
\ No newline at end of file diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/information.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/information.gif Binary files differdeleted file mode 100755 index 26c7477336..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/information.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/warning.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/warning.gif Binary files differdeleted file mode 100755 index cf4fdf93c7..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/warning.gif +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java deleted file mode 100755 index 5d35e6ec83..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java +++ /dev/null @@ -1,2076 +0,0 @@ -package org.eclipse.swt.examples.imageanalyzer;
-
-/*
- * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.printing.*;
-import org.eclipse.swt.custom.*;
-import java.util.*;
-import java.net.*;
-import java.io.*;
-import java.text.MessageFormat;
-
-public class ImageAnalyzer {
- static ResourceBundle bundle = ResourceBundle.getBundle("examples_images");
- Display display;
- Shell shell;
- Canvas imageCanvas, paletteCanvas;
- Label typeLabel, sizeLabel, depthLabel, transparentPixelLabel,
- timeToLoadLabel, screenSizeLabel, backgroundPixelLabel,
- locationLabel, disposalMethodLabel, delayTimeLabel,
- repeatCountLabel, paletteLabel, dataLabel, statusLabel;
- Combo backgroundCombo, scaleXCombo, scaleYCombo, alphaCombo;
- Button incrementalCheck, transparentCheck, maskCheck, backgroundCheck;
- Button previousButton, nextButton, animateButton;
- StyledText dataText;
- Sash sash;
- Color whiteColor, blackColor, redColor, greenColor, blueColor, canvasBackground;
- Font fixedWidthFont;
- Cursor crossCursor;
- GC imageCanvasGC;
-
- int paletteWidth = 140; // recalculated and used as a width hint
- int ix = 0, iy = 0, py = 0; // used to scroll the image and palette
- float xscale = 1, yscale = 1; // used to scale the image
- int alpha = 255; // used to modify the alpha value of the image
- boolean incremental = false; // used to incrementally display an image
- boolean transparent = true; // used to display an image with transparency
- boolean showMask = false; // used to display an icon mask or transparent image mask
- boolean showBackground = false; // used to display the background of an animated image
- boolean animate = false; // used to animate a multi-image file
- Thread animateThread; // draws animated images
- Thread incrementalThread; // draws incremental images
- String lastPath; // used to seed the file dialog
- String currentName; // the current image file or URL name
- String fileName; // the current image file
- ImageLoader loader; // the loader for the current image file
- ImageData[] imageDataArray; // all image data read from the current file
- int imageDataIndex; // the index of the current image data
- ImageData imageData; // the currently-displayed image data
- Image image; // the currently-displayed image
- Vector incrementalEvents; // incremental image events
- long loadTime = 0; // the time it took to load the current image
-
- static final int INDEX_DIGITS = 4;
- static final int ALPHA_CONSTANT = 0;
- static final int ALPHA_X = 1;
- static final int ALPHA_Y = 2;
-
- class TextPrompter extends Dialog {
- String message = "";
- String result = null;
- Shell dialog;
- Text text;
- public TextPrompter (Shell parent, int style) {
- super (parent, style);
- }
- public TextPrompter (Shell parent) {
- this (parent, SWT.APPLICATION_MODAL);
- }
- public String getMessage () {
- return message;
- }
- public void setMessage (String string) {
- message = string;
- }
- public String open () {
- dialog = new Shell(getParent(), getStyle());
- dialog.setText(getText());
- dialog.setLayout(new GridLayout());
- Label label = new Label(dialog, SWT.NULL);
- label.setText(message);
- label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- text = new Text(dialog, SWT.SINGLE | SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 300;
- text.setLayoutData(data);
- Composite buttons = new Composite(dialog, SWT.NONE);
- GridLayout grid = new GridLayout();
- grid.numColumns = 2;
- buttons.setLayout(grid);
- buttons.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- Button ok = new Button(buttons, SWT.PUSH);
- ok.setText(bundle.getString("OK"));
- data = new GridData();
- data.widthHint = 75;
- ok.setLayoutData(data);
- ok.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- result = text.getText();
- dialog.dispose();
- }
- });
- Button cancel = new Button(buttons, SWT.PUSH);
- cancel.setText(bundle.getString("Cancel"));
- data = new GridData();
- data.widthHint = 75;
- cancel.setLayoutData(data);
- cancel.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- dialog.dispose();
- }
- });
- dialog.setDefaultButton(ok);
- dialog.pack();
- dialog.open();
- while (!dialog.isDisposed()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- return result;
- }
- }
-
- public static void main(String [] args) {
- Display display = new Display();
- ImageAnalyzer imageAnalyzer = new ImageAnalyzer();
- Shell shell = imageAnalyzer.open(display);
-
- while (!shell.isDisposed())
- if (!display.readAndDispatch()) display.sleep();
- display.dispose();
- }
-
- public Shell open(Display dpy) {
- // Create a window and set its title.
- this.display = dpy;
- shell = new Shell(display);
- shell.setText(bundle.getString("Image_analyzer"));
-
- // Hook resize and dispose listeners.
- shell.addControlListener(new ControlAdapter() {
- public void controlResized(ControlEvent event) {
- resizeShell(event);
- }
- });
- shell.addShellListener(new ShellAdapter() {
- public void shellClosed(ShellEvent e) {
- animate = false; // stop any animation in progress
- if (animateThread != null) {
- // wait for the thread to die before disposing the shell.
- while (animateThread.isAlive()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- }
- e.doit = true;
- }
- });
- shell.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- // Clean up.
- if (image != null)
- image.dispose();
- whiteColor.dispose();
- blackColor.dispose();
- redColor.dispose();
- greenColor.dispose();
- blueColor.dispose();
- fixedWidthFont.dispose();
- crossCursor.dispose();
- }
- });
-
- // Create colors and fonts.
- whiteColor = new Color(display, 255, 255, 255);
- blackColor = new Color(display, 0, 0, 0);
- redColor = new Color(display, 255, 0, 0);
- greenColor = new Color(display, 0, 255, 0);
- blueColor = new Color(display, 0, 0, 255);
- fixedWidthFont = new Font(display, "courier", 10, 0);
- crossCursor = new Cursor(display, SWT.CURSOR_CROSS);
-
- // Add a menu bar and widgets.
- Menu menuBar = createMenuBar();
- createWidgets();
- shell.pack();
-
- // Create a GC for drawing, and hook the listener to dispose it.
- imageCanvasGC = new GC(imageCanvas);
- imageCanvas.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- imageCanvasGC.dispose();
- }
- });
-
- // Open the window
- shell.open();
- return shell;
- }
-
- void createWidgets() {
- // Add the widgets to the shell in a grid layout.
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.numColumns = 2;
- shell.setLayout(layout);
-
- // Separate the menu bar from the rest of the widgets.
- Label separator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData gridData = new GridData();
- gridData.horizontalSpan = 2;
- gridData.horizontalAlignment = GridData.FILL;
- separator.setLayoutData(gridData);
-
- // Add a composite to contain some control widgets across the top.
- Composite controls = new Composite(shell, SWT.NULL);
- RowLayout rowLayout = new RowLayout();
- rowLayout.marginTop = 0;
- rowLayout.marginBottom = 5;
- rowLayout.spacing = 8;
- controls.setLayout(rowLayout);
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- controls.setLayoutData(gridData);
-
- // Combo to change the background.
- Group group = new Group(controls, SWT.NULL);
- group.setLayout(new RowLayout());
- group.setText(bundle.getString("Background"));
- backgroundCombo = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY);
- backgroundCombo.setItems(new String[] {
- bundle.getString("None"),
- bundle.getString("White"),
- bundle.getString("Black"),
- bundle.getString("Red"),
- bundle.getString("Green"),
- bundle.getString("Blue")});
- backgroundCombo.select(backgroundCombo.indexOf(bundle.getString("White")));
- backgroundCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- changeBackground();
- }
- });
-
- // Combo to change the x scale.
- String[] values = {
- "0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1",
- "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "2",
- "3", "4", "5", "6", "7", "8", "9", "10",};
- group = new Group(controls, SWT.NULL);
- group.setLayout(new RowLayout());
- group.setText(bundle.getString("X_scale"));
- scaleXCombo = new Combo(group, SWT.DROP_DOWN);
- for (int i = 0; i < values.length; i++) {
- scaleXCombo.add(values[i]);
- }
- scaleXCombo.select(scaleXCombo.indexOf("1"));
- scaleXCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- scaleX();
- }
- });
-
- // Combo to change the y scale.
- group = new Group(controls, SWT.NULL);
- group.setLayout(new RowLayout());
- group.setText(bundle.getString("Y_scale"));
- scaleYCombo = new Combo(group, SWT.DROP_DOWN);
- for (int i = 0; i < values.length; i++) {
- scaleYCombo.add(values[i]);
- }
- scaleYCombo.select(scaleYCombo.indexOf("1"));
- scaleYCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- scaleY();
- }
- });
-
- // Combo to change the alpha value.
- group = new Group(controls, SWT.NULL);
- group.setLayout(new RowLayout());
- group.setText(bundle.getString("Alpha_K"));
- alphaCombo = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY);
- for (int i = 0; i <= 255; i += 5) {
- alphaCombo.add(String.valueOf(i));
- }
- alphaCombo.select(alphaCombo.indexOf("255"));
- alphaCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- alpha();
- }
- });
-
- // Check box to request incremental display.
- group = new Group(controls, SWT.NULL);
- group.setLayout(new RowLayout());
- group.setText(bundle.getString("Display"));
- incrementalCheck = new Button(group, SWT.CHECK);
- incrementalCheck.setText(bundle.getString("Incremental"));
- incrementalCheck.setSelection(incremental);
- incrementalCheck.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- incremental = ((Button)event.widget).getSelection();
- }
- });
-
- // Check box to request transparent display.
- transparentCheck = new Button(group, SWT.CHECK);
- transparentCheck.setText(bundle.getString("Transparent"));
- transparentCheck.setSelection(transparent);
- transparentCheck.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- transparent = ((Button)event.widget).getSelection();
- if (image != null) {
- imageCanvas.redraw();
- }
- }
- });
-
- // Check box to request mask display.
- maskCheck = new Button(group, SWT.CHECK);
- maskCheck.setText(bundle.getString("Mask"));
- maskCheck.setSelection(showMask);
- maskCheck.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- showMask = ((Button)event.widget).getSelection();
- if (image != null) {
- imageCanvas.redraw();
- }
- }
- });
-
- // Check box to request background display.
- backgroundCheck = new Button(group, SWT.CHECK);
- backgroundCheck.setText(bundle.getString("Background"));
- backgroundCheck.setSelection(showBackground);
- backgroundCheck.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- showBackground = ((Button)event.widget).getSelection();
- }
- });
-
- // Group the animation buttons.
- group = new Group(controls, SWT.NULL);
- group.setLayout(new RowLayout());
- group.setText(bundle.getString("Animation"));
-
- // Push button to display the previous image in a multi-image file.
- previousButton = new Button(group, SWT.PUSH);
- previousButton.setText(bundle.getString("Previous"));
- previousButton.setEnabled(false);
- previousButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- previous();
- }
- });
-
- // Push button to display the next image in a multi-image file.
- nextButton = new Button(group, SWT.PUSH);
- nextButton.setText(bundle.getString("Next"));
- nextButton.setEnabled(false);
- nextButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- next();
- }
- });
-
- // Push button to toggle animation of a multi-image file.
- animateButton = new Button(group, SWT.PUSH);
- animateButton.setText(bundle.getString("Animate"));
- animateButton.setEnabled(false);
- animateButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- animate();
- }
- });
-
- // Label to show the image file type.
- typeLabel = new Label(shell, SWT.NULL);
- typeLabel.setText(bundle.getString("Type_initial"));
- typeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Canvas to show the image.
- imageCanvas = new Canvas(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.NO_REDRAW_RESIZE);
- imageCanvas.setBackground(whiteColor);
- imageCanvas.setCursor(crossCursor);
- gridData = new GridData();
- gridData.verticalSpan = 15;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- imageCanvas.setLayoutData(gridData);
- imageCanvas.addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent event) {
- if (image != null)
- paintImage(event);
- }
- });
- imageCanvas.addMouseMoveListener(new MouseMoveListener() {
- public void mouseMove(MouseEvent event) {
- if (image != null) {
- showColorAt(event.x, event.y);
- }
- }
- });
-
- // Set up the image canvas scroll bars.
- ScrollBar horizontal = imageCanvas.getHorizontalBar();
- horizontal.setVisible(true);
- horizontal.setMinimum(0);
- horizontal.setEnabled(false);
- horizontal.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- scrollHorizontally((ScrollBar)event.widget);
- }
- });
- ScrollBar vertical = imageCanvas.getVerticalBar();
- vertical.setVisible(true);
- vertical.setMinimum(0);
- vertical.setEnabled(false);
- vertical.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- scrollVertically((ScrollBar)event.widget);
- }
- });
-
- // Label to show the image size.
- sizeLabel = new Label(shell, SWT.NULL);
- sizeLabel.setText(bundle.getString("Size_initial"));
- sizeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Label to show the image depth.
- depthLabel = new Label(shell, SWT.NULL);
- depthLabel.setText(bundle.getString("Depth_initial"));
- depthLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Label to show the transparent pixel.
- transparentPixelLabel = new Label(shell, SWT.NULL);
- transparentPixelLabel.setText(bundle.getString("Transparent_pixel_initial"));
- transparentPixelLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Label to show the time to load.
- timeToLoadLabel = new Label(shell, SWT.NULL);
- timeToLoadLabel.setText(bundle.getString("Time_to_load_initial"));
- timeToLoadLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Separate the animation fields from the rest of the fields.
- separator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
- separator.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Label to show the logical screen size for animation.
- screenSizeLabel = new Label(shell, SWT.NULL);
- screenSizeLabel.setText(bundle.getString("Animation_size_initial"));
- screenSizeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Label to show the background pixel.
- backgroundPixelLabel = new Label(shell, SWT.NULL);
- backgroundPixelLabel.setText(bundle.getString("Background_pixel_initial"));
- backgroundPixelLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Label to show the image location (x, y).
- locationLabel = new Label(shell, SWT.NULL);
- locationLabel.setText(bundle.getString("Image_location_initial"));
- locationLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Label to show the image disposal method.
- disposalMethodLabel = new Label(shell, SWT.NULL);
- disposalMethodLabel.setText(bundle.getString("Disposal_initial"));
- disposalMethodLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Label to show the image delay time.
- delayTimeLabel = new Label(shell, SWT.NULL);
- delayTimeLabel.setText(bundle.getString("Delay_initial"));
- delayTimeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Label to show the background pixel.
- repeatCountLabel = new Label(shell, SWT.NULL);
- repeatCountLabel.setText(bundle.getString("Repeats_initial"));
- repeatCountLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Separate the animation fields from the palette.
- separator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
- separator.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Label to show if the image has a direct or indexed palette.
- paletteLabel = new Label(shell, SWT.NULL);
- paletteLabel.setText(bundle.getString("Palette_initial"));
- paletteLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- // Canvas to show the image's palette.
- paletteCanvas = new Canvas(shell, SWT.BORDER | SWT.V_SCROLL | SWT.NO_REDRAW_RESIZE);
- paletteCanvas.setFont(fixedWidthFont);
- paletteCanvas.getVerticalBar().setVisible(true);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- GC gc = new GC(paletteLabel);
- paletteWidth = gc.stringExtent(bundle.getString("Max_length_string")).x;
- gc.dispose();
- gridData.widthHint = paletteWidth;
- gridData.heightHint = 16 * 11; // show at least 16 colors
- paletteCanvas.setLayoutData(gridData);
- paletteCanvas.addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent event) {
- if (image != null)
- paintPalette(event);
- }
- });
-
- // Set up the palette canvas scroll bar.
- vertical = paletteCanvas.getVerticalBar();
- vertical.setVisible(true);
- vertical.setMinimum(0);
- vertical.setIncrement(10);
- vertical.setEnabled(false);
- vertical.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- scrollPalette((ScrollBar)event.widget);
- }
- });
-
- // Sash to see more of image or image data.
- sash = new Sash(shell, SWT.HORIZONTAL);
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- gridData.horizontalAlignment = GridData.FILL;
- sash.setLayoutData(gridData);
- sash.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- if (event.detail != SWT.DRAG) {
- ((GridData)paletteCanvas.getLayoutData()).heightHint = SWT.DEFAULT;
- Rectangle paletteCanvasBounds = paletteCanvas.getBounds();
- int minY = paletteCanvasBounds.y + 20;
- Rectangle dataLabelBounds = dataLabel.getBounds();
- int maxY = statusLabel.getBounds().y - dataLabelBounds.height - 20;
- if (event.y > minY && event.y < maxY) {
- Rectangle oldSash = sash.getBounds();
- sash.setBounds(event.x, event.y, event.width, event.height);
- int diff = event.y - oldSash.y;
- Rectangle bounds = imageCanvas.getBounds();
- imageCanvas.setBounds(bounds.x, bounds.y, bounds.width, bounds.height + diff);
- bounds = paletteCanvasBounds;
- paletteCanvas.setBounds(bounds.x, bounds.y, bounds.width, bounds.height + diff);
- bounds = dataLabelBounds;
- dataLabel.setBounds(bounds.x, bounds.y + diff, bounds.width, bounds.height);
- bounds = dataText.getBounds();
- dataText.setBounds(bounds.x, bounds.y + diff, bounds.width, bounds.height - diff);
- //shell.layout(true);
- }
- }
- }
- });
-
- // Label to show data-specific fields.
- dataLabel = new Label(shell, SWT.NULL);
- dataLabel.setText(bundle.getString("Pixel_data_initial"));
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- gridData.horizontalAlignment = GridData.FILL;
- dataLabel.setLayoutData(gridData);
-
- // Text to show a dump of the data.
- dataText = new StyledText(shell, SWT.BORDER | SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL);
- dataText.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- dataText.setFont(fixedWidthFont);
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.heightHint = 128;
- gridData.grabExcessVerticalSpace = true;
- dataText.setLayoutData(gridData);
- dataText.addMouseListener(new MouseAdapter() {
- public void mouseDown(MouseEvent event) {
- if (image != null && event.button == 1) {
- showColorForData();
- }
- }
- });
- dataText.addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent event) {
- if (image != null) {
- showColorForData();
- }
- }
- });
-
- // Label to show status and cursor location in image.
- statusLabel = new Label(shell, SWT.NULL);
- statusLabel.setText("");
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- gridData.horizontalAlignment = GridData.FILL;
- statusLabel.setLayoutData(gridData);
- }
-
- Menu createMenuBar() {
- // Menu bar.
- Menu menuBar = new Menu(shell, SWT.BAR);
- shell.setMenuBar(menuBar);
- createFileMenu(menuBar);
- createAlphaMenu(menuBar);
- return menuBar;
- }
-
- void createFileMenu(Menu menuBar) {
- // File menu
- MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
- item.setText(bundle.getString("File"));
- Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
- item.setMenu(fileMenu);
-
- // File -> Open File...
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("OpenFile"));
- item.setAccelerator(SWT.CTRL + 'O');
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuOpenFile();
- }
- });
-
- // File -> Open URL...
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("OpenURL"));
- item.setAccelerator(SWT.CTRL + 'U');
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuOpenURL();
- }
- });
-
- // File -> Reopen
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Reopen"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuReopen();
- }
- });
-
- new MenuItem(fileMenu, SWT.SEPARATOR);
-
- // File -> Save
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Save"));
- item.setAccelerator(SWT.CTRL + 'S');
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuSave();
- }
- });
-
- // File -> Save As...
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Save_as"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuSaveAs();
- }
- });
-
- // File -> Save Mask As...
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Save_mask_as"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuSaveMaskAs();
- }
- });
-
- new MenuItem(fileMenu, SWT.SEPARATOR);
-
- // File -> Print
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Print"));
- item.setAccelerator(SWT.CTRL + 'P');
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuPrint();
- }
- });
-
- new MenuItem(fileMenu, SWT.SEPARATOR);
-
- // File -> Exit
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Exit"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- shell.close();
- }
- });
-
- }
-
- void createAlphaMenu(Menu menuBar) {
- // Alpha menu
- MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
- item.setText(bundle.getString("Alpha"));
- Menu alphaMenu = new Menu(shell, SWT.DROP_DOWN);
- item.setMenu(alphaMenu);
-
- // Alpha -> K
- item = new MenuItem(alphaMenu, SWT.NULL);
- item.setText("K");
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuComposeAlpha(ALPHA_CONSTANT);
- }
- });
-
- // Alpha -> (K + x) % 256
- item = new MenuItem(alphaMenu, SWT.NULL);
- item.setText("(K + x) % 256");
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuComposeAlpha(ALPHA_X);
- }
- });
-
- // Alpha -> (K + y) % 256
- item = new MenuItem(alphaMenu, SWT.NULL);
- item.setText("(K + y) % 256");
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuComposeAlpha(ALPHA_Y);
- }
- });
- }
-
- void menuComposeAlpha(int alpha_op) {
- if (image == null) return;
- animate = false; // stop any animation in progress
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- if (alpha_op == ALPHA_CONSTANT) {
- imageData.alpha = alpha;
- } else {
- imageData.alpha = -1;
- switch (alpha_op) {
- case ALPHA_X:
- for (int y = 0; y < imageData.height; y++) {
- for (int x = 0; x < imageData.width; x++) {
- imageData.setAlpha(x, y, (x + alpha) % 256);
- }
- }
- break;
- case ALPHA_Y:
- for (int y = 0; y < imageData.height; y++) {
- for (int x = 0; x < imageData.width; x++) {
- imageData.setAlpha(x, y, (y + alpha) % 256);
- }
- }
- break;
- default: break;
- }
- }
- displayImage(imageData);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
-
- void menuOpenFile() {
- animate = false; // stop any animation in progress
- resetScaleCombos();
-
- // Get the user to choose an image file.
- FileDialog fileChooser = new FileDialog(shell, SWT.OPEN);
- if (lastPath != null)
- fileChooser.setFilterPath(lastPath);
- fileChooser.setFilterExtensions(new String[] { "*.bmp; *.gif; *.ico; *.jpg; *.pcx; *.png; *.tif", "*.bmp", "*.gif", "*.ico", "*.jpg", "*.pcx", "*.png", "*.tif" });
- fileChooser.setFilterNames(new String[] { bundle.getString("All_images") + " (bmp, gif, ico, jpg, pcx, png, tif)",
- "BMP (*.bmp)", "GIF (*.gif)", "ICO (*.ico)", "JPEG (*.jpg)", "PCX (*.pcx)", "PNG (*.png)", "TIFF (*.tif)" });
- String filename = fileChooser.open();
- lastPath = fileChooser.getFilterPath();
- if (filename == null)
- return;
-
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- loader = new ImageLoader();
- if (incremental) {
- // Prepare to handle incremental events.
- loader.addImageLoaderListener(new ImageLoaderListener() {
- public void imageDataLoaded(ImageLoaderEvent event) {
- incrementalDataLoaded(event);
- }
- });
- incrementalThreadStart();
- }
- // Read the new image(s) from the chosen file.
- long startTime = System.currentTimeMillis();
- imageDataArray = loader.load(filename);
- loadTime = System.currentTimeMillis() - startTime;
- if (imageDataArray.length > 0) {
- // Cache the filename.
- currentName = filename;
- fileName = filename;
-
- // If there are multiple images in the file (typically GIF)
- // then enable the Previous, Next and Animate buttons.
- previousButton.setEnabled(imageDataArray.length > 1);
- nextButton.setEnabled(imageDataArray.length > 1);
- animateButton.setEnabled(imageDataArray.length > 1 && loader.logicalScreenWidth > 0 && loader.logicalScreenHeight > 0);
-
- // Display the first image in the file.
- imageDataIndex = 0;
- displayImage(imageDataArray[imageDataIndex]);
- resetScrollBars();
- }
- } catch (SWTException e) {
- showErrorDialog(bundle.getString("Loading_lc"), filename, e);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
-
- void menuOpenURL() {
- animate = false; // stop any animation in progress
- resetScaleCombos();
-
- // Get the user to choose an image URL.
- TextPrompter textPrompter = new TextPrompter(shell, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
- textPrompter.setText(bundle.getString("OpenURLDialog"));
- textPrompter.setMessage(bundle.getString("EnterURL"));
- String urlname = textPrompter.open();
- if (urlname == null) return;
-
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- URL url = new URL(urlname);
- InputStream stream = url.openStream();
- loader = new ImageLoader();
- if (incremental) {
- // Prepare to handle incremental events.
- loader.addImageLoaderListener(new ImageLoaderListener() {
- public void imageDataLoaded(ImageLoaderEvent event) {
- incrementalDataLoaded(event);
- }
- });
- incrementalThreadStart();
- }
- // Read the new image(s) from the chosen file.
- long startTime = System.currentTimeMillis();
- imageDataArray = loader.load(stream);
- loadTime = System.currentTimeMillis() - startTime;
- if (imageDataArray.length > 0) {
- currentName = urlname;
- fileName = null;
-
- // If there are multiple images in the file (typically GIF)
- // then enable the Previous, Next and Animate buttons.
- previousButton.setEnabled(imageDataArray.length > 1);
- nextButton.setEnabled(imageDataArray.length > 1);
- animateButton.setEnabled(imageDataArray.length > 1 && loader.logicalScreenWidth > 0 && loader.logicalScreenHeight > 0);
-
- // Display the first image in the file.
- imageDataIndex = 0;
- displayImage(imageDataArray[imageDataIndex]);
- resetScrollBars();
- }
- } catch (Exception e) {
- showErrorDialog(bundle.getString("Loading_lc"), urlname, e);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
-
- /*
- * Called to start a thread that draws incremental images
- * as they are loaded.
- */
- void incrementalThreadStart() {
- incrementalEvents = new Vector();
- incrementalThread = new Thread("Incremental") {
- public void run() {
- // Draw the first ImageData increment.
- while (incrementalEvents != null) {
- // Synchronize so we don't try to remove when the vector is null.
- synchronized (ImageAnalyzer.this) {
- if (incrementalEvents != null) {
- if (incrementalEvents.size() > 0) {
- ImageLoaderEvent event = (ImageLoaderEvent) incrementalEvents.remove(0);
- if (image != null) image.dispose();
- image = new Image(display, event.imageData);
- imageData = event.imageData;
- imageCanvasGC.drawImage(
- image,
- 0,
- 0,
- imageData.width,
- imageData.height,
- imageData.x,
- imageData.y,
- imageData.width,
- imageData.height);
- } else {
- yield();
- }
- }
- }
- }
- display.wake();
- }
- };
- incrementalThread.setDaemon(true);
- incrementalThread.start();
- }
-
- /*
- * Called when incremental image data has been loaded,
- * for example, for interlaced GIF/PNG or progressive JPEG.
- */
- void incrementalDataLoaded(ImageLoaderEvent event) {
- // Synchronize so that we do not try to add while
- // the incremental drawing thread is removing.
- synchronized (this) {
- incrementalEvents.addElement(event);
- }
- }
-
- void menuSave() {
- if (image == null) return;
- animate = false; // stop any animation in progress
-
- // If the image file type is unknown, we can't 'Save',
- // so we have to use 'Save As...'.
- if (imageData.type == SWT.IMAGE_UNDEFINED || fileName == null) {
- menuSaveAs();
- return;
- }
-
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- // Save the current image to the current file.
- loader.data = new ImageData[] {imageData};
- loader.save(fileName, imageData.type);
-
- } catch (SWTException e) {
- showErrorDialog(bundle.getString("Saving_lc"), fileName, e);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
-
- void menuSaveAs() {
- if (image == null) return;
- animate = false; // stop any animation in progress
-
- // Get the user to choose a file name and type to save.
- FileDialog fileChooser = new FileDialog(shell, SWT.SAVE);
- fileChooser.setFilterPath(lastPath);
- if (fileName != null) fileChooser.setFileName(fileName);
- fileChooser.setFilterExtensions(new String[] { "*.bmp", "*.gif", "*.ico", "*.jpg", "*.png" });
- fileChooser.setFilterNames(new String[] { "BMP (*.bmp)", "GIF (*.gif)", "ICO (*.ico)", "JPEG (*.jpg)", "PNG (*.png)" });
- String filename = fileChooser.open();
- lastPath = fileChooser.getFilterPath();
- if (filename == null)
- return;
-
- // Figure out what file type the user wants saved.
- // We need to rely on the file extension because FileDialog
- // does not have API for asking what filter type was selected.
- int filetype = determineFileType(filename);
- if (filetype == SWT.IMAGE_UNDEFINED) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- box.setMessage(createMsg(bundle.getString("Unknown_extension"),
- filename.substring(filename.lastIndexOf('.') + 1)));
- box.open();
- return;
- }
-
- if (new java.io.File(filename).exists()) {
- MessageBox box = new MessageBox(shell, SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
- box.setMessage(createMsg(bundle.getString("Overwrite"), filename));
- if (box.open() == SWT.CANCEL)
- return;
- }
-
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- // Save the current image to the specified file.
- loader.data = new ImageData[] {imageData};
- loader.save(filename, filetype);
-
- // Update the shell title and file type label,
- // and use the new file.
- fileName = filename;
- shell.setText(createMsg(bundle.getString("Analyzer_on"), filename));
- typeLabel.setText(createMsg(bundle.getString("Type_string"), fileTypeString(filetype)));
-
- } catch (SWTException e) {
- showErrorDialog(bundle.getString("Saving_lc"), filename, e);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
-
- void menuSaveMaskAs() {
- if (image == null || !showMask) return;
- if (imageData.getTransparencyType() == SWT.TRANSPARENCY_NONE) return;
- animate = false; // stop any animation in progress
-
- // Get the user to choose a file name and type to save.
- FileDialog fileChooser = new FileDialog(shell, SWT.SAVE);
- fileChooser.setFilterPath(lastPath);
- if (fileName != null) fileChooser.setFileName(fileName);
- fileChooser.setFilterExtensions(new String[] { "*.bmp", "*.gif", "*.ico", "*.jpg", "*.png" });
- fileChooser.setFilterNames(new String[] { "BMP (*.bmp)", "GIF (*.gif)", "ICO (*.ico)", "JPEG (*.jpg)", "PNG (*.png)" });
- String filename = fileChooser.open();
- lastPath = fileChooser.getFilterPath();
- if (filename == null)
- return;
-
- // Figure out what file type the user wants saved.
- // We need to rely on the file extension because FileDialog
- // does not have API for asking what filter type was selected.
- int filetype = determineFileType(filename);
- if (filetype == SWT.IMAGE_UNDEFINED) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- box.setMessage(createMsg(bundle.getString("Unknown_extension"),
- filename.substring(filename.lastIndexOf('.') + 1)));
- box.open();
- return;
- }
-
- if (new java.io.File(filename).exists()) {
- MessageBox box = new MessageBox(shell, SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
- box.setMessage(createMsg(bundle.getString("Overwrite"), filename));
- if (box.open() == SWT.CANCEL)
- return;
- }
-
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- // Save the mask of the current image to the specified file.
- ImageData maskImageData = imageData.getTransparencyMask();
- loader.data = new ImageData[] {maskImageData};
- loader.save(filename, filetype);
-
- } catch (SWTException e) {
- showErrorDialog(bundle.getString("Saving_lc"), filename, e);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
-
- void menuPrint() {
- if (image == null) return;
-
- try {
- // Ask the user to specify the printer.
- PrintDialog dialog = new PrintDialog(shell, SWT.NULL);
- PrinterData printerData = dialog.open();
- if (printerData == null) return;
-
- Printer printer = new Printer(printerData);
- Point screenDPI = display.getDPI();
- Point printerDPI = printer.getDPI();
- int scaleFactor = printerDPI.x / screenDPI.x;
- Rectangle trim = printer.computeTrim(0, 0, 0, 0);
- if (printer.startJob(currentName)) {
- if (printer.startPage()) {
- GC gc = new GC(printer);
- int transparentPixel = imageData.transparentPixel;
- if (transparentPixel != -1 && !transparent) {
- imageData.transparentPixel = -1;
- }
- Image printerImage = new Image(printer, imageData);
- gc.drawImage(
- printerImage,
- 0,
- 0,
- imageData.width,
- imageData.height,
- -trim.x,
- -trim.y,
- scaleFactor * imageData.width,
- scaleFactor * imageData.height);
- if (transparentPixel != -1 && !transparent) {
- imageData.transparentPixel = transparentPixel;
- }
- printerImage.dispose();
- gc.dispose();
- printer.endPage();
- }
- printer.endJob();
- }
- printer.dispose();
- } catch (SWTError e) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- box.setMessage(bundle.getString("Printing_error") + e.getMessage());
- box.open();
- }
- }
-
- void menuReopen() {
- if (currentName == null) return;
- animate = false; // stop any animation in progress
- resetScrollBars();
- resetScaleCombos();
- Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
- imageCanvas.setCursor(waitCursor);
- try {
- loader = new ImageLoader();
- long startTime = System.currentTimeMillis();
- ImageData[] newImageData;
- if (fileName == null) {
- URL url = new URL(currentName);
- InputStream stream = url.openStream();
- newImageData = loader.load(stream);
- } else {
- newImageData = loader.load(fileName);
- }
- loadTime = System.currentTimeMillis() - startTime;
- imageDataIndex = 0;
- displayImage(newImageData[imageDataIndex]);
-
- } catch (Exception e) {
- showErrorDialog(bundle.getString("Reloading_lc"), currentName, e);
- } finally {
- shell.setCursor(null);
- imageCanvas.setCursor(crossCursor);
- waitCursor.dispose();
- }
- }
-
- void changeBackground() {
- String background = backgroundCombo.getText();
- if (background.equals(bundle.getString("White"))) {
- imageCanvas.setBackground(whiteColor);
- } else if (background.equals(bundle.getString("Black"))) {
- imageCanvas.setBackground(blackColor);
- } else if (background.equals(bundle.getString("Red"))) {
- imageCanvas.setBackground(redColor);
- } else if (background.equals(bundle.getString("Green"))) {
- imageCanvas.setBackground(greenColor);
- } else if (background.equals(bundle.getString("Blue"))) {
- imageCanvas.setBackground(blueColor);
- } else {
- imageCanvas.setBackground(null);
- }
- }
-
- /*
- * Called when the ScaleX combo selection changes.
- */
- void scaleX() {
- try {
- xscale = Float.parseFloat(scaleXCombo.getText());
- } catch (NumberFormatException e) {
- xscale = 1;
- scaleXCombo.select(scaleXCombo.indexOf("1"));
- }
- if (image != null) {
- resizeScrollBars();
- imageCanvas.redraw();
- }
- }
-
- /*
- * Called when the ScaleY combo selection changes.
- */
- void scaleY() {
- try {
- yscale = Float.parseFloat(scaleYCombo.getText());
- } catch (NumberFormatException e) {
- yscale = 1;
- scaleYCombo.select(scaleYCombo.indexOf("1"));
- }
- if (image != null) {
- resizeScrollBars();
- imageCanvas.redraw();
- }
- }
-
- /*
- * Called when the Alpha combo selection changes.
- */
- void alpha() {
- try {
- alpha = Integer.parseInt(alphaCombo.getText());
- } catch (NumberFormatException e) {
- alphaCombo.select(alphaCombo.indexOf("255"));
- alpha = 255;
- }
- }
-
- /*
- * Called when the mouse moves in the image canvas.
- * Show the color of the image at the point under the mouse.
- */
- void showColorAt(int mx, int my) {
- int x = mx - imageData.x - ix;
- int y = my - imageData.y - iy;
- showColorForPixel(x, y);
- }
-
- /*
- * Called when a mouse down or key press is detected
- * in the data text. Show the color of the pixel at
- * the caret position in the data text.
- */
- void showColorForData() {
- int delimiterLength = dataText.getLineDelimiter().length();
- int charactersPerLine = 6 + 3 * imageData.bytesPerLine + delimiterLength;
- int position = dataText.getCaretOffset();
- int y = position / charactersPerLine;
- if ((position - y * charactersPerLine) < 6 || ((y + 1) * charactersPerLine - position) <= delimiterLength) {
- statusLabel.setText("");
- return;
- }
- int dataPosition = position - 6 * (y + 1) - delimiterLength * y;
- int byteNumber = dataPosition / 3;
- int where = dataPosition - byteNumber * 3;
- int xByte = byteNumber % imageData.bytesPerLine;
- int x = -1;
- int depth = imageData.depth;
- if (depth == 1) { // 8 pixels per byte (can only show 3 of 8)
- if (where == 0) x = xByte * 8;
- if (where == 1) x = xByte * 8 + 3;
- if (where == 2) x = xByte * 8 + 7;
- }
- if (depth == 2) { // 4 pixels per byte (can only show 3 of 4)
- if (where == 0) x = xByte * 4;
- if (where == 1) x = xByte * 4 + 1;
- if (where == 2) x = xByte * 4 + 3;
- }
- if (depth == 4) { // 2 pixels per byte
- if (where == 0) x = xByte * 2;
- if (where == 1) x = xByte * 2;
- if (where == 2) x = xByte * 2 + 1;
- }
- if (depth == 8) { // 1 byte per pixel
- x = xByte;
- }
- if (depth == 16) { // 2 bytes per pixel
- x = xByte / 2;
- }
- if (depth == 24) { // 3 bytes per pixel
- x = xByte / 3;
- }
- if (depth == 32) { // 4 bytes per pixel
- x = xByte / 4;
- }
- if (x != -1) {
- showColorForPixel(x, y);
- } else {
- statusLabel.setText("");
- }
- }
-
- /*
- * Set the status label to show color information
- * for the specified pixel in the image.
- */
- void showColorForPixel(int x, int y) {
- if (x >= 0 && x < imageData.width && y >= 0 && y < imageData.height) {
- int pixel = imageData.getPixel(x, y);
- RGB rgb = imageData.palette.getRGB(pixel);
-
-
- Object[] args = {new Integer(x),
- new Integer(y),
- new Integer(pixel),
- Integer.toHexString(pixel),
- rgb};
- if (pixel == imageData.transparentPixel) {
- statusLabel.setText(createMsg(bundle.getString("Color_at_trans"), args));
- } else {
- statusLabel.setText(createMsg(bundle.getString("Color_at"), args));
- }
- } else {
- statusLabel.setText("");
- }
- }
-
- /*
- * Called when the Animate button is pressed.
- */
- void animate() {
- animate = !animate;
- if (animate && image != null && imageDataArray.length > 1) {
- animateThread = new Thread(bundle.getString("Animation")) {
- public void run() {
- // Pre-animation widget setup.
- preAnimation();
-
- // Animate.
- try {
- animateLoop();
- } catch (final SWTException e) {
- display.syncExec(new Runnable() {
- public void run() {
- showErrorDialog(createMsg(bundle.getString("Creating_image"),
- new Integer(imageDataIndex+1)),
- currentName, e);
- }
- });
- }
-
- // Post animation widget reset.
- postAnimation();
- }
- };
- animateThread.setDaemon(true);
- animateThread.start();
- }
- }
-
- /*
- * Loop through all of the images in a multi-image file
- * and display them one after another.
- */
- void animateLoop() {
- // Create an off-screen image to draw on, and a GC to draw with.
- // Both are disposed after the animation.
- Image offScreenImage = new Image(display, loader.logicalScreenWidth, loader.logicalScreenHeight);
- GC offScreenImageGC = new GC(offScreenImage);
-
- try {
- // Use syncExec to get the background color of the imageCanvas.
- display.syncExec(new Runnable() {
- public void run() {
- canvasBackground = imageCanvas.getBackground();
- }
- });
-
- // Fill the off-screen image with the background color of the canvas.
- offScreenImageGC.setBackground(canvasBackground);
- offScreenImageGC.fillRectangle(
- 0,
- 0,
- loader.logicalScreenWidth,
- loader.logicalScreenHeight);
-
- // Draw the current image onto the off-screen image.
- offScreenImageGC.drawImage(
- image,
- 0,
- 0,
- imageData.width,
- imageData.height,
- imageData.x,
- imageData.y,
- imageData.width,
- imageData.height);
-
- int repeatCount = loader.repeatCount;
- while (animate && (loader.repeatCount == 0 || repeatCount > 0)) {
- if (imageData.disposalMethod == SWT.DM_FILL_BACKGROUND) {
- // Fill with the background color before drawing.
- Color bgColor = null;
- int backgroundPixel = loader.backgroundPixel;
- if (showBackground && backgroundPixel != -1) {
- // Fill with the background color.
- RGB backgroundRGB = imageData.palette.getRGB(backgroundPixel);
- bgColor = new Color(null, backgroundRGB);
- }
- try {
- offScreenImageGC.setBackground(bgColor != null ? bgColor : canvasBackground);
- offScreenImageGC.fillRectangle(
- imageData.x,
- imageData.y,
- imageData.width,
- imageData.height);
- } finally {
- if (bgColor != null) bgColor.dispose();
- }
- } else if (imageData.disposalMethod == SWT.DM_FILL_PREVIOUS) {
- // Restore the previous image before drawing.
- offScreenImageGC.drawImage(
- image,
- 0,
- 0,
- imageData.width,
- imageData.height,
- imageData.x,
- imageData.y,
- imageData.width,
- imageData.height);
- }
-
- // Get the next image data.
- imageDataIndex = (imageDataIndex + 1) % imageDataArray.length;
- imageData = imageDataArray[imageDataIndex];
- image.dispose();
- image = new Image(display, imageData);
-
- // Draw the new image data.
- offScreenImageGC.drawImage(
- image,
- 0,
- 0,
- imageData.width,
- imageData.height,
- imageData.x,
- imageData.y,
- imageData.width,
- imageData.height);
-
- // Draw the off-screen image to the screen.
- imageCanvasGC.drawImage(offScreenImage, 0, 0);
-
- // Sleep for the specified delay time before drawing again.
- try {
- Thread.sleep(visibleDelay(imageData.delayTime * 10));
- } catch (InterruptedException e) {
- }
-
- // If we have just drawn the last image in the set,
- // then decrement the repeat count.
- if (imageDataIndex == imageDataArray.length - 1) repeatCount--;
- }
- } finally {
- offScreenImage.dispose();
- offScreenImageGC.dispose();
- }
- }
-
- /*
- * Pre animation setup.
- */
- void preAnimation() {
- display.syncExec(new Runnable() {
- public void run() {
- // Change the label of the Animate button to 'Stop'.
- animateButton.setText(bundle.getString("Stop"));
-
- // Disable anything we don't want the user
- // to select during the animation.
- previousButton.setEnabled(false);
- nextButton.setEnabled(false);
- backgroundCombo.setEnabled(false);
- scaleXCombo.setEnabled(false);
- scaleYCombo.setEnabled(false);
- alphaCombo.setEnabled(false);
- incrementalCheck.setEnabled(false);
- transparentCheck.setEnabled(false);
- maskCheck.setEnabled(false);
- // leave backgroundCheck enabled
-
- // Reset the scale combos and scrollbars.
- resetScaleCombos();
- resetScrollBars();
- }
- });
- }
-
- /*
- * Post animation reset.
- */
- void postAnimation() {
- display.syncExec(new Runnable() {
- public void run() {
- // Enable anything we disabled before the animation.
- previousButton.setEnabled(true);
- nextButton.setEnabled(true);
- backgroundCombo.setEnabled(true);
- scaleXCombo.setEnabled(true);
- scaleYCombo.setEnabled(true);
- alphaCombo.setEnabled(true);
- incrementalCheck.setEnabled(true);
- transparentCheck.setEnabled(true);
- maskCheck.setEnabled(true);
-
- // Reset the label of the Animate button.
- animateButton.setText(bundle.getString("Animate"));
-
- if (animate) {
- // If animate is still true, we finished the
- // full number of repeats. Leave the image as-is.
- animate = false;
- } else {
- // Redisplay the current image and its palette.
- displayImage(imageDataArray[imageDataIndex]);
- }
- }
- });
- }
-
- /*
- * Called when the Previous button is pressed.
- * Display the previous image in a multi-image file.
- */
- void previous() {
- if (image != null && imageDataArray.length > 1) {
- if (imageDataIndex == 0) {
- imageDataIndex = imageDataArray.length;
- }
- imageDataIndex = imageDataIndex - 1;
- displayImage(imageDataArray[imageDataIndex]);
- }
- }
-
- /*
- * Called when the Next button is pressed.
- * Display the next image in a multi-image file.
- */
- void next() {
- if (image != null && imageDataArray.length > 1) {
- imageDataIndex = (imageDataIndex + 1) % imageDataArray.length;
- displayImage(imageDataArray[imageDataIndex]);
- }
- }
-
- void displayImage(ImageData newImageData) {
- if (incremental && incrementalThread != null) {
- // Tell the incremental thread to stop drawing.
- synchronized (this) {
- incrementalEvents = null;
- }
-
- // Wait until the incremental thread is done.
- while (incrementalThread.isAlive()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- }
-
- // Dispose of the old image, if there was one.
- if (image != null) image.dispose();
-
- try {
- // Cache the new image and imageData.
- image = new Image(display, newImageData);
- imageData = newImageData;
-
- } catch (SWTException e) {
- showErrorDialog(bundle.getString("Creating_from") + " ", currentName, e);
- image = null;
- return;
- }
-
- // Update the widgets with the new image info.
- String string = createMsg(bundle.getString("Analyzer_on"), currentName);
- shell.setText(string);
-
- if (imageDataArray.length > 1) {
- string = createMsg(bundle.getString("Type_index"),
- new Object[] {fileTypeString(imageData.type),
- new Integer(imageDataIndex + 1),
- new Integer(imageDataArray.length)});
- } else {
- string = createMsg(bundle.getString("Type_string"), fileTypeString(imageData.type));
- }
- typeLabel.setText(string);
-
- string = createMsg(bundle.getString("Size_value"),
- new Object[] {new Integer(imageData.width),
- new Integer(imageData.height)});
- sizeLabel.setText(string);
-
- string = createMsg(bundle.getString("Depth_value"), new Integer(imageData.depth));
- depthLabel.setText(string);
-
- string = createMsg(bundle.getString("Transparent_pixel_value"), pixelInfo(imageData.transparentPixel));
- transparentPixelLabel.setText(string);
-
- string = createMsg(bundle.getString("Time_to_load_value"), new Long(loadTime));
- timeToLoadLabel.setText(string);
-
- string = createMsg(bundle.getString("Animation_size_value"),
- new Object[] {new Integer(loader.logicalScreenWidth),
- new Integer(loader.logicalScreenHeight)});
- screenSizeLabel.setText(string);
-
- string = createMsg(bundle.getString("Background_pixel_value"), pixelInfo(loader.backgroundPixel));
- backgroundPixelLabel.setText(string);
-
- string = createMsg(bundle.getString("Image_location_value"),
- new Object[] {new Integer(imageData.x), new Integer(imageData.y)});
- locationLabel.setText(string);
-
- string = createMsg(bundle.getString("Disposal_value"),
- new Object[] {new Integer(imageData.disposalMethod),
- disposalString(imageData.disposalMethod)});
- disposalMethodLabel.setText(string);
-
- int delay = imageData.delayTime * 10;
- int delayUsed = visibleDelay(delay);
- if (delay != delayUsed) {
- string = createMsg(bundle.getString("Delay_value"),
- new Object[] {new Integer(delay), new Integer(delayUsed)});
- } else {
- string = createMsg(bundle.getString("Delay_used"), new Integer(delay));
- }
- delayTimeLabel.setText(string);
-
- if (loader.repeatCount == 0) {
- string = createMsg( bundle.getString("Repeats_forever"), new Integer(loader.repeatCount));
- } else {
- string = createMsg(bundle.getString("Repeats_value"), new Integer(loader.repeatCount));
- }
- repeatCountLabel.setText(string);
-
-
- if (imageData.palette.isDirect) {
- string = bundle.getString("Palette_direct");
- } else {
- string = createMsg(bundle.getString("Palette_value"), new Integer(imageData.palette.getRGBs().length));
- }
- paletteLabel.setText(string);
-
- string = createMsg(bundle.getString("Pixel_data_value"),
- new Object[] {new Integer(imageData.bytesPerLine),
- new Integer(imageData.scanlinePad),
- depthInfo(imageData.depth)});
- dataLabel.setText(string);
-
- String data = dataHexDump(dataText.getLineDelimiter());
- dataText.setText(data);
-
- // bold the first column all the way down
- int index = 0;
- while((index = data.indexOf(':', index+1)) != -1)
- dataText.setStyleRange(new StyleRange(index - INDEX_DIGITS, INDEX_DIGITS, dataText.getForeground(), dataText.getBackground(), SWT.BOLD));
-
- statusLabel.setText("");
-
- // Redraw both canvases.
- paletteCanvas.redraw();
- imageCanvas.redraw();
- }
-
- void paintImage(PaintEvent event) {
- Image paintImage = image;
- int transparentPixel = imageData.transparentPixel;
- if (transparentPixel != -1 && !transparent) {
- imageData.transparentPixel = -1;
- paintImage = new Image(display, imageData);
- }
- int w = Math.round(imageData.width * xscale);
- int h = Math.round(imageData.height * yscale);
- event.gc.drawImage(
- paintImage,
- 0,
- 0,
- imageData.width,
- imageData.height,
- ix + imageData.x,
- iy + imageData.y,
- w,
- h);
- if (showMask && (imageData.getTransparencyType() != SWT.TRANSPARENCY_NONE)) {
- ImageData maskImageData = imageData.getTransparencyMask();
- Image maskImage = new Image(display, maskImageData);
- event.gc.drawImage(
- maskImage,
- 0,
- 0,
- imageData.width,
- imageData.height,
- w + 10 + ix + imageData.x,
- iy + imageData.y,
- w,
- h);
- maskImage.dispose();
- }
- if (transparentPixel != -1 && !transparent) {
- imageData.transparentPixel = transparentPixel;
- paintImage.dispose();
- }
- }
-
- void paintPalette(PaintEvent event) {
- GC gc = event.gc;
- gc.fillRectangle(paletteCanvas.getClientArea());
- if (imageData.palette.isDirect) {
- // For a direct palette, display the masks.
- int y = py + 10;
- int xTab = 50;
- gc.drawString("rMsk", 10, y, true);
- gc.drawString(toHex4ByteString(imageData.palette.redMask), xTab, y, true);
- gc.drawString("gMsk", 10, y+=12, true);
- gc.drawString(toHex4ByteString(imageData.palette.greenMask), xTab, y, true);
- gc.drawString("bMsk", 10, y+=12, true);
- gc.drawString(toHex4ByteString(imageData.palette.blueMask), xTab, y, true);
- gc.drawString("rShf", 10, y+=12, true);
- gc.drawString(Integer.toString(imageData.palette.redShift), xTab, y, true);
- gc.drawString("gShf", 10, y+=12, true);
- gc.drawString(Integer.toString(imageData.palette.greenShift), xTab, y, true);
- gc.drawString("bShf", 10, y+=12, true);
- gc.drawString(Integer.toString(imageData.palette.blueShift), xTab, y, true);
- } else {
- // For an indexed palette, display the palette colors and indices.
- RGB[] rgbs = imageData.palette.getRGBs();
- if (rgbs != null) {
- int xTab1 = 40, xTab2 = 100;
- for (int i = 0; i < rgbs.length; i++) {
- int y = (i+1) * 10 + py;
- gc.drawString(String.valueOf(i), 10, y, true);
- gc.drawString(toHexByteString(rgbs[i].red) + toHexByteString(rgbs[i].green) + toHexByteString(rgbs[i].blue), xTab1, y, true);
- Color color = new Color(display, rgbs[i]);
- gc.setBackground(color);
- gc.fillRectangle(xTab2, y+2, 10, 10);
- color.dispose();
- }
- }
- }
- }
-
- void resizeShell(ControlEvent event) {
- if (image == null || shell.isDisposed())
- return;
- resizeScrollBars();
- }
-
- // Reset the scale combos to 1.
- void resetScaleCombos() {
- xscale = 1; yscale = 1;
- scaleXCombo.select(scaleXCombo.indexOf("1"));
- scaleYCombo.select(scaleYCombo.indexOf("1"));
- }
-
- // Reset the scroll bars to 0.
- void resetScrollBars() {
- if (image == null) return;
- ix = 0; iy = 0; py = 0;
- resizeScrollBars();
- imageCanvas.getHorizontalBar().setSelection(0);
- imageCanvas.getVerticalBar().setSelection(0);
- paletteCanvas.getVerticalBar().setSelection(0);
- }
-
- void resizeScrollBars() {
- // Set the max and thumb for the image canvas scroll bars.
- ScrollBar horizontal = imageCanvas.getHorizontalBar();
- ScrollBar vertical = imageCanvas.getVerticalBar();
- Rectangle canvasBounds = imageCanvas.getClientArea();
- int width = Math.round(imageData.width * xscale);
- if (width > canvasBounds.width) {
- // The image is wider than the canvas.
- horizontal.setEnabled(true);
- horizontal.setMaximum(width);
- horizontal.setThumb(canvasBounds.width);
- horizontal.setPageIncrement(canvasBounds.width);
- } else {
- // The canvas is wider than the image.
- horizontal.setEnabled(false);
- if (ix != 0) {
- // Make sure the image is completely visible.
- ix = 0;
- imageCanvas.redraw();
- }
- }
- int height = Math.round(imageData.height * yscale);
- if (height > canvasBounds.height) {
- // The image is taller than the canvas.
- vertical.setEnabled(true);
- vertical.setMaximum(height);
- vertical.setThumb(canvasBounds.height);
- vertical.setPageIncrement(canvasBounds.height);
- } else {
- // The canvas is taller than the image.
- vertical.setEnabled(false);
- if (iy != 0) {
- // Make sure the image is completely visible.
- iy = 0;
- imageCanvas.redraw();
- }
- }
-
- // Set the max and thumb for the palette canvas scroll bar.
- vertical = paletteCanvas.getVerticalBar();
- if (imageData.palette.isDirect) {
- vertical.setEnabled(false);
- } else { // indexed palette
- canvasBounds = paletteCanvas.getClientArea();
- int paletteHeight = imageData.palette.getRGBs().length * 10 + 20; // 10 pixels each index + 20 for margins.
- vertical.setEnabled(true);
- vertical.setMaximum(paletteHeight);
- vertical.setThumb(canvasBounds.height);
- vertical.setPageIncrement(canvasBounds.height);
- }
- }
-
- /*
- * Called when the image canvas' horizontal scrollbar is selected.
- */
- void scrollHorizontally(ScrollBar scrollBar) {
- if (image == null) return;
- Rectangle canvasBounds = imageCanvas.getClientArea();
- int width = Math.round(imageData.width * xscale);
- int height = Math.round(imageData.height * yscale);
- if (width > canvasBounds.width) {
- // Only scroll if the image is bigger than the canvas.
- int x = -scrollBar.getSelection();
- if (x + width < canvasBounds.width) {
- // Don't scroll past the end of the image.
- x = canvasBounds.width - width;
- }
- imageCanvas.scroll(x, iy, ix, iy, width, height, false);
- ix = x;
- }
- }
-
- /*
- * Called when the image canvas' vertical scrollbar is selected.
- */
- void scrollVertically(ScrollBar scrollBar) {
- if (image == null) return;
- Rectangle canvasBounds = imageCanvas.getClientArea();
- int width = Math.round(imageData.width * xscale);
- int height = Math.round(imageData.height * yscale);
- if (height > canvasBounds.height) {
- // Only scroll if the image is bigger than the canvas.
- int y = -scrollBar.getSelection();
- if (y + height < canvasBounds.height) {
- // Don't scroll past the end of the image.
- y = canvasBounds.height - height;
- }
- imageCanvas.scroll(ix, y, ix, iy, width, height, false);
- iy = y;
- }
- }
-
- /*
- * Called when the palette canvas' vertical scrollbar is selected.
- */
- void scrollPalette(ScrollBar scrollBar) {
- if (image == null) return;
- Rectangle canvasBounds = paletteCanvas.getClientArea();
- int paletteHeight = imageData.palette.getRGBs().length * 10 + 20;
- if (paletteHeight > canvasBounds.height) {
- // Only scroll if the palette is bigger than the canvas.
- int y = -scrollBar.getSelection();
- if (y + paletteHeight < canvasBounds.height) {
- // Don't scroll past the end of the palette.
- y = canvasBounds.height - paletteHeight;
- }
- paletteCanvas.scroll(0, y, 0, py, paletteWidth, paletteHeight, false);
- py = y;
- }
- }
-
- /*
- * Return a String containing a line-by-line dump of
- * the data in the current imageData. The lineDelimiter
- * parameter must be a string of length 1 or 2.
- */
- String dataHexDump(String lineDelimiter) {
- if (image == null) return "";
- char[] dump = new char[imageData.height * (6 + 3 * imageData.bytesPerLine + lineDelimiter.length())];
- int index = 0;
- for (int i = 0; i < imageData.data.length; i++) {
- if (i % imageData.bytesPerLine == 0) {
- int line = i / imageData.bytesPerLine;
- dump[index++] = Character.forDigit(line / 1000 % 10, 10);
- dump[index++] = Character.forDigit(line / 100 % 10, 10);
- dump[index++] = Character.forDigit(line / 10 % 10, 10);
- dump[index++] = Character.forDigit(line % 10, 10);
- dump[index++] = ':';
- dump[index++] = ' ';
- }
- byte b = imageData.data[i];
- dump[index++] = Character.forDigit((b & 0xF0) >> 4, 16);
- dump[index++] = Character.forDigit(b & 0x0F, 16);
- dump[index++] = ' ';
- if ((i + 1) % imageData.bytesPerLine == 0) {
- dump[index++] = lineDelimiter.charAt(0);
- if (lineDelimiter.length() > 1)
- dump[index++] = lineDelimiter.charAt(1);
- }
- }
- return new String(dump);
- }
-
- /*
- * Open an error dialog displaying the specified information.
- */
- void showErrorDialog(String operation, String filename, Exception e) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- String message = createMsg(bundle.getString("Error"), new String[] {operation, filename});
- String errorMessage = "";
- if (e != null) {
- if (e instanceof SWTException) {
- SWTException swte = (SWTException) e;
- errorMessage = swte.getMessage();
- if (swte.throwable != null) {
- errorMessage += ":\n" + swte.throwable.toString();
- }
- } else {
- errorMessage = e.toString();
- }
- }
- box.setMessage(message + errorMessage);
- box.open();
- }
-
- /*
- * Return a String describing how to analyze the bytes
- * in the hex dump.
- */
- static String depthInfo(int depth) {
- Object[] args = {new Integer(depth), ""};
- switch (depth) {
- case 1:
- args[1] = createMsg(bundle.getString("Multi_pixels"),
- new Object[] {new Integer(8), " [01234567]"});
- break;
- case 2:
- args[1] = createMsg(bundle.getString("Multi_pixels"),
- new Object[] {new Integer(4), "[00112233]"});
- break;
- case 4:
- args[1] = createMsg(bundle.getString("Multi_pixels"),
- new Object[] {new Integer(2), "[00001111]"});
- break;
- case 8:
- args[1] = bundle.getString("One_byte");
- break;
- case 16:
- args[1] = createMsg(bundle.getString("Multi_bytes"), new Integer(2));
- break;
- case 24:
- args[1] = createMsg(bundle.getString("Multi_bytes"), new Integer(3));
- break;
- case 32:
- args[1] = createMsg(bundle.getString("Multi_bytes"), new Integer(4));
- break;
- default:
- args[1] = bundle.getString("Unsupported_lc");
- }
- return createMsg(bundle.getString("Depth_info"), args);
- }
-
- /*
- * Return the specified number of milliseconds.
- * If the specified number of milliseconds is too small
- * to see a visual change, then return a higher number.
- */
- static int visibleDelay(int ms) {
- if (ms < 20) return ms + 30;
- if (ms < 30) return ms + 10;
- return ms;
- }
-
- /*
- * Return the specified byte value as a hex string,
- * preserving leading 0's.
- */
- static String toHexByteString(int i) {
- if (i <= 0x0f)
- return "0" + Integer.toHexString(i);
- return Integer.toHexString(i & 0xff);
- }
-
- /*
- * Return the specified 4-byte value as a hex string,
- * preserving leading 0's.
- * (a bit 'brute force'... should probably use a loop...)
- */
- static String toHex4ByteString(int i) {
- String hex = Integer.toHexString(i);
- if (hex.length() == 1)
- return "0000000" + hex;
- if (hex.length() == 2)
- return "000000" + hex;
- if (hex.length() == 3)
- return "00000" + hex;
- if (hex.length() == 4)
- return "0000" + hex;
- if (hex.length() == 5)
- return "000" + hex;
- if (hex.length() == 6)
- return "00" + hex;
- if (hex.length() == 7)
- return "0" + hex;
- return hex;
- }
-
- /*
- * Return a String describing the specified
- * transparent or background pixel.
- */
- static String pixelInfo(int pixel) {
- if (pixel == -1)
- return pixel + " (" + bundle.getString("None_lc") + ")";
- else
- return pixel + " (0x" + Integer.toHexString(pixel) + ")";
- }
-
- /*
- * Return a String describing the specified disposal method.
- */
- static String disposalString(int disposalMethod) {
- switch (disposalMethod) {
- case SWT.DM_FILL_NONE: return bundle.getString("None_lc");
- case SWT.DM_FILL_BACKGROUND: return bundle.getString("Background_lc");
- case SWT.DM_FILL_PREVIOUS: return bundle.getString("Previous_lc");
- }
- return bundle.getString("Unspecified_lc");
- }
-
- /*
- * Return a String describing the specified image file type.
- */
- static String fileTypeString(int filetype) {
- if (filetype == SWT.IMAGE_BMP)
- return "BMP";
- if (filetype == SWT.IMAGE_GIF)
- return "GIF";
- if (filetype == SWT.IMAGE_ICO)
- return "ICO";
- if (filetype == SWT.IMAGE_JPEG)
- return "JPEG";
- if (filetype == SWT.IMAGE_PNG)
- return "PNG";
- return bundle.getString("Unknown_ac");
- }
-
- /*
- * Return the specified file's image type, based on its extension.
- * Note that this is not a very robust way to determine image type,
- * and it is only to be used in the absence of any better method.
- */
- static int determineFileType(String filename) {
- String ext = filename.substring(filename.lastIndexOf('.') + 1);
- if (ext.equalsIgnoreCase("bmp"))
- return SWT.IMAGE_BMP;
- if (ext.equalsIgnoreCase("gif"))
- return SWT.IMAGE_GIF;
- if (ext.equalsIgnoreCase("ico"))
- return SWT.IMAGE_ICO;
- if (ext.equalsIgnoreCase("jpg") || ext.equalsIgnoreCase("jpeg"))
- return SWT.IMAGE_JPEG;
- if (ext.equalsIgnoreCase("png"))
- return SWT.IMAGE_PNG;
- return SWT.IMAGE_UNDEFINED;
- }
-
- static String createMsg(String msg, Object[] args) {
- MessageFormat formatter = new MessageFormat(msg);
- return formatter.format(args);
- }
-
- static String createMsg(String msg, Object arg) {
- MessageFormat formatter = new MessageFormat(msg);
- return formatter.format(new Object[]{arg});
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java deleted file mode 100755 index 876789b219..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java +++ /dev/null @@ -1,375 +0,0 @@ -package org.eclipse.swt.examples.javaviewer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.io.*;
-
-class JavaLineStyler implements LineStyleListener {
- JavaScanner scanner = new JavaScanner();
- int[] tokenColors;
- Color[] colors;
- Vector blockComments = new Vector();
-
- public static final int EOF= -1;
- public static final int EOL= 10;
-
- public static final int WORD= 0;
- public static final int WHITE= 1;
- public static final int KEY= 2;
- public static final int COMMENT= 3;
- public static final int STRING= 5;
- public static final int OTHER= 6;
- public static final int NUMBER= 7;
-
- public static final int MAXIMUM_TOKEN= 8;
-
-public JavaLineStyler() {
- initializeColors();
- scanner = new JavaScanner();
-}
-
-Color getColor(int type) {
- if (type < 0 || type >= tokenColors.length) {
- return null;
- }
- return colors[tokenColors[type]];
-}
-
-boolean inBlockComment(int start, int end) {
- for (int i=0; i<blockComments.size(); i++) {
- int[] offsets = (int[])blockComments.elementAt(i);
- // start of comment in the line
- if ((offsets[0] >= start) && (offsets[0] <= end)) return true;
- // end of comment in the line
- if ((offsets[1] >= start) && (offsets[1] <= end)) return true;
- if ((offsets[0] <= start) && (offsets[1] >= end)) return true;
- }
- return false;
-}
-
-void initializeColors() {
- Display display = Display.getDefault();
- colors= new Color[] {
- new Color(display, new RGB(0, 0, 0)), // black
- new Color(display, new RGB(255, 0, 0)), // red
- new Color(display, new RGB(0, 255, 0)), // green
- new Color(display, new RGB(0, 0, 255)) // blue
- };
- tokenColors= new int[MAXIMUM_TOKEN];
- tokenColors[WORD]= 0;
- tokenColors[WHITE]= 0;
- tokenColors[KEY]= 3;
- tokenColors[COMMENT]= 1;
- tokenColors[STRING]= 2;
- tokenColors[OTHER]= 0;
- tokenColors[NUMBER]= 0;
-}
-
-void disposeColors() {
- for (int i=0;i<colors.length;i++) {
- colors[i].dispose();
- }
-}
-
-/**
- * Event.detail line start offset (input)
- * Event.text line text (input)
- * LineStyleEvent.styles Enumeration of StyleRanges, need to be in order. (output)
- * LineStyleEvent.background line background color (output)
- */
-public void lineGetStyle(LineStyleEvent event) {
- Vector styles = new Vector();
- int token;
- StyleRange lastStyle;
- // If the line is part of a block comment, create one style for the entire line.
- if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
- styles.addElement(new StyleRange(event.lineOffset, event.lineText.length(), getColor(COMMENT), null));
- event.styles = new StyleRange[styles.size()];
- styles.copyInto(event.styles);
- return;
- }
- Color defaultFgColor = ((Control)event.widget).getForeground();
- scanner.setRange(event.lineText);
- token = scanner.nextToken();
- while (token != EOF) {
- if (token == OTHER) {
- // do nothing for non-colored tokens
- } else if (token != WHITE) {
- Color color = getColor(token);
- // Only create a style if the token color is different than the
- // widget's default foreground color and the token's style is not
- // bold. Keywords are bolded.
- if ((!color.equals(defaultFgColor)) || (token == KEY)) {
- StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null);
- if (token == KEY) {
- style.fontStyle = SWT.BOLD;
- }
- if (styles.isEmpty()) {
- styles.addElement(style);
- } else {
- // Merge similar styles. Doing so will improve performance.
- lastStyle = (StyleRange)styles.lastElement();
- if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
- lastStyle.length += style.length;
- } else {
- styles.addElement(style);
- }
- }
- }
- } else if ((!styles.isEmpty()) && ((lastStyle=(StyleRange)styles.lastElement()).fontStyle == SWT.BOLD)) {
- int start = scanner.getStartOffset() + event.lineOffset;
- lastStyle = (StyleRange)styles.lastElement();
- // A font style of SWT.BOLD implies that the last style
- // represents a java keyword.
- if (lastStyle.start + lastStyle.length == start) {
- // Have the white space take on the style before it to
- // minimize the number of style ranges created and the
- // number of font style changes during rendering.
- lastStyle.length += scanner.getLength();
- }
- }
- token= scanner.nextToken();
- }
- event.styles = new StyleRange[styles.size()];
- styles.copyInto(event.styles);
-}
-public void parseBlockComments(String text) {
- blockComments = new Vector();
- StringReader buffer = new StringReader(text);
- int ch;
- boolean blkComment = false;
- int cnt = 0;
- int[] offsets = new int[2];
- boolean done = false;
-
- try {
- while (!done) {
- switch (ch = buffer.read()) {
- case -1 : {
- if (blkComment) {
- offsets[1] = cnt;
- blockComments.addElement(offsets);
- }
- done = true;
- break;
- }
- case '/' : {
- ch = buffer.read();
- if ((ch == '*') && (!blkComment)) {
- offsets = new int[2];
- offsets[0] = cnt;
- blkComment = true;
- cnt++;
- } else {
- cnt++;
- }
- cnt++;
- break;
- }
- case '*' : {
- if (blkComment) {
- ch = buffer.read();
- cnt++;
- if (ch == '/') {
- blkComment = false;
- offsets[1] = cnt;
- blockComments.addElement(offsets);
- }
- }
- cnt++;
- break;
- }
- default : {
- cnt++;
- break;
- }
- }
- }
- } catch(IOException e) {
- // ignore errors
- }
-}
-
-/**
- * A simple fuzzy scanner for Java
- */
-public class JavaScanner {
-
- protected Hashtable fgKeys= null;
- protected StringBuffer fBuffer= new StringBuffer();
- protected String fDoc;
- protected int fPos;
- protected int fEnd;
- protected int fStartToken;
- protected boolean fEofSeen= false;
-
- private String[] fgKeywords= {
- "abstract",
- "boolean", "break", "byte",
- "case", "catch", "char", "class", "continue",
- "default", "do", "double",
- "else", "extends",
- "false", "final", "finally", "float", "for",
- "if", "implements", "import", "instanceof", "int", "interface",
- "long",
- "native", "new", "null",
- "package", "private", "protected", "public",
- "return",
- "short", "static", "super", "switch", "synchronized",
- "this", "throw", "throws", "transient", "true", "try",
- "void", "volatile",
- "while"
- };
-
- public JavaScanner() {
- initialize();
- }
-
- /**
- * Returns the ending location of the current token in the document.
- */
- public final int getLength() {
- return fPos - fStartToken;
- }
-
- /**
- * Initialize the lookup table.
- */
- void initialize() {
- fgKeys= new Hashtable();
- Integer k= new Integer(KEY);
- for (int i= 0; i < fgKeywords.length; i++)
- fgKeys.put(fgKeywords[i], k);
- }
-
- /**
- * Returns the starting location of the current token in the document.
- */
- public final int getStartOffset() {
- return fStartToken;
- }
-
- /**
- * Returns the next lexical token in the document.
- */
- public int nextToken() {
- int c;
- fStartToken= fPos;
- while (true) {
- switch (c= read()) {
- case EOF:
- return EOF;
- case '/': // comment
- c= read();
- if (c == '/') {
- while (true) {
- c= read();
- if ((c == EOF) || (c == EOL)) {
- unread(c);
- return COMMENT;
- }
- }
- } else {
- unread(c);
- }
- return OTHER;
- case '\'': // char const
- character: for(;;) {
- c= read();
- switch (c) {
- case '\'':
- return STRING;
- case EOF:
- unread(c);
- return STRING;
- case '\\':
- c= read();
- break;
- }
- }
-
- case '"': // string
- string: for (;;) {
- c= read();
- switch (c) {
- case '"':
- return STRING;
- case EOF:
- unread(c);
- return STRING;
- case '\\':
- c= read();
- break;
- }
- }
-
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- do {
- c= read();
- } while(Character.isDigit((char)c));
- unread(c);
- return NUMBER;
- default:
- if (Character.isWhitespace((char)c)) {
- do {
- c= read();
- } while(Character.isWhitespace((char)c));
- unread(c);
- return WHITE;
- }
- if (Character.isJavaIdentifierStart((char)c)) {
- fBuffer.setLength(0);
- do {
- fBuffer.append((char)c);
- c= read();
- } while(Character.isJavaIdentifierPart((char)c));
- unread(c);
- Integer i= (Integer) fgKeys.get(fBuffer.toString());
- if (i != null)
- return i.intValue();
- return WORD;
- }
- return OTHER;
- }
- }
- }
-
- /**
- * Returns next character.
- */
- protected int read() {
- if (fPos <= fEnd) {
- return fDoc.charAt(fPos++);
- }
- return EOF;
- }
-
- public void setRange(String text) {
- fDoc= text;
- fPos= 0;
- fEnd= fDoc.length() -1;
- }
-
- protected void unread(int c) {
- if (c != EOF)
- fPos--;
- }
-}
-
-
-
-
-
-} diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaViewer.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaViewer.java deleted file mode 100755 index e08f22939e..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaViewer.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.eclipse.swt.examples.javaviewer;
-
-/*
- * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.io.*;
-import java.text.*;
-
-/**
- */
-public class JavaViewer {
- Shell shell;
- StyledText text;
- JavaLineStyler lineStyler = new JavaLineStyler();
- static ResourceBundle resources = ResourceBundle.getBundle("examples_javaviewer");
-
-Menu createFileMenu() {
- Menu bar = shell.getMenuBar ();
- Menu menu = new Menu (bar);
- MenuItem item;
-
- // Open
- item = new MenuItem (menu, SWT.CASCADE);
- item.setText (resources.getString("Open_menuitem"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- openFile();
- }
- });
-
- // Close
- item = new MenuItem (menu, SWT.PUSH);
- item.setText (resources.getString("Close_menuitem"));
- item.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent e) {
- menuFileExit ();
- }
- });
- return menu;
-}
-
-void createMenuBar () {
- Menu bar = new Menu (shell, SWT.BAR);
- shell.setMenuBar (bar);
-
- MenuItem fileItem = new MenuItem (bar, SWT.CASCADE);
- fileItem.setText (resources.getString("File_menuitem"));
- fileItem.setMenu (createFileMenu ());
-
-}
-
-void createShell (Display display) {
- shell = new Shell (display);
- shell.setText (resources.getString("Window_title"));
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- shell.setSize(500, 400);
- shell.setLayout(layout);
- shell.addShellListener (new ShellAdapter () {
- public void shellClosed (ShellEvent e) {
- lineStyler.disposeColors();
- text.removeLineStyleListener(lineStyler);
- }
- });
-}
-void createStyledText() {
- text = new StyledText (shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
- GridData spec = new GridData();
- spec.horizontalAlignment = spec.FILL;
- spec.grabExcessHorizontalSpace = true;
- spec.verticalAlignment = spec.FILL;
- spec.grabExcessVerticalSpace = true;
- text.setLayoutData(spec);
- text.addLineStyleListener(lineStyler);
- text.setEditable(false);
- Color bg = Display.getDefault().getSystemColor(SWT.COLOR_GRAY);
- text.setBackground(bg);
-}
-
-void displayError(String msg) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- box.setMessage(msg);
- box.open();
-}
-
-public static void main (String [] args) {
- Display display = new Display();
- JavaViewer example = new JavaViewer ();
- Shell shell = example.open (display);
- while (!shell.isDisposed ())
- if (!display.readAndDispatch ()) display.sleep ();
- display.dispose ();
-}
-
-public Shell open (Display display) {
- createShell (display);
- createMenuBar ();
- createStyledText ();
- shell.open ();
- return shell;
-}
-
-void openFile() {
- final String textString;
- FileDialog fileDialog = new FileDialog(shell, SWT.OPEN);
-
- fileDialog.setFilterExtensions(new String[] {"*.java", "*.*"});
- fileDialog.open();
- String name = fileDialog.getFileName();
-
- if ((name == null) || (name.length() == 0)) return;
-
- File file = new File(fileDialog.getFilterPath(), name);
- if (!file.exists()) {
- String message = MessageFormat.format(resources.getString("Err_file_no_exist"), new String[] {file.getName()});
- displayError(message);
- return;
- }
-
- try {
- FileInputStream stream= new FileInputStream(file.getPath());
- try {
- Reader in = new BufferedReader(new InputStreamReader(stream));
- char[] readBuffer= new char[2048];
- StringBuffer buffer= new StringBuffer((int) file.length());
- int n;
- while ((n = in.read(readBuffer)) > 0) {
- buffer.append(readBuffer, 0, n);
- }
- textString = buffer.toString();
- stream.close();
- }
- catch (IOException e) {
- // Err_file_io
- String message = MessageFormat.format(resources.getString("Err_file_io"), new String[] {file.getName()});
- displayError(message);
- return;
- }
- }
- catch (FileNotFoundException e) {
- String message = MessageFormat.format(resources.getString("Err_not_found"), new String[] {file.getName()});
- displayError(message);
- return;
- }
- // Guard against superfluous mouse move events -- defer action until later
- Display display = text.getDisplay();
- display.asyncExec(new Runnable() {
- public void run() {
- text.setText(textString);
- }
- });
-
- // parse the block comments up front since block comments can go across
- // lines - inefficient way of doing this
- lineStyler.parseBlockComments(textString);
-}
-
-void menuFileExit () {
- shell.close ();
-}
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FillLayoutTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FillLayoutTab.java deleted file mode 100644 index 6653cf573c..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FillLayoutTab.java +++ /dev/null @@ -1,176 +0,0 @@ -package org.eclipse.swt.examples.layoutexample; - -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -class FillLayoutTab extends Tab { - /* Controls for setting layout parameters */ - Button horizontal, vertical; - /* The example layout instance */ - FillLayout fillLayout; - /* TableEditors and related controls*/ - TableEditor comboEditor; - CCombo combo; - - /** - * Creates the Tab within a given instance of LayoutExample. - */ - FillLayoutTab(LayoutExample instance) { - super(instance); - } - - /** - * Creates the widgets in the "child" group. - */ - void createChildWidgets () { - /* Add common controls */ - super.createChildWidgets (); - - /* Add TableEditors */ - comboEditor = new TableEditor (table); - table.addSelectionListener (new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - resetEditors (); - index = table.getSelectionIndex (); - if (index == -1) return; - TableItem oldItem = comboEditor.getItem (); - newItem = table.getItem (index); - if (newItem == oldItem || newItem != lastSelected) { - lastSelected = newItem; - return; - } - table.showSelection (); - - combo = new CCombo (table, SWT.READ_ONLY); - createComboEditor (combo, comboEditor); - } - }); - - - /* Add listener to add an element to the table */ - add.addSelectionListener(new SelectionAdapter () { - public void widgetSelected(SelectionEvent e) { - TableItem item = new TableItem (table, 0); - item.setText (0, String.valueOf (table.indexOf (item))); - item.setText (1, "Button"); - data.addElement ("Button"); - resetEditors (); - } - }); - } - - /** - * Creates the control widgets. - */ - void createControlWidgets () { - /* Controls the type of FillLayout */ - Group typeGroup = new Group (controlGroup, SWT.NONE); - typeGroup.setText (LayoutExample.getResourceString ("Type")); - typeGroup.setLayout (new GridLayout ()); - typeGroup.setLayoutData (new GridData (GridData.FILL_HORIZONTAL)); - horizontal = new Button (typeGroup, SWT.RADIO); - horizontal.setText ("SWT.HORIZONTAL"); - horizontal.setLayoutData(new GridData (GridData.FILL_HORIZONTAL)); - horizontal.setSelection(true); - horizontal.addSelectionListener (selectionListener); - vertical = new Button (typeGroup, SWT.RADIO); - vertical.setText ("SWT.VERTICAL"); - vertical.setLayoutData(new GridData (GridData.FILL_HORIZONTAL)); - vertical.addSelectionListener (selectionListener); - - /* Add common controls */ - super.createControlWidgets (); - - /* Position the sash */ - sash.setWeights (new int [] {4,1}); - } - - /** - * Creates the example layout. - */ - void createLayout () { - fillLayout = new FillLayout (); - layoutComposite.setLayout (fillLayout); - } - - /** - * Disposes the editors without placing their contents - * into the table. - */ - void disposeEditors () { - comboEditor.setEditor (null, null, -1); - combo.dispose (); - } - - - /** - * Generates code for the example layout. - */ - StringBuffer generateLayoutCode () { - StringBuffer code = new StringBuffer (); - code.append ("\t\tFillLayout fillLayout = new FillLayout ();\n"); - if (fillLayout.type == SWT.VERTICAL) { - code.append ("\t\tfillLayout.type = SWT.VERTICAL;\n"); - } - code.append ("\t\tshell.setLayout (fillLayout);\n"); - for (int i = 0; i < children.length; i++) { - Control control = children [i]; - code.append (getChildCode (control, i)); - } - return code; - } - - /** - * Returns the layout data field names. - */ - String [] getLayoutDataFieldNames() { - return new String [] {"","Control"}; - } - - /** - * Gets the text for the tab folder item. - */ - String getTabText () { - return "FillLayout"; - } - - /** - * Takes information from TableEditors and stores it. - */ - void resetEditors () { - TableItem oldItem = comboEditor.getItem (); - comboEditor.setEditor (null, null, -1); - if (oldItem != null) { - int row = table.indexOf (oldItem); - data.insertElementAt (combo.getText (), row); - oldItem.setText (1, data.elementAt (row).toString ()); - combo.dispose (); - } - setLayoutState (); - refreshLayoutComposite (); - layoutComposite.layout (true); - layoutGroup.layout (true); - } - - /** - * Sets the state of the layout. - */ - void setLayoutState () { - if (vertical.getSelection()) { - fillLayout.type = SWT.VERTICAL; - } else { - fillLayout.type = SWT.HORIZONTAL; - } - } -} diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java deleted file mode 100644 index a79a0bef18..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/FormLayoutTab.java +++ /dev/null @@ -1,758 +0,0 @@ -package org.eclipse.swt.examples.layoutexample; - -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.custom.*; - -class FormLayoutTab extends Tab { - /* Controls for setting layout parameters */ - Combo marginHeight, marginWidth; - /* The example layout instance */ - FormLayout formLayout; - /* TableEditors and related controls*/ - TableEditor comboEditor, widthEditor, heightEditor; - TableEditor leftEditor, rightEditor, topEditor, bottomEditor; - CCombo combo; - Text widthText, heightText; - Button leftAttach, rightAttach, topAttach, bottomAttach; - - /* Constants */ - final int COMBO_COL = 1; - final int WIDTH_COL = 2; - final int HEIGHT_COL = 3; - final int LEFT_COL = 4; - final int RIGHT_COL = 5; - final int TOP_COL = 6; - final int BOTTOM_COL = 7; - - final int MODIFY_COLS = 4; // The number of columns with combo or text editors - final int TOTAL_COLS = 8; - - /** - * Creates the Tab within a given instance of LayoutExample. - */ - FormLayoutTab(LayoutExample instance) { - super(instance); - } - - /** - * Returns the constant for the alignment for an - * attachment given a string. - */ - int alignmentConstant (String align) { - if (align.equals("LEFT")) return SWT.LEFT; - if (align.equals("RIGHT")) return SWT.RIGHT; - if (align.equals("TOP")) return SWT.TOP; - if (align.equals("BOTTOM")) return SWT.BOTTOM; - if (align.equals("CENTER")) return SWT.CENTER; - return SWT.DEFAULT; - } - - /** - * Returns a string representing the alignment for an - * attachment given a constant. - */ - String alignmentString (int align) { - switch (align) { - case SWT.LEFT: return "LEFT"; - case SWT.RIGHT: return "RIGHT"; - case SWT.TOP: return "TOP"; - case SWT.BOTTOM: return "BOTTOM"; - case SWT.CENTER: return "CENTER"; - } - return "DEFAULT"; - } - - /** - * Update the attachment field in case the type of control - * has changed. - */ - String checkAttachment (String oldAttach, FormAttachment newAttach) { - String controlClass = newAttach.control.getClass().toString (); - String controlType = controlClass.substring (controlClass.lastIndexOf ('.') + 1); - int i = 0; - while (i < oldAttach.length () && !Character.isDigit(oldAttach.charAt (i))) { - i++; - } - String index = oldAttach.substring (i, oldAttach.indexOf (',')); - return controlType + index + "," + newAttach.offset + ":" + alignmentString (newAttach.alignment); - } - - /** - * Creates the widgets in the "child" group. - */ - void createChildWidgets () { - /* Add common controls */ - super.createChildWidgets (); - - /* Resize the columns */ - table.getColumn (LEFT_COL).setWidth (100); - table.getColumn (RIGHT_COL).setWidth (100); - table.getColumn (TOP_COL).setWidth (100); - table.getColumn (BOTTOM_COL).setWidth (100); - - /* Add TableEditors */ - comboEditor = new TableEditor (table); - widthEditor = new TableEditor (table); - heightEditor = new TableEditor (table); - leftEditor = new TableEditor (table); - rightEditor = new TableEditor (table); - topEditor = new TableEditor (table); - bottomEditor = new TableEditor (table); - table.addMouseListener (new MouseAdapter () { - public void mouseDown(MouseEvent e) { - resetEditors(); - index = table.getSelectionIndex (); - Point pt = new Point (e.x, e.y); - newItem = table.getItem (pt); - if (newItem == null) return; - TableItem oldItem = comboEditor.getItem (); - if (newItem == oldItem || newItem != lastSelected) { - lastSelected = newItem; - return; - } - table.showSelection (); - - combo = new CCombo (table, SWT.READ_ONLY); - createComboEditor (combo, comboEditor); - - widthText = new Text (table, SWT.SINGLE); - widthText.setText (((String [])data.elementAt (index)) [WIDTH_COL]); - createTextEditor (widthText, widthEditor, WIDTH_COL); - - heightText = new Text (table, SWT.SINGLE); - heightText.setText (((String [])data.elementAt (index)) [HEIGHT_COL]); - createTextEditor (heightText, heightEditor, HEIGHT_COL); - - leftAttach = new Button (table, SWT.PUSH); - leftAttach.setText (LayoutExample.getResourceString ("Attach_Edit")); - leftEditor.horizontalAlignment = SWT.LEFT; - leftEditor.grabHorizontal = true; - leftEditor.minimumWidth = leftAttach.computeSize (SWT.DEFAULT, SWT.DEFAULT).x; - leftEditor.setEditor (leftAttach, newItem, LEFT_COL); - leftAttach.addSelectionListener (new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - Shell shell = tabFolderPage.getShell (); - AttachDialog dialog = new AttachDialog (shell); - dialog.setText (LayoutExample.getResourceString ("Left_Attachment")); - dialog.setColumn (LEFT_COL); - String attach = dialog.open (); - newItem.setText (LEFT_COL, attach); - resetEditors (); - } - }); - - rightAttach = new Button (table, SWT.PUSH); - rightAttach.setText (LayoutExample.getResourceString ("Attach_Edit")); - rightEditor.horizontalAlignment = SWT.LEFT; - rightEditor.grabHorizontal = true; - rightEditor.minimumWidth = rightAttach.computeSize (SWT.DEFAULT, SWT.DEFAULT).x; - rightEditor.setEditor (rightAttach, newItem, RIGHT_COL); - rightAttach.addSelectionListener (new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - Shell shell = tabFolderPage.getShell (); - AttachDialog dialog = new AttachDialog (shell); - dialog.setText (LayoutExample.getResourceString ("Right_Attachment")); - dialog.setColumn (RIGHT_COL); - String attach = dialog.open (); - newItem.setText (RIGHT_COL, attach); - if (newItem.getText (LEFT_COL).endsWith (")")) newItem.setText (LEFT_COL, ""); - resetEditors (); - } - }); - - topAttach = new Button (table, SWT.PUSH); - topAttach.setText (LayoutExample.getResourceString ("Attach_Edit")); - topEditor.horizontalAlignment = SWT.LEFT; - topEditor.grabHorizontal = true; - topEditor.minimumWidth = topAttach.computeSize (SWT.DEFAULT, SWT.DEFAULT).x; - topEditor.setEditor (topAttach, newItem, TOP_COL); - topAttach.addSelectionListener (new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - Shell shell = tabFolderPage.getShell (); - AttachDialog dialog = new AttachDialog (shell); - dialog.setText (LayoutExample.getResourceString ("Top_Attachment")); - dialog.setColumn (TOP_COL); - String attach = dialog.open (); - newItem.setText (TOP_COL, attach); - resetEditors (); - } - }); - bottomAttach = new Button (table, SWT.PUSH); - bottomAttach.setText (LayoutExample.getResourceString ("Attach_Edit")); - bottomEditor.horizontalAlignment = SWT.LEFT; - bottomEditor.grabHorizontal = true; - bottomEditor.minimumWidth = bottomAttach.computeSize (SWT.DEFAULT, SWT.DEFAULT).x; - bottomEditor.setEditor (bottomAttach, newItem, BOTTOM_COL); - bottomAttach.addSelectionListener (new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - Shell shell = tabFolderPage.getShell (); - AttachDialog dialog = new AttachDialog (shell); - dialog.setText (LayoutExample.getResourceString ("Bottom_Attachment")); - dialog.setColumn (BOTTOM_COL); - String attach = dialog.open (); - newItem.setText (BOTTOM_COL, attach); - if (newItem.getText (TOP_COL).endsWith (")")) newItem.setText (TOP_COL, ""); - resetEditors (); - } - }); - - for (int i=0; i<table.getColumnCount (); i++) { - Rectangle rect = newItem.getBounds (i); - if (rect.contains (pt)) { - switch (i) { - case 0: - resetEditors (); - break; - case COMBO_COL : - combo.setFocus (); - break; - case WIDTH_COL : - widthText.setFocus (); - break; - case HEIGHT_COL : - heightText.setFocus (); - break; - default : - break; - } - } - } - } - }); - - /* Add listener to add an element to the table */ - add.addSelectionListener(new SelectionAdapter () { - public void widgetSelected(SelectionEvent e) { - TableItem item = new TableItem (table, 0); - String [] insert = new String [] { - String.valueOf (table.indexOf (item)), "Button", "-1", "-1", - "0,0 (" + LayoutExample.getResourceString ("Default") + ")", "", - "0,0 (" + LayoutExample.getResourceString ("Default") + ")", ""}; - item.setText (insert); - data.addElement (insert); - resetEditors (); - } - }); - } - - /** - * Creates the control widgets. - */ - void createControlWidgets () { - /* Controls the margins and spacing of the FormLayout */ - String [] marginValues = new String [] {"0","3","5","10"}; - Group marginGroup = new Group (controlGroup, SWT.NONE); - marginGroup.setText (LayoutExample.getResourceString ("Margins")); - GridLayout layout = new GridLayout (); - layout.numColumns = 2; - marginGroup.setLayout (layout); - marginGroup.setLayoutData (new GridData (GridData.FILL_HORIZONTAL)); - new Label (marginGroup, SWT.NONE).setText ("marginHeight"); - marginHeight = new Combo (marginGroup, SWT.NONE); - marginHeight.setItems (marginValues); - marginHeight.select (0); - marginHeight.addSelectionListener (selectionListener); - marginHeight.addTraverseListener (traverseListener); - GridData data = new GridData (GridData.FILL_HORIZONTAL); - data.widthHint = 60; - marginHeight.setLayoutData (data); - new Label (marginGroup, SWT.NONE).setText ("marginWidth"); - marginWidth = new Combo (marginGroup, SWT.NONE); - marginWidth.setItems (marginValues); - marginWidth.select (0); - marginWidth.addSelectionListener (selectionListener); - marginWidth.addTraverseListener (traverseListener); - data = new GridData (GridData.FILL_HORIZONTAL); - data.widthHint = 60; - marginWidth.setLayoutData (data); - - /* Add common controls */ - super.createControlWidgets (); - - /* Position the sash */ - sash.setWeights (new int [] {6,4}); - } - - /** - * Creates the example layout. - */ - void createLayout () { - formLayout = new FormLayout (); - layoutComposite.setLayout (formLayout); - } - - /** - * Disposes the editors without placing their contents - * into the table. - */ - void disposeEditors () { - comboEditor.setEditor (null, null, -1); - combo.dispose (); - widthText.dispose (); - heightText.dispose (); - leftAttach.dispose (); - rightAttach.dispose (); - topAttach.dispose (); - bottomAttach.dispose (); - } - - /** - * Generates code for the example layout. - */ - StringBuffer generateLayoutCode () { - StringBuffer code = new StringBuffer (); - code.append ("\t\tFormLayout formLayout = new FormLayout ();\n"); - if (formLayout.marginHeight != 0) { - code.append ("\t\tformLayout.marginHeight = " + formLayout.marginHeight + ";\n"); - } - if (formLayout.marginWidth != 0) { - code.append ("\t\tformLayout.marginWidth = " + formLayout.marginWidth + ";\n"); - } - code.append ("\t\tshell.setLayout (formLayout);\n"); - - boolean first = true; - for (int i = 0; i < children.length; i++) { - Control control = children [i]; - code.append (getChildCode (control, i)); - FormData data = (FormData) control.getLayoutData (); - if (data != null) { - code.append ("\t\t"); - if (first) { - code.append ("FormData "); - first = false; - } - code.append ("data = new FormData ();\n"); - if (data.width != SWT.DEFAULT) { - code.append ("\t\tdata.width = " + data.width + ";\n"); - } - if (data.height != SWT.DEFAULT) { - code.append ("\t\tdata.height = " + data.height + ";\n"); - } - if (data.left != null) { - if (data.left.control != null) { - TableItem item = table.getItem (i); - String controlString = item.getText (LEFT_COL); - int index = new Integer (controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (','))).intValue (); - code.append ("\t\tdata.left = new FormAttachment (" + names [index] + ", " + data.left.offset + ", SWT." + alignmentString (data.left.alignment) + ");\n"); - } else { - if (data.right != null || (data.left.numerator != 0 ||data.left.offset != 0)) { - code.append ("\t\tdata.left = new FormAttachment (" + data.left.numerator + ", " + data.left.offset + ");\n"); - } - } - } - if (data.right != null) { - if (data.right.control != null) { - TableItem item = table.getItem (i); - String controlString = item.getText (RIGHT_COL); - int index = new Integer (controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (','))).intValue (); - code.append ("\t\tdata.right = new FormAttachment (" + names [index] + ", " + data.right.offset + ", SWT." + alignmentString (data.right.alignment) + ");\n"); - } else { - code.append ("\t\tdata.right = new FormAttachment (" + data.right.numerator + ", " + data.right.offset + ");\n"); - } - } - if (data.top != null) { - if (data.top.control != null) { - TableItem item = table.getItem (i); - String controlString = item.getText (TOP_COL); - int index = new Integer (controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (','))).intValue (); - code.append ("\t\tdata.top = new FormAttachment (" + names [index] + ", " + data.top.offset + ", SWT." + alignmentString (data.top.alignment) + ");\n"); - } else { - if (data.bottom != null || (data.top.numerator != 0 ||data.top.offset != 0)) { - code.append ("\t\tdata.top = new FormAttachment (" + data.top.numerator + ", " + data.top.offset + ");\n"); - } - } - } - if (data.bottom != null) { - if (data.bottom.control != null) { - TableItem item = table.getItem (i); - String controlString = item.getText (BOTTOM_COL); - int index = new Integer (controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (','))).intValue (); - code.append ("\t\tdata.bottom = new FormAttachment (" + names [index] + ", " + data.bottom.offset + ", SWT." + alignmentString (data.bottom.alignment) + ");\n"); - } else { - code.append ("\t\tdata.bottom = new FormAttachment (" + data.bottom.numerator + ", " + data.bottom.offset + ");\n"); - } - } - code.append ("\t\t" + names [i] + ".setLayoutData (data);\n"); - } - } - return code; - } - - /** - * Returns the layout data field names. - */ - String [] getLayoutDataFieldNames() { - return new String [] { - "", - "Control", - "width", - "height", - "left", - "right", - "top", - "bottom" - }; - } - - /** - * Gets the text for the tab folder item. - */ - String getTabText () { - return "FormLayout"; - } - - /** - * Takes information from TableEditors and stores it. - */ - void resetEditors () { - resetEditors (false); - } - - void resetEditors (boolean tab) { - TableItem oldItem = comboEditor.getItem (); - if (oldItem != null) { - int row = table.indexOf (oldItem); - try { - new Integer (widthText.getText ()).intValue (); - } catch (NumberFormatException e) { - widthText.setText (oldItem.getText (WIDTH_COL)); - } - try { - new Integer (heightText.getText ()).intValue (); - } catch (NumberFormatException e) { - heightText.setText (oldItem.getText (HEIGHT_COL)); - } - String [] insert = new String [] {String.valueOf (row), combo.getText (), widthText.getText (), heightText.getText ()}; - data.setElementAt (insert, row); - for (int i = 0 ; i < MODIFY_COLS; i++) { - oldItem.setText (i, ((String [])data.elementAt (row)) [i]); - } - if (!tab) disposeEditors (); - } - setLayoutState (); - refreshLayoutComposite (); - setLayoutData (); - layoutComposite.layout (true); - layoutGroup.layout (true); - } - - /** - * Sets an attachment to the edge of a widget using the - * information in the table. - */ - FormAttachment setAttachment (String attachment) { - String control, align; - int position, offset; - int comma = attachment.indexOf (','); - char first = attachment.charAt (0); - if (Character.isLetter(first)) { - /* Case where there is a control */ - control = attachment.substring (0, comma); - int i = 0; - while (i < control.length () && !Character.isDigit (control.charAt (i))) { - i++; - } - String end = control.substring (i); - int index = new Integer (end).intValue (); - Control attachControl = children [index]; - int colon = attachment.indexOf (':'); - try { - offset = new Integer (attachment.substring (comma + 1, colon)).intValue (); - } catch (NumberFormatException e) { - offset = 0; - } - align = attachment.substring (colon + 1); - return new FormAttachment (attachControl, offset, alignmentConstant (align)); - } else { - /* Case where there is a position */ - try { - position = new Integer (attachment.substring (0,comma)).intValue (); - } catch (NumberFormatException e) { - position = 0; - } - try { - offset = new Integer (attachment.substring (comma + 1)).intValue (); - } catch (NumberFormatException e) { - offset = 0; - } - return new FormAttachment (position, offset); - } - } - - /** - * Sets the layout data for the children of the layout. - */ - void setLayoutData () { - Control [] children = layoutComposite.getChildren (); - TableItem [] items = table.getItems (); - FormData data; - int width, height; - String left, right, top, bottom; - for (int i = 0; i < children.length; i++) { - width = new Integer (items [i].getText (WIDTH_COL)).intValue (); - height = new Integer (items [i].getText (HEIGHT_COL)).intValue (); - data = new FormData (); - if (width > 0) data.width = width; - if (height > 0) data.height = height; - - left = items [i].getText (LEFT_COL); - if (left.length () > 0) { - data.left = setAttachment (left); - if (data.left.control != null) { - String attachment = checkAttachment (left, data.left); - items [i].setText (LEFT_COL, attachment); - } - } - right = items [i].getText (RIGHT_COL); - if (right.length () > 0) { - data.right = setAttachment (right); - if (data.right.control != null) { - String attachment = checkAttachment (right, data.right); - items [i].setText (RIGHT_COL, attachment); - } - } - top = items [i].getText (TOP_COL); - if (top.length () > 0 ) { - data.top = setAttachment (top); - if (data.top.control != null) { - String attachment = checkAttachment (top, data.top); - items [i].setText (TOP_COL, attachment); - } - } - bottom = items [i].getText (BOTTOM_COL); - if (bottom.length () > 0) { - data.bottom = setAttachment (bottom); - if (data.bottom.control != null) { - String attachment = checkAttachment (bottom, data.bottom); - items [i].setText (BOTTOM_COL, attachment); - } - } - children [i].setLayoutData (data); - } - } - - /** - * Sets the state of the layout. - */ - void setLayoutState () { - /* Set the margins and spacing */ - try { - formLayout.marginHeight = new Integer (marginHeight.getText ()).intValue (); - } catch (NumberFormatException e) { - formLayout.marginHeight = 0; - marginHeight.select (0); - } - try { - formLayout.marginWidth = new Integer (marginWidth.getText ()).intValue (); - } catch (NumberFormatException e) { - formLayout.marginWidth = 0; - marginWidth.select (0); - } - } - - - /** - * <code>AttachDialog</code> is the class that creates a - * dialog specific for this example. It creates a dialog - * with controls to set the values in a FormAttachment. - */ - public class AttachDialog extends Dialog { - String result = ""; - String controlInput, positionInput, alignmentInput, offsetInput; - int col = 0; - - public AttachDialog (Shell parent, int style) { - super (parent, style); - } - - public AttachDialog (Shell parent) { - this (parent, 0); - } - - public void setColumn (int col) { - this.col = col; - } - - public String open () { - Shell parent = getParent (); - final Shell shell = new Shell (parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); - shell.setText (getText ()); - GridLayout layout = new GridLayout (); - layout.numColumns = 3; - layout.makeColumnsEqualWidth = true; - shell.setLayout (layout); - - /* Find out what was previously set as an attachment */ - TableItem newItem = leftEditor.getItem (); - result = newItem.getText (col); - String oldAttach = result; - String oldPos = "0", oldControl = "", oldAlign = "DEFAULT", oldOffset = "0"; - boolean isControl = false; - if (oldAttach.length () != 0) { - char first = oldAttach.charAt (0); - if (Character.isLetter(first)) { - /* We have a control */ - isControl = true; - oldControl = oldAttach.substring (0, oldAttach.indexOf (',')); - oldAlign = oldAttach.substring (oldAttach.indexOf (':') + 1); - oldOffset = oldAttach.substring (oldAttach.indexOf (',') + 1, oldAttach.indexOf (':')); - } else { - /* We have a position */ - oldPos = oldAttach.substring (0, oldAttach.indexOf (',')); - oldOffset = oldAttach.substring (oldAttach.indexOf (',') + 1); - if (oldOffset.endsWith (")")) { // i.e. (Default) - oldOffset = oldOffset.substring (0, oldOffset.indexOf (' ')); - } - } - } - - /* Add position field */ - final Button posButton = new Button (shell, SWT.RADIO); - posButton.setText (LayoutExample.getResourceString ("Position")); - posButton.setSelection (!isControl); - final Combo position = new Combo (shell, SWT.NONE); - position.setItems (new String [] {"0","25","50","75","100"}); - position.setText (oldPos); - position.setEnabled (!isControl); - GridData data = new GridData (GridData.FILL_HORIZONTAL); - data.horizontalSpan = 2; - position.setLayoutData (data); - - /* Add control field */ - final Button contButton = new Button (shell, SWT.RADIO); - contButton.setText (LayoutExample.getResourceString ("Control")); - contButton.setSelection (isControl); - final Combo control = new Combo (shell, SWT.READ_ONLY); - TableItem [] items = table.getItems (); - TableItem currentItem = leftEditor.getItem (); - for (int i = 0; i < table.getItemCount (); i++) { - if (items [i].getText (0).length() > 0) { - if (items [i] != currentItem) { - control.add (items [i].getText (COMBO_COL) + i); - } - } - } - if (oldControl.length () != 0) control.setText (oldControl); - else control.select (0); - control.setEnabled (isControl); - data = new GridData (GridData.FILL_HORIZONTAL); - data.horizontalSpan = 2; - control.setLayoutData (data); - - /* Add alignment field */ - new Label (shell, SWT.NONE).setText (LayoutExample.getResourceString ("Alignment")); - final Combo alignment = new Combo (shell, SWT.NONE); - String[] alignmentValues; - if (col == LEFT_COL || col == RIGHT_COL) { - alignmentValues = new String [] {"SWT.LEFT", "SWT.RIGHT", "SWT.CENTER", "SWT.DEFAULT"}; - } else { - // col == TOP_COL || col == BOTTOM_COL - alignmentValues = new String [] {"SWT.TOP", "SWT.BOTTOM", "SWT.CENTER", "SWT.DEFAULT"}; - } - alignment.setItems (alignmentValues); - alignment.setText ("SWT." + oldAlign); - alignment.setEnabled (isControl); - data = new GridData (GridData.FILL_HORIZONTAL); - data.horizontalSpan = 2; - alignment.setLayoutData (data); - - /* Add offset field */ - new Label (shell, SWT.NONE).setText (LayoutExample.getResourceString ("Offset")); - final Text offset = new Text (shell, SWT.SINGLE | SWT.BORDER); - offset.setText (oldOffset); - data = new GridData (GridData.FILL_HORIZONTAL); - data.horizontalSpan = 2; - offset.setLayoutData (data); - - /* Add listeners for choosing between position and control */ - posButton.addSelectionListener (new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - position.setEnabled (true); - control.setEnabled (false); - alignment.setEnabled(false); - } - }); - contButton.addSelectionListener (new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - position.setEnabled (false); - control.setEnabled (true); - alignment.setEnabled(true); - } - }); - - Button clear = new Button (shell, SWT.PUSH); - clear.setText (LayoutExample.getResourceString ("Clear")); - clear.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_END)); - clear.addSelectionListener (new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - result = ""; - shell.close (); - } - }); - /* OK button sets data into table */ - Button ok = new Button (shell, SWT.PUSH); - ok.setText (LayoutExample.getResourceString ("OK")); - ok.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_CENTER)); - ok.addSelectionListener (new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - controlInput = control.getText (); - alignmentInput = alignment.getText ().substring (4); - positionInput = position.getText (); - if (positionInput.length () == 0) positionInput = "0"; - try { - new Integer (positionInput).intValue (); - } catch (NumberFormatException except) { - positionInput = "0"; - } - offsetInput = offset.getText (); - if (offsetInput.length () == 0) offsetInput = "0"; - try { - new Integer (offsetInput).intValue (); - } catch (NumberFormatException except) { - offsetInput = "0"; - } - if (posButton.getSelection() || controlInput.length () == 0) { - result = positionInput + "," + offsetInput; - } else { - result = controlInput + "," + offsetInput + ":" + alignmentInput; - } - shell.close (); - } - }); - Button cancel = new Button (shell, SWT.PUSH); - cancel.setText (LayoutExample.getResourceString ("Cancel")); - cancel.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_BEGINNING)); - cancel.addSelectionListener (new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - shell.close (); - } - }); - - shell.setDefaultButton (ok); - shell.pack (); - /* Center the dialog */ - Point center = parent.getLocation (); - center.x = center.x + (parent.getBounds ().width / 2) - (shell.getBounds ().width / 2); - center.y = center.y + (parent.getBounds ().height / 2) - (shell.getBounds ().height / 2); - shell.setLocation (center); - shell.open (); - Display display = shell.getDisplay (); - while (!shell.isDisposed ()) { - if (display.readAndDispatch ()) display.sleep (); - } - - return result; - } - } -} diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java deleted file mode 100644 index e45f67f810..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java +++ /dev/null @@ -1,586 +0,0 @@ -package org.eclipse.swt.examples.layoutexample; - -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; - -class GridLayoutTab extends Tab { - /* Controls for setting layout parameters */ - Text numColumns; - Button makeColumnsEqualWidth; - Combo marginHeight, marginWidth, horizontalSpacing, verticalSpacing; - /* The example layout instance */ - GridLayout gridLayout; - /* TableEditors and related controls*/ - TableEditor comboEditor, widthEditor, heightEditor; - TableEditor vAlignEditor, hAlignEditor, hIndentEditor; - TableEditor hSpanEditor, vSpanEditor, hGrabEditor, vGrabEditor; - CCombo combo, vAlign, hAlign, hGrab, vGrab; - Text widthText, heightText, hIndent, hSpan, vSpan; - - /* Constants */ - final int COMBO_COL = 1; - final int WIDTH_COL = 2; - final int HEIGHT_COL = 3; - final int HALIGN_COL = 4; - final int VALIGN_COL = 5; - final int HINDENT_COL = 6; - final int HSPAN_COL = 7; - final int VSPAN_COL = 8; - final int HGRAB_COL = 9; - final int VGRAB_COL = 10; - - final int TOTAL_COLS = 11; - - /** - * Creates the Tab within a given instance of LayoutExample. - */ - GridLayoutTab(LayoutExample instance) { - super(instance); - } - - /** - * Creates the widgets in the "child" group. - */ - void createChildWidgets () { - /* Create the TraverseListener */ - final TraverseListener traverseListener = new TraverseListener () { - public void keyTraversed (TraverseEvent e) { - if (e.detail == SWT.TRAVERSE_RETURN || e.detail == SWT.TRAVERSE_TAB_NEXT) - resetEditors (); - if (e.detail == SWT.TRAVERSE_ESCAPE) - disposeEditors (); - }; - }; - - /* Add common controls */ - super.createChildWidgets (); - - /* Add TableEditors */ - comboEditor = new TableEditor (table); - widthEditor = new TableEditor (table); - heightEditor = new TableEditor (table); - vAlignEditor = new TableEditor (table); - hAlignEditor = new TableEditor (table); - hIndentEditor = new TableEditor (table); - hSpanEditor = new TableEditor (table); - vSpanEditor = new TableEditor (table); - hGrabEditor = new TableEditor (table); - vGrabEditor = new TableEditor (table); - table.addMouseListener (new MouseAdapter () { - public void mouseDown(MouseEvent e) { - resetEditors(); - index = table.getSelectionIndex (); - Point pt = new Point (e.x, e.y); - newItem = table.getItem (pt); - if (newItem == null) return; - TableItem oldItem = comboEditor.getItem (); - if (newItem == oldItem || newItem != lastSelected) { - lastSelected = newItem; - return; - } - table.showSelection (); - - combo = new CCombo (table, SWT.READ_ONLY); - createComboEditor (combo, comboEditor); - - widthText = new Text (table, SWT.SINGLE); - widthText.setText (((String [])data.elementAt (index)) [WIDTH_COL]); - createTextEditor (widthText, widthEditor, WIDTH_COL); - - heightText = new Text (table, SWT.SINGLE); - heightText.setText (((String [])data.elementAt (index)) [HEIGHT_COL]); - createTextEditor (heightText, heightEditor, HEIGHT_COL); - String [] alignValues = new String [] {"BEGINNING","CENTER","END","FILL"}; - hAlign = new CCombo (table, SWT.NONE); - hAlign.setItems (alignValues); - hAlign.setText (newItem.getText (HALIGN_COL)); - hAlignEditor.horizontalAlignment = SWT.LEFT; - hAlignEditor.grabHorizontal = true; - hAlignEditor.minimumWidth = 50; - hAlignEditor.setEditor (hAlign, newItem, HALIGN_COL); - hAlign.addTraverseListener (traverseListener); - - vAlign = new CCombo (table, SWT.NONE); - vAlign.setItems (alignValues); - vAlign.setText (newItem.getText (VALIGN_COL)); - vAlignEditor.horizontalAlignment = SWT.LEFT; - vAlignEditor.grabHorizontal = true; - vAlignEditor.minimumWidth = 50; - vAlignEditor.setEditor (vAlign, newItem, VALIGN_COL); - vAlign.addTraverseListener (traverseListener); - - hIndent = new Text (table, SWT.SINGLE); - hIndent.setText (((String [])data.elementAt (index)) [HINDENT_COL]); - createTextEditor (hIndent, hIndentEditor, HINDENT_COL); - - hSpan = new Text (table, SWT.SINGLE); - hSpan.setText (((String [])data.elementAt (index)) [HSPAN_COL]); - createTextEditor (hSpan, hSpanEditor, HSPAN_COL); - - vSpan = new Text (table, SWT.SINGLE); - vSpan.setText (((String [])data.elementAt (index)) [VSPAN_COL]); - createTextEditor (vSpan, vSpanEditor, VSPAN_COL); - - String [] boolValues = new String [] {"false","true"}; - hGrab = new CCombo (table, SWT.NONE); - hGrab.setItems (boolValues); - hGrab.setText (newItem.getText (HGRAB_COL)); - hGrabEditor.horizontalAlignment = SWT.LEFT; - hGrabEditor.grabHorizontal = true; - hGrabEditor.minimumWidth = 50; - hGrabEditor.setEditor (hGrab, newItem, HGRAB_COL); - hGrab.addTraverseListener (traverseListener);; - - vGrab = new CCombo (table, SWT.NONE); - vGrab.setItems (boolValues); - vGrab.setText (newItem.getText (VGRAB_COL)); - vGrabEditor.horizontalAlignment = SWT.LEFT; - vGrabEditor.grabHorizontal = true; - vGrabEditor.minimumWidth = 50; - vGrabEditor.setEditor (vGrab, newItem, VGRAB_COL); - vGrab.addTraverseListener (traverseListener); - - for (int i=0; i<table.getColumnCount (); i++) { - Rectangle rect = newItem.getBounds (i); - if (rect.contains (pt)) { - switch (i) { - case COMBO_COL : - combo.setFocus (); - break; - case WIDTH_COL : - widthText.setFocus (); - break; - case HEIGHT_COL : - heightText.setFocus (); - break; - case HALIGN_COL : - hAlign.setFocus (); - break; - case VALIGN_COL : - vAlign.setFocus (); - break; - case HINDENT_COL : - hIndent.setFocus (); - break; - case HSPAN_COL : - hSpan.setFocus (); - break; - case VSPAN_COL : - vSpan.setFocus (); - break; - case HGRAB_COL : - hGrab.setFocus (); - break; - case VGRAB_COL : - vGrab.setFocus (); - break; - default : - resetEditors (); - break; - } - } - } - } - }); - - /* Add listener to add an element to the table */ - add.addSelectionListener(new SelectionAdapter () { - public void widgetSelected(SelectionEvent e) { - TableItem item = new TableItem (table, 0); - String [] insert = new String [] { - String.valueOf (table.indexOf (item)), "Button", - "-1","-1","BEGINNING","CENTER", - "0","1","1","false","false"}; - item.setText (insert); - data.addElement (insert); - resetEditors (); - } - }); - } - - /** - * Creates the control widgets. - */ - void createControlWidgets () { - /* Rearrange the layout of the control group */ - size.setLayoutData (new GridData ()); - - /* Controls the margins and spacing of the GridLayout */ - String [] marginValues = new String [] {"0","3","5","10"}; - Group marginGroup = new Group (controlGroup, SWT.NONE); - marginGroup.setText (LayoutExample.getResourceString ("Margins_Spacing")); - GridData data = new GridData (GridData.FILL_HORIZONTAL); - data.verticalSpan = 2; - marginGroup.setLayoutData (data); - GridLayout layout = new GridLayout (); - layout.numColumns = 2; - marginGroup.setLayout (layout); - new Label (marginGroup, SWT.NONE).setText ("marginHeight"); - marginHeight = new Combo (marginGroup, SWT.NONE); - marginHeight.setItems (marginValues); - marginHeight.select (2); - data = new GridData (GridData.FILL_HORIZONTAL); - data.widthHint = 60; - marginHeight.setLayoutData (data); - marginHeight.addSelectionListener (selectionListener); - marginHeight.addTraverseListener (traverseListener); - new Label (marginGroup, SWT.NONE).setText ("marginWidth"); - marginWidth = new Combo (marginGroup, SWT.NONE); - marginWidth.setItems (marginValues); - marginWidth.select (2); - data = new GridData (GridData.FILL_HORIZONTAL); - data.widthHint = 60; - marginWidth.setLayoutData (data); - marginWidth.addSelectionListener (selectionListener); - marginWidth.addTraverseListener (traverseListener); - new Label (marginGroup, SWT.NONE).setText ("horizontalSpacing"); - horizontalSpacing = new Combo (marginGroup, SWT.NONE); - horizontalSpacing.setItems (marginValues); - horizontalSpacing.select (2); - data = new GridData (GridData.FILL_HORIZONTAL); - data.widthHint = 60; - horizontalSpacing.setLayoutData (data); - horizontalSpacing.addSelectionListener (selectionListener); - horizontalSpacing.addTraverseListener (traverseListener); - new Label (marginGroup, SWT.NONE).setText ("verticalSpacing"); - verticalSpacing = new Combo (marginGroup, SWT.NONE); - verticalSpacing.setItems (marginValues); - verticalSpacing.select (2); - data = new GridData (GridData.FILL_HORIZONTAL); - data.widthHint = 60; - verticalSpacing.setLayoutData (data); - verticalSpacing.addSelectionListener (selectionListener); - verticalSpacing.addTraverseListener (traverseListener); - - /* Controls the columns in the GridLayout */ - Group columnGroup = new Group (controlGroup, SWT.NONE); - columnGroup.setText (LayoutExample.getResourceString ("Columns")); - layout = new GridLayout (); - layout.numColumns = 2; - columnGroup.setLayout (layout); - data = new GridData (GridData.VERTICAL_ALIGN_FILL); - columnGroup.setLayoutData (data); - numColumns = new Text (columnGroup, SWT.BORDER); - numColumns.setText ("1"); - numColumns.addSelectionListener (selectionListener); - numColumns.addTraverseListener (traverseListener); - data = new GridData (GridData.FILL_HORIZONTAL); - data.widthHint = 15; - numColumns.setLayoutData (data); - new Label (columnGroup, SWT.NONE).setText ("numColumns"); - makeColumnsEqualWidth = new Button (columnGroup, SWT.CHECK); - makeColumnsEqualWidth.setText ("makeColumnsEqualWidth"); - makeColumnsEqualWidth.addSelectionListener (selectionListener); - data = new GridData (GridData.FILL_HORIZONTAL); - data.horizontalSpan = 2; - data.horizontalIndent = 14; - makeColumnsEqualWidth.setLayoutData (data); - - /* Add common controls */ - super.createControlWidgets (); - controlGroup.pack(); - } - - /** - * Creates the example layout. - */ - void createLayout () { - gridLayout = new GridLayout (); - layoutComposite.setLayout (gridLayout); - } - - /** - * Disposes the editors without placing their contents - * into the table. - */ - void disposeEditors () { - comboEditor.setEditor (null, null, -1); - combo.dispose (); - widthText.dispose (); - heightText.dispose (); - hAlign.dispose (); - vAlign.dispose (); - hIndent.dispose (); - hSpan.dispose (); - vSpan.dispose (); - hGrab.dispose (); - vGrab.dispose (); - } - - /** - * Generates code for the example layout. - */ - StringBuffer generateLayoutCode () { - StringBuffer code = new StringBuffer (); - code.append ("\t\tGridLayout gridLayout = new GridLayout ();\n"); - if (gridLayout.numColumns != 1) { - code.append ("\t\tgridLayout.numColumns = " + gridLayout.numColumns + ";\n"); - } - if (gridLayout.makeColumnsEqualWidth) { - code.append ("\t\tgridLayout.makeColumnsEqualWidth = true;\n"); - } - if (gridLayout.marginHeight != 5) { - code.append ("\t\tgridLayout.marginHeight = " + gridLayout.marginHeight + ";\n"); - } - if (gridLayout.marginWidth != 5) { - code.append ("\t\tgridLayout.marginWidth = " + gridLayout.marginWidth + ";\n"); - } - if (gridLayout.horizontalSpacing != 5) { - code.append ("\t\tgridLayout.horizontalSpacing = " + gridLayout.horizontalSpacing + ";\n"); - } - if (gridLayout.verticalSpacing != 5) { - code.append ("\t\tgridLayout.verticalSpacing = " + gridLayout.verticalSpacing + ";\n"); - } - code.append ("\t\tshell.setLayout (gridLayout);\n"); - - boolean first = true; - for (int i = 0; i < children.length; i++) { - Control control = children [i]; - code.append (getChildCode (control, i)); - GridData data = (GridData) control.getLayoutData (); - if (data != null) { - code.append ("\t\t"); - if (first) { - code.append ("GridData "); - first = false; - } - code.append ("data = new GridData ();\n"); - if (data.widthHint != SWT.DEFAULT) { - code.append ("\t\tdata.widthHint = " + data.widthHint + ";\n"); - } - if (data.heightHint != SWT.DEFAULT) { - code.append ("\t\tdata.heightHint = " + data.heightHint + ";\n"); - } - if (data.horizontalAlignment != GridData.BEGINNING) { - String alignment; - int hAlignment = data.horizontalAlignment; - if (hAlignment == GridData.CENTER) alignment = "GridData.CENTER"; - else if (hAlignment == GridData.END) alignment = "GridData.END"; - else alignment = "GridData.FILL"; - code.append ("\t\tdata.horizontalAlignment = " + alignment + ";\n"); - } - if (data.verticalAlignment != GridData.CENTER) { - String alignment; - int vAlignment = data.verticalAlignment; - if (vAlignment == GridData.BEGINNING) alignment = "GridData.BEGINNING"; - else if (vAlignment == GridData.END) alignment = "GridData.END"; - else alignment = "GridData.FILL"; - code.append ("\t\tdata.verticalAlignment = " + alignment + ";\n"); - } - if (data.horizontalIndent != 0) { - code.append ("\t\tdata.horizontalIndent = " + data.horizontalIndent + ";\n"); - } - if (data.horizontalSpan != 1) { - code.append ("\t\tdata.horizontalSpan = " + data.horizontalSpan + ";\n"); - } - if (data.verticalSpan != 1) { - code.append ("\t\tdata.verticalSpan = " + data.verticalSpan + ";\n"); - } - if (data.grabExcessHorizontalSpace) { - code.append ("\t\tdata.grabExcessHorizontalSpace = true;\n"); - } - if (data.grabExcessVerticalSpace) { - code.append ("\t\tdata.grabExcessVerticalSpace = true;\n"); - } - if (code.substring (code.length () - 33).equals ("GridData data = new GridData ();\n")) { - code.delete (code.length () - 33, code.length ()); - first = true; - } else if (code.substring (code.length () - 24).equals ("data = new GridData ();\n")) { - code.delete (code.length () - 24, code.length ()); - } else { - code.append ("\t\t" + names [i] + ".setLayoutData (data);\n"); - } - } - } - return code; - } - - /** - * Returns the layout data field names. - */ - String [] getLayoutDataFieldNames() { - return new String [] { - "", - "Control", - "width", - "height", - "horizontalAlignment", - "verticalAlignment", - "horizontalIndent", - "horizontalSpan", - "verticalSpan", - "grabExcessHorizontalSpace", - "grabExcessVerticalSpace" - }; - } - - /** - * Gets the text for the tab folder item. - */ - String getTabText () { - return "GridLayout"; - } - - /** - * Takes information from TableEditors and stores it. - */ - void resetEditors () { - resetEditors (false); - } - - void resetEditors (boolean tab) { - TableItem oldItem = comboEditor.getItem (); - if (oldItem != null) { - int row = table.indexOf (oldItem); - try { - new Integer (widthText.getText ()).intValue (); - } catch (NumberFormatException e) { - widthText.setText (oldItem.getText (WIDTH_COL)); - } - try { - new Integer (heightText.getText ()).intValue (); - } catch (NumberFormatException e) { - heightText.setText (oldItem.getText (HEIGHT_COL)); - } - try { - new Integer (hIndent.getText ()).intValue (); - } catch (NumberFormatException e) { - hIndent.setText (oldItem.getText (HINDENT_COL)); - } - try { - new Integer (hSpan.getText ()).intValue (); - } catch (NumberFormatException e) { - hSpan.setText (oldItem.getText (HSPAN_COL)); - } - try { - new Integer (vSpan.getText ()).intValue (); - } catch (NumberFormatException e) { - vSpan.setText (oldItem.getText (VSPAN_COL)); - } - String [] insert = new String [] { - String.valueOf (row), combo.getText (), widthText.getText (), heightText.getText (), - hAlign.getText (), vAlign.getText (), hIndent.getText (), - hSpan.getText (), vSpan.getText (), hGrab.getText (), vGrab.getText () - }; - data.setElementAt (insert, row); - for (int i = 0; i < TOTAL_COLS; i++) { - oldItem.setText (i, ((String [])data.elementAt (row)) [i]); - } - if (!tab) disposeEditors (); - } - setLayoutState (); - refreshLayoutComposite (); - setLayoutData (); - layoutComposite.layout (true); - layoutGroup.layout (true); - } - - /** - * Sets the layout data for the children of the layout. - */ - void setLayoutData () { - Control [] children = layoutComposite.getChildren (); - TableItem [] items = table.getItems (); - GridData data; - int width, height, hIndent, hSpan, vSpan; - String vAlign, hAlign, vGrab, hGrab; - for (int i = 0; i < children.length; i++) { - data = new GridData (); - /* Set widthHint and heightHint */ - data.widthHint = new Integer (items [i].getText (WIDTH_COL)).intValue (); - data.heightHint = new Integer (items [i].getText (HEIGHT_COL)).intValue (); - /* Set vertical alignment and horizontal alignment */ - hAlign = items [i].getText (HALIGN_COL); - if (hAlign.equals ("CENTER")) { - data.horizontalAlignment = GridData.CENTER; - } else if (hAlign.equals ("END")) { - data.horizontalAlignment = GridData.END; - } else if (hAlign.equals ("FILL")) { - data.horizontalAlignment = GridData.FILL; - } else { - data.horizontalAlignment = GridData.BEGINNING; - } - vAlign = items [i].getText (VALIGN_COL); - if (vAlign.equals ("BEGINNING")) { - data.verticalAlignment = GridData.BEGINNING; - } else if (vAlign.equals ("END")) { - data.verticalAlignment = GridData.END; - } else if (vAlign.equals ("FILL")) { - data.verticalAlignment = GridData.FILL; - } else { - data.verticalAlignment = GridData.CENTER; - } - /* Set indents and spans */ - hIndent = new Integer (items [i].getText (HINDENT_COL)).intValue (); - data.horizontalIndent = hIndent; - hSpan = new Integer (items [i].getText (HSPAN_COL)).intValue (); - data.horizontalSpan = hSpan; - vSpan = new Integer (items [i].getText (VSPAN_COL)).intValue (); - data.verticalSpan = vSpan; - /* Set grabbers */ - hGrab = items [i].getText (HGRAB_COL); - if (hGrab.equals ("true")) { - data.grabExcessHorizontalSpace = true; - } else { - data.grabExcessHorizontalSpace = false; - } - vGrab = items [i].getText (VGRAB_COL); - if (vGrab.equals ("true")) { - data.grabExcessVerticalSpace = true; - } else { - data.grabExcessVerticalSpace = false; - } - children [i].setLayoutData (data); - } - } - - /** - * Sets the state of the layout. - */ - void setLayoutState () { - /* Set the columns for the layout */ - try { - gridLayout.numColumns = new Integer (numColumns.getText ()).intValue (); - } catch (NumberFormatException e) { - gridLayout.numColumns = 1; - } - gridLayout.makeColumnsEqualWidth = makeColumnsEqualWidth.getSelection (); - - /* Set the margins and spacing */ - try { - gridLayout.marginHeight = new Integer (marginHeight.getText ()).intValue (); - } catch (NumberFormatException e) { - gridLayout.marginHeight = 5; - marginHeight.select (2); - } - try { - gridLayout.marginWidth = new Integer (marginWidth.getText ()).intValue (); - } catch (NumberFormatException e) { - gridLayout.marginWidth = 5; - marginWidth.select (2); - } - try { - gridLayout.horizontalSpacing = new Integer (horizontalSpacing.getText ()).intValue (); - } catch (NumberFormatException e) { - gridLayout.horizontalSpacing = 5; - horizontalSpacing.select (2); - } - try { - gridLayout.verticalSpacing = new Integer (verticalSpacing.getText ()).intValue (); - } catch (NumberFormatException e) { - gridLayout.verticalSpacing = 5; - verticalSpacing.select (2); - } - } -} diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/LayoutExample.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/LayoutExample.java deleted file mode 100644 index 2081decfed..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/LayoutExample.java +++ /dev/null @@ -1,111 +0,0 @@ -package org.eclipse.swt.examples.layoutexample; - -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.events.*; - -import java.text.*; -import java.util.*; - -public class LayoutExample { - private static ResourceBundle resourceBundle = ResourceBundle.getBundle("examples_layout"); - private TabFolder tabFolder; - - /** - * Creates an instance of a LayoutExample embedded inside - * the supplied parent Composite. - * - * @param parent the container of the example - */ - public LayoutExample(Composite parent) { - tabFolder = new TabFolder (parent, SWT.NULL); - Tab [] tabs = new Tab [] { - new FillLayoutTab (this), - new RowLayoutTab (this), - new GridLayoutTab (this), - new FormLayoutTab (this), - }; - for (int i=0; i<tabs.length; i++) { - TabItem item = new TabItem (tabFolder, SWT.NULL); - item.setText (tabs [i].getTabText ()); - item.setControl (tabs [i].createTabFolderPage (tabFolder)); - } - } - - /** - * Grabs input focus. - */ - public void setFocus() { - tabFolder.setFocus(); - } - - /** - * Disposes of all resources associated with a particular - * instance of the LayoutExample. - */ - public void dispose() { - tabFolder = null; - } - - /** - * Invokes as a standalone program. - */ - public static void main(String[] args) { - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - new LayoutExample(shell); - shell.setText(getResourceString("window.title")); - shell.addShellListener (new ShellAdapter () { - public void shellClosed(ShellEvent e) { - Shell [] shells = display.getShells(); - for (int i = 0; i < shells.length; i++) { - if (shells [i] != shell) shells [i].close (); - } - } - }); - shell.open(); - while (! shell.isDisposed()) { - if (! display.readAndDispatch()) display.sleep(); - } - } - - /** - * Gets a string from the resource bundle. - * We don't want to crash because of a missing String. - * Returns the key if not found. - */ - static String getResourceString(String key) { - try { - return resourceBundle.getString(key); - } catch (MissingResourceException e) { - return key; - } catch (NullPointerException e) { - return "!" + key + "!"; - } - } - - /** - * Gets a string from the resource bundle and binds it - * with the given arguments. If the key is not found, - * return the key. - */ - static String getResourceString(String key, Object[] args) { - try { - return MessageFormat.format(getResourceString(key), args); - } catch (MissingResourceException e) { - return key; - } catch (NullPointerException e) { - return "!" + key + "!"; - } - } -} diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/RowLayoutTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/RowLayoutTab.java deleted file mode 100644 index 32b54e9e46..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/RowLayoutTab.java +++ /dev/null @@ -1,409 +0,0 @@ -package org.eclipse.swt.examples.layoutexample; - -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.custom.*; - -class RowLayoutTab extends Tab { - /* Controls for setting layout parameters */ - Button horizontal, vertical; - Button wrap, pack, justify; - Combo marginRight, marginLeft, marginTop, marginBottom, spacing; - /* The example layout instance */ - RowLayout rowLayout; - /* TableEditors and related controls*/ - TableEditor comboEditor, widthEditor, heightEditor; - CCombo combo; - Text widthText, heightText; - - /* Constants */ - final int COMBO_COL = 1; - final int WIDTH_COL = 2; - final int HEIGHT_COL = 3; - - final int TOTAL_COLS = 4; - - /** - * Creates the Tab within a given instance of LayoutExample. - */ - RowLayoutTab(LayoutExample instance) { - super(instance); - } - - /** - * Creates the widgets in the "child" group. - */ - void createChildWidgets () { - /* Add common controls */ - super.createChildWidgets (); - - /* Add TableEditors */ - comboEditor = new TableEditor (table); - widthEditor = new TableEditor (table); - heightEditor = new TableEditor (table); - table.addMouseListener (new MouseAdapter () { - public void mouseDown(MouseEvent e) { - resetEditors(); - index = table.getSelectionIndex (); - Point pt = new Point (e.x, e.y); - newItem = table.getItem (pt); - if (newItem == null) return; - TableItem oldItem = comboEditor.getItem (); - if (newItem == oldItem || newItem != lastSelected) { - lastSelected = newItem; - return; - } - table.showSelection (); - - combo = new CCombo (table, SWT.READ_ONLY); - createComboEditor (combo, comboEditor); - - widthText = new Text (table, SWT.SINGLE); - widthText.setText (((String [])data.elementAt (index)) [WIDTH_COL]); - createTextEditor (widthText, widthEditor, WIDTH_COL); - - heightText = new Text (table, SWT.SINGLE); - heightText.setText (((String [])data.elementAt (index)) [HEIGHT_COL]); - createTextEditor (heightText, heightEditor, HEIGHT_COL); - - for (int i=0; i<table.getColumnCount (); i++) { - Rectangle rect = newItem.getBounds (i); - if (rect.contains (pt)) { - switch (i) { - case COMBO_COL : - combo.setFocus (); - break; - case WIDTH_COL : - widthText.setFocus (); - break; - case HEIGHT_COL : - heightText.setFocus (); - break; - default : - resetEditors (); - break; - } - } - } - } - }); - - /* Add listener to add an element to the table */ - add.addSelectionListener(new SelectionAdapter () { - public void widgetSelected(SelectionEvent e) { - TableItem item = new TableItem (table, 0); - String [] insert = new String [] { - String.valueOf (table.indexOf (item)), - "Button", "-1", "-1"}; - item.setText (insert); - data.addElement (insert); - resetEditors (); - } - }); - } - - /** - * Creates the control widgets. - */ - void createControlWidgets () { - /* Controls the type of RowLayout */ - Group typeGroup = new Group (controlGroup, SWT.NONE); - typeGroup.setText (LayoutExample.getResourceString ("Type")); - typeGroup.setLayout (new GridLayout ()); - GridData data = new GridData (GridData.FILL_HORIZONTAL); - typeGroup.setLayoutData (data); - horizontal = new Button (typeGroup, SWT.RADIO); - horizontal.setText ("SWT.HORIZONTAL"); - horizontal.setLayoutData (new GridData (GridData.FILL_HORIZONTAL)); - horizontal.setSelection(true); - horizontal.addSelectionListener (selectionListener); - vertical = new Button (typeGroup, SWT.RADIO); - vertical.setText ("SWT.VERTICAL"); - vertical.setLayoutData (new GridData (GridData.FILL_HORIZONTAL)); - vertical.addSelectionListener (selectionListener); - - /* Controls the margins and spacing of the RowLayout */ - String [] marginValues = new String [] {"0","3","5","10"}; - Group marginGroup = new Group (controlGroup, SWT.NONE); - marginGroup.setText (LayoutExample.getResourceString ("Margins_Spacing")); - data = new GridData (GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); - data.verticalSpan = 2; - marginGroup.setLayoutData (data); - GridLayout layout = new GridLayout (); - layout.numColumns = 2; - marginGroup.setLayout (layout); - new Label (marginGroup, SWT.NONE).setText ("marginRight"); - marginRight = new Combo (marginGroup, SWT.NONE); - marginRight.setItems (marginValues); - marginRight.select (1); - marginRight.setLayoutData (new GridData(GridData.FILL_HORIZONTAL)); - marginRight.addSelectionListener (selectionListener); - marginRight.addTraverseListener (traverseListener); - new Label (marginGroup, SWT.NONE).setText ("marginLeft"); - marginLeft = new Combo (marginGroup, SWT.NONE); - marginLeft.setItems (marginValues); - marginLeft.select (1); - marginLeft.setLayoutData (new GridData(GridData.FILL_HORIZONTAL)); - marginLeft.addSelectionListener (selectionListener); - marginLeft.addTraverseListener(traverseListener); - new Label (marginGroup, SWT.NONE).setText ("marginTop"); - marginTop = new Combo (marginGroup, SWT.NONE); - marginTop.setItems (marginValues); - marginTop.select (1); - marginTop.setLayoutData (new GridData(GridData.FILL_HORIZONTAL)); - marginTop.addSelectionListener (selectionListener); - marginTop.addTraverseListener(traverseListener); - new Label (marginGroup, SWT.NONE).setText ("marginBottom"); - marginBottom = new Combo (marginGroup, SWT.NONE); - marginBottom.setItems (marginValues); - marginBottom.select (1); - marginBottom.setLayoutData (new GridData(GridData.FILL_HORIZONTAL)); - marginBottom.addSelectionListener (selectionListener); - marginBottom.addTraverseListener(traverseListener); - new Label (marginGroup, SWT.NONE).setText ("spacing"); - spacing = new Combo (marginGroup, SWT.NONE); - spacing.setItems (marginValues); - spacing.select (1); - spacing.setLayoutData (new GridData(GridData.FILL_HORIZONTAL)); - spacing.addSelectionListener (selectionListener); - spacing.addTraverseListener(traverseListener); - - /* Controls other parameters of the RowLayout */ - Group specGroup = new Group (controlGroup, SWT.NONE); - specGroup.setText (LayoutExample.getResourceString ("Properties")); - specGroup.setLayoutData (new GridData (GridData.FILL_HORIZONTAL)); - specGroup.setLayout (new GridLayout ()); - wrap = new Button (specGroup, SWT.CHECK); - wrap.setText ("wrap"); - wrap.setSelection (true); - wrap.setLayoutData (new GridData (GridData.FILL_HORIZONTAL)); - wrap.addSelectionListener (selectionListener); - pack = new Button (specGroup, SWT.CHECK); - pack.setText ("pack"); - pack.setLayoutData (new GridData (GridData.FILL_HORIZONTAL)); - pack.setSelection (true); - pack.addSelectionListener (selectionListener); - justify = new Button (specGroup, SWT.CHECK); - justify.setText ("justify"); - justify.setLayoutData (new GridData (GridData.FILL_HORIZONTAL)); - justify.addSelectionListener (selectionListener); - - /* Add common controls */ - super.createControlWidgets (); - - /* Position the sash */ - sash.setWeights (new int [] {6,5}); - } - - /** - * Creates the example layout. - */ - void createLayout () { - rowLayout = new RowLayout (); - layoutComposite.setLayout (rowLayout); - } - - /** - * Disposes the editors without placing their contents - * into the table. - */ - void disposeEditors () { - comboEditor.setEditor (null, null, -1); - combo.dispose (); - widthText.dispose (); - heightText.dispose (); - } - - /** - * Generates code for the example layout. - */ - StringBuffer generateLayoutCode () { - StringBuffer code = new StringBuffer (); - code.append ("\t\tRowLayout rowLayout = new RowLayout ();\n"); - if (rowLayout.type == SWT.VERTICAL) { - code.append ("\t\trowLayout.type = SWT.VERTICAL;\n"); - } - if (rowLayout.wrap == false) { - code.append ("\t\trowLayout.wrap = false;\n"); - } - if (rowLayout.pack == false) { - code.append ("\t\trowLayout.pack = false;\n"); - } - if (rowLayout.justify == true) { - code.append ("\t\trowLayout.justify = true;\n"); - } - if (rowLayout.marginLeft != 3) { - code.append ("\t\trowLayout.marginLeft = " + rowLayout.marginLeft + ";\n"); - } - if (rowLayout.marginRight != 3) { - code.append ("\t\trowLayout.marginRight = " + rowLayout.marginRight + ";\n"); - } - if (rowLayout.marginTop != 3) { - code.append ("\t\trowLayout.marginTop = " + rowLayout.marginTop + ";\n"); - } - if (rowLayout.marginBottom != 3) { - code.append ("\t\trowLayout.marginBottom = " + rowLayout.marginBottom + ";\n"); - } - if (rowLayout.spacing != 3) { - code.append ("\t\trowLayout.spacing = " + rowLayout.spacing + ";\n"); - } - code.append ("\t\tshell.setLayout (rowLayout);\n"); - - boolean first = true; - for (int i = 0; i < children.length; i++) { - Control control = children [i]; - code.append (getChildCode (control,i)); - RowData data = (RowData) control.getLayoutData (); - if (data != null) { - if (data.width != -1 || data.height != -1) { - code.append ("\t\t"); - if (first) { - code.append ("RowData "); - first = false; - } - if (data.width == -1) { - code.append ("data = new RowData (SWT.DEFAULT, " + data.height + ");\n"); - } else if (data.height == -1) { - code.append ("data = new RowData (" + data.width + ", SWT.DEFAULT);\n"); - } else { - code.append ("data = new RowData (" + data.width + ", " + data.height + ");\n"); - } - code.append ("\t\t" + names [i] + ".setLayoutData (data);\n"); - } - } - } - return code; - } - - /** - * Returns the layout data field names. - */ - String [] getLayoutDataFieldNames() { - return new String [] { - "", - "Control", - "width", - "height" - }; - } - - /** - * Gets the text for the tab folder item. - */ - String getTabText () { - return "RowLayout"; - } - - /** - * Takes information from TableEditors and stores it. - */ - void resetEditors () { - resetEditors (false); - } - - void resetEditors (boolean tab) { - TableItem oldItem = comboEditor.getItem (); - if (oldItem != null) { - int row = table.indexOf (oldItem); - /* Make sure user has entered valid data */ - try { - new Integer (widthText.getText ()).intValue (); - } catch (NumberFormatException e) { - widthText.setText (oldItem.getText (WIDTH_COL)); - } - try { - new Integer (heightText.getText ()).intValue (); - } catch (NumberFormatException e) { - heightText.setText (oldItem.getText (HEIGHT_COL)); - } - String [] insert = new String [] { - String.valueOf (row), combo.getText (), widthText.getText (), heightText.getText ()}; - data.setElementAt (insert, row); - for (int i = 0 ; i < TOTAL_COLS; i++) { - oldItem.setText (i, ((String [])data.elementAt (row)) [i]); - } - if (!tab) disposeEditors (); - } - setLayoutState (); - refreshLayoutComposite (); - setLayoutData (); - layoutComposite.layout (true); - layoutGroup.layout (true); - } - - /** - * Sets the layout data for the children of the layout. - */ - void setLayoutData () { - Control [] children = layoutComposite.getChildren (); - TableItem [] items = table.getItems (); - RowData data; - int width, height; - for (int i = 0; i < children.length; i++) { - width = new Integer (items [i].getText (WIDTH_COL)).intValue (); - height = new Integer (items [i].getText (HEIGHT_COL)).intValue (); - data = new RowData (width, height); - children [i].setLayoutData (data); - } - - } - - /** - * Sets the state of the layout. - */ - void setLayoutState () { - /* Set the type of layout */ - if (vertical.getSelection ()) { - rowLayout.type = SWT.VERTICAL; - } else { - rowLayout.type = SWT.HORIZONTAL; - } - - /* Set the margins and spacing */ - try { - rowLayout.marginRight = new Integer (marginRight.getText ()).intValue (); - } catch (NumberFormatException e) { - rowLayout.marginRight = 3; - marginRight.select (1); - } - try { - rowLayout.marginLeft = new Integer (marginLeft.getText ()).intValue (); - } catch (NumberFormatException e) { - rowLayout.marginLeft = 3; - marginLeft.select (1); - } - try { - rowLayout.marginTop = new Integer (marginTop.getText ()).intValue (); - } catch (NumberFormatException e) { - rowLayout.marginTop = 3; - marginTop.select (1); - } - try { - rowLayout.marginBottom = new Integer (marginBottom.getText ()).intValue (); - } catch (NumberFormatException e) { - rowLayout.marginBottom = 3; - marginBottom.select (1); - } - try { - rowLayout.spacing = new Integer (spacing.getText ()).intValue (); - } catch (NumberFormatException e) { - rowLayout.spacing = 3; - spacing.select (1); - } - - /* Set the other layout properties */ - rowLayout.wrap = wrap.getSelection (); - rowLayout.pack = pack.getSelection (); - rowLayout.justify = justify.getSelection (); - } -} diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/Tab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/Tab.java deleted file mode 100644 index 668e4da9d1..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/Tab.java +++ /dev/null @@ -1,641 +0,0 @@ -package org.eclipse.swt.examples.layoutexample; - -/* - * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import java.util.Vector; - -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -/** - * <code>Tab</code> is the abstract superclass of every page - * in the example's tab folder. Each page in the tab folder - * displays a layout, and allows the user to manipulate the - * layout. - * - * A typical page in a Tab contains a two column composite. - * The left column contains the layout group, which contains - * the "layout composite" (the one that has the example layout). - * The right column contains the "control" group. The "control" - * group allows the user to interact with the example. Typical - * operations are modifying layout parameters, adding children - * to the "layout composite", and modifying child layout data. - * The "Code" button in the "control" group opens a new window - * containing code that will regenerate the layout. This code - * (or parts of it) can be selected and copied to the clipboard. - */ -abstract class Tab { - /* Common groups and composites */ - Composite tabFolderPage; - SashForm sash; - Group layoutGroup, controlGroup, childGroup; - /* The composite that contains the example layout */ - Composite layoutComposite; - /* Common controls for modifying the example layout */ - String [] names; - Control [] children; - Button size, add, delete, clear, code; - /* Common values for working with TableEditors */ - Table table; - int index; - TableItem newItem, lastSelected; - Vector data = new Vector (); - /* Controlling instance */ - final LayoutExample instance; - - /* Listeners */ - SelectionListener selectionListener = new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - resetEditors (); - }; - }; - - TraverseListener traverseListener = new TraverseListener () { - public void keyTraversed (TraverseEvent e) { - if (e.detail == SWT.TRAVERSE_RETURN) { - e.doit = false; - resetEditors (); - } - }; - }; - - /** - * Creates the Tab within a given instance of LayoutExample. - */ - Tab(LayoutExample instance) { - this.instance = instance; - } - - /** - * Creates the "child" group. This is the group that allows - * you to add children to the layout. It exists within the - * controlGroup. - */ - void createChildGroup () { - childGroup = new Group (controlGroup, SWT.NONE); - childGroup.setText (LayoutExample.getResourceString("Children")); - GridLayout layout = new GridLayout (); - layout.numColumns = 3; - childGroup.setLayout (layout); - GridData data = new GridData (GridData.FILL_BOTH); - data.horizontalSpan = 2; - childGroup.setLayoutData (data); - createChildWidgets (); - } - - /** - * Creates the controls for modifying the "children" - * table, and the table itself. - * Subclasses override this method to augment the - * standard table. - */ - void createChildWidgets () { - /* Controls for adding and removing children */ - add = new Button (childGroup, SWT.PUSH); - add.setText (LayoutExample.getResourceString ("Add")); - add.setLayoutData(new GridData (GridData.FILL_HORIZONTAL)); - delete = new Button (childGroup, SWT.PUSH); - delete.setText (LayoutExample.getResourceString ("Delete")); - delete.setLayoutData(new GridData (GridData.FILL_HORIZONTAL)); - delete.addSelectionListener (new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - resetEditors (); - int [] selected = table.getSelectionIndices (); - table.remove (selected); - /* Refresh the control indices of the table */ - for (int i = 0; i < table.getItemCount(); i++) { - table.getItem (i).setText (0, String.valueOf (i)); - } - refreshLayoutComposite (); - layoutComposite.layout (true); - layoutGroup.layout (true); - } - }); - clear = new Button (childGroup, SWT.PUSH); - clear.setText (LayoutExample.getResourceString ("Clear")); - clear.setLayoutData(new GridData (GridData.FILL_HORIZONTAL)); - clear.addSelectionListener (new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - resetEditors (); - children = layoutComposite.getChildren (); - for (int i = 0; i < children.length; i++) { - children [i].dispose (); - } - table.removeAll (); - data.clear (); - children = new Control [0]; - layoutGroup.layout (true); - } - }); - /* Create the "children" table */ - table = new Table (childGroup, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION); - table.setLinesVisible (true); - table.setHeaderVisible (true); - GridData gridData = new GridData (GridData.FILL_BOTH); - gridData.horizontalSpan = 3; - gridData.heightHint = 150; - table.setLayoutData (gridData); - table.addTraverseListener (traverseListener); - - /* Add columns to the table */ - String [] columnHeaders = getLayoutDataFieldNames (); - for (int i = 0; i < columnHeaders.length; i++) { - TableColumn column = new TableColumn(table, SWT.NONE); - column.setText (columnHeaders [i]); - if (i == 0) column.setWidth (20); - else if (i == 1) column.setWidth (80); - else column.pack (); - } - } - - /** - * Creates the TableEditor with a CCombo in the first column - * of the table. This CCombo lists all the controls that - * the user can select to place on their layout. - */ - void createComboEditor (CCombo combo, TableEditor comboEditor) { - combo.setItems (new String [] { - "Button", "Canvas", "Combo", "Composite", - "CoolBar", "Group", "Label", "List", - "ProgressBar", "Scale", "Slider", "StyledText", - "Table", "Text", "ToolBar", "Tree"}); - combo.setText (newItem.getText (1)); - - /* Set up editor */ - comboEditor.horizontalAlignment = SWT.LEFT; - comboEditor.grabHorizontal = true; - comboEditor.minimumWidth = 50; - comboEditor.setEditor (combo, newItem, 1); - - /* Add listener */ - combo.addTraverseListener(new TraverseListener() { - public void keyTraversed(TraverseEvent e) { - if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_RETURN) { - resetEditors (); - } - if (e.detail == SWT.TRAVERSE_ESCAPE) { - disposeEditors (); - } - } - }); - } - - /** - * Creates the "control" group. This is the group on the - * right half of each example tab. It contains controls - * for adding new children to the layoutComposite, and - * for modifying the children's layout data. - */ - void createControlGroup () { - controlGroup = new Group (sash, SWT.NONE); - controlGroup.setText (LayoutExample.getResourceString("Parameters")); - GridLayout layout = new GridLayout (); - layout.numColumns = 2; - controlGroup.setLayout (layout); - size = new Button (controlGroup, SWT.CHECK); - size.setText (LayoutExample.getResourceString ("Preferred_Size")); - size.setSelection (false); - size.addSelectionListener (new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - resetEditors (); - if (size.getSelection ()) { - layoutComposite.setLayoutData (new GridData ()); - layoutGroup.layout (true); - } else { - layoutComposite.setLayoutData (new GridData (GridData.FILL_BOTH)); - layoutGroup.layout (true); - } - } - }); - GridData data = new GridData (GridData.FILL_HORIZONTAL); - data.horizontalSpan = 2; - size.setLayoutData (data); - createControlWidgets (); - } - - /** - * Creates the "control" widget children. - * Subclasses override this method to augment - * the standard controls created. - */ - void createControlWidgets () { - createChildGroup (); - code = new Button (controlGroup, SWT.PUSH); - code.setText (LayoutExample.getResourceString ("Code")); - GridData gridData = new GridData (GridData.HORIZONTAL_ALIGN_CENTER | GridData.GRAB_HORIZONTAL); - gridData.horizontalSpan = 2; - code.setLayoutData (gridData); - code.addSelectionListener (new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - final Shell shell = new Shell (); - shell.setText (LayoutExample.getResourceString ("Generated_Code")); - shell.setLayout (new FillLayout ()); - final StyledText text = new StyledText (shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); - String layoutCode = generateCode ().toString (); - if (layoutCode.length () == 0) return; - text.setText (layoutCode); - - Menu bar = new Menu (shell, SWT.BAR); - shell.setMenuBar (bar); - MenuItem editItem = new MenuItem (bar, SWT.CASCADE); - editItem.setText (LayoutExample.getResourceString ("Edit")); - Menu menu = new Menu (bar); - MenuItem select = new MenuItem (menu, SWT.PUSH); - select.setText (LayoutExample.getResourceString ("Select_All")); - select.setAccelerator (SWT.CTRL + 'A'); - select.addSelectionListener (new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - text.selectAll (); - } - }); - MenuItem copy = new MenuItem (menu, SWT.PUSH); - copy.setText (LayoutExample.getResourceString ("Copy")); - copy.setAccelerator (SWT.CTRL + 'C'); - copy.addSelectionListener (new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - text.copy (); - } - }); - MenuItem exit = new MenuItem (menu, SWT.PUSH); - exit.setText (LayoutExample.getResourceString ("Exit")); - exit.addSelectionListener (new SelectionAdapter () { - public void widgetSelected (SelectionEvent e) { - shell.close (); - } - }); - editItem.setMenu (menu); - - shell.pack (); - shell.setSize (400, 500); - shell.open (); - Display display = shell.getDisplay (); - while (!shell.isDisposed ()) - if (!display.readAndDispatch ()) display.sleep (); - } - }); - } - - /** - * Creates the example layout. - * Subclasses override this method. - */ - void createLayout () { - } - - /** - * Creates the composite that contains the example layout. - */ - void createLayoutComposite () { - layoutComposite = new Composite (layoutGroup, SWT.BORDER); - layoutComposite.setLayoutData (new GridData (GridData.FILL_BOTH)); - createLayout (); - } - - /** - * Creates the layout group. This is the group on the - * left half of each example tab. - */ - void createLayoutGroup () { - layoutGroup = new Group (sash, SWT.NONE); - layoutGroup.setText (LayoutExample.getResourceString("Layout")); - layoutGroup.setLayout (new GridLayout ()); - createLayoutComposite (); - } - - /** - * Creates the tab folder page. - * - * @param tabFolder org.eclipse.swt.widgets.TabFolder - * @return the new page for the tab folder - */ - Composite createTabFolderPage (TabFolder tabFolder) { - /* Create a two column page with a SashForm*/ - tabFolderPage = new Composite (tabFolder, SWT.NULL); - tabFolderPage.setLayout (new FillLayout ()); - sash = new SashForm (tabFolderPage, SWT.HORIZONTAL); - - /* Create the "layout" and "control" columns */ - createLayoutGroup (); - createControlGroup (); - - return tabFolderPage; - } - - /** - * Creates the TableEditor with a Text in the given column - * of the table. - */ - void createTextEditor (Text text, TableEditor textEditor, int column) { - text.setFont (table.getFont ()); - text.selectAll (); - textEditor.horizontalAlignment = SWT.LEFT; - textEditor.grabHorizontal = true; - textEditor.setEditor (text, newItem, column); - - text.addTraverseListener(new TraverseListener() { - public void keyTraversed(TraverseEvent e) { - if (e.detail == SWT.TRAVERSE_TAB_NEXT) { - resetEditors (true); - } - if (e.detail == SWT.TRAVERSE_ESCAPE) { - disposeEditors (); - } - } - }); - } - - /** - * Disposes the editors without placing their contents - * into the table. - * Subclasses override this method. - */ - void disposeEditors () { - } - - /** - * Generates the code needed to produce the example layout. - */ - StringBuffer generateCode () { - /* Make sure all information being entered is stored in the table */ - resetEditors (); - - /* Get names for controls in the layout */ - names = new String [children.length]; - for (int i = 0; i < children.length; i++) { - Control control = children [i]; - String controlClass = control.getClass ().toString (); - String controlType = controlClass.substring (controlClass.lastIndexOf ('.') + 1); - names [i] = controlType.toLowerCase () + i; - } - - /* Create StringBuffer containing the code */ - StringBuffer code = new StringBuffer (); - code.append ("import org.eclipse.swt.*;\n"); - code.append ("import org.eclipse.swt.custom.*;\n"); - code.append ("import org.eclipse.swt.graphics.*;\n"); - code.append ("import org.eclipse.swt.layout.*;\n"); - code.append ("import org.eclipse.swt.widgets.*;\n\n"); - code.append ("public class MyLayout {\n"); - code.append ("\tpublic static void main (String [] args) {\n"); - code.append ("\t\tDisplay display = new Display ();\n"); - code.append ("\t\tShell shell = new Shell (display);\n"); - - /* Get layout specific code */ - code.append (generateLayoutCode ()); - - code.append ("\n\t\tshell.pack ();\n\t\tshell.open ();\n\n"); - code.append ("\t\twhile (!shell.isDisposed ()) {\n"); - code.append ("\t\t\tif (!display.readAndDispatch ())\n"); - code.append ("\t\t\t\tdisplay.sleep ();\n\t\t}\n\t\tdisplay.dispose ();\n\t}\n}"); - - return code; - } - - /** - * Generates layout specific code for the example layout. - * Subclasses override this method. - */ - StringBuffer generateLayoutCode () { - return new StringBuffer (); - } - - /** - * Returns the StringBuffer for the code which will - * create a child control. - */ - StringBuffer getChildCode (Control control, int i) { - StringBuffer code = new StringBuffer (); - /* Find the type of control */ - String controlClass = control.getClass().toString (); - String controlType = controlClass.substring (controlClass.lastIndexOf ('.') + 1); - /* Find the style of the control */ - String styleString; - if (controlType.equals ("Button")) { - styleString = "SWT.PUSH"; - } else if (controlType.equals ("Text")) { - styleString = "SWT.BORDER"; - } else if (controlType.equals ("StyledText")) { - styleString = "SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL"; - } else if (controlType.equals ("Canvas") || controlType.equals ("Composite") || - controlType.equals ("Table") || controlType.equals ("StyledText") || - controlType.equals ("ToolBar") || controlType.equals ("Tree") || - controlType.equals ("List")) { - styleString = "SWT.BORDER"; - } else styleString = "SWT.NONE"; - /* Write out the control being declared */ - code.append ("\n\t\t" + controlType + " " + names [i] + - " = new " + controlType + " (shell, " + styleString + ");\n"); - /* Add items to those controls that need items */ - if (controlType.equals ("Combo") || controlType.equals ("List")) { - code.append ("\t\t" + names [i] + ".setItems (new String [] {\"Item 1\", \"Item 2\", \"Item 2\"});\n"); - } else if (controlType.equals ("Table")) { - code.append ("\t\t" + names [i] + ".setLinesVisible (true);\n"); - for (int j = 1; j < 3; j++) { - code.append ("\t\tTableItem tableItem" + j + " = new TableItem (" + names [i] + ", SWT.NONE);\n"); - code.append ("\t\ttableItem" + j + ".setText (\"Item" + j + "\");\n"); - } - } else if (controlType.equals ("Tree")) { - for (int j = 1; j < 3; j++) { - code.append ("\t\tTreeItem treeItem" + j + " = new TreeItem (" + names [i] + ", SWT.NONE);\n"); - code.append ("\t\ttreeItem" + j + ".setText (\"Item" + j + "\");\n"); - } - } else if (controlType.equals ("ToolBar")) { - for (int j = 1; j < 3; j++) { - code.append ("\t\tToolItem toolItem" + j + " = new ToolItem (" + names [i] + ", SWT.NONE);\n"); - code.append ("\t\ttoolItem" + j + ".setText (\"Item" + j + "\");\n"); - } - } else if (controlType.equals ("CoolBar")) { - code.append ("\t\tToolBar coolToolBar = new ToolBar (" + names [i] + ", SWT.BORDER);\n"); - code.append ("\t\tToolItem coolToolItem = new ToolItem (coolToolBar, SWT.NONE);\n"); - code.append ("\t\tcoolToolItem.setText (\"Item 1\");\n"); - code.append ("\t\tcoolToolItem = new ToolItem (coolToolBar, SWT.NONE);\n"); - code.append ("\t\tcoolToolItem.setText (\"Item 2\");\n"); - code.append ("\t\tCoolItem coolItem1 = new CoolItem (" + names [i] + ", SWT.NONE);\n"); - code.append ("\t\tcoolItem1.setControl (coolToolBar);\n"); - code.append ("\t\tcoolToolBar = new ToolBar (" + names [i] + ", SWT.BORDER);\n"); - code.append ("\t\tcoolToolItem = new ToolItem (coolToolBar, SWT.NONE);\n"); - code.append ("\t\tcoolToolItem.setText (\"Item 3\");\n"); - code.append ("\t\tcoolToolItem = new ToolItem (coolToolBar, SWT.NONE);\n"); - code.append ("\t\tcoolToolItem.setText (\"Item 4\");\n"); - code.append ("\t\tCoolItem coolItem2 = new CoolItem (" + names [i] + ", SWT.NONE);\n"); - code.append ("\t\tcoolItem2.setControl (coolToolBar);\n"); - code.append ("\t\tPoint size = coolToolBar.computeSize (SWT.DEFAULT, SWT.DEFAULT);\n"); - code.append ("\t\tcoolItem1.setSize (coolItem1.computeSize (size.x, size.y));\n"); - code.append ("\t\tcoolItem2.setSize (coolItem2.computeSize (size.x, size.y));\n"); - code.append ("\t\t" + names [i] + ".setSize (" + names [i] + ".computeSize (SWT.DEFAULT, SWT.DEFAULT));\n"); - } else if (controlType.equals ("ProgressBar")) { - code.append ("\t\t" + names [i] + ".setSelection (50);\n"); - } - /* Set text for those controls that support it */ - if (controlType.equals ("Button") || - controlType.equals ("Combo") || - controlType.equals ("Group") || - controlType.equals ("Label") || - controlType.equals ("StyledText") || - controlType.equals ("Text")) { - code.append ("\t\t" + names [i] + ".setText (\"" + names [i] + "\");\n"); - } - return code; - } - - /** - * Returns the layout data field names. - * Subclasses override this method. - */ - String [] getLayoutDataFieldNames () { - return new String [] {}; - } - - /** - * Gets the text for the tab folder item. - * Subclasses override this method. - */ - String getTabText () { - return ""; - } - - /** - * Refreshes the composite and draws all controls - * in the layout example. - */ - void refreshLayoutComposite () { - /* Remove children that are already layed out */ - children = layoutComposite.getChildren (); - for (int i = 0; i < children.length; i++) { - children [i].dispose (); - } - /* Add all children listed in the table */ - TableItem [] items = table.getItems (); - children = new Control [items.length]; - String [] itemValues = new String [] { - LayoutExample.getResourceString ("Item",new String [] {"1"}), - LayoutExample.getResourceString ("Item",new String [] {"2"}), - LayoutExample.getResourceString ("Item",new String [] {"3"})}; - for (int i = 0; i < items.length; i++) { - String control = items [i].getText (1); - if (control.equals ("Button")) { - Button button = new Button (layoutComposite, SWT.PUSH); - button.setText (LayoutExample.getResourceString ("Button_Index", new String [] {new Integer (i).toString ()})); - children [i] = button; - } else if (control.equals ("Canvas")) { - Canvas canvas = new Canvas (layoutComposite, SWT.BORDER); - children [i] = canvas; - } else if (control.equals ("Combo")) { - Combo combo = new Combo (layoutComposite, SWT.NONE); - combo.setItems (itemValues); - combo.setText (LayoutExample.getResourceString ("Combo_Index", new String [] {new Integer (i).toString ()})); - children [i] = combo; - } else if (control.equals ("Composite")) { - Composite composite = new Composite (layoutComposite, SWT.BORDER); - children [i] = composite; - } else if (control.equals ("CoolBar")) { - CoolBar coolBar = new CoolBar (layoutComposite, SWT.NONE); - ToolBar toolBar = new ToolBar (coolBar, SWT.BORDER); - ToolItem item = new ToolItem (toolBar, 0); - item.setText (LayoutExample.getResourceString ("Item",new String [] {"1"})); - item = new ToolItem (toolBar, 0); - item.setText (LayoutExample.getResourceString ("Item",new String [] {"2"})); - CoolItem coolItem1 = new CoolItem (coolBar, 0); - coolItem1.setControl (toolBar); - toolBar = new ToolBar (coolBar, SWT.BORDER); - item = new ToolItem (toolBar, 0); - item.setText (LayoutExample.getResourceString ("Item",new String [] {"3"})); - item = new ToolItem (toolBar, 0); - item.setText (LayoutExample.getResourceString ("Item",new String [] {"4"})); - CoolItem coolItem2 = new CoolItem (coolBar, 0); - coolItem2.setControl (toolBar); - Point size = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT); - coolItem1.setSize(coolItem1.computeSize (size.x, size.y)); - coolItem2.setSize(coolItem2.computeSize (size.x, size.y)); - coolBar.setSize(coolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT)); - children [i] = coolBar; - } else if (control.equals ("Group")) { - Group group = new Group (layoutComposite, SWT.NONE); - group.setText (LayoutExample.getResourceString ("Group_Index", new String [] {new Integer (i).toString ()})); - children [i] = group; - } else if (control.equals ("Label")) { - Label label = new Label (layoutComposite, SWT.NONE); - label.setText (LayoutExample.getResourceString ("Label_Index", new String [] {new Integer (i).toString ()})); - children [i] = label; - } else if (control.equals ("List")) { - List list = new List (layoutComposite, SWT.BORDER); - list.setItems (itemValues); - children [i] = list; - } else if (control.equals ("ProgressBar")) { - ProgressBar progress = new ProgressBar (layoutComposite, SWT.NONE); - progress.setSelection (50); - children [i] = progress; - } else if (control.equals ("Scale")) { - Scale scale = new Scale (layoutComposite, SWT.NONE); - children [i] = scale; - } else if (control.equals ("Slider")) { - Slider slider = new Slider (layoutComposite, SWT.NONE); - children [i] = slider; - } else if (control.equals ("StyledText")) { - StyledText styledText = new StyledText (layoutComposite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); - styledText.setText (LayoutExample.getResourceString ("StyledText_Index", new String [] {new Integer (i).toString ()})); - children [i] = styledText; - } else if (control.equals ("Table")) { - Table table = new Table (layoutComposite, SWT.BORDER); - table.setLinesVisible (true); - TableItem item1 = new TableItem (table, 0); - item1.setText (LayoutExample.getResourceString ("Item",new String [] {"1"})); - TableItem item2 = new TableItem (table, 0); - item2.setText (LayoutExample.getResourceString ("Item",new String [] {"2"})); - children [i] = table; - } else if (control.equals ("Text")) { - Text text = new Text (layoutComposite, SWT.BORDER); - text.setText (LayoutExample.getResourceString ("Text_Index", new String [] {new Integer (i).toString ()})); - children [i] = text; - } else if (control.equals ("ToolBar")) { - ToolBar toolBar = new ToolBar (layoutComposite, SWT.BORDER); - ToolItem item1 = new ToolItem (toolBar, 0); - item1.setText (LayoutExample.getResourceString ("Item",new String [] {"1"})); - ToolItem item2 = new ToolItem (toolBar, 0); - item2.setText (LayoutExample.getResourceString ("Item",new String [] {"2"})); - children [i] = toolBar; - } else { - Tree tree = new Tree (layoutComposite, SWT.BORDER); - TreeItem item1 = new TreeItem (tree, 0); - item1.setText (LayoutExample.getResourceString ("Item",new String [] {"1"})); - TreeItem item2 = new TreeItem (tree, 0); - item2.setText (LayoutExample.getResourceString ("Item",new String [] {"2"})); - children [i] = tree; - } - } - } - - /** - * Takes information from TableEditors and stores it. - * Subclasses override this method. - */ - void resetEditors () { - resetEditors (false); - } - - void resetEditors (boolean tab) { - } - - /** - * Sets the layout data for the children of the layout. - * Subclasses override this method. - */ - void setLayoutData () { - } - - /** - * Sets the state of the layout. - * Subclasses override this method. - */ - void setLayoutState () { - } -} diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/Images.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/Images.java deleted file mode 100755 index f24a177c4a..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/Images.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.eclipse.swt.examples.texteditor;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import java.io.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-public class Images {
-
- // Bitmap Images
- public Image Bold;
- public Image Red;
- public Image Green;
- public Image Blue;
- public Image Erase;
-
- Image [] AllBitmaps;
-
-Images () {
-}
-
-public void freeAll () {
- for (int i=0; i<AllBitmaps.length; i++) AllBitmaps [i].dispose ();
- AllBitmaps = null;
-}
-
-Image createBitmapImage(Display display, String fileName) {
- ImageData source = new ImageData(Images.class.getResourceAsStream(fileName+".bmp"));
- ImageData mask = new ImageData(Images.class.getResourceAsStream(fileName+"_mask"+".bmp"));
- return new Image (display, source, mask);
-}
-
-public void loadAll (Display display) {
- // Bitmap Images
- Bold = createBitmapImage (display, "bold");
- Red = createBitmapImage (display, "red");
- Green = createBitmapImage (display, "green");
- Blue = createBitmapImage (display, "blue");
- Erase = createBitmapImage (display, "erase");
-
- AllBitmaps = new Image [] {
- Bold,
- Red,
- Green,
- Blue,
- Erase,
- };
-}
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java deleted file mode 100755 index a3579a91bc..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java +++ /dev/null @@ -1,360 +0,0 @@ -package org.eclipse.swt.examples.texteditor;
-
-/*
- * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.io.*;
-
-/**
- */
-public class TextEditor {
- Shell shell;
- ToolBar toolBar;
- StyledText text;
-
- Images images = new Images();
- Vector cachedStyles = new Vector();
- Color RED = null;
- Color BLUE = null;
- Color GREEN = null;
- Font font = null;
-
- boolean isBold = false;
-
- ExtendedModifyListener extendedModifyListener;
- VerifyKeyListener verifyKeyListener;
- static ResourceBundle resources = ResourceBundle.getBundle("examples_texteditor");
-
-Menu createEditMenu() {
- Menu bar = shell.getMenuBar ();
- Menu menu = new Menu (bar);
-
- MenuItem item = new MenuItem (menu, SWT.PUSH);
- item.setText (resources.getString("Cut_menuitem"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- text.cut();
- }
- });
-
- item = new MenuItem (menu, SWT.PUSH);
- item.setText (resources.getString("Copy_menuitem"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- text.copy();
- }
- });
-
- item = new MenuItem (menu, SWT.PUSH);
- item.setText (resources.getString("Paste_menuitem"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- text.paste();
- }
- });
-
- new MenuItem (menu, SWT.SEPARATOR);
-
- item = new MenuItem (menu, SWT.PUSH);
- item.setText (resources.getString("Font_menuitem"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- setFont();
- }
- });
- return menu;
-}
-
-
-/*
- * Set the text state to bold.
- */
-void bold(boolean bold) {
- isBold = bold;
- Point sel = text.getSelectionRange();
- if ((sel != null) && (sel.y != 0)) {
- StyleRange style;
- int fontStyle = SWT.NORMAL;
- if (isBold) fontStyle = SWT.BOLD;
- style = new StyleRange(sel.x, sel.y, null, null, fontStyle);
- text.setStyleRange(style);
- }
- text.setSelectionRange(sel.x + sel.y, 0);
-}
-/*
- * Clear all style data for the selected text.
- */
-void clear() {
- Point sel = text.getSelectionRange();
- if ((sel != null) && (sel.y != 0)) {
- StyleRange style;
- style = new StyleRange(sel.x, sel.y, null, null, SWT.NORMAL);
- text.setStyleRange(style);
- }
- text.setSelectionRange(sel.x + sel.y, 0);
-}
-/*
- * Set the foreground color for the selected text.
- */
-void fgColor(int color) {
- Point sel = text.getSelectionRange();
- if ((sel == null) || (sel.y == 0)) return;
- Color fg;
- if (color == SWT.COLOR_RED) {
- fg = RED;
- } else if (color == SWT.COLOR_GREEN) {
- fg = GREEN;
- } else if (color == SWT.COLOR_BLUE) {
- fg = BLUE;
- } else {
- fg = null;
- }
- StyleRange style;
- for (int i = sel.x; i<sel.x+sel.y; i++) {
- StyleRange range = text.getStyleRangeAtOffset(i);
- if (range == null) {style = new StyleRange(i, 1, fg, null, SWT.NORMAL);}
- else {style = new StyleRange(i, 1, fg, null, range.fontStyle);};
- text.setStyleRange(style);
- }
- text.setSelectionRange(sel.x + sel.y, 0);
-}
-void createMenuBar () {
- Menu bar = new Menu (shell, SWT.BAR);
- shell.setMenuBar (bar);
-
- MenuItem editItem = new MenuItem (bar, SWT.CASCADE);
- editItem.setText (resources.getString("Edit_menuitem"));
- editItem.setMenu (createEditMenu ());
-}
-
-void createShell (Display display) {
- shell = new Shell (display);
- shell.setText (resources.getString("Window_title"));
- images.loadAll (display);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- shell.setSize(500, 300);
- shell.setLayout(layout);
- shell.addDisposeListener (new DisposeListener () {
- public void widgetDisposed (DisposeEvent e) {
- if (font != null) font.dispose();
- images.freeAll ();
- RED.dispose();
- GREEN.dispose();
- BLUE.dispose();
- }
- });
-}
-void createStyledText() {
- initializeColors();
- text = new StyledText (shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
- GridData spec = new GridData();
- spec.horizontalAlignment = spec.FILL;
- spec.grabExcessHorizontalSpace = true;
- spec.verticalAlignment = spec.FILL;
- spec.grabExcessVerticalSpace = true;
- text.setLayoutData(spec);
- extendedModifyListener = new ExtendedModifyListener() {
- public void modifyText(ExtendedModifyEvent e) {
- handleExtendedModify(e);
- }
- };
- text.addExtendedModifyListener(extendedModifyListener);
- verifyKeyListener = new VerifyKeyListener() {
- public void verifyKey(VerifyEvent e) {
- handleVerifyKey(e);
- }
- };
- text.addVerifyKeyListener(verifyKeyListener);
-}
-
-void createToolBar() {
- toolBar = new ToolBar(shell, SWT.NULL);
-
- ToolItem item = new ToolItem(toolBar, SWT.CHECK);
- item.setImage(images.Bold);
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- bold(((ToolItem)event.widget).getSelection());
- }
- });
-
- item = new ToolItem(toolBar, SWT.SEPARATOR);
-
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(images.Red);
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- fgColor(SWT.COLOR_RED);
- }
- });
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(images.Green);
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- fgColor(SWT.COLOR_GREEN);
- }
- });
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(images.Blue);
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- fgColor(SWT.COLOR_BLUE);
- }
- });
-
- item = new ToolItem(toolBar, SWT.SEPARATOR);
-
- item = new ToolItem(toolBar, SWT.PUSH);
- item.setImage(images.Erase);
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- clear();
- }
- });
-}
-void displayError(String msg) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- box.setMessage(msg);
- box.open();
-}
-/*
- * Cache the style information for text that has been cut or copied.
- */
-void handleCutCopy() {
- // Save the cut/copied style info so that during paste we will maintain
- // the style information. Cut/copied text is put in the clipboard in
- // RTF format, but is not pasted in RTF format. The other way to
- // handle the pasting of styles would be to access the Clipboard directly and
- // parse the RTF text.
- cachedStyles = new Vector();
- Point sel = text.getSelectionRange();
- int startX = sel.x;
- for (int i=sel.x; i<=sel.x+sel.y-1; i++) {
- StyleRange style = text.getStyleRangeAtOffset(i);
- if (style != null) {
- style.start = style.start - startX;
- if (!cachedStyles.isEmpty()) {
- StyleRange lastStyle = (StyleRange)cachedStyles.lastElement();
- if (lastStyle.similarTo(style)) {
- lastStyle.length++;
- } else {
- cachedStyles.addElement(style);
- }
- } else {
- cachedStyles.addElement(style);
- }
- }
- }
-}
-void handleExtendedModify(ExtendedModifyEvent event) {
- if (event.length == 0) return;
- StyleRange style;
- if (event.length == 1 || text.getTextRange(event.start, event.length).equals(text.getLineDelimiter())) {
- // Have the new text take on the style of the text to its right (during
- // typing) if no style information is active.
- int caretOffset = text.getCaretOffset();
- style = null;
- if (caretOffset < text.getCharCount()) style = text.getStyleRangeAtOffset(caretOffset);
- if (style != null) {
- style.start = event.start;
- style.length = event.length;
- int fontStyle = SWT.NORMAL;
- if (isBold) fontStyle = SWT.BOLD;
- style.fontStyle = fontStyle;
- text.setStyleRange(style);
- } else if (isBold) {
- StyleRange newStyle = new StyleRange(event.start, event.length, null, null, SWT.BOLD);
- text.setStyleRange(newStyle);
- }
- } else {
- // paste occurring
- for (int i=0; i<cachedStyles.size(); i++) {
- style = (StyleRange)cachedStyles.elementAt(i);
- StyleRange newStyle = (StyleRange)style.clone();
- newStyle.start = style.start + event.start;
- text.setStyleRange(newStyle);
- }
- }
-}
-/*
- * Intercept the cut and copy keys so that during paste we can maintain
- * style information.
- */
-void handleVerifyKey(VerifyEvent event) {
- int input;
- if (event.keyCode != 0) input = event.keyCode | event.stateMask;
- else input = event.character | event.stateMask;
- if (isCut(input) || isCopy(input)) {
- handleCutCopy();
- }
-}
-
-public static void main (String [] args) {
- Display display = new Display ();
- TextEditor example = new TextEditor ();
- Shell shell = example.open (display);
- while (!shell.isDisposed ())
- if (!display.readAndDispatch ()) display.sleep ();
- display.dispose ();
-}
-
-public Shell open (Display display) {
- createShell (display);
- createMenuBar ();
- createToolBar ();
- createStyledText ();
- shell.open ();
- return shell;
-}
-
-void setFont() {
- FontDialog fontDialog = new FontDialog(shell);
- fontDialog.setFontData((text.getFont()).getFontData()[0]);
- FontData fontData = fontDialog.open();
- if(fontData != null) {
- if(font != null)
- font.dispose();
- font = new Font(shell.getDisplay(), fontData);
- text.setFont(font);
- }
-}
-
-void initializeColors() {
- Display display = Display.getDefault();
- RED = new Color (display, new RGB(255,0,0));
- BLUE = new Color (display, new RGB(0,0,255));
- GREEN = new Color (display, new RGB(0,255,0));
-}
-boolean isCopy(int input) {
-
- if (input == (SWT.INSERT | SWT.CTRL)) return true;
-
- if (input == ('\u0003' | SWT.CTRL)) return true;
-
- return false;
-
-}
-boolean isCut(int input) {
-
- if (input == (SWT.DEL | SWT.SHIFT)) return true;
-
- if (input == ('\u0018' | SWT.CTRL)) return true;
-
- return false;
-
-}
-
-
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue.bmp Binary files differdeleted file mode 100755 index 84c7ac9a46..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue.bmp +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue_mask.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue_mask.bmp Binary files differdeleted file mode 100755 index 6ce92645e5..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue_mask.bmp +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold.bmp Binary files differdeleted file mode 100755 index a3184bb26c..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold.bmp +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold_mask.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold_mask.bmp Binary files differdeleted file mode 100755 index 382751efa3..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold_mask.bmp +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase.bmp Binary files differdeleted file mode 100755 index 1d2ace7ee3..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase.bmp +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase_mask.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase_mask.bmp Binary files differdeleted file mode 100755 index f6ab21e471..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase_mask.bmp +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green.bmp Binary files differdeleted file mode 100755 index cca023fd57..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green.bmp +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green_mask.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green_mask.bmp Binary files differdeleted file mode 100755 index 6ce92645e5..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green_mask.bmp +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red.bmp Binary files differdeleted file mode 100755 index 88c63be336..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red.bmp +++ /dev/null diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red_mask.bmp b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red_mask.bmp Binary files differdeleted file mode 100755 index 6ce92645e5..0000000000 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red_mask.bmp +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/.classpath b/tests/org.eclipse.swt.tests/.classpath deleted file mode 100644 index d9fef0329c..0000000000 --- a/tests/org.eclipse.swt.tests/.classpath +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/> - <classpathentry kind="var" - path="ECLIPSE_HOME/plugins/org.junit_3.7.0/junit.jar" sourcepath="ECLIPSE_HOME/plugins/org.junit_3.7.0/src.jar"/> - <classpathentry kind="src" path="/org.eclipse.swt"/> - <classpathentry kind="src" path="JUnit Tests"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/tests/org.eclipse.swt.tests/.cvsignore b/tests/org.eclipse.swt.tests/.cvsignore deleted file mode 100644 index c5e82d7458..0000000000 --- a/tests/org.eclipse.swt.tests/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin
\ No newline at end of file diff --git a/tests/org.eclipse.swt.tests/.project b/tests/org.eclipse.swt.tests/.project deleted file mode 100644 index 1b33bcfbd2..0000000000 --- a/tests/org.eclipse.swt.tests/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.swt.tests</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.swt</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllGraphicsTests.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllGraphicsTests.java deleted file mode 100644 index 5d8e47d916..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllGraphicsTests.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.eclipse.swt.tests.junit;
-
/*
- * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Suite for testing all of the graphics test cases.
- */
-public class AllGraphicsTests {
-public static void main(String[] args) {
- TestRunner.run (suite());
-}
-public static Test suite() {
- TestSuite suite = new TestSuite();
-
- suite.addTest(Test_org_eclipse_swt_graphics_Color.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_Cursor.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_DeviceData.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_Font.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_FontData.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_FontMetrics.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_GC.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_GCData.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_Image.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_ImageData.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_PaletteData.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_Point.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_Rectangle.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_Region.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_RGB.suite());
-
-
- suite.addTest(Test_org_eclipse_swt_graphics_ImageLoader.suite());
- suite.addTest(Test_org_eclipse_swt_graphics_ImageLoaderEvent.suite());
-
- return suite;
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllTests.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllTests.java deleted file mode 100644 index e143bb982d..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllTests.java +++ /dev/null @@ -1,180 +0,0 @@ -package org.eclipse.swt.tests.junit;
-
/*
- * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import junit.framework.*;
-import junit.textui.*;
-
/**
- * Suite for running all SWT test cases.
- */
-public class AllTests extends TestSuite {
- public static int unimplementedMethods;
-
-public static void main(String[] args) {
- unimplementedMethods = 0;
- TestRunner.run(suite());
- if (unimplementedMethods > 0) {
- System.out.println("\nCalls to warnUnimpl: " + unimplementedMethods);
- }
-}
-public static Test suite() {
- return new AllTests();
-}
-
-public AllTests() {
- super();
- /* The logical order to run the tests in is:
- * - SWT, SWTError, SWTException
- * - Display
- * - graphics classes
- * - items and Caret, etc
- * - widgets
- * - dialogs
- * - layout
- * - custom widgets
- * - printing and program
- * - events
- * - drag & drop
- */
- addTest(Test_org_eclipse_swt_SWT.suite());
- addTest(Test_org_eclipse_swt_SWTException.suite());
- addTest(Test_org_eclipse_swt_SWTError.suite());
-
- addTest(Test_org_eclipse_swt_widgets_Display.suite());
-
- addTest(Test_org_eclipse_swt_graphics_Image.suite());
- addTest(Test_org_eclipse_swt_graphics_Cursor.suite());
- addTest(Test_org_eclipse_swt_graphics_DeviceData.suite());
- addTest(Test_org_eclipse_swt_graphics_ImageLoaderEvent.suite());
- addTest(Test_org_eclipse_swt_graphics_RGB.suite());
- addTest(Test_org_eclipse_swt_graphics_Font.suite());
- addTest(Test_org_eclipse_swt_graphics_Rectangle.suite());
- addTest(Test_org_eclipse_swt_graphics_FontData.suite());
- addTest(Test_org_eclipse_swt_graphics_GC.suite());
- addTest(Test_org_eclipse_swt_graphics_ImageData.suite());
- addTest(Test_org_eclipse_swt_graphics_Region.suite());
- addTest(Test_org_eclipse_swt_graphics_GCData.suite());
- addTest(Test_org_eclipse_swt_graphics_FontMetrics.suite());
- addTest(Test_org_eclipse_swt_graphics_Color.suite());
- addTest(Test_org_eclipse_swt_graphics_Point.suite());
- addTest(Test_org_eclipse_swt_graphics_PaletteData.suite());
- addTest(Test_org_eclipse_swt_graphics_ImageLoader.suite());
-
- addTest(Test_org_eclipse_swt_widgets_MenuItem.suite());
- addTest(Test_org_eclipse_swt_widgets_ToolItem.suite());
- //addTest(Test_org_eclipse_swt_widgets_CoolItem.suite());
- addTest(Test_org_eclipse_swt_widgets_TabItem.suite());
- addTest(Test_org_eclipse_swt_widgets_TableItem.suite());
- addTest(Test_org_eclipse_swt_widgets_TableColumn.suite());
- addTest(Test_org_eclipse_swt_widgets_TreeItem.suite());
- addTest(Test_org_eclipse_swt_widgets_Caret.suite());
- addTest(Test_org_eclipse_swt_widgets_Event.suite());
- addTest(Test_org_eclipse_swt_widgets_TypedListener.suite());
- addTest(Test_org_eclipse_swt_widgets_Menu.suite());
- //addTest(Test_org_eclipse_swt_widgets_Tracker.suite());
- addTest(Test_org_eclipse_swt_widgets_Synchronizer.suite());
-
- addTest(Test_org_eclipse_swt_widgets_Shell.suite());
- //addTest(Test_org_eclipse_swt_widgets_Decorations.suite());
- addTest(Test_org_eclipse_swt_widgets_Label.suite());
- addTest(Test_org_eclipse_swt_widgets_Button.suite());
- addTest(Test_org_eclipse_swt_widgets_List.suite());
- addTest(Test_org_eclipse_swt_widgets_Text.suite());
- addTest(Test_org_eclipse_swt_widgets_ScrollBar.suite());
- addTest(Test_org_eclipse_swt_widgets_Sash.suite());
- addTest(Test_org_eclipse_swt_widgets_Tree.suite());
- addTest(Test_org_eclipse_swt_widgets_TabFolder.suite());
- addTest(Test_org_eclipse_swt_widgets_Combo.suite());
- addTest(Test_org_eclipse_swt_widgets_Group.suite());
- addTest(Test_org_eclipse_swt_widgets_ToolBar.suite());
- addTest(Test_org_eclipse_swt_widgets_Table.suite());
- addTest(Test_org_eclipse_swt_widgets_Canvas.suite());
- addTest(Test_org_eclipse_swt_widgets_Scale.suite());
- addTest(Test_org_eclipse_swt_widgets_Slider.suite());
- addTest(Test_org_eclipse_swt_widgets_ProgressBar.suite());
- addTest(Test_org_eclipse_swt_widgets_Composite.suite());
- //addTest(Test_org_eclipse_swt_widgets_CoolBar.suite());
-
- addTest(Test_org_eclipse_swt_widgets_ColorDialog.suite());
- addTest(Test_org_eclipse_swt_widgets_FileDialog.suite());
- addTest(Test_org_eclipse_swt_widgets_DirectoryDialog.suite());
- addTest(Test_org_eclipse_swt_widgets_FontDialog.suite());
- addTest(Test_org_eclipse_swt_widgets_MessageBox.suite());
-
- addTest(Test_org_eclipse_swt_layout_GridData.suite());
- addTest(Test_org_eclipse_swt_layout_RowData.suite());
- addTest(Test_org_eclipse_swt_layout_GridLayout.suite());
- addTest(Test_org_eclipse_swt_layout_FillLayout.suite());
- addTest(Test_org_eclipse_swt_layout_RowLayout.suite());
-
- addTest(Test_org_eclipse_swt_custom_TableTree.suite());
- addTest(Test_org_eclipse_swt_custom_BidiSegmentEvent.suite());
- addTest(Test_org_eclipse_swt_custom_LineBackgroundEvent.suite());
- addTest(Test_org_eclipse_swt_custom_LineStyleEvent.suite());
- addTest(Test_org_eclipse_swt_custom_SashForm.suite());
- addTest(Test_org_eclipse_swt_custom_TableEditor.suite());
- addTest(Test_org_eclipse_swt_custom_AnimatedProgress.suite());
- addTest(Test_org_eclipse_swt_custom_StyleRange.suite());
- addTest(Test_org_eclipse_swt_custom_TextChangedEvent.suite());
- addTest(Test_org_eclipse_swt_custom_StackLayout.suite());
- addTest(Test_org_eclipse_swt_custom_CTabFolderEvent.suite());
- addTest(Test_org_eclipse_swt_custom_ExtendedModifyEvent.suite());
- addTest(Test_org_eclipse_swt_custom_CCombo.suite());
- addTest(Test_org_eclipse_swt_custom_TableTreeItem.suite());
- addTest(Test_org_eclipse_swt_custom_ViewForm.suite());
- addTest(Test_org_eclipse_swt_custom_CTabFolderAdapter.suite());
- addTest(Test_org_eclipse_swt_custom_CLabel.suite());
- addTest(Test_org_eclipse_swt_custom_TableTreeEditor.suite());
- addTest(Test_org_eclipse_swt_custom_TextChangingEvent.suite());
- addTest(Test_org_eclipse_swt_custom_ScrolledComposite.suite());
- addTest(Test_org_eclipse_swt_custom_TreeEditor.suite());
- addTest(Test_org_eclipse_swt_custom_PopupList.suite());
- addTest(Test_org_eclipse_swt_custom_CTabItem.suite());
- addTest(Test_org_eclipse_swt_custom_BusyIndicator.suite());
- //addTest(Test_org_eclipse_swt_custom_StyledText.suite());
- addTest(Test_org_eclipse_swt_custom_ControlEditor.suite());
- addTest(Test_org_eclipse_swt_custom_ST.suite());
- addTest(Test_org_eclipse_swt_custom_CTabFolder.suite());
-
- addTest(Test_org_eclipse_swt_events_ControlEvent.suite());
- addTest(Test_org_eclipse_swt_events_ModifyEvent.suite());
- addTest(Test_org_eclipse_swt_events_ArmEvent.suite());
- addTest(Test_org_eclipse_swt_events_ShellEvent.suite());
- addTest(Test_org_eclipse_swt_events_TypedEvent.suite());
- addTest(Test_org_eclipse_swt_events_PaintEvent.suite());
- addTest(Test_org_eclipse_swt_events_VerifyEvent.suite());
- addTest(Test_org_eclipse_swt_events_KeyEvent.suite());
- addTest(Test_org_eclipse_swt_events_TraverseEvent.suite());
- addTest(Test_org_eclipse_swt_events_MouseTrackAdapter.suite());
- addTest(Test_org_eclipse_swt_events_DisposeEvent.suite());
- addTest(Test_org_eclipse_swt_events_SelectionEvent.suite());
- addTest(Test_org_eclipse_swt_events_HelpEvent.suite());
- addTest(Test_org_eclipse_swt_events_FocusEvent.suite());
- addTest(Test_org_eclipse_swt_events_MouseEvent.suite());
- addTest(Test_org_eclipse_swt_events_MenuEvent.suite());
- addTest(Test_org_eclipse_swt_events_TreeEvent.suite());
-
- addTest(Test_org_eclipse_swt_printing_PrintDialog.suite());
- addTest(Test_org_eclipse_swt_printing_PrinterData.suite());
- addTest(Test_org_eclipse_swt_printing_Printer.suite());
-
- addTest(Test_org_eclipse_swt_program_Program.suite());
-
-// addTest(Test_org_eclipse_swt_dnd_FileTransfer.suite());
-// addTest(Test_org_eclipse_swt_dnd_DragSourceAdapter.suite());
-// addTest(Test_org_eclipse_swt_dnd_DropTargetAdapter.suite());
-// addTest(Test_org_eclipse_swt_dnd_TextTransfer.suite());
-// addTest(Test_org_eclipse_swt_dnd_DragSourceEvent.suite());
-// addTest(Test_org_eclipse_swt_dnd_DragSource.suite());
-// addTest(Test_org_eclipse_swt_dnd_DND.suite());
-// addTest(Test_org_eclipse_swt_dnd_TransferData.suite());
-// addTest(Test_org_eclipse_swt_dnd_RTFTransfer.suite());
-// addTest(Test_org_eclipse_swt_dnd_Clipboard.suite());
-// addTest(Test_org_eclipse_swt_dnd_DropTargetEvent.suite());
-// addTest(Test_org_eclipse_swt_dnd_DropTarget.suite());
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllWidgetTests.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllWidgetTests.java deleted file mode 100644 index 63b8b456a2..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllWidgetTests.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.eclipse.swt.tests.junit;
-
/*
- * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Suite for testing all of the widget test cases.
- */
-public class AllWidgetTests {
-public static void main(String[] args) {
- TestRunner.run (suite());
-}
-public static Test suite() {
- TestSuite suite = new TestSuite();
-
- suite.addTest(Test_org_eclipse_swt_widgets_MenuItem.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_ToolItem.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_CoolItem.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TabItem.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TableItem.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TableColumn.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TreeItem.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Caret.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Event.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TypedListener.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Menu.suite());
- //suite.addTest(Test_org_eclipse_swt_widgets_Tracker.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Synchronizer.suite());
-
- suite.addTest(Test_org_eclipse_swt_widgets_Shell.suite());
- //suite.addTest(Test_org_eclipse_swt_widgets_Decorations.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Label.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Button.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_List.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Text.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_ScrollBar.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Sash.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Tree.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TabFolder.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Combo.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Group.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_ToolBar.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Table.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Canvas.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Scale.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Slider.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_ProgressBar.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Composite.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_CoolBar.suite());
-
- suite.addTest(Test_org_eclipse_swt_widgets_ColorDialog.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_FileDialog.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_DirectoryDialog.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_FontDialog.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_MessageBox.suite());
-
- return suite;
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/EmulatedWidgetsTests.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/EmulatedWidgetsTests.java deleted file mode 100644 index d3ff1ec703..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/EmulatedWidgetsTests.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.eclipse.swt.tests.junit;
-
/*
- * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Suite for testing widgets that have been emulated on Motif.
- */
-public class EmulatedWidgetsTests {
-
-public static void main(String[] args) {
- TestRunner.run (suite());
-}
-public static Test suite() {
- TestSuite suite = new TestSuite();
-
- suite.addTest(Test_org_eclipse_swt_widgets_ColorDialog.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_FontDialog.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TabFolder.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TabItem.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Table.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TableItem.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TableColumn.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_Tree.suite());
- suite.addTest(Test_org_eclipse_swt_widgets_TreeItem.suite());
-
- return suite;
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/StyledTextContentSpec.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/StyledTextContentSpec.java deleted file mode 100644 index ec3f77b4da..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/StyledTextContentSpec.java +++ /dev/null @@ -1,1023 +0,0 @@ -package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-/**
- * Use this test class to validate an implementation of the StyledTextContent
- * interface. To perform the validation, copy this class to the package where
- * your StyledTextContent implementation lives. Then specify the fully qualified
- * name of your StyledTextContent class as an argument to the main method of this
- * class.
- *
- * NOTE: This test class assumes that your StyledTextContent implementation
- * handles the following delimiters:
- *
- * /r
- * /n
- * /r/n
- */
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import java.io.*;
-import java.lang.reflect.*;
-public class StyledTextContentSpec implements TextChangeListener {
- static String contentClassName;
- static int failCount = 0;
- static int errorCount = 0;
- Class contentClass = null;
- StyledTextContent contentInstance = null;
- int verify = 0;
- Method currentMethod = null;
- boolean failed = false;
- StyledText widget = null;
- Shell shell = null;
-
-public StyledTextContentSpec() {
-}
-public void assert(String message, boolean condition) {
- System.out.print("\t" + currentMethod.getName() + " " + message);
- if (!condition)
- fail(message);
- else
- System.out.println(" passed");
-}
-public void fail(String message) {
- failed = true;
- System.out.println(" FAILED");
- failCount++;
-}
-public StyledTextContent getContentInstance() {
- contentInstance.setText("");
- widget.setContent(contentInstance);
- return contentInstance;
-}
-public static String getTestText() {
- return
- "This is the first line.\r\n" +
- "This is the second line.\r\n" +
- "This is the third line.\r\n" +
- "This is the fourth line.\r\n" +
- "This is the fifth line.\r\n" +
- "\r\n" +
- "This is the first line again.\r\n" +
- "This is the second line again.\r\n" +
- "This is the third line again.\r\n" +
- "This is the fourth line again.\r\n" +
- "This is the fifth line again.\r\n" +
- "\r\n" +
- "This is the first line once again.\r\n" +
- "This is the second line once again.\r\n" +
- "This is the third line once again.\r\n" +
- "This is the fourth line once again.\r\n" +
- "This is the fifth line once again.";
-}
-public static void main(String[] args) {
- StyledTextContentSpec spec = new StyledTextContentSpec();
- if (args.length > 0) {
- contentClassName = args[0];
- } else {
- MessageBox box = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR);
- box.setMessage("Content class must be specified as an execution argument."); //$NON-NLS-1$
- box.open();
- return;
- }
- spec.run();
- System.out.println();
- System.out.println(failCount + " TEST FAILURES.");
- System.out.println(errorCount + " UNEXPECTED ERRORS.");
-}
-public void run() {
- if (contentClassName.equals("")) {
- MessageBox box = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR);
- box.setMessage("Content class must be specified as an execution argument."); //$NON-NLS-1$
- box.open();
- return;
- }
- if (contentClass == null) {
- try {
- contentClass = Class.forName(contentClassName);
- } catch (ClassNotFoundException e) {
- MessageBox box = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR);
- box.setMessage("Content class:\n" + contentClassName + "\nnot found"); //$NON-NLS-1$
- box.open();
- return;
- }
- }
- try {
- contentInstance = (StyledTextContent)contentClass.newInstance();
- } catch (IllegalAccessException e) {
- MessageBox box = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR);
- box.setMessage("Unable to access content class:\n" + contentClassName); //$NON-NLS-1$
- box.open();
- return;
- } catch (InstantiationException e) {
- MessageBox box = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR);
- box.setMessage("Unable to instantiate content class:\n" + contentClassName); //$NON-NLS-1$
- box.open();
- return;
- }
- Class clazz;
- clazz = this.getClass();
- Method[] methods = clazz.getDeclaredMethods();
- for (int i=0; i<methods.length; i++) {
- setUp();
- currentMethod = methods[i];
- failed = false;
- try {
- if (currentMethod.getName().startsWith("test_")) {
- System.out.println();
- System.out.println(currentMethod.getName() + "...");
- currentMethod.invoke(this, new Object[0]);
- if (!failed) {
- System.out.println("PASSED.");
- } else {
- System.out.println("FAILED");
- }
- }
- } catch (InvocationTargetException ex) {
- System.out.println("\t" + currentMethod.getName() + " ERROR ==> " + ex.getTargetException().toString());
- System.out.println("FAILED");
- errorCount++;
- } catch (Exception ex) {
- System.out.println("\t" + currentMethod.getName() + " ERROR ==> " + ex.toString());
- System.out.println("FAILED");
- errorCount++;
- }
- if (verify != 0) {
- verify = 0;
- contentInstance.removeTextChangeListener(this);
- }
- tearDown();
- }
-}
-public void textSet(TextChangedEvent event) {
-}
-public void textChanged(TextChangedEvent event) {
-}
-public void textChanging(TextChangingEvent event) {
- switch (verify) {
- case 1 : {
- assert(":1a:", event.replaceLineCount == 0);
- assert(":1b:", event.newLineCount == 1);
- break;
- }
- case 2 : {
- assert(":2a:", event.replaceLineCount == 2);
- assert(":2b:", event.newLineCount == 0);
- break;
- }
- case 3 : {
- assert(":3a:", event.replaceLineCount == 0);
- assert(":3b:", event.newLineCount == 2);
- break;
- }
- case 4: {
- assert(":4:", false);
- break;
- }
- case 5 : {
- assert(":5a:", event.replaceLineCount == 0);
- assert(":5b:", event.newLineCount == 1);
- break;
- }
- case 6 : {
- assert(":6a:", event.replaceLineCount == 1);
- assert(":6b:", event.newLineCount == 0);
- break;
- }
- case 8 : {
- assert(":8a:", event.replaceLineCount == 1);
- assert(":8b:", event.newLineCount == 0);
- break;
- }
- case 9 : {
- assert(":9a:", event.replaceLineCount == 1);
- assert(":9b:", event.newLineCount == 0);
- break;
- }
- case 10:{
- assert(":10:", false);
- break;
- }
- case 11: {
- assert(":11:", false);
- break;
- }
- case 12: {
- assert(":12a:", event.replaceLineCount == 0);
- assert(":12b:", event.newLineCount == 1);
- break;
- }
- case 13: {
- assert(":13a:", event.replaceLineCount == 0);
- assert(":13b:", event.newLineCount == 1);
- break;
- }
- case 14: {
- assert(":14:", false);
- break;
- }
- case 15: {
- assert(":15a:", event.replaceLineCount == 1);
- assert(":15b:", event.newLineCount == 2);
- break;
- }
- case 16:{
- assert(":16:", false);
- break;
- }
- case 17: {
- assert(":17:", false);
- break;
- }
- case 18: {
- assert(":18a:", event.replaceLineCount == 0);
- assert(":18b:", event.newLineCount == 2);
- break;
- }
- case 19: {
- assert(":19a:", event.replaceLineCount == 0);
- assert(":19b:", event.newLineCount == 3);
- break;
- }
- case 20: {
- assert(":20:", false);
- break;
- }
- }
-}
-public void test_Insert() {
- StyledTextContent content = getContentInstance();
- String newText;
-
- content.setText("This\nis a test\r");
- content.replaceTextRange(0, 0, "test\n ");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":1a:", newText.equals("test\n This\nis a test\r"));
- assert(":1b:", content.getLineCount() == 4);
- assert(":1c:", content.getLine(0).equals("test"));
- assert(":1d:", content.getLine(1).equals(" This"));
- assert(":1e:", content.getLine(2).equals("is a test"));
- assert(":1f:", content.getLine(3).equals(""));
-
- content.setText("This\nis a test\r");
- content.replaceTextRange(5, 0, "*** ");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":2a:", newText.equals("This\n*** is a test\r"));
- assert(":2b:", content.getLineCount() == 3);
- assert(":2c:", content.getLine(0).equals("This"));
- assert(":2d:", content.getLine(1).equals("*** is a test"));
- assert(":2e:", content.getLine(2).equals(""));
-
- content.setText("Line 1\r\nLine 2");
- content.replaceTextRange(0, 0, "\r");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":3a:", newText.equals("\rLine 1\r\nLine 2"));
- assert(":3b:", content.getLineCount() == 3);
- assert(":3c:", content.getLine(0).equals(""));
- assert(":3d:", content.getLine(1).equals("Line 1"));
- assert(":3e:", content.getLine(2).equals("Line 2"));
- content.replaceTextRange(9, 0, "\r");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":3f:", newText.equals("\rLine 1\r\n\rLine 2"));
- assert(":3g:", content.getLineCount() == 4);
- assert(":3h:", content.getLine(0).equals(""));
- assert(":3i:", content.getLine(1).equals("Line 1"));
- assert(":3j:", content.getLine(2).equals(""));
- assert(":3k:", content.getLine(3).equals("Line 2"));
-
- content.setText("This\nis a test\r");
- content.replaceTextRange(0, 0, "\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":4a:", newText.equals("\nThis\nis a test\r"));
- assert(":4b:", content.getLineCount() == 4);
- assert(":4c:", content.getLine(0).equals(""));
- assert(":4d:", content.getLine(1).equals("This"));
- assert(":4e:", content.getLine(2).equals("is a test"));
- assert(":4f:", content.getLine(3).equals(""));
-
- content.setText("This\nis a test\r");
- content.replaceTextRange(7, 0, "\r\nnewLine");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":5a:", newText.equals("This\nis\r\nnewLine a test\r"));
- assert(":5b:", content.getLineCount() == 4);
- assert(":5c:", content.getLine(0).equals("This"));
- assert(":5d:", content.getLine(1).equals("is"));
- assert(":5e:", content.getLine(2).equals("newLine a test"));
- assert(":5f:", content.getLine(3).equals(""));
-
- content.setText("");
- content.replaceTextRange(0, 0, "This\nis\r\nnewLine a test\r");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":6a:", newText.equals("This\nis\r\nnewLine a test\r"));
- assert(":6b:", content.getLineCount() == 4);
- assert(":6c:", content.getLine(0).equals("This"));
- assert(":6d:", content.getLine(1).equals("is"));
- assert(":6e:", content.getLine(2).equals("newLine a test"));
- assert(":6f:", content.getLine(3).equals(""));
-
- // insert at end
- content.setText("This");
- content.replaceTextRange(4, 0, "\n ");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":7a:", newText.equals("This\n "));
- assert(":7b:", content.getLineCount() == 2);
- assert(":7c:", content.getLine(0).equals("This"));
- assert(":7d:", content.getLine(1).equals(" "));
- content.setText("This\n");
- content.replaceTextRange(5, 0, "\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":7e:", newText.equals("This\n\n"));
- assert(":7f:", content.getLineCount() == 3);
- assert(":7g:", content.getLine(0).equals("This"));
- assert(":7h:", content.getLine(1).equals(""));
- assert(":7i:", content.getLine(2).equals(""));
-
- // insert at beginning
- content.setText("This");
- content.replaceTextRange(0, 0, "\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":8a:", newText.equals("\nThis"));
- assert(":8b:", content.getLineCount() == 2);
- assert(":8c:", content.getLine(0).equals(""));
- assert(":8d:", content.getLine(1).equals("This"));
-
- // insert text
- content.setText("This\nis a test\r");
- content.replaceTextRange(5, 0, "*** ");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":9a:", newText.equals("This\n*** is a test\r"));
- assert(":9b:", content.getLineCount() == 3);
- assert(":9c:", content.getLine(0).equals("This"));
- assert(":9d:", content.getLine(1).equals("*** is a test"));
- assert(":9e:", content.getLine(2).equals(""));
-
- content.setText("This\n");
- content.replaceTextRange(5, 0, "line");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":10a:", newText.equals("This\nline"));
- assert(":10b:", content.getLineCount() == 2);
- assert(":10c:", content.getLine(0).equals("This"));
- assert(":10d:", content.getLine(1).equals("line"));
- assert(":10e:", content.getLineAtOffset(8) == 1);
- assert(":10f:", content.getLineAtOffset(9) == 1);
-
- // insert at beginning
- content.setText("This\n");
- content.replaceTextRange(0, 0, "line\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":11a:", newText.equals("line\nThis\n"));
- assert(":11b:", content.getLineCount() == 3);
- assert(":11c:", content.getLine(0).equals("line"));
- assert(":11d:", content.getLine(1).equals("This"));
- assert(":11e:", content.getLineAtOffset(5) == 1);
-
- content.setText("Line 1\r\nLine 2\r\nLine 3");
- content.replaceTextRange(0, 0, "\r");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":12a:", newText.equals("\rLine 1\r\nLine 2\r\nLine 3"));
- assert(":12b:", content.getLineCount() == 4);
- assert(":12c:", content.getLine(0).equals(""));
- assert(":12d:", content.getLine(1).equals("Line 1"));
- assert(":12e:", content.getLine(2).equals("Line 2"));
- assert(":12f:", content.getLine(3).equals("Line 3"));
-
- content.setText("Line 1\nLine 2\nLine 3");
- content.replaceTextRange(7, 0, "Line1a\nLine1b\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":13a:", newText.equals("Line 1\nLine1a\nLine1b\nLine 2\nLine 3"));
- assert(":13b:", content.getLineCount() == 5);
- assert(":13c:", content.getLine(0).equals("Line 1"));
- assert(":13d:", content.getLine(1).equals("Line1a"));
- assert(":13e:", content.getLine(2).equals("Line1b"));
- assert(":13f:", content.getLine(3).equals("Line 2"));
- assert(":13g:", content.getLine(4).equals("Line 3"));
-
- content.setText("Line 1\nLine 2\nLine 3");
- content.replaceTextRange(11, 0, "l1a");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":14a:", newText.equals("Line 1\nLinel1a 2\nLine 3"));
- assert(":14b:", content.getLineCount() == 3);
- assert(":14c:", content.getLine(0).equals("Line 1"));
- assert(":14d:", content.getLine(1).equals("Linel1a 2"));
- assert(":14e:", content.getLine(2).equals("Line 3"));
-
- content.setText("Line 1\nLine 2 is a very long line that spans many words\nLine 3");
- content.replaceTextRange(19, 0, "very, very, ");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":15a:", newText.equals("Line 1\nLine 2 is a very, very, very long line that spans many words\nLine 3"));
- assert(":15b:", content.getLineCount() == 3);
- assert(":15c:", content.getLine(0).equals("Line 1"));
- assert(":15d:", content.getLine(1).equals("Line 2 is a very, very, very long line that spans many words"));
- assert(":15e:", content.getLine(2).equals("Line 3"));
-}
-
-public void test_Empty() {
- StyledTextContent content = getContentInstance();
- assert(":1a:", content.getLineCount() == 1);
- assert(":1b:", content.getLine(0).equals(""));
-
- content.setText("test");
- content.replaceTextRange(0,4,"");
- assert(":2a:", content.getLineCount() == 1);
- assert(":2b:", content.getLine(0).equals(""));
-}
-public void test_Line_Conversion() {
- StyledTextContent content = getContentInstance();
-
- content.setText("This\nis a test\rrepeat\nend\r");
- assert(":1a:", content.getLineCount() == 5);
- assert(":1b:", content.getLine(0).equals("This"));
- assert(":1c:", content.getOffsetAtLine(0) == 0);
- assert(":1d:", content.getLine(1).equals("is a test"));
- assert(":1e:", content.getLineAtOffset(4) == 0);
- assert(":1f:", content.getOffsetAtLine(1) == 5);
- assert(":1g:", content.getLine(2).equals("repeat"));
- assert(":1h:", content.getOffsetAtLine(2) == 15);
- assert(":1i:", content.getLine(3).equals("end"));
- assert(":1j:", content.getOffsetAtLine(3) == 22);
- assert(":1k:", content.getLine(4).equals(""));
- assert(":1l:", content.getOffsetAtLine(4) == 26);
-
- content.setText("This\r\nis a test");
- assert(":2a:", content.getLineCount() == 2);
- assert(":2b:", content.getLine(1).equals("is a test"));
- assert(":2c:", content.getLineAtOffset(4) == 0);
- assert(":2d:", content.getLineAtOffset(5) == 0);
-
- content.setText("This\r\nis a test\r");
- assert(":3a:", content.getLineCount() == 3);
- assert(":3b:", content.getLine(1).equals("is a test"));
- assert(":3c:", content.getLineAtOffset(15) == 1);
-
- content.setText("\r\n");
- assert(":4a:", content.getLineCount() == 2);
- assert(":4b:", content.getLine(0).equals(""));
- assert(":4c:", content.getLine(1).equals(""));
- assert(":4d:", content.getLineAtOffset(0) == 0);
- assert(":4e:", content.getLineAtOffset(1) == 0);
- assert(":4f:", content.getLineAtOffset(2) == 1);
-
- content.setText("\r\n\n\r\r\n");
- assert(":5a:", content.getLineCount() == 5);
- assert(":5b:", content.getLine(0).equals(""));
- assert(":5c:", content.getOffsetAtLine(0) == 0);
- assert(":5d:", content.getLine(1).equals(""));
- assert(":5e:", content.getOffsetAtLine(1) == 2);
- assert(":5f:", content.getLine(2).equals(""));
- assert(":5g:", content.getOffsetAtLine(2) == 3);
- assert(":5h:", content.getLine(3).equals(""));
- assert(":5i:", content.getOffsetAtLine(3) == 4);
- assert(":5j:", content.getLine(4).equals(""));
- assert(":5k:", content.getOffsetAtLine(4) == 6);
-
- content.setText("test\r\rtest2\r\r");
- assert(":6a:", content.getLineCount() == 5);
- assert(":6b:", content.getLine(0).equals("test"));
- assert(":6c:", content.getOffsetAtLine(0) == 0);
- assert(":6d:", content.getLine(1).equals(""));
- assert(":6e:", content.getOffsetAtLine(1) == 5);
- assert(":6f:", content.getLine(2).equals("test2"));
- assert(":6g:", content.getOffsetAtLine(2) == 6);
- assert(":6h:", content.getLine(3).equals(""));
- assert(":6i:", content.getOffsetAtLine(3) == 12);
- assert(":6j:", content.getLine(4).equals(""));
- assert(":6k:", content.getOffsetAtLine(4) == 13);
-}
-public void test_Offset_To_Line() {
- StyledTextContent content = getContentInstance();
-
- content.setText("This\nis a test\rrepeat\nend\r");
- assert(":1a:", content.getLineAtOffset(0) == 0);
- assert(":1b:", content.getLineAtOffset(3) == 0);
- assert(":1c:", content.getLineAtOffset(4) == 0);
- assert(":1d:", content.getLineAtOffset(25) == 3);
- assert(":1e:", content.getLineAtOffset(26) == 4);
-
- content.setText("This\r\nis a test");
- assert(":2a:", content.getLineAtOffset(5) == 0);
- assert(":2b:", content.getLineAtOffset(6) == 1);
- assert(":2c:", content.getLineAtOffset(10) == 1);
-
- content.setText("\r\n");
- assert(":3a:", content.getLineAtOffset(0) == 0);
- assert(":3b:", content.getLineAtOffset(1) == 0);
- assert(":3c:", content.getLineAtOffset(2) == 1);
-
- content.setText("\r\n\n\r\r\n");
- assert(":4a:", content.getLineAtOffset(0) == 0);
- assert(":4b:", content.getLineAtOffset(1) == 0);
- assert(":4c:", content.getLineAtOffset(2) == 1);
- assert(":4d:", content.getLineAtOffset(3) == 2);
- assert(":4e:", content.getLineAtOffset(4) == 3);
- assert(":4f:", content.getLineAtOffset(5) == 3);
- assert(":4g:", content.getLineAtOffset(6) == 4);
-
- content.setText("\r\n\r\n");
- assert(":5a:", content.getLineAtOffset(0) == 0);
- assert(":5b:", content.getLineAtOffset(1) == 0);
- assert(":5c:", content.getLineAtOffset(2) == 1);
- assert(":5d:", content.getLineAtOffset(3) == 1);
- assert(":5e:", content.getLineAtOffset(4) == 2);
-
- content.setText("\r\r\r\n\r\n");
- assert(":6a:", content.getLineAtOffset(0) == 0);
- assert(":6b:", content.getLineAtOffset(1) == 1);
- assert(":6c:", content.getLineAtOffset(2) == 2);
- assert(":6d:", content.getLineAtOffset(4) == 3);
-
- content.setText("");
- assert(":7a:", content.getLineAtOffset(0) == 0);
-
- content = getContentInstance();
- assert(":8a:", content.getLineAtOffset(0) == 0);
-}
-
-public void test_Line_To_Offset() {
- StyledTextContent content = getContentInstance();
-
- content.setText("This\nis a test\rrepeat\nend\r");
- assert(":1a:", content.getOffsetAtLine(0) == 0);
- assert(":1b:", content.getOffsetAtLine(1) == 5);
- assert(":1c:", content.getOffsetAtLine(2) == 15);
- assert(":1d:", content.getOffsetAtLine(3) == 22);
- assert(":1e:", content.getOffsetAtLine(4) == 26);
-
- content.setText("This\r\nis a test");
- assert(":2a:", content.getOffsetAtLine(0) == 0);
- assert(":2b:", content.getOffsetAtLine(1) == 6);
-
- content.setText("\r\n");
- assert(":3a:", content.getOffsetAtLine(0) == 0);
- assert(":3b:", content.getOffsetAtLine(1) == 2);
-
- content.setText("\r\n\n\r\r\n");
- assert(":4a:", content.getOffsetAtLine(0) == 0);
- assert(":4b:", content.getOffsetAtLine(1) == 2);
- assert(":4c:", content.getOffsetAtLine(2) == 3);
- assert(":4d:", content.getOffsetAtLine(3) == 4);
- assert(":4e:", content.getOffsetAtLine(4) == 6);
-
- content.setText("\r\ntest\r\n");
- assert(":5a:", content.getOffsetAtLine(0) == 0);
- assert(":5b:", content.getOffsetAtLine(1) == 2);
- assert(":5c:", content.getOffsetAtLine(2) == 8);
-}
-
-public void test_Delete() {
- StyledTextContent content = getContentInstance();
- String newText;
-
- content.setText("This\nis a test\r");
- content.replaceTextRange(6, 2, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":1a:", newText.equals("This\nia test\r"));
- assert(":1b:", content.getLine(0).equals("This"));
- assert(":1c:", content.getLine(1).equals("ia test"));
-
- content.setText("This\nis a test\r");
- content.replaceTextRange(5, 9, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":2a:", newText.equals("This\n\r"));
- assert(":2b:",content.getLineCount() == 3);
- assert(":2c:", content.getLine(0).equals("This"));
- assert(":2d:", content.getLine(1).equals(""));
- assert(":2e:", content.getLine(2).equals(""));
-
- content.setText("This\nis a test\nline 3\nline 4");
- content.replaceTextRange(21, 7, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":3a:", newText.equals("This\nis a test\nline 3"));
- assert(":3b:", content.getLineCount() == 3);
- assert(":3c:", content.getLine(0).equals("This"));
- assert(":3d:", content.getLine(1).equals("is a test"));
- assert(":3e:", content.getLine(2).equals("line 3"));
-
- content.setText("This\nis a test\nline 3\nline 4");
- content.replaceTextRange(0, 5, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":4a:", newText.equals("is a test\nline 3\nline 4"));
- assert(":4b:", content.getLineCount() == 3);
- assert(":4c:", content.getLine(0).equals("is a test"));
- assert(":4d:", content.getLine(1).equals("line 3"));
- assert(":4e:", content.getLine(2).equals("line 4"));
- content.replaceTextRange(16, 7, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":4f:", newText.equals("is a test\nline 3"));
- assert(":4g:", content.getLine(0).equals("is a test"));
- assert(":4h:", content.getLine(1).equals("line 3"));
- content.replaceTextRange(9, 7, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":4i:", newText.equals("is a test"));
- assert(":4j:", content.getLine(0).equals("is a test"));
- content.replaceTextRange(1, 8, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":4k:", newText.equals("i"));
- assert(":4l:", content.getLine(0).equals("i"));
- content.replaceTextRange(0, 1, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":4m:", newText.equals(""));
- assert(":4n:", content.getLine(0).equals(""));
-
- content.setText("This\nis a test\r");
- content.replaceTextRange(5, 9, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":5a:", newText.equals("This\n\r"));
- assert(":5b:",content.getLineCount() == 3);
- assert(":5c:", content.getLine(0).equals("This"));
- assert(":5d:", content.getLine(1).equals(""));
- assert(":5e:", content.getLine(2).equals(""));
-
- content.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- content.replaceTextRange(4, 8, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":6a:", newText.equals("L1\r\nL4\r\n"));
- assert(":6b:",content.getLineCount() == 3);
- assert(":6c:", content.getLine(0).equals("L1"));
- assert(":6d:", content.getLine(1).equals("L4"));
- assert(":6e:", content.getLine(2).equals(""));
-
- content.setText("\nL1\r\nL2");
- content.replaceTextRange(0, 1, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":7a:", newText.equals("L1\r\nL2"));
- assert(":7b:",content.getLineCount() == 2);
- assert(":7c:", content.getLine(0).equals("L1"));
- assert(":7d:", content.getLine(1).equals("L2"));
-
- content.setText("\nL1\r\nL2\r\n");
- content.replaceTextRange(7, 2, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":8a:", newText.equals("\nL1\r\nL2"));
- assert(":8b:",content.getLineCount() == 3);
- assert(":8c:", content.getLine(0).equals(""));
- assert(":8d:", content.getLine(1).equals("L1"));
- assert(":8e:", content.getLine(2).equals("L2"));
-
- content.setText("\nLine 1\nLine 2\n");
- content.replaceTextRange(0, 7, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":9a:", newText.equals("\nLine 2\n"));
- assert(":9b:", content.getLineCount() == 3);
- assert(":9c:", content.getLine(0).equals(""));
- assert(":9d:", content.getLine(1).equals("Line 2"));
- assert(":9e:", content.getLine(2).equals(""));
-
- content.setText("Line 1\nLine 2\n");
- content.replaceTextRange(6, 8, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":10a:", newText.equals("Line 1"));
- assert(":10b:", content.getLineCount() == 1);
- assert(":10c:", content.getLine(0).equals("Line 1"));
-
- content.setText("Line one is short\r\nLine 2 is a longer line\r\nLine 3\n");
- content.replaceTextRange(12, 17, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":11a:", newText.equals("Line one is a longer line\r\nLine 3\n"));
- assert(":11b:", content.getLineCount() == 3);
- assert(":11c:", content.getLine(0).equals("Line one is a longer line"));
- assert(":11d:", content.getLine(1).equals("Line 3"));
- assert(":11e:", content.getLine(2).equals(""));
-
-}
-public void test_Replace() {
- StyledTextContent content = getContentInstance();
- String newText;
-
- content.setText("This\nis a test\r");
- content.replaceTextRange(5, 4, "a");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":1a:", newText.equals("This\na test\r"));
- assert(":1b:",content.getLineCount() == 3);
- assert(":1c:", content.getLine(0).equals("This"));
- assert(":1d:", content.getLine(1).equals("a test"));
- assert(":1e:", content.getLine(2).equals(""));
-
- content.setText("This\nis a test\r");
- content.replaceTextRange(5, 2, "was");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":2a:", newText.equals("This\nwas a test\r"));
- assert(":2b:",content.getLineCount() == 3);
- assert(":2c:", content.getLine(0).equals("This"));
- assert(":2d:", content.getLine(1).equals("was a test"));
- assert(":2e:", content.getLine(2).equals(""));
-
- content.setText("This is a test\r");
- content.replaceTextRange(5, 2, "was");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":3a:", newText.equals("This was a test\r"));
- assert(":3b:",content.getLineCount() == 2);
- assert(":3c:", content.getLine(0).equals("This was a test"));
- assert(":3d:", content.getLineAtOffset(15) == 0);
-
- content.setText("Line 1\nLine 2\nLine 3");
- content.replaceTextRange(0, 7, "La\nLb\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":4a:", newText.equals("La\nLb\nLine 2\nLine 3"));
- assert(":4b:", content.getLine(0).equals("La"));
- assert(":4c:", content.getLine(1).equals("Lb"));
- assert(":4d:", content.getLine(2).equals("Line 2"));
- assert(":4e:", content.getLine(3).equals("Line 3"));
-
- content.setText(getTestText());
- newText = content.getTextRange(0, content.getCharCount());
- int start = content.getOffsetAtLine(6);
- int end = content.getOffsetAtLine(11);
- content.replaceTextRange(start, end - start, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":5a:", content.getLineCount() == 12);
- assert(":5a:", content.getLine(5).equals(""));
- assert(":5a:", content.getLine(6).equals(""));
- start = content.getOffsetAtLine(7);
- content.replaceTextRange(start, content.getCharCount() - start, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":5a:", content.getLineCount() == 8);
- assert(":5a:", content.getLine(5).equals(""));
- assert(":5a:", content.getLine(6).equals(""));
- assert(":5a:", content.getLine(7).equals(""));
-
-}
-public void test_Special_Cases() {
- String newText;
- StyledTextContent content = getContentInstance();
- assert(":0a:", content.getLineCount() == 1);
- assert(":0b:", content.getOffsetAtLine(0) == 0);
-
- content.setText("This is the input/output text component.");
- content.replaceTextRange(0, 0, "\n");
- assert(":1a:", content.getLine(0).equals(""));
- content.replaceTextRange(1, 0, "\n");
- assert(":1b:",content.getLine(0).equals(""));
- content.replaceTextRange(2, 0, "\n");
- assert(":1c:",content.getLine(0).equals(""));
- content.replaceTextRange(3, 0, "\n");
- assert(":1d:",content.getLine(0).equals(""));
- content.replaceTextRange(4, 0, "\n");
- assert(":1e:",content.getLine(0).equals(""));
- content.replaceTextRange(5, 0, "\n");
- assert(":1f:",content.getLine(0).equals(""));
- content.replaceTextRange(6, 0, "\n");
- assert(":1g:",content.getLine(0).equals(""));
- content.replaceTextRange(7, 0, "\n");
- assert(":1h:",content.getLine(0).equals(""));
-
- content.setText("This is the input/output text component.");
- content.replaceTextRange(0, 0, "\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":2a:", newText.equals("\nThis is the input/output text component."));
- assert(":2b:", content.getLine(0).equals(""));
- assert(":2c:", content.getLine(1).equals("This is the input/output text component."));
- content.replaceTextRange(1, 0, "\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":2d:", newText.equals("\n\nThis is the input/output text component."));
- assert(":2e:", content.getLine(0).equals(""));
- assert(":2f:", content.getLine(1).equals(""));
- assert(":2g:", content.getLine(2).equals("This is the input/output text component."));
-
- content.replaceTextRange(2, 0, "\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":3a:", newText.equals("\n\n\nThis is the input/output text component."));
- assert(":3b:", content.getLine(0).equals(""));
- assert(":3c:", content.getLine(1).equals(""));
- assert(":3d:", content.getLine(2).equals(""));
- assert(":3e:", content.getLine(3).equals("This is the input/output text component."));
- content.replaceTextRange(3, 0, "\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":3f:", newText.equals("\n\n\n\nThis is the input/output text component."));
- assert(":3g:", content.getLine(0).equals(""));
- assert(":3h:", content.getLine(1).equals(""));
- assert(":3i:", content.getLine(2).equals(""));
- assert(":3j:", content.getLine(3).equals(""));
- assert(":3k:", content.getLine(4).equals("This is the input/output text component."));
-
- content.replaceTextRange(3, 1, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":4a:", newText.equals("\n\n\nThis is the input/output text component."));
- assert(":4b:", content.getLine(0).equals(""));
- assert(":4c:", content.getLine(1).equals(""));
- assert(":4d:", content.getLine(2).equals(""));
- assert(":4e:", content.getLine(3).equals("This is the input/output text component."));
- content.replaceTextRange(2, 1, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":4f:", newText.equals("\n\nThis is the input/output text component."));
- assert(":4g:", content.getLine(0).equals(""));
- assert(":4h:", content.getLine(1).equals(""));
- assert(":4i:", content.getLine(2).equals("This is the input/output text component."));
-
- content.replaceTextRange(2, 0, "a");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":5a:", newText.equals("\n\naThis is the input/output text component."));
- assert(":5b:", content.getLine(0).equals(""));
- assert(":5c:", content.getLine(1).equals(""));
- assert(":5d:", content.getLine(2).equals("aThis is the input/output text component."));
-
- content.setText("abc\r\ndef");
- content.replaceTextRange(1, 1, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":6a:", newText.equals("ac\r\ndef"));
- assert(":6b:", content.getLineCount() == 2);
- assert(":6c:", content.getLine(0).equals("ac"));
- assert(":6d:", content.getLine(1).equals("def"));
- content.replaceTextRange(1, 1, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":6e:", newText.equals("a\r\ndef"));
- assert(":6f:", content.getLineCount() == 2);
- assert(":6g:", content.getLine(0).equals("a"));
- assert(":6h:", content.getLine(1).equals("def"));
- content.replaceTextRange(1, 2, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":6i:", newText.equals("adef"));
- assert(":6j:", content.getLineCount() == 1);
- assert(":6k:", content.getLine(0).equals("adef"));
- content.replaceTextRange(1, 1, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":6l:", newText.equals("aef"));
- assert(":6m:", content.getLineCount() == 1);
- assert(":6n:", content.getLine(0).equals("aef"));
- content.replaceTextRange(1, 1, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":6o:", newText.equals("af"));
- assert(":6p:", content.getLineCount() == 1);
- assert(":6q:", content.getLine(0).equals("af"));
-
- content.setText("abc");
- content.replaceTextRange(0, 1, "1");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":7a:", content.getLineCount() == 1);
- assert(":7b:", newText.equals("1bc"));
- assert(":7c:", content.getLine(0).equals("1bc"));
- content.replaceTextRange(0, 0, "\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":7d:", newText.equals("\n1bc"));
- assert(":7e:", content.getLineCount() == 2);
- assert(":7f:", content.getLine(0).equals(""));
- assert(":7g:", content.getLine(1).equals("1bc"));
-
- content = getContentInstance();
- content.replaceTextRange(0,0,"a");
-
- content.setText("package test;\n/* Line 1\n * Line 2\n */\npublic class SimpleClass {\n}");
- content.replaceTextRange(14, 23, "\t/*Line 1\n\t * Line 2\n\t */");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":8a:", newText.equals("package test;\n\t/*Line 1\n\t * Line 2\n\t */\npublic class SimpleClass {\n}"));
- assert(":8b:", content.getLineCount() == 6);
- assert(":8c:", content.getLine(0).equals("package test;"));
- assert(":8d:", content.getLine(1).equals("\t/*Line 1"));
- assert(":8e:", content.getLine(2).equals("\t * Line 2"));
- assert(":8f:", content.getLine(3).equals("\t */"));
- assert(":8g:", content.getLine(4).equals("public class SimpleClass {"));
- assert(":8h:", content.getLine(5).equals("}"));
-}
-public void test_Text_Changed_Event() {
- StyledTextContent content = getContentInstance();
- content.addTextChangeListener(this);
- verify = 1;
- content.setText("testing");
- content.replaceTextRange(0, 0, "\n");
-
- verify = 2;
- content.setText("\n\n");
- content.replaceTextRange(0, 2, "a");
-
- verify = 3;
- content.setText("a");
- content.replaceTextRange(0, 1, "\n\n");
-
- verify = 4;
- content.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- try {content.replaceTextRange(3, 1, "test\n");}
- catch (IllegalArgumentException ex) {assert(":4:", true);}
-
- verify = 5;
- content.setText("Line 1\r\nLine 2");
- content.replaceTextRange(0, 0, "\r");
-
- verify = 6;
- content.setText("This\nis a test\nline 3\nline 4");
- content.replaceTextRange(21, 7, "");
-
- verify = 7;
- content.setText("This\nis a test\r");
- content.replaceTextRange(5, 9, "");
-
- verify = 8;
- content.setText("\nL1\r\nL2\r\n");
- content.replaceTextRange(7, 2, "");
-
- verify = 9;
- content.setText("L1\r\n");
- content.replaceTextRange(2, 2, "test");
-
- verify = 10;
- content.setText("L1\r\n");
- try {content.replaceTextRange(3, 1, "");}
- catch (IllegalArgumentException ex) {assert(":10:", true);}
-
- verify = 11;
- content.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- try {content.replaceTextRange(1, 2, "");}
- catch (IllegalArgumentException ex) {assert(":11:", true);}
-
- verify = 12;
- content.setText("L1\r");
- content.replaceTextRange(3, 0, "\n");
-
- verify = 13;
- content.setText("L1\n");
- content.replaceTextRange(2, 0, "\r");
-
- verify = 14;
- content.setText("L1\r\n");
- try {content.replaceTextRange(3, 0, "test");}
- catch (IllegalArgumentException ex) {assert(":14:", true);}
-
- verify = 15;
- content.setText("L1\r\n");
- content.replaceTextRange(2, 2, "test\n\n");
-
- verify = 16;
- content.setText("L1\r\n");
- try {content.replaceTextRange(3, 1, "test\r\n");}
- catch (IllegalArgumentException ex) {assert(":16:", true);}
-
- verify = 17;
- content.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- try {content.replaceTextRange(1, 2, "test\n\n");}
- catch (IllegalArgumentException ex) {assert(":17:", true);}
-
- verify = 18;
- content.setText("L1\r");
- content.replaceTextRange(3, 0, "\ntest\r\n");
-
- verify = 19;
- content.setText("L1\n");
- content.replaceTextRange(2, 0, "test\r\r\r");
- verify = 20;
- content.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
- try {content.replaceTextRange(3, 1, "test\n");}
- catch (IllegalArgumentException ex) {assert(":20:", true);}
-
-
- verify = 0;
- content.removeTextChangeListener(this);
-}
-public void test_Delimiter_Special_Cases() {
- StyledTextContent content = getContentInstance();
- String newText;
-
- content.setText("\nL1\r\nL2\r\n");
- content.replaceTextRange(7, 2, "");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":1:", newText.equals("\nL1\r\nL2"));
-
- content.setText("L1\r\n");
- content.replaceTextRange(2, 2, "test\n\n");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":2:", newText.equals("L1test\n\n"));
-
-// content.setText("L1\r\n");
-// content.replaceTextRange(3, 1, "test\r\n");
-// newText = content.getTextRange(0, content.getCharCount());
-// assert(":3:", newText.equals("L1\rtest\r\n"));
-
-// content.setText("L1\r\nL2\r\nL3\r\nL4\r\n");
-// content.replaceTextRange(1, 2, "test\n\n");
-// newText = content.getTextRange(0, content.getCharCount());
-// assert(":4:", newText.equals("Ltest\n\n\nL2\r\nL3\r\nL4\r\n"));
-
- content.setText("L1\n");
- content.replaceTextRange(2, 0, "test\r\r\r");
- newText = content.getTextRange(0, content.getCharCount());
- assert(":3:", newText.equals("L1test\r\r\r\n"));
-}
-protected void setUp() {
- // create shell
- shell = new Shell ();
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- shell.setSize(500, 300);
- shell.setLayout(layout);
- // create widget
- widget = new StyledText (shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
- GridData spec = new GridData();
- spec.horizontalAlignment = spec.FILL;
- spec.grabExcessHorizontalSpace = true;
- spec.verticalAlignment = spec.FILL;
- spec.grabExcessVerticalSpace = true;
- widget.setLayoutData(spec);
- shell.open ();
-}
-protected void tearDown() {
- if (shell != null && !shell.isDisposed ())
- shell.dispose ();
- shell = null;
-
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtJunit.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtJunit.java deleted file mode 100644 index e9bd49d636..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtJunit.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-/**
- * Platform-specific constants used in SWT test cases.
- */
public class SwtJunit {
-
- public static final String testFontName;
- public final static boolean isLinux = System.getProperty("os.name").equals("Linux");
- public final static boolean isAIX = System.getProperty("os.name").equals("AIX");
- public final static boolean isMotif = isLinux || isAIX;
- public final static boolean isWindows = !isMotif;
-
- static {
- if (isMotif) {
- testFontName = "misc-fixed";
- }
- else {
- testFontName = "Helvetica";
- }
- }
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestCase.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestCase.java deleted file mode 100644 index d46197df2e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestCase.java +++ /dev/null @@ -1,105 +0,0 @@ -package org.eclipse.swt.tests.junit;
-
/*
- * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import java.lang.reflect.*;
-import junit.framework.*;
-
public class SwtTestCase extends TestCase {
- /**
- * The following flags are used to mark test cases that
- * are not handled correctly by SWT at this time, or test
- * cases that maybe themselves dubious (eg. when the correct
- * behaviour may not be clear). Most of these flagged test
- * cases involve handling error conditions.
- *
- * Setting these flags to true will run those tests. As api
- * is implemented this gives us a convenient way to include
- * it in the junit tests.
- */
-
- // call should result in an 'Argument cannot be null' SWT error
- public static boolean fCheckSwtNullExceptions = false;
-
- // an out of range value is not handled gracefully according to our SWT policy
- public static boolean fCheckOutOfRangeBehaviour = false;
-
- // run test cases that may themselves be dubious
- // these should be eventually checked to see if
- // there is a valid failure or the test is bogus
- public static boolean fCheckBogusTestCases = false;
-
- // check multi select tree api
- public static boolean fCheckMultiSelectTree = false;
-
- // check visibility api (eg in menu)
- public static boolean fCheckVisibility = false;
-
- // run test cases that check SWT policy not covered by the flags above
- public static boolean fCheckSWTPolicy = false;
-
- // make dialog open calls, operator must then close them
- public static boolean fTestDialogOpen = false;
-
-public SwtTestCase(String name) {
- super(name);
-}
-
-static public void assertEquals(String message, Object expected[], Object actual[]) {
- if (expected == null && actual == null)
- return;
- boolean equal = false;
- if (expected != null && actual != null && expected.length == actual.length) {
- if (expected.length == 0)
- return;
- equal = true;
- for (int i = 0; i < expected.length; i++) {
- if (!expected[i].equals(actual[i])) {
- equal = false;
- }
- }
- }
- if (!equal) {
- failNotEquals(message, expected, actual);
- }
-}
-static public void assertEquals(Object expected[], Object actual[]) {
- assertEquals(null, expected, actual);
-}
-static public void assertEquals(String message, int expected[], int actual[]) {
- if (expected == null && actual == null)
- return;
- boolean equal = false;
- if (expected != null && actual != null && expected.length == actual.length) {
- if (expected.length == 0)
- return;
- equal = true;
- for (int i = 0; i < expected.length; i++) {
- if (expected[i] != actual[i]) {
- equal = false;
- }
- }
- }
- if (!equal) {
- failNotEquals(message, expected, actual);
- }
-}
-static public void assertEquals(int expected[], int actual[]) {
- assertEquals(null, expected, actual);
-}
-// copied exactly from junit.framework.TestCase so that it can be called from here even though private
-static private void failNotEquals(String message, Object expected, Object actual) {
- String formatted= "";
- if (message != null)
- formatted= message+" ";
- fail(formatted+"expected:<"+expected+"> but was:<"+actual+">");
-}
-
-protected void warnUnimpl(String message) {
- //System.out.println(this.getClass() + ": " + message);
- AllTests.unimplementedMethods++;
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWT.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWT.java deleted file mode 100644 index 55da8f786f..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWT.java +++ /dev/null @@ -1,156 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.SWT - * - * @see org.eclipse.swt.SWT - */ -public class Test_org_eclipse_swt_SWT extends SwtTestCase { - -public Test_org_eclipse_swt_SWT(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - // Do nothing. Class SWT is not intended to be subclassed. -} - -public void test_getMessageLjava_lang_String() { - boolean passed = false; - try { - passed = false; - SWT.getMessage(null); - } catch (IllegalArgumentException ex) { - passed = true; - } - assertTrue ("did not correctly throw exception with null argument", passed); - try { - SWT.getMessage("SWT_Yes"); - } catch (Throwable t) { - fail ("exception " + t + " generated for SWT_Yes"); - } - assertTrue ( - "invalid key did not return as itself", - "_NOT_FOUND_IN_PROPERTIES_".equals(SWT.getMessage("_NOT_FOUND_IN_PROPERTIES_"))); - -} - -public void test_getPlatform() { - // Can't test the list of platforms, since this may change, - // so just test to see it returns something. - assertTrue ("returned null platform name", SWT.getPlatform() != null); -} - -public void test_getVersion() { - // Test that the version number which is returned is reasonable. - int ver = SWT.getVersion(); - assertTrue ("unreasonable value returned", ver > 0 && ver < 1000000); -} - -public void test_errorI() { - // Test that we throw the expected kinds of errors for the given error types. - boolean passed = false; - try { - SWT.error(SWT.ERROR_NULL_ARGUMENT); - } catch (IllegalArgumentException ex) { - passed = true; - } catch (Throwable t) { } - assertTrue ("did not correctly throw exception for ERROR_NULL_ARGUMENT", passed); - passed = false; - try { - SWT.error(SWT.ERROR_FAILED_EXEC); - } catch (SWTException ex) { - passed = true; - } catch (Throwable t) { } - assertTrue ("did not correctly throw exception for ERROR_FAILED_EXEC", passed); - passed = false; - try { - SWT.error(SWT.ERROR_NO_HANDLES); - } catch (SWTError ex) { - passed = true; - } catch (Throwable t) { } - assertTrue ("did not correctly throw exception for ERROR_NO_HANDLES", passed); - passed = false; - try { - SWT.error(-1); - } catch (SWTError ex) { - passed = true; - } catch (Throwable t) { } - assertTrue ("did not correctly throw exception for error(-1)", passed); -} - -public void test_errorILjava_lang_Throwable() { - // Test that the causing throwable is filled in. - Throwable cause = new RuntimeException("Just for testing"); - boolean passed = false; - try { - SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT, cause); - } catch (SWTException ex) { - passed = ex.throwable == cause; - } catch (Throwable t) { } - assertTrue ("did not correctly throw exception for ERROR_UNSUPPORTED_FORMAT", passed); - passed = false; - try { - SWT.error(SWT.ERROR_NOT_IMPLEMENTED, cause); - } catch (SWTError ex) { - passed = ex.throwable == cause; - } catch (Throwable t) { } - assertTrue ("did not correctly throw exception for ERROR_NOT_IMPLEMENTED", passed); - passed = false; - try { - SWT.error(-1, cause); - } catch (SWTError ex) { - passed = ex.throwable == cause; - } catch (Throwable t) { } - assertTrue ("did not correctly throw exception for error(-1)", passed); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_SWT((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_getMessageLjava_lang_String"); - methodNames.addElement("test_getPlatform"); - methodNames.addElement("test_getVersion"); - methodNames.addElement("test_errorI"); - methodNames.addElement("test_errorILjava_lang_Throwable"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_getMessageLjava_lang_String")) test_getMessageLjava_lang_String(); - else if (getName().equals("test_getPlatform")) test_getPlatform(); - else if (getName().equals("test_getVersion")) test_getVersion(); - else if (getName().equals("test_errorI")) test_errorI(); - else if (getName().equals("test_errorILjava_lang_Throwable")) test_errorILjava_lang_Throwable(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTError.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTError.java deleted file mode 100644 index eab01a1814..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTError.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.SWTError - * - * @see org.eclipse.swt.SWTError - */ -public class Test_org_eclipse_swt_SWTError extends SwtTestCase { - -public Test_org_eclipse_swt_SWTError(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - assertTrue ( - "did not fill in code properly", - new SWTError().code == SWT.ERROR_UNSPECIFIED); -} - -public void test_ConstructorLjava_lang_String() { - assertTrue ( - "did not fill in code properly", - new SWTError("An uninteresting message").code == SWT.ERROR_UNSPECIFIED); -} - -public void test_ConstructorI() { - assertTrue ( - "did not fill in code properly", - new SWTError(SWT.ERROR_CANNOT_BE_ZERO).code == SWT.ERROR_CANNOT_BE_ZERO); -} - -public void test_ConstructorILjava_lang_String() { - assertTrue ( - "did not fill in code properly", - new SWTError(SWT.ERROR_CANNOT_BE_ZERO, "An uninteresting message").code - == SWT.ERROR_CANNOT_BE_ZERO); -} - -public void test_getMessage() { - assertTrue ( - "did not include creation string in result", - new SWTError(SWT.ERROR_CANNOT_BE_ZERO, "An interesting message").getMessage() - .indexOf("An interesting message") >= 0); -} - -public void test_printStackTraceLjava_io_PrintStream() { - // Should not test. Result varies by VM. -} - -public void test_printStackTraceLjava_io_PrintWriter() { - // Should not test. Result varies by VM. -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_SWTError((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorLjava_lang_String"); - methodNames.addElement("test_ConstructorI"); - methodNames.addElement("test_ConstructorILjava_lang_String"); - methodNames.addElement("test_getMessage"); - methodNames.addElement("test_printStackTraceLjava_io_PrintStream"); - methodNames.addElement("test_printStackTraceLjava_io_PrintWriter"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorLjava_lang_String")) test_ConstructorLjava_lang_String(); - else if (getName().equals("test_ConstructorI")) test_ConstructorI(); - else if (getName().equals("test_ConstructorILjava_lang_String")) test_ConstructorILjava_lang_String(); - else if (getName().equals("test_getMessage")) test_getMessage(); - else if (getName().equals("test_printStackTraceLjava_io_PrintStream")) test_printStackTraceLjava_io_PrintStream(); - else if (getName().equals("test_printStackTraceLjava_io_PrintWriter")) test_printStackTraceLjava_io_PrintWriter(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTException.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTException.java deleted file mode 100644 index 9b50c80163..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTException.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.SWTException - * - * @see org.eclipse.swt.SWTException - */ -public class Test_org_eclipse_swt_SWTException extends SwtTestCase { - -public Test_org_eclipse_swt_SWTException(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - assertTrue ( - "did not fill in code properly", - new SWTException().code == SWT.ERROR_UNSPECIFIED); -} - -public void test_ConstructorLjava_lang_String() { - assertTrue ( - "did not fill in code properly", - new SWTException("An uninteresting message").code == SWT.ERROR_UNSPECIFIED); -} - -public void test_ConstructorI() { - assertTrue ( - "did not fill in code properly", - new SWTException(SWT.ERROR_CANNOT_BE_ZERO).code == SWT.ERROR_CANNOT_BE_ZERO); -} - -public void test_ConstructorILjava_lang_String() { - assertTrue ( - "did not fill in code properly", - new SWTException(SWT.ERROR_CANNOT_BE_ZERO, "An uninteresting message").code - == SWT.ERROR_CANNOT_BE_ZERO); -} - -public void test_getMessage() { - assertTrue ( - "did not include creation string in result", - new SWTException(SWT.ERROR_CANNOT_BE_ZERO, "An interesting message").getMessage() - .indexOf("An interesting message") >= 0); -} - -public void test_printStackTraceLjava_io_PrintStream() { - // Should not test. Result varies by VM. -} - -public void test_printStackTraceLjava_io_PrintWriter() { - // Should not test. Result varies by VM. -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_SWTException((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorLjava_lang_String"); - methodNames.addElement("test_ConstructorI"); - methodNames.addElement("test_ConstructorILjava_lang_String"); - methodNames.addElement("test_getMessage"); - methodNames.addElement("test_printStackTraceLjava_io_PrintStream"); - methodNames.addElement("test_printStackTraceLjava_io_PrintWriter"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorLjava_lang_String")) test_ConstructorLjava_lang_String(); - else if (getName().equals("test_ConstructorI")) test_ConstructorI(); - else if (getName().equals("test_ConstructorILjava_lang_String")) test_ConstructorILjava_lang_String(); - else if (getName().equals("test_getMessage")) test_getMessage(); - else if (getName().equals("test_printStackTraceLjava_io_PrintStream")) test_printStackTraceLjava_io_PrintStream(); - else if (getName().equals("test_printStackTraceLjava_io_PrintWriter")) test_printStackTraceLjava_io_PrintWriter(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_AnimatedProgress.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_AnimatedProgress.java deleted file mode 100644 index 5698911d01..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_AnimatedProgress.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.AnimatedProgress - * - * @see org.eclipse.swt.custom.AnimatedProgress - */ -public class Test_org_eclipse_swt_custom_AnimatedProgress extends Test_org_eclipse_swt_widgets_Canvas { - -public Test_org_eclipse_swt_custom_AnimatedProgress(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_clear() { - warnUnimpl("Test test_clear not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_start() { - warnUnimpl("Test test_start not written"); -} - -public void test_stop() { - warnUnimpl("Test test_stop not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_AnimatedProgress((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_clear"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_start"); - methodNames.addElement("test_stop"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Canvas.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_clear")) test_clear(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_start")) test_start(); - else if (getName().equals("test_stop")) test_stop(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentEvent.java deleted file mode 100644 index 9d9d78d46b..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentEvent.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.BidiSegmentEvent - * - * @see org.eclipse.swt.custom.BidiSegmentEvent - */ -public class Test_org_eclipse_swt_custom_BidiSegmentEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_custom_BidiSegmentEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_BidiSegmentEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentListener.java deleted file mode 100644 index 3d73a9050d..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentListener.java +++ /dev/null @@ -1,186 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import junit.framework.Test; -import junit.framework.TestSuite; -import junit.textui.TestRunner; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.BidiSegmentEvent; -import org.eclipse.swt.custom.BidiSegmentListener; -import org.eclipse.swt.custom.StyleRange; -import org.eclipse.swt.custom.StyledText; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.internal.BidiUtil; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.BidiSegmentListener - * - * @see org.eclipse.swt.custom.BidiSegmentListener - */ -public class Test_org_eclipse_swt_custom_BidiSegmentListener extends SwtTestCase { - Shell shell; - StyledText text; - boolean listenerCalled; - String line = "Line1"; - -public static void main(String[] args) { - TestRunner.run(suite()); -} -public Test_org_eclipse_swt_custom_BidiSegmentListener(String name) { - super(name); -} - -private boolean isBidi() { - return BidiUtil.isBidiPlatform(); -} -protected void setUp() { - shell = new Shell(); - text = new StyledText(shell, SWT.NULL); -} -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_BidiSegmentListener((String)e.nextElement())); - } - return suite; -} -protected void tearDown() { - shell.dispose(); -} -private void testListener(final String message, final int[] segments, boolean exceptionExpected) { - boolean exceptionThrown = false; - BidiSegmentListener listener = new BidiSegmentListener() { - public void lineGetSegments(BidiSegmentEvent event) { - assertEquals(message + " incorrect BidiSegmentEvent", 0, event.lineOffset); - assertEquals(message + " incorrect BidiSegmentEvent", line, event.lineText); - - event.segments = segments; - listenerCalled = true; - } - }; - - listenerCalled = false; - try { - text.addBidiSegmentListener(listener); - text.getLocationAtOffset(0); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - finally { - text.removeBidiSegmentListener(listener); - } - if (exceptionExpected) { - assertTrue(message + " expected exception not thrown", exceptionThrown); - } - else { - assertTrue(message + " unexpected exception thrown", exceptionThrown == false); - } - if (isBidi()) { - assertTrue(message + " listener not called", listenerCalled); - } - else { - assertTrue(message + " listener called when it shouldn't be", listenerCalled == false); - } -} -private void testStyleRangeSegmenting(final int[] segments, int[] boldRanges) { - boolean exceptionThrown = false; - BidiSegmentListener listener = new BidiSegmentListener() { - public void lineGetSegments(BidiSegmentEvent event) { - assertEquals(" incorrect BidiSegmentEvent", 0, event.lineOffset); - assertEquals(" incorrect BidiSegmentEvent", line, event.lineText); - - event.segments = segments; - listenerCalled = true; - } - }; - - listenerCalled = false; - try { - text.addBidiSegmentListener(listener); - text.setStyleRange(null); - for (int i=0; i<boldRanges.length; i+=2) { - StyleRange styleRange = new StyleRange(boldRanges[i], boldRanges[i+1], null, null, SWT.BOLD); - text.setStyleRange(styleRange); - }; - text.getLocationAtOffset(0); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - finally { - text.removeBidiSegmentListener(listener); - } - assertTrue(" unexpected exception thrown", exceptionThrown == false); - if (isBidi()) { - assertTrue(" listener not called", listenerCalled); - } - else { - assertTrue(" listener called when it shouldn't be", listenerCalled == false); - } -} - -public void test_lineGetSegmentsLorg_eclipse_swt_custom_BidiSegmentEvent() { - int lineLength = line.length(); - - text.setText(line); - // should not cause an exception - testListener(":a:", null, false); - testListener(":b:", new int[] {0, lineLength / 2, lineLength}, false); - testListener(":c:", new int[] {0, lineLength / 2}, false); - - // should all cause an exception on a bidi platform - if (isBidi()) { - testListener(":d:", new int[] {lineLength / 2}, true); - testListener(":e:", new int[] {0, 1, 1, lineLength / 2}, true); - testListener(":f:", new int[] {0, 1, 2, lineLength + 1}, true); - testListener(":g:", new int[] {0, 1, lineLength + 1, lineLength + 1}, true); - testListener(":h:", new int[] {0, 2, 1}, true); - testListener(":i:", new int[] {0, -1, 2}, true); - testListener(":j:", new int[] {0, -1, 2}, true); - } - - // test bold segmenting - line = "this is a line with 50 chars - **** **** **** ****"; - text.setText(line); - // should segment as int[] {0,5,5,2,12,3,20,5} - testStyleRangeSegmenting(new int[] {0,5,10,15,20,25}, new int[] {0,5,5,2,12,3,20,5}); - // should segment as int[] {0,5,5,1,7,3,10,3,15,5,20,5} - testStyleRangeSegmenting(new int[] {0,5,10,15,20,25}, new int[] {0,6,7,6,15,10}); - // should segment as int[] {0,5,5,5,10,5} - testStyleRangeSegmenting(new int[] {0,5,10,15}, new int[] {0,15}); - // should segment as int[] {0,5} - testStyleRangeSegmenting(new int[] {0,5}, new int[] {0,5}); - // should segment as int[] {2,3} - testStyleRangeSegmenting(new int[] {0,5}, new int[] {2,3}); - // should segment as int[] {0,2} - testStyleRangeSegmenting(new int[] {0,5}, new int[] {0,2}); - // should segment as int[] {10,5} - testStyleRangeSegmenting(new int[] {0,5,10,15}, new int[] {10,5}); - // should segment as int[] {12,3} - testStyleRangeSegmenting(new int[] {0,5,10,15}, new int[] {12,3}); - // should segment as int[] {3,2,5,5,10,3,21,4,25,3} - testStyleRangeSegmenting(new int[] {0,5,10,15,20,25,30}, new int[] {3,10,21,7}); - // should segment as int[] {10,2} - line = "test1test2/r/n"; - text.setText(line); - testStyleRangeSegmenting(new int[] {0,5}, new int[] {10,2}); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_lineGetSegmentsLorg_eclipse_swt_custom_BidiSegmentEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_lineGetSegmentsLorg_eclipse_swt_custom_BidiSegmentEvent")) test_lineGetSegmentsLorg_eclipse_swt_custom_BidiSegmentEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BusyIndicator.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BusyIndicator.java deleted file mode 100644 index d7856c004d..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BusyIndicator.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.BusyIndicator - * - * @see org.eclipse.swt.custom.BusyIndicator - */ -public class Test_org_eclipse_swt_custom_BusyIndicator extends SwtTestCase { - -public Test_org_eclipse_swt_custom_BusyIndicator(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_showWhileLorg_eclipse_swt_widgets_DisplayLjava_lang_Runnable() { - warnUnimpl("Test test_showWhileLorg_eclipse_swt_widgets_DisplayLjava_lang_Runnable not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_BusyIndicator((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_showWhileLorg_eclipse_swt_widgets_DisplayLjava_lang_Runnable"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_showWhileLorg_eclipse_swt_widgets_DisplayLjava_lang_Runnable")) test_showWhileLorg_eclipse_swt_widgets_DisplayLjava_lang_Runnable(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java deleted file mode 100644 index f0ef4be0e1..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java +++ /dev/null @@ -1,294 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.CCombo - * - * @see org.eclipse.swt.custom.CCombo - */ -public class Test_org_eclipse_swt_custom_CCombo extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_custom_CCombo(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_addLjava_lang_String() { - warnUnimpl("Test test_addLjava_lang_String not written"); -} - -public void test_addLjava_lang_StringI() { - warnUnimpl("Test test_addLjava_lang_StringI not written"); -} - -public void test_addModifyListenerLorg_eclipse_swt_events_ModifyListener() { - warnUnimpl("Test test_addModifyListenerLorg_eclipse_swt_events_ModifyListener not written"); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_clearSelection() { - warnUnimpl("Test test_clearSelection not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_deselectI() { - warnUnimpl("Test test_deselectI not written"); -} - -public void test_deselectAll() { - warnUnimpl("Test test_deselectAll not written"); -} - -public void test_getChildren() { - warnUnimpl("Test test_getChildren not written"); -} - -public void test_getItemI() { - warnUnimpl("Test test_getItemI not written"); -} - -public void test_getItemCount() { - warnUnimpl("Test test_getItemCount not written"); -} - -public void test_getItemHeight() { - warnUnimpl("Test test_getItemHeight not written"); -} - -public void test_getItems() { - warnUnimpl("Test test_getItems not written"); -} - -public void test_getSelection() { - warnUnimpl("Test test_getSelection not written"); -} - -public void test_getSelectionIndex() { - warnUnimpl("Test test_getSelectionIndex not written"); -} - -public void test_getText() { - warnUnimpl("Test test_getText not written"); -} - -public void test_getTextHeight() { - warnUnimpl("Test test_getTextHeight not written"); -} - -public void test_getTextLimit() { - warnUnimpl("Test test_getTextLimit not written"); -} - -public void test_indexOfLjava_lang_String() { - warnUnimpl("Test test_indexOfLjava_lang_String not written"); -} - -public void test_indexOfLjava_lang_StringI() { - warnUnimpl("Test test_indexOfLjava_lang_StringI not written"); -} - -public void test_isFocusControl() { - warnUnimpl("Test test_isFocusControl not written"); -} - -public void test_redrawIIIIZ() { - warnUnimpl("Test test_redrawIIIIZ not written"); -} - -public void test_removeI() { - warnUnimpl("Test test_removeI not written"); -} - -public void test_removeII() { - warnUnimpl("Test test_removeII not written"); -} - -public void test_removeLjava_lang_String() { - warnUnimpl("Test test_removeLjava_lang_String not written"); -} - -public void test_removeAll() { - warnUnimpl("Test test_removeAll not written"); -} - -public void test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener() { - warnUnimpl("Test test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener not written"); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_selectI() { - warnUnimpl("Test test_selectI not written"); -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setBackgroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setFocus() { - warnUnimpl("Test test_setFocus not written"); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written"); -} - -public void test_setForegroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setForegroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setItemILjava_lang_String() { - warnUnimpl("Test test_setItemILjava_lang_String not written"); -} - -public void test_setItems$Ljava_lang_String() { - warnUnimpl("Test test_setItems$Ljava_lang_String not written"); -} - -public void test_setSelectionLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_setSelectionLorg_eclipse_swt_graphics_Point not written"); -} - -public void test_setTextLjava_lang_String() { - warnUnimpl("Test test_setTextLjava_lang_String not written"); -} - -public void test_setTextLimitI() { - warnUnimpl("Test test_setTextLimitI not written"); -} - -public void test_setVisibleZ() { - warnUnimpl("Test test_setVisibleZ not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_CCombo((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addLjava_lang_String"); - methodNames.addElement("test_addLjava_lang_StringI"); - methodNames.addElement("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_clearSelection"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_deselectI"); - methodNames.addElement("test_deselectAll"); - methodNames.addElement("test_getChildren"); - methodNames.addElement("test_getItemI"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItemHeight"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionIndex"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_getTextHeight"); - methodNames.addElement("test_getTextLimit"); - methodNames.addElement("test_indexOfLjava_lang_String"); - methodNames.addElement("test_indexOfLjava_lang_StringI"); - methodNames.addElement("test_isFocusControl"); - methodNames.addElement("test_redrawIIIIZ"); - methodNames.addElement("test_removeI"); - methodNames.addElement("test_removeII"); - methodNames.addElement("test_removeLjava_lang_String"); - methodNames.addElement("test_removeAll"); - methodNames.addElement("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_selectI"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setFocus"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setForegroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setItemILjava_lang_String"); - methodNames.addElement("test_setItems$Ljava_lang_String"); - methodNames.addElement("test_setSelectionLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_setTextLimitI"); - methodNames.addElement("test_setVisibleZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addLjava_lang_String")) test_addLjava_lang_String(); - else if (getName().equals("test_addLjava_lang_StringI")) test_addLjava_lang_StringI(); - else if (getName().equals("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_addModifyListenerLorg_eclipse_swt_events_ModifyListener(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_clearSelection")) test_clearSelection(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_deselectI")) test_deselectI(); - else if (getName().equals("test_deselectAll")) test_deselectAll(); - else if (getName().equals("test_getChildren")) test_getChildren(); - else if (getName().equals("test_getItemI")) test_getItemI(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItemHeight")) test_getItemHeight(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionIndex")) test_getSelectionIndex(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_getTextHeight")) test_getTextHeight(); - else if (getName().equals("test_getTextLimit")) test_getTextLimit(); - else if (getName().equals("test_indexOfLjava_lang_String")) test_indexOfLjava_lang_String(); - else if (getName().equals("test_indexOfLjava_lang_StringI")) test_indexOfLjava_lang_StringI(); - else if (getName().equals("test_isFocusControl")) test_isFocusControl(); - else if (getName().equals("test_redrawIIIIZ")) test_redrawIIIIZ(); - else if (getName().equals("test_removeI")) test_removeI(); - else if (getName().equals("test_removeII")) test_removeII(); - else if (getName().equals("test_removeLjava_lang_String")) test_removeLjava_lang_String(); - else if (getName().equals("test_removeAll")) test_removeAll(); - else if (getName().equals("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_selectI")) test_selectI(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setFocus")) test_setFocus(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setForegroundLorg_eclipse_swt_graphics_Color")) test_setForegroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setItemILjava_lang_String")) test_setItemILjava_lang_String(); - else if (getName().equals("test_setItems$Ljava_lang_String")) test_setItems$Ljava_lang_String(); - else if (getName().equals("test_setSelectionLorg_eclipse_swt_graphics_Point")) test_setSelectionLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_setTextLimitI")) test_setTextLimitI(); - else if (getName().equals("test_setVisibleZ")) test_setVisibleZ(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CLabel.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CLabel.java deleted file mode 100644 index e6da2a07cc..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CLabel.java +++ /dev/null @@ -1,138 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.CLabel - * - * @see org.eclipse.swt.custom.CLabel - */ -public class Test_org_eclipse_swt_custom_CLabel extends Test_org_eclipse_swt_widgets_Canvas { - -public Test_org_eclipse_swt_custom_CLabel(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_getAlignment() { - warnUnimpl("Test test_getAlignment not written"); -} - -public void test_getImage() { - warnUnimpl("Test test_getImage not written"); -} - -public void test_setToolTipTextLjava_lang_String() { - warnUnimpl("Test test_setToolTipTextLjava_lang_String not written"); -} - -public void test_getText() { - warnUnimpl("Test test_getText not written"); -} - -public void test_getToolTipText() { - warnUnimpl("Test test_getToolTipText not written"); -} - -public void test_setAlignmentI() { - warnUnimpl("Test test_setAlignmentI not written"); -} - -public void test_setBackground$Lorg_eclipse_swt_graphics_Color$I() { - warnUnimpl("Test test_setBackground$Lorg_eclipse_swt_graphics_Color$I not written"); -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setBackgroundLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written"); -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setTextLjava_lang_String() { - warnUnimpl("Test test_setTextLjava_lang_String not written"); -} - -public void test_shortenTextLorg_eclipse_swt_graphics_GCLjava_lang_StringI() { - warnUnimpl("Test test_shortenTextLorg_eclipse_swt_graphics_GCLjava_lang_StringI not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_CLabel((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_getAlignment"); - methodNames.addElement("test_getImage"); - methodNames.addElement("test_setToolTipTextLjava_lang_String"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_getToolTipText"); - methodNames.addElement("test_setAlignmentI"); - methodNames.addElement("test_setBackground$Lorg_eclipse_swt_graphics_Color$I"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_shortenTextLorg_eclipse_swt_graphics_GCLjava_lang_StringI"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Canvas.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_getAlignment")) test_getAlignment(); - else if (getName().equals("test_getImage")) test_getImage(); - else if (getName().equals("test_setToolTipTextLjava_lang_String")) test_setToolTipTextLjava_lang_String(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_getToolTipText")) test_getToolTipText(); - else if (getName().equals("test_setAlignmentI")) test_setAlignmentI(); - else if (getName().equals("test_setBackground$Lorg_eclipse_swt_graphics_Color$I")) test_setBackground$Lorg_eclipse_swt_graphics_Color$I(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Image")) test_setBackgroundLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_shortenTextLorg_eclipse_swt_graphics_GCLjava_lang_StringI")) test_shortenTextLorg_eclipse_swt_graphics_GCLjava_lang_StringI(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolder.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolder.java deleted file mode 100644 index 122fd9d50e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolder.java +++ /dev/null @@ -1,222 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.CTabFolder - * - * @see org.eclipse.swt.custom.CTabFolder - */ -public class Test_org_eclipse_swt_custom_CTabFolder extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_custom_CTabFolder(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_addCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener() { - warnUnimpl("Test test_addCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_computeTrimIIII() { - warnUnimpl("Test test_computeTrimIIII not written"); -} - -public void test_onFocusLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_onFocusLorg_eclipse_swt_widgets_Event not written"); -} - -public void test_getClientArea() { - warnUnimpl("Test test_getClientArea not written"); -} - -public void test_getTabHeight() { - warnUnimpl("Test test_getTabHeight not written"); -} - -public void test_getItemI() { - warnUnimpl("Test test_getItemI not written"); -} - -public void test_getItemLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_getItemLorg_eclipse_swt_graphics_Point not written"); -} - -public void test_getItemCount() { - warnUnimpl("Test test_getItemCount not written"); -} - -public void test_getItems() { - warnUnimpl("Test test_getItems not written"); -} - -public void test_getSelection() { - warnUnimpl("Test test_getSelection not written"); -} - -public void test_getSelectionIndex() { - warnUnimpl("Test test_getSelectionIndex not written"); -} - -public void test_indexOfLorg_eclipse_swt_custom_CTabItem() { - warnUnimpl("Test test_indexOfLorg_eclipse_swt_custom_CTabItem not written"); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_removeCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener() { - warnUnimpl("Test test_removeCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener not written"); -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setBackgroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setSelectionBackground$Lorg_eclipse_swt_graphics_Color$I() { - warnUnimpl("Test test_setSelectionBackground$Lorg_eclipse_swt_graphics_Color$I not written"); -} - -public void test_setSelectionBackgroundLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setSelectionBackgroundLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setBorderVisibleZ() { - warnUnimpl("Test test_setBorderVisibleZ not written"); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written"); -} - -public void test_setSelectionForegroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setSelectionForegroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setInsertMarkLorg_eclipse_swt_custom_CTabItemZ() { - warnUnimpl("Test test_setInsertMarkLorg_eclipse_swt_custom_CTabItemZ not written"); -} - -public void test_setInsertMarkIZ() { - warnUnimpl("Test test_setInsertMarkIZ not written"); -} - -public void test_setSelectionI() { - warnUnimpl("Test test_setSelectionI not written"); -} - -public void test_setSelectionLorg_eclipse_swt_custom_CTabItem() { - warnUnimpl("Test test_setSelectionLorg_eclipse_swt_custom_CTabItem not written"); -} - -public void test_setTabHeightI() { - warnUnimpl("Test test_setTabHeightI not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_CTabFolder((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_addCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_computeTrimIIII"); - methodNames.addElement("test_onFocusLorg_eclipse_swt_widgets_Event"); - methodNames.addElement("test_getClientArea"); - methodNames.addElement("test_getTabHeight"); - methodNames.addElement("test_getItemI"); - methodNames.addElement("test_getItemLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionIndex"); - methodNames.addElement("test_indexOfLorg_eclipse_swt_custom_CTabItem"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_removeCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setSelectionBackground$Lorg_eclipse_swt_graphics_Color$I"); - methodNames.addElement("test_setSelectionBackgroundLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setBorderVisibleZ"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setSelectionForegroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setInsertMarkLorg_eclipse_swt_custom_CTabItemZ"); - methodNames.addElement("test_setInsertMarkIZ"); - methodNames.addElement("test_setSelectionI"); - methodNames.addElement("test_setSelectionLorg_eclipse_swt_custom_CTabItem"); - methodNames.addElement("test_setTabHeightI"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_addCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener")) test_addCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII(); - else if (getName().equals("test_onFocusLorg_eclipse_swt_widgets_Event")) test_onFocusLorg_eclipse_swt_widgets_Event(); - else if (getName().equals("test_getClientArea")) test_getClientArea(); - else if (getName().equals("test_getTabHeight")) test_getTabHeight(); - else if (getName().equals("test_getItemI")) test_getItemI(); - else if (getName().equals("test_getItemLorg_eclipse_swt_graphics_Point")) test_getItemLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionIndex")) test_getSelectionIndex(); - else if (getName().equals("test_indexOfLorg_eclipse_swt_custom_CTabItem")) test_indexOfLorg_eclipse_swt_custom_CTabItem(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_removeCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener")) test_removeCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setSelectionBackground$Lorg_eclipse_swt_graphics_Color$I")) test_setSelectionBackground$Lorg_eclipse_swt_graphics_Color$I(); - else if (getName().equals("test_setSelectionBackgroundLorg_eclipse_swt_graphics_Image")) test_setSelectionBackgroundLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setBorderVisibleZ")) test_setBorderVisibleZ(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setSelectionForegroundLorg_eclipse_swt_graphics_Color")) test_setSelectionForegroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setInsertMarkLorg_eclipse_swt_custom_CTabItemZ")) test_setInsertMarkLorg_eclipse_swt_custom_CTabItemZ(); - else if (getName().equals("test_setInsertMarkIZ")) test_setInsertMarkIZ(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else if (getName().equals("test_setSelectionLorg_eclipse_swt_custom_CTabItem")) test_setSelectionLorg_eclipse_swt_custom_CTabItem(); - else if (getName().equals("test_setTabHeightI")) test_setTabHeightI(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderAdapter.java deleted file mode 100644 index 3d291123e5..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderAdapter.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.CTabFolderAdapter - * - * @see org.eclipse.swt.custom.CTabFolderAdapter - */ -public class Test_org_eclipse_swt_custom_CTabFolderAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_custom_CTabFolderAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent() { - warnUnimpl("Test test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_CTabFolderAdapter((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent")) test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderEvent.java deleted file mode 100644 index ba4de07b11..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderEvent.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.CTabFolderEvent - * - * @see org.eclipse.swt.custom.CTabFolderEvent - */ -public class Test_org_eclipse_swt_custom_CTabFolderEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_custom_CTabFolderEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_CTabFolderEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderListener.java deleted file mode 100644 index 4de5de656a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderListener.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.CTabFolderListener - * - * @see org.eclipse.swt.custom.CTabFolderListener - */ -public class Test_org_eclipse_swt_custom_CTabFolderListener extends SwtTestCase { - -public Test_org_eclipse_swt_custom_CTabFolderListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent() { - warnUnimpl("Test test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent")) test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabItem.java deleted file mode 100644 index 35f8a51e92..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabItem.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.CTabItem - * - * @see org.eclipse.swt.custom.CTabItem - */ -public class Test_org_eclipse_swt_custom_CTabItem extends Test_org_eclipse_swt_widgets_Item { - - CTabFolder cTabFolder; - CTabItem cTabItem; - -public Test_org_eclipse_swt_custom_CTabItem(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - cTabFolder = new CTabFolder(shell, SWT.NONE); - cTabItem = new CTabItem(cTabFolder, SWT.NONE); - setWidget(cTabItem); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_custom_CTabFolderI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_CTabFolderI not written"); -} - -public void test_ConstructorLorg_eclipse_swt_custom_CTabFolderII() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_CTabFolderII not written"); -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_getBounds() { - warnUnimpl("Test test_getBounds not written"); -} - -public void test_getControl() { - warnUnimpl("Test test_getControl not written"); -} - -public void test_getDisplay() { - warnUnimpl("Test test_getDisplay not written"); -} - -public void test_getDisabledImage() { - warnUnimpl("Test test_getDisabledImage not written"); -} - -public void test_getParent() { - warnUnimpl("Test test_getParent not written"); -} - -public void test_getToolTipText() { - warnUnimpl("Test test_getToolTipText not written"); -} - -public void test_setControlLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setControlLorg_eclipse_swt_widgets_Control not written"); -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setDisabledImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setDisabledImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setTextLjava_lang_String() { - warnUnimpl("Test test_setTextLjava_lang_String not written"); -} - -public void test_setToolTipTextLjava_lang_String() { - warnUnimpl("Test test_setToolTipTextLjava_lang_String not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_CTabItem((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_CTabFolderI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_CTabFolderII"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getControl"); - methodNames.addElement("test_getDisplay"); - methodNames.addElement("test_getDisabledImage"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getToolTipText"); - methodNames.addElement("test_setControlLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setDisabledImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_setToolTipTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_CTabFolderI")) test_ConstructorLorg_eclipse_swt_custom_CTabFolderI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_CTabFolderII")) test_ConstructorLorg_eclipse_swt_custom_CTabFolderII(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getControl")) test_getControl(); - else if (getName().equals("test_getDisplay")) test_getDisplay(); - else if (getName().equals("test_getDisabledImage")) test_getDisabledImage(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getToolTipText")) test_getToolTipText(); - else if (getName().equals("test_setControlLorg_eclipse_swt_widgets_Control")) test_setControlLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setDisabledImageLorg_eclipse_swt_graphics_Image")) test_setDisabledImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_setToolTipTextLjava_lang_String")) test_setToolTipTextLjava_lang_String(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ControlEditor.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ControlEditor.java deleted file mode 100644 index d05aa3f2fc..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ControlEditor.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.ControlEditor - * - * @see org.eclipse.swt.custom.ControlEditor - */ -public class Test_org_eclipse_swt_custom_ControlEditor extends SwtTestCase { - -public Test_org_eclipse_swt_custom_ControlEditor(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Composite() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Composite not written"); -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_getEditor() { - warnUnimpl("Test test_getEditor not written"); -} - -public void test_setEditorLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setEditorLorg_eclipse_swt_widgets_Control not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_ControlEditor((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Composite"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getEditor"); - methodNames.addElement("test_setEditorLorg_eclipse_swt_widgets_Control"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Composite")) test_ConstructorLorg_eclipse_swt_widgets_Composite(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getEditor")) test_getEditor(); - else if (getName().equals("test_setEditorLorg_eclipse_swt_widgets_Control")) test_setEditorLorg_eclipse_swt_widgets_Control(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyEvent.java deleted file mode 100644 index 9f23339d0d..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.ExtendedModifyEvent - * - * @see org.eclipse.swt.custom.ExtendedModifyEvent - */ -public class Test_org_eclipse_swt_custom_ExtendedModifyEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_custom_ExtendedModifyEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent() { - // this method tested by other test classes -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_ExtendedModifyEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent")) test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyListener.java deleted file mode 100644 index 2d64f17552..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyListener.java +++ /dev/null @@ -1,317 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.ExtendedModifyListener - * - * @see org.eclipse.swt.custom.ExtendedModifyListener - */ -public class Test_org_eclipse_swt_custom_ExtendedModifyListener extends SwtTestCase { - Shell shell; - StyledText styledText; - int verify = -1; - -public Test_org_eclipse_swt_custom_ExtendedModifyListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} -protected void setUp() { - shell = new Shell(); - styledText = new StyledText(shell, SWT.NULL); - shell.open(); -} -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_ExtendedModifyListener((String)e.nextElement())); - } - return suite; -} -public void test_modifyTextLorg_eclipse_swt_custom_ExtendedModifyEvent() { - ExtendedModifyListener listener = new ExtendedModifyListener() { - public void modifyText(ExtendedModifyEvent event) { - switch(verify) { - case 1 : { - assertTrue(":1a:", event.start == 0); - assertTrue(":1b:", event.length == 1); - assertTrue(":1c:", event.replacedText.equals("")); - break; - } - case 2 : { - assertTrue(":2a:", event.start == 0); - assertTrue(":2b:", event.length == 1); - assertTrue(":2c:", event.replacedText.equals("\n\n")); - break; - } - case 3 : { - assertTrue(":3a:", event.start == 0); - assertTrue(":3b:", event.length == 2); - assertTrue(":3c:", event.replacedText.equals("a")); - break; - } - case 4: { - assertTrue(":4:", false); - break; - } - case 5 : { - assertTrue(":5a:", event.start == 0); - assertTrue(":5b:", event.length == 1); - assertTrue(":5c:", event.replacedText.equals("")); - break; - } - case 6 : { - assertTrue(":6a:", event.start == 21); - assertTrue(":6b:", event.length == 0); - assertTrue(":6c:", event.replacedText.equals("\nline 4")); - break; - } - case 7 : { - assertTrue(":7a:", event.start == 5); - assertTrue(":7b:", event.length == 0); - assertTrue(":7c:", event.replacedText.equals("is a test")); - break; - } - case 8 : { - assertTrue(":8a:", event.start == 7); - assertTrue(":8b:", event.length == 0); - assertTrue(":8c:", event.replacedText.equals("\r\n")); - break; - } - case 9 : { - assertTrue(":9a:", event.start == 2); - assertTrue(":9b:", event.length == 4); - assertTrue(":9c:", event.replacedText.equals("\r\n")); - break; - } - case 10:{ - assertTrue(":10:", false); - break; - } - case 11: { - assertTrue(":11:", false); - break; - } - case 12: { - assertTrue(":12a:", event.start == 3); - assertTrue(":12b:", event.length == 1); - assertTrue(":12c:", event.replacedText.equals("")); - break; - } - case 13: { - assertTrue(":13a:", event.start == 2); - assertTrue(":13b:", event.length == 1); - assertTrue(":13c:", event.replacedText.equals("")); - break; - } - case 14: { - assertTrue(":14:", false); - break; - } - case 15: { - assertTrue(":15a:", event.start == 2); - assertTrue(":15b:", event.length == 6); - assertTrue(":15c:", event.replacedText.equals("\r\n")); - break; - } - case 16:{ - assertTrue(":16:", false); - break; - } - case 17: { - assertTrue(":17:", false); - break; - } - case 18: { - assertTrue(":18a:", event.start == 3); - assertTrue(":18b:", event.length == 7); - assertTrue(":18c:", event.replacedText.equals("")); - break; - } - case 19: { - assertTrue(":19a:", event.start == 2); - assertTrue(":19b:", event.length == 7); - assertTrue(":19c:", event.replacedText.equals("")); - break; - } - case 20: { - assertTrue(":20:", false); - break; - } - case 21: { - assertTrue(":21a:", event.start == 0); - assertTrue(":21b:", event.length == 16); - assertTrue(":21c:", event.replacedText.equals("L1\r\nL2\r\nL3\r\nL4\r\n")); - break; - } - } - } - }; - styledText.addExtendedModifyListener(listener); - - boolean exceptionHandled = false; - verify = 0; - styledText.setText("testing"); - verify = 1; - styledText.replaceTextRange(0, 0, "\n"); - - verify = 0; - styledText.setText("\n\n"); - verify = 2; - styledText.replaceTextRange(0, 2, "a"); - - verify = 0; - styledText.setText("a"); - verify = 3; - styledText.replaceTextRange(0, 1, "\n\n"); - - verify = 0; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - verify = 4; - try {styledText.replaceTextRange(3, 1, "test\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":4: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("Line 1\r\nLine 2"); - verify = 5; - styledText.replaceTextRange(0, 0, "\r"); - - verify = 0; - styledText.setText("This\nis a test\nline 3\nline 4"); - verify = 6; - styledText.replaceTextRange(21, 7, ""); - - verify = 0; - styledText.setText("This\nis a test\r"); - verify = 7; - styledText.replaceTextRange(5, 9, ""); - - verify = 0; - styledText.setText("\nL1\r\nL2\r\n"); - verify = 8; - styledText.replaceTextRange(7, 2, ""); - - verify = 0; - styledText.setText("L1\r\n"); - verify = 9; - styledText.replaceTextRange(2, 2, "test"); - - verify = 0; - styledText.setText("L1\r\n"); - verify = 10; - try {styledText.replaceTextRange(3, 1, "");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":10: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - verify = 11; - try {styledText.replaceTextRange(1, 2, "");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":11: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r"); - verify = 12; - styledText.replaceTextRange(3, 0, "\n"); - - verify = 0; - styledText.setText("L1\n"); - verify = 13; - styledText.replaceTextRange(2, 0, "\r"); - - verify = 0; - styledText.setText("L1\r\n"); - verify = 14; - try {styledText.replaceTextRange(3, 0, "test");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":14: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r\n"); - verify = 15; - styledText.replaceTextRange(2, 2, "test\n\n"); - - verify = 0; - styledText.setText("L1\r\n"); - verify = 16; - try {styledText.replaceTextRange(3, 1, "test\r\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":16: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - verify = 17; - try {styledText.replaceTextRange(1, 2, "test\n\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":17: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r"); - verify = 18; - styledText.replaceTextRange(3, 0, "\ntest\r\n"); - - verify = 0; - styledText.setText("L1\n"); - verify = 19; - styledText.replaceTextRange(2, 0, "test\r\r\r"); - - verify = 0; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - verify = 20; - try {styledText.replaceTextRange(3, 1, "test\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":20: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 21; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - styledText.removeExtendedModifyListener(listener); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_modifyTextLorg_eclipse_swt_custom_ExtendedModifyEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_modifyTextLorg_eclipse_swt_custom_ExtendedModifyEvent")) test_modifyTextLorg_eclipse_swt_custom_ExtendedModifyEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundEvent.java deleted file mode 100644 index f69a0cfb48..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.LineBackgroundEvent - * - * @see org.eclipse.swt.custom.LineBackgroundEvent - */ -public class Test_org_eclipse_swt_custom_LineBackgroundEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_custom_LineBackgroundEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent() { - // this method tested by other test classes -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_LineBackgroundEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent")) test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundListener.java deleted file mode 100644 index 86fb99ebc4..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundListener.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.LineBackgroundListener - * - * @see org.eclipse.swt.custom.LineBackgroundListener - */ -public class Test_org_eclipse_swt_custom_LineBackgroundListener extends SwtTestCase { - Shell shell; - StyledText styledText; - -public Test_org_eclipse_swt_custom_LineBackgroundListener(String name) { - super(name); -} -public static void main(String[] args) { - TestRunner.run(suite()); -} -protected void setUp() { - shell = new Shell(); - styledText = new StyledText(shell, SWT.NULL); - shell.open(); -} -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_LineBackgroundListener((String)e.nextElement())); - } - return suite; -} -protected void tearDown() { -} - -public void test_lineGetBackgroundLorg_eclipse_swt_custom_LineBackgroundEvent() { - LineBackgroundListener listener = new LineBackgroundListener() { - public void lineGetBackground(LineBackgroundEvent event) { - assertTrue(":1:", event.lineOffset==0); - assertTrue(":2:",event.lineText.equals("0123456789")); - } - }; - styledText.addLineBackgroundListener(listener); - styledText.setText("0123456789"); - // force get line bg callback - styledText.selectAll(); - styledText.copy(); - styledText.removeLineBackgroundListener(listener); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_lineGetBackgroundLorg_eclipse_swt_custom_LineBackgroundEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_lineGetBackgroundLorg_eclipse_swt_custom_LineBackgroundEvent")) test_lineGetBackgroundLorg_eclipse_swt_custom_LineBackgroundEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleEvent.java deleted file mode 100644 index 518ff4f3c7..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.LineStyleEvent - * - * @see org.eclipse.swt.custom.LineStyleEvent - */ -public class Test_org_eclipse_swt_custom_LineStyleEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_custom_LineStyleEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent() { - // this method tested by other test classes -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_LineStyleEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent")) test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleListener.java deleted file mode 100644 index 30f55faa8e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleListener.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.LineStyleListener - * - * @see org.eclipse.swt.custom.LineStyleListener - */ -public class Test_org_eclipse_swt_custom_LineStyleListener extends SwtTestCase { - Shell shell; - StyledText styledText; - -public Test_org_eclipse_swt_custom_LineStyleListener(String name) { - super(name); -} -public static void main(String[] args) { - TestRunner.run(suite()); -} -protected void setUp() { - shell = new Shell(); - styledText = new StyledText(shell, SWT.NULL); - shell.open(); -} -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_LineStyleListener((String)e.nextElement())); - } - return suite; -} -protected void tearDown() { -} - -public void test_lineGetStyleLorg_eclipse_swt_custom_LineStyleEvent() { - LineStyleListener listener = new LineStyleListener() { - public void lineGetStyle(LineStyleEvent event) { - assertTrue(":1:", event.lineOffset==0); - assertTrue(":2:",event.lineText.equals("0123456789")); - } - }; - styledText.addLineStyleListener(listener); - styledText.setText("0123456789"); - // force get line styles callback - styledText.getLocationAtOffset(5); - styledText.removeLineStyleListener(listener); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_lineGetStyleLorg_eclipse_swt_custom_LineStyleEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_lineGetStyleLorg_eclipse_swt_custom_LineStyleEvent")) test_lineGetStyleLorg_eclipse_swt_custom_LineStyleEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_PopupList.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_PopupList.java deleted file mode 100644 index 4cb67a5921..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_PopupList.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.PopupList - * - * @see org.eclipse.swt.custom.PopupList - */ -public class Test_org_eclipse_swt_custom_PopupList extends SwtTestCase { - -public Test_org_eclipse_swt_custom_PopupList(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Shell() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Shell not written"); -} - -public void test_getFont() { - warnUnimpl("Test test_getFont not written"); -} - -public void test_getItems() { - warnUnimpl("Test test_getItems not written"); -} - -public void test_getMinimumWidth() { - warnUnimpl("Test test_getMinimumWidth not written"); -} - -public void test_openLorg_eclipse_swt_graphics_Rectangle() { - warnUnimpl("Test test_openLorg_eclipse_swt_graphics_Rectangle not written"); -} - -public void test_selectLjava_lang_String() { - warnUnimpl("Test test_selectLjava_lang_String not written"); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written"); -} - -public void test_setItems$Ljava_lang_String() { - warnUnimpl("Test test_setItems$Ljava_lang_String not written"); -} - -public void test_setMinimumWidthI() { - warnUnimpl("Test test_setMinimumWidthI not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_PopupList((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell"); - methodNames.addElement("test_getFont"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getMinimumWidth"); - methodNames.addElement("test_openLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_selectLjava_lang_String"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setItems$Ljava_lang_String"); - methodNames.addElement("test_setMinimumWidthI"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell(); - else if (getName().equals("test_getFont")) test_getFont(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getMinimumWidth")) test_getMinimumWidth(); - else if (getName().equals("test_openLorg_eclipse_swt_graphics_Rectangle")) test_openLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_selectLjava_lang_String")) test_selectLjava_lang_String(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setItems$Ljava_lang_String")) test_setItems$Ljava_lang_String(); - else if (getName().equals("test_setMinimumWidthI")) test_setMinimumWidthI(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ST.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ST.java deleted file mode 100644 index 4b040d6e2f..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ST.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.ST - * - * @see org.eclipse.swt.custom.ST - */ -public class Test_org_eclipse_swt_custom_ST extends SwtTestCase { - -public Test_org_eclipse_swt_custom_ST(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - // doesn't make sense to test this, ST is constants class -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_ST((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_SashForm.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_SashForm.java deleted file mode 100644 index 05dbcbdfed..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_SashForm.java +++ /dev/null @@ -1,114 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.SashForm - * - * @see org.eclipse.swt.custom.SashForm - */ -public class Test_org_eclipse_swt_custom_SashForm extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_custom_SashForm(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_getOrientation() { - warnUnimpl("Test test_getOrientation not written"); -} - -public void test_getMaximizedControl() { - warnUnimpl("Test test_getMaximizedControl not written"); -} - -public void test_getWeights() { - warnUnimpl("Test test_getWeights not written"); -} - -public void test_layoutZ() { - warnUnimpl("Test test_layoutZ not written"); -} - -public void test_setOrientationI() { - warnUnimpl("Test test_setOrientationI not written"); -} - -public void test_setLayoutLorg_eclipse_swt_widgets_Layout() { - warnUnimpl("Test test_setLayoutLorg_eclipse_swt_widgets_Layout not written"); -} - -public void test_setMaximizedControlLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setMaximizedControlLorg_eclipse_swt_widgets_Control not written"); -} - -public void test_setWeights$I() { - warnUnimpl("Test test_setWeights$I not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_SashForm((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_getOrientation"); - methodNames.addElement("test_getMaximizedControl"); - methodNames.addElement("test_getWeights"); - methodNames.addElement("test_layoutZ"); - methodNames.addElement("test_setOrientationI"); - methodNames.addElement("test_setLayoutLorg_eclipse_swt_widgets_Layout"); - methodNames.addElement("test_setMaximizedControlLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setWeights$I"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_getOrientation")) test_getOrientation(); - else if (getName().equals("test_getMaximizedControl")) test_getMaximizedControl(); - else if (getName().equals("test_getWeights")) test_getWeights(); - else if (getName().equals("test_layoutZ")) test_layoutZ(); - else if (getName().equals("test_setOrientationI")) test_setOrientationI(); - else if (getName().equals("test_setLayoutLorg_eclipse_swt_widgets_Layout")) test_setLayoutLorg_eclipse_swt_widgets_Layout(); - else if (getName().equals("test_setMaximizedControlLorg_eclipse_swt_widgets_Control")) test_setMaximizedControlLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setWeights$I")) test_setWeights$I(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ScrolledComposite.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ScrolledComposite.java deleted file mode 100644 index 50f9a1fd41..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ScrolledComposite.java +++ /dev/null @@ -1,132 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.ScrolledComposite - * - * @see org.eclipse.swt.custom.ScrolledComposite - */ -public class Test_org_eclipse_swt_custom_ScrolledComposite extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_custom_ScrolledComposite(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_getAlwaysShowScrollBars() { - warnUnimpl("Test test_getAlwaysShowScrollBars not written"); -} - -public void test_getContent() { - warnUnimpl("Test test_getContent not written"); -} - -public void test_layoutZ() { - warnUnimpl("Test test_layoutZ not written"); -} - -public void test_setAlwaysShowScrollBarsZ() { - warnUnimpl("Test test_setAlwaysShowScrollBarsZ not written"); -} - -public void test_setContentLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setContentLorg_eclipse_swt_widgets_Control not written"); -} - -public void test_setExpandHorizontalZ() { - warnUnimpl("Test test_setExpandHorizontalZ not written"); -} - -public void test_setExpandVerticalZ() { - warnUnimpl("Test test_setExpandVerticalZ not written"); -} - -public void test_setLayoutLorg_eclipse_swt_widgets_Layout() { - warnUnimpl("Test test_setLayoutLorg_eclipse_swt_widgets_Layout not written"); -} - -public void test_setMinHeightI() { - warnUnimpl("Test test_setMinHeightI not written"); -} - -public void test_setMinSizeLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_setMinSizeLorg_eclipse_swt_graphics_Point not written"); -} - -public void test_setMinSizeII() { - warnUnimpl("Test test_setMinSizeII not written"); -} - -public void test_setMinWidthI() { - warnUnimpl("Test test_setMinWidthI not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_ScrolledComposite((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_getAlwaysShowScrollBars"); - methodNames.addElement("test_getContent"); - methodNames.addElement("test_layoutZ"); - methodNames.addElement("test_setAlwaysShowScrollBarsZ"); - methodNames.addElement("test_setContentLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setExpandHorizontalZ"); - methodNames.addElement("test_setExpandVerticalZ"); - methodNames.addElement("test_setLayoutLorg_eclipse_swt_widgets_Layout"); - methodNames.addElement("test_setMinHeightI"); - methodNames.addElement("test_setMinSizeLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setMinSizeII"); - methodNames.addElement("test_setMinWidthI"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_getAlwaysShowScrollBars")) test_getAlwaysShowScrollBars(); - else if (getName().equals("test_getContent")) test_getContent(); - else if (getName().equals("test_layoutZ")) test_layoutZ(); - else if (getName().equals("test_setAlwaysShowScrollBarsZ")) test_setAlwaysShowScrollBarsZ(); - else if (getName().equals("test_setContentLorg_eclipse_swt_widgets_Control")) test_setContentLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setExpandHorizontalZ")) test_setExpandHorizontalZ(); - else if (getName().equals("test_setExpandVerticalZ")) test_setExpandVerticalZ(); - else if (getName().equals("test_setLayoutLorg_eclipse_swt_widgets_Layout")) test_setLayoutLorg_eclipse_swt_widgets_Layout(); - else if (getName().equals("test_setMinHeightI")) test_setMinHeightI(); - else if (getName().equals("test_setMinSizeLorg_eclipse_swt_graphics_Point")) test_setMinSizeLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setMinSizeII")) test_setMinSizeII(); - else if (getName().equals("test_setMinWidthI")) test_setMinWidthI(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StackLayout.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StackLayout.java deleted file mode 100644 index a0083c627f..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StackLayout.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.StackLayout - * - * @see org.eclipse.swt.custom.StackLayout - */ -public class Test_org_eclipse_swt_custom_StackLayout extends Test_org_eclipse_swt_widgets_Layout { - -public Test_org_eclipse_swt_custom_StackLayout(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ() { - warnUnimpl("Test test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ not written"); -} - -public void test_layoutLorg_eclipse_swt_widgets_CompositeZ() { - warnUnimpl("Test test_layoutLorg_eclipse_swt_widgets_CompositeZ not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_StackLayout((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ"); - methodNames.addElement("test_layoutLorg_eclipse_swt_widgets_CompositeZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Layout.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ")) test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ(); - else if (getName().equals("test_layoutLorg_eclipse_swt_widgets_CompositeZ")) test_layoutLorg_eclipse_swt_widgets_CompositeZ(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyleRange.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyleRange.java deleted file mode 100644 index 9c9f49cd25..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyleRange.java +++ /dev/null @@ -1,175 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.widgets.*; -import junit.framework.*; -import junit.textui.*; -import java.util.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.StyleRange - * - * @see org.eclipse.swt.custom.StyleRange - */ -public class Test_org_eclipse_swt_custom_StyleRange extends SwtTestCase { - final static RGB RED = new RGB(255,0,0); - final static RGB BLUE = new RGB(0,0,255); - final static RGB GREEN = new RGB(0,255,0); - Hashtable colors = new Hashtable(); -public Test_org_eclipse_swt_custom_StyleRange(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} -private Color getColor(RGB rgb) { - return (Color)colors.get(rgb); -} -protected void initializeColors() { - Display display = Display.getDefault(); - colors.put(RED, new Color (display, RED)); - colors.put(GREEN, new Color (display, GREEN)); - colors.put(BLUE, new Color (display, BLUE)); -} - -protected void setUp() { - initializeColors(); -} - -protected void tearDown() { - Enumeration enum = colors.keys(); - while (enum.hasMoreElements()) { - Color color = (Color)colors.get((RGB)enum.nextElement()); - color.dispose(); - } -} - -public void test_Constructor() { - StyleRange styleRange = new StyleRange(); - assertTrue(":a:", styleRange.start == 0); - assertTrue(":a:", styleRange.length == 0); - assertTrue(":a:", styleRange.foreground == null); - assertTrue(":a:", styleRange.background == null); - assertTrue(":a:", styleRange.fontStyle == SWT.NORMAL); -} - -public void test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_Color() { - StyleRange styleRange = new StyleRange(5, 10, getColor(RED), getColor(BLUE)); - assertTrue(":b:", styleRange.start == 5); - assertTrue(":b:", styleRange.length == 10); - assertTrue(":b:", styleRange.foreground == getColor(RED)); - assertTrue(":b:", styleRange.background == getColor(BLUE)); - assertTrue(":b:", styleRange.fontStyle == SWT.NORMAL); -} - -public void test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_ColorI() { - StyleRange styleRange = new StyleRange(5, 10, getColor(RED), getColor(BLUE), SWT.BOLD); - assertTrue(":c:", styleRange.start == 5); - assertTrue(":c:", styleRange.length == 10); - assertTrue(":c:", styleRange.foreground == getColor(RED)); - assertTrue(":c:", styleRange.background == getColor(BLUE)); - assertTrue(":c:", styleRange.fontStyle == SWT.BOLD); -} - -public void test_equalsLjava_lang_Object() { - StyleRange styleRangeA = new StyleRange(5, 10, getColor(RED), getColor(BLUE), SWT.BOLD); - StyleRange styleRangeB = new StyleRange(5, 10, getColor(RED), getColor(BLUE), SWT.BOLD); - StyleRange styleRangeC = new StyleRange(5, 10, getColor(BLUE), getColor(BLUE), SWT.BOLD); - StyleRange styleRangeD = new StyleRange(6, 10, getColor(RED), getColor(BLUE), SWT.BOLD); - StyleRange styleRangeE = new StyleRange(5, 11, getColor(RED), getColor(BLUE), SWT.BOLD); - StyleRange styleRangeF = new StyleRange(5, 11, getColor(RED), getColor(RED), SWT.BOLD); - StyleRange styleRangeG = new StyleRange(5, 11, getColor(RED), getColor(BLUE), SWT.NORMAL); - assertTrue(":d:", styleRangeA.equals(styleRangeB)); - assertTrue(":d:",!styleRangeA.equals(styleRangeC)); - assertTrue(":d:",!styleRangeA.equals(styleRangeD)); - assertTrue(":d:",!styleRangeA.equals(styleRangeE)); - assertTrue(":d:",!styleRangeA.equals(styleRangeF)); - assertTrue(":d:",!styleRangeA.equals(styleRangeG)); -} - -public void test_hashCode() { - // does not make sense to test -} - -public void test_isUnstyled() { - StyleRange styleRangeA = new StyleRange(5, 10, null, null, SWT.NORMAL); - StyleRange styleRangeB = new StyleRange(5, 10, getColor(RED), null, SWT.NORMAL); - StyleRange styleRangeC = new StyleRange(5, 10, null, null, SWT.BOLD); - StyleRange styleRangeD = new StyleRange(6, 10, null, getColor(BLUE), SWT.NORMAL); - StyleRange styleRangeE = new StyleRange(5, 10, null, null); - assertTrue(":e:", styleRangeA.isUnstyled()); - assertTrue(":e:",!styleRangeB.isUnstyled()); - assertTrue(":e:",!styleRangeC.isUnstyled()); - assertTrue(":e:",!styleRangeD.isUnstyled()); - assertTrue(":e:", styleRangeE.isUnstyled()); -} - -public void test_similarToLorg_eclipse_swt_custom_StyleRange() { - StyleRange styleRangeA = new StyleRange(6, 10, getColor(RED), getColor(BLUE), SWT.NORMAL); - StyleRange styleRangeB = new StyleRange(5, 5, getColor(RED), getColor(BLUE), SWT.NORMAL); - StyleRange styleRangeC = new StyleRange(6, 10, getColor(RED), getColor(BLUE), SWT.NORMAL); - StyleRange styleRangeD = new StyleRange(6, 10, getColor(BLUE), getColor(BLUE), SWT.NORMAL); - StyleRange styleRangeE = new StyleRange(6, 10, getColor(RED), getColor(RED), SWT.NORMAL); - StyleRange styleRangeF = new StyleRange(6, 10, getColor(RED), getColor(BLUE), SWT.BOLD); - assertTrue(":f:", styleRangeA.similarTo(styleRangeB)); - assertTrue(":f:", styleRangeA.similarTo(styleRangeC)); - assertTrue(":f:", !styleRangeA.similarTo(styleRangeD)); - assertTrue(":f:", !styleRangeA.similarTo(styleRangeE)); - assertTrue(":f:", !styleRangeA.similarTo(styleRangeF)); -} - -public void test_clone() { - StyleRange styleRangeA = new StyleRange(6, 10, null, getColor(BLUE), SWT.NORMAL); - StyleRange styleRangeB = (StyleRange)styleRangeA.clone(); - assertTrue(":g:", styleRangeA.equals(styleRangeB)); -} - -public void test_toString() { - StyleRange styleRange = new StyleRange(6, 10, null, getColor(BLUE), SWT.NORMAL); - styleRange.toString(); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_StyleRange((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_ColorI"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_isUnstyled"); - methodNames.addElement("test_similarToLorg_eclipse_swt_custom_StyleRange"); - methodNames.addElement("test_clone"); - methodNames.addElement("test_toString"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_Color")) test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_ColorI")) test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_ColorI(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_isUnstyled")) test_isUnstyled(); - else if (getName().equals("test_similarToLorg_eclipse_swt_custom_StyleRange")) test_similarToLorg_eclipse_swt_custom_StyleRange(); - else if (getName().equals("test_clone")) test_clone(); - else if (getName().equals("test_toString")) test_toString(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java deleted file mode 100644 index 5457937145..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java +++ /dev/null @@ -1,4169 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import java.util.*; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.dnd.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.printing.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.internal.BidiUtil; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.StyledText - * - * @see org.eclipse.swt.custom.StyledText - */ -public class Test_org_eclipse_swt_custom_StyledText extends Test_org_eclipse_swt_widgets_Canvas { - -StyledText text; -final static RGB RED = new RGB(255,0,0); -final static RGB BLUE = new RGB(0,0,255); -final static RGB GREEN = new RGB(0,255,0); -final static RGB YELLOW = new RGB(255,255,0); -final static RGB CYAN = new RGB(0,255,255); -final static RGB PURPLE = new RGB(255,0,255); -Hashtable colors = new Hashtable(); -private boolean listenerCalled; -private boolean listener2Called; - -public Test_org_eclipse_swt_custom_StyledText(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - initializeColors(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); -} - -protected void tearDown() { - Enumeration enum = colors.keys(); - while (enum.hasMoreElements()) { - Color color = (Color)colors.get((RGB)enum.nextElement()); - color.dispose(); - } - super.tearDown(); - -} - -// this method must not be public so that the auto-gen tool keeps it -private StyleRange[] defaultStyles() { - return new StyleRange[] { - getStyle(0,48,RED,YELLOW), - getStyle(58,10,BLUE,CYAN), - getStyle(68,10,GREEN,PURPLE)}; -} -// this method must not be public so that the auto-gen tool keeps it -protected void getLineBackgrounds() { - for (int i=0; i<text.getLineCount(); i++) { - text.getLineBackground(i); - } -} -// this method must not be public so that the auto-gen tool keeps it -private String textString() { - return "This is the text component in testing\nNew Line1\nNew Line2\nNew Line3\nNew Line4."; -} -private boolean isBidi() { - return BidiUtil.isBidiPlatform(); -} -// this method must not be public so that the auto-gen tool keeps it -private StyleRange getStyle(int start, int length, RGB fg, RGB bg) { - StyleRange style = new StyleRange(); - style.start = start; - style.length = length; - if (fg != null) style.foreground = getColor(fg); - else style.foreground = null; - if (bg != null) style.background = getColor(bg); - else style.background = null; - return style; -} -// this method must not be public so that the auto-gen tool keeps it -private Color getColor(RGB rgb) { - return (Color)colors.get(rgb); -} -// this method must not be public so that the auto-gen tool keeps it -protected void initializeColors() { - Display display = Display.getDefault(); - colors.put(RED, new Color (display, RED)); - colors.put(BLUE, new Color (display, BLUE)); - colors.put(GREEN, new Color (display, GREEN)); - colors.put(YELLOW, new Color (display, YELLOW)); - colors.put(CYAN, new Color (display, CYAN)); - colors.put(PURPLE, new Color (display, PURPLE)); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){ - StyledText text = new StyledText(shell, SWT.READ_ONLY); - - assertTrue(":a:", text.getEditable() == false); - text.dispose(); - - text = new StyledText(shell, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE); - assertTrue(":b:", text.getVerticalBar() == null); - assertTrue(":c:", text.getHorizontalBar() == null); - text.dispose(); -} - -public void test_addExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener() { - final String line = "Line1"; - boolean exceptionThrown = false; - ExtendedModifyListener listener = new ExtendedModifyListener() { - public void modifyText(ExtendedModifyEvent event) { - listenerCalled = true; - assertEquals("ExtendedModify event data invalid", 0, event.start); - assertEquals("ExtendedModify event data invalid", line.length(), event.length); - assertEquals("ExtendedModify event data invalid", "", event.replacedText); - } - }; - - try { - text.addExtendedModifyListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown", exceptionThrown); - - // test whether all content modifying API methods send an ExtendedModify event - text.addExtendedModifyListener(listener); - - listenerCalled = false; - text.append(line); - assertTrue("append does not send event", listenerCalled); - - listenerCalled = false; - text.insert(line); - assertTrue("replaceTextRange does not send event", listenerCalled); - - listenerCalled = false; - text.removeExtendedModifyListener(listener); - listener = new ExtendedModifyListener() { - public void modifyText(ExtendedModifyEvent event) { - listenerCalled = true; - assertEquals("ExtendedModify event data invalid", 0, event.start); - assertEquals("ExtendedModify event data invalid", line.length(), event.length); - assertEquals("ExtendedModify event data invalid", line.substring(0, 1), event.replacedText); - } - }; - text.addExtendedModifyListener(listener); - text.replaceTextRange(0, 1, line); - assertTrue("replaceTextRange does not send event", listenerCalled); - - listenerCalled = false; - text.removeExtendedModifyListener(listener); - listener = new ExtendedModifyListener() { - public void modifyText(ExtendedModifyEvent event) { - listenerCalled = true; - assertEquals("ExtendedModify event data invalid", 0, event.start); - assertEquals("ExtendedModify event data invalid", line.length(), event.length); - assertEquals("ExtendedModify event data invalid", line + line.substring(1, line.length()) + line, event.replacedText); - } - }; - text.addExtendedModifyListener(listener); - text.setText(line); - assertTrue("setText does not send event", listenerCalled); - - listenerCalled = false; - text.removeExtendedModifyListener(listener); - // cause StyledText to call the listener. - text.setText(line); - assertTrue("Listener not removed", listenerCalled == false); -} - -public void test_setKeyBindingII(){ - text.setKeyBinding(SWT.DEL, SWT.NULL); - assertTrue(":a:", text.getKeyBinding(SWT.DEL) == SWT.NULL); - text.setKeyBinding(SWT.DEL, ST.LINE_UP); - assertTrue(":b:", text.getKeyBinding(SWT.DEL) == ST.LINE_UP); - text.setKeyBinding(SWT.DEL | SWT.SHIFT, ST.SELECT_PAGE_UP); - assertTrue(":c:", text.getKeyBinding(SWT.DEL | SWT.SHIFT) == ST.SELECT_PAGE_UP); - text.setKeyBinding(SWT.DEL | SWT.SHIFT, ST.PAGE_UP); - assertTrue(":d:", text.getKeyBinding(SWT.DEL | SWT.SHIFT) == ST.PAGE_UP); - text.setKeyBinding(-1, ST.PAGE_UP); - text.setKeyBinding(-1, -1); -} - -public void test_addBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener() { - String line = "Line1"; - boolean exceptionThrown = false; - BidiSegmentListener listener = new BidiSegmentListener() { - public void lineGetSegments(BidiSegmentEvent event) { - listenerCalled = true; - } - }; - - try { - text.addBidiSegmentListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown", exceptionThrown); - - listenerCalled = false; - text.setText(line); - text.addBidiSegmentListener(listener); - // cause StyledText to call the BidiSegmentListener. - text.getLocationAtOffset(0); - if (isBidi()) { - assertTrue("Listener not called", listenerCalled); - } - else { - assertTrue("Listener called when it shouldn't be", listenerCalled == false); - } - listenerCalled = false; - text.removeBidiSegmentListener(listener); - // cause StyledText to call the BidiSegmentListener. - text.getLocationAtOffset(0); - assertTrue("Listener not removed", listenerCalled == false); -} - -public void test_addLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener() { - String line = "Line1"; - boolean exceptionThrown = false; - LineBackgroundListener listener = new LineBackgroundListener() { - public void lineGetBackground(LineBackgroundEvent event) { - listenerCalled = true; - } - }; - - try { - text.addLineBackgroundListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown", exceptionThrown); - - listenerCalled = false; - text.setText(line); - text.addLineBackgroundListener(listener); - // cause StyledText to call the listener. - text.setSelection(0, text.getCharCount()); - text.copy(); - assertTrue("Listener not called", listenerCalled); - - listenerCalled = false; - text.removeLineBackgroundListener(listener); - // cause StyledText to call the listener. - text.setText(line); - text.setSelection(0, text.getCharCount()); - text.copy(); - assertTrue("Listener not removed", listenerCalled == false); -} - -public void test_addLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener() { - String line = "Line1"; - boolean exceptionThrown = false; - LineStyleListener listener = new LineStyleListener() { - public void lineGetStyle(LineStyleEvent event) { - listenerCalled = true; - } - }; - - try { - text.addLineStyleListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown", exceptionThrown); - - listenerCalled = false; - text.setText(line); - text.addLineStyleListener(listener); - // cause StyledText to call the listener. - text.setSelection(0, text.getCharCount()); - text.copy(); - assertTrue("Listener not called", listenerCalled); - - listenerCalled = false; - text.removeLineStyleListener(listener); - // cause StyledText to call the listener. - text.setText(line); - text.setSelection(0, text.getCharCount()); - text.copy(); - assertTrue("Listener not removed", listenerCalled == false); -} - -public void test_addModifyListenerLorg_eclipse_swt_events_ModifyListener() { - String line = "Line1"; - boolean exceptionThrown = false; - ModifyListener listener = new ModifyListener() { - public void modifyText(ModifyEvent event) { - listenerCalled = true; - } - }; - - try { - text.addModifyListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown", exceptionThrown); - - // test whether all content modifying API methods send a Modify event - text.addModifyListener(listener); - - listenerCalled = false; - text.append(line); - assertTrue("append does not send event", listenerCalled); - - listenerCalled = false; - text.insert(line); - assertTrue("replaceTextRange does not send event", listenerCalled); - - listenerCalled = false; - text.replaceTextRange(0, 1, line); - assertTrue("replaceTextRange does not send event", listenerCalled); - - listenerCalled = false; - text.setText(line); - assertTrue("setText does not send event", listenerCalled); - - listenerCalled = false; - text.removeModifyListener(listener); - // cause StyledText to call the listener. - text.setText(line); - assertTrue("Listener not removed", listenerCalled == false); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - String line = "Line1"; - boolean exceptionThrown = false; - SelectionListener listener = new SelectionListener() { - public void widgetSelected(SelectionEvent event) { - listenerCalled = true; - } - public void widgetDefaultSelected(SelectionEvent event) { - listener2Called = true; - } - }; - - try { - text.addSelectionListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown", exceptionThrown); - - text.setText(line); - listenerCalled = false; - listener2Called = false; - text.addSelectionListener(listener); - // cause StyledText to call the listener. - text.invokeAction(ST.SELECT_LINE_END); - assertTrue("Listener not called", listenerCalled); - assertTrue("Listener called unexpectedly", listener2Called == false); - - listenerCalled = false; - listener2Called = false; - text.removeSelectionListener(listener); - // cause StyledText to call the listener. - text.invokeAction(ST.SELECT_LINE_END); - assertTrue("Listener not removed", listenerCalled == false); - assertTrue("Listener called unexpectedly", listener2Called == false); -} - -public void test_addVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener() { - String line = "Line1"; - boolean exceptionThrown = false; - VerifyKeyListener listener = new VerifyKeyListener() { - public void verifyKey(VerifyEvent event) { - } - }; - - try { - text.addVerifyKeyListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown", exceptionThrown); - - // only test whether listener can be added and removed. - // can't test listener because VerifyKey is user driven. - text.addVerifyKeyListener(listener); - text.removeVerifyKeyListener(listener); -} - -public void test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener() { - final String line = "Line1"; - final String newLine = "NewLine1"; - final int textLength; - boolean exceptionThrown = false; - VerifyListener listener = new VerifyListener() { - public void verifyText(VerifyEvent event) { - listenerCalled = true; - assertEquals("Verify event data invalid", 0, event.start); - assertEquals("Verify event data invalid", 0, event.end); - assertEquals("Verify event data invalid", line, event.text); - event.start = 2; - event.end = 5; - event.text = newLine; - } - }; - - try { - text.addVerifyListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown", exceptionThrown); - - // test whether all content modifying API sends a Verify event - text.addVerifyListener(listener); - - listenerCalled = false; - text.append(line); - assertTrue("append does not send event", listenerCalled); - assertEquals("Listener failed", newLine, text.getText()); - - listenerCalled = false; - text.insert(line); - assertTrue("replaceTextRange does not send event", listenerCalled); - assertEquals("Listener failed", newLine + newLine, text.getText()); - - listenerCalled = false; - text.removeVerifyListener(listener); - listener = new VerifyListener() { - public void verifyText(VerifyEvent event) { - listenerCalled = true; - assertEquals("Verify event data invalid", 0, event.start); - assertEquals("Verify event data invalid", 1, event.end); - assertEquals("Verify event data invalid", line, event.text); - event.start = 2; - event.end = 5; - event.text = newLine; - } - }; - text.addVerifyListener(listener); - textLength = text.getCharCount() - 1 + newLine.length(); - text.replaceTextRange(0, 1, line); - assertTrue("replaceTextRange does not send event", listenerCalled); - assertEquals("Listener failed", newLine + newLine.substring(1, newLine.length()) + newLine, text.getText()); - - listenerCalled = false; - text.removeVerifyListener(listener); - listener = new VerifyListener() { - public void verifyText(VerifyEvent event) { - listenerCalled = true; - assertEquals("Verify event data invalid", 0, event.start); - assertEquals("Verify event data invalid", textLength, event.end); - assertEquals("Verify event data invalid", line, event.text); - event.start = 2; - event.end = 5; - event.text = newLine; - } - }; - text.addVerifyListener(listener); - text.setText(line); - assertTrue("setText does not send event", listenerCalled); - assertEquals("Listener failed", newLine, text.getText()); - - text.removeVerifyListener(listener); - - listenerCalled = false; - listener = new VerifyListener() { - public void verifyText(VerifyEvent event) { - listenerCalled = true; - assertEquals("Verify event data invalid", 2, event.start); - assertEquals("Verify event data invalid", newLine.length(), event.end); - assertEquals("Verify event data invalid", line, event.text); - event.doit = false; - } - }; - text.addVerifyListener(listener); - // cause StyledText to call the listener. - text.replaceTextRange(2, text.getCharCount() - 2, line); - assertTrue("Listener not called", listenerCalled); - assertEquals("Listener failed", newLine, text.getText()); - - listenerCalled = false; - text.removeVerifyListener(listener); - // cause StyledText to call the listener. - text.setText(line); - assertTrue("Listener not removed", listenerCalled == false); -} - -public void test_appendLjava_lang_String() { - boolean exceptionThrown; - String line = "Line1"; - - text.append(line); - assertEquals("append to empty text", line, text.getText()); - - exceptionThrown = false; - try { - text.append(null); - } - catch (IllegalArgumentException exception) { - exceptionThrown = true; - } - assertTrue("append null string", exceptionThrown); - - text.append(""); - assertEquals("append empty string", line, text.getText()); - - text.append(line); - assertEquals("append non-empty string", line + line, text.getText()); - - text.setText(""); - String text2 = "line\r"; - text.append(text2); - assertEquals("append string ending with line delimiter", text2, text.getText()); - - String text3 = "line\r\nline3"; - text.append(text3); - assertEquals("append multi line string", text2 + text3, text.getText()); -} - -public void test_computeSizeIIZ() { - // inherited test is sufficient -} - -public void test_copy() { - Clipboard clipboard = new Clipboard(text.getDisplay()); - TextTransfer transfer = TextTransfer.getInstance(); - String clipboardText; - String convertedText; - - clipboard.setContents(new String[]{""}, new Transfer[]{transfer}); - - text.setSelectionRange(0, 0); - text.copy(); - clipboardText = (String) clipboard.getContents(transfer); - assertTrue(":a:", clipboardText != null && clipboardText.length() == 0); - - text.setText("0123456789"); - text.setSelectionRange(0, 0); - text.copy(); - clipboardText = (String) clipboard.getContents(transfer); - assertTrue(":c:", clipboardText != null && clipboardText.length() == 0); - - - text.setSelectionRange(0, 1); - text.copy(); - clipboardText = (String) clipboard.getContents(transfer); - assertTrue(":d:", clipboardText != null && clipboardText.equals("0")); - - text.setSelectionRange(1, 2); - text.copy(); - clipboardText = (String) clipboard.getContents(transfer); - assertTrue(":e:", clipboardText != null && clipboardText.equals("12")); - - // test line delimiter conversion - text.setText("\rLine1\nLine2\r\nLine3\n\rLine4\n"); - text.setSelectionRange(0, text.getCharCount()); - text.copy(); - clipboardText = (String) clipboard.getContents(transfer); - if (SwtJunit.isLinux) { - convertedText = "\nLine1\nLine2\nLine3\n\nLine4\n"; - } - else { - convertedText = "\r\nLine1\r\nLine2\r\nLine3\r\n\r\nLine4\r\n"; - } - assertTrue(":f:", clipboardText != null && clipboardText.equals(convertedText)); - - // test line delimiter conversion - text.setText("Line1\r\nLine2"); - text.setSelectionRange(0, text.getCharCount()); - text.copy(); - clipboardText = (String) clipboard.getContents(transfer); - if (SwtJunit.isLinux) { - convertedText = "Line1\nLine2"; - } - else { - convertedText = "Line1\r\nLine2"; - } - assertTrue(":g:", clipboardText != null && clipboardText.equals(convertedText)); - - clipboard.dispose(); -} - -public void test_cut() { - Clipboard clipboard = new Clipboard(text.getDisplay()); - TextTransfer transfer = TextTransfer.getInstance(); - String clipboardText; - String convertedText; - - clipboard.setContents(new String[]{""}, new Transfer[]{transfer}); - - text.setSelectionRange(0, 0); - text.cut(); - clipboardText = (String) clipboard.getContents(transfer); - assertTrue(":a:", clipboardText != null && clipboardText.length() == 0); - - text.setText("0123456789"); - text.setSelectionRange(0, 0); - text.cut(); - clipboardText = (String) clipboard.getContents(transfer); - assertTrue(":c:", clipboardText != null && clipboardText.length() == 0); - - text.setSelectionRange(0, 1); - text.cut(); - clipboardText = (String) clipboard.getContents(transfer); - assertTrue(":d:", clipboardText != null && clipboardText.equals("0")); - - text.setSelectionRange(1, 2); - text.cut(); - clipboardText = (String) clipboard.getContents(transfer); - assertTrue(":e:", clipboardText != null && clipboardText.equals("23")); - - // test line delimiter conversion - text.setText("\rLine1\nLine2\r\nLine3\n\rLine4\n"); - text.setSelectionRange(0, text.getCharCount()); - text.cut(); - clipboardText = (String) clipboard.getContents(transfer); - if (SwtJunit.isLinux) { - convertedText = "\nLine1\nLine2\nLine3\n\nLine4\n"; - } - else { - convertedText = "\r\nLine1\r\nLine2\r\nLine3\r\n\r\nLine4\r\n"; - } - assertTrue(":f:", clipboardText != null && clipboardText.equals(convertedText)); - - // test line delimiter conversion - text.setText("Line1\r\nLine2"); - text.setSelectionRange(0, text.getCharCount()); - text.cut(); - clipboardText = (String) clipboard.getContents(transfer); - if (SwtJunit.isLinux) { - convertedText = "Line1\nLine2"; - } - else { - convertedText = "Line1\r\nLine2"; - } - assertTrue(":g:", clipboardText != null && clipboardText.equals(convertedText)); - - clipboard.dispose(); -} - -public void test_getBidiColoring() { - /// getBidiColoring is deprecated and will be removed. - warnUnimpl("Test test_getBidiColoring not written"); -} - -public void test_getCaretOffset() { - assertTrue(":a:", text.getCaretOffset() == 0); - text.setText("Line0\r\n"); - assertTrue(":b:", text.getCaretOffset() == 0); - text.setTopIndex(1); - assertTrue(":c:", text.getCaretOffset() == 0); - - text.replaceTextRange(text.getCharCount(), 0, "Line1"); - assertTrue(":d:", text.getCaretOffset() == 0); - String newText = "Line-1\r\n"; - text.replaceTextRange(0, 0, newText); - assertTrue(":e:", text.getCaretOffset() == 0); - - text.setCaretOffset(1); - assertTrue(":f:", text.getCaretOffset() == 1); - text.replaceTextRange(2, 0, newText); - assertTrue(":g:", text.getCaretOffset() == 1); - text.replaceTextRange(0, 0, newText); - assertTrue(":h:", text.getCaretOffset() == newText.length() + 1); -} - -public void test_getContent() { - StyledTextContent content = text.getContent(); - - assertTrue(content != null); - content = new StyledTextContent() { - public void addTextChangeListener(TextChangeListener listener) { - } - public int getCharCount() { - return 0; - } - public String getLine(int lineIndex) { - return ""; - } - public int getLineAtOffset(int offset) { - return 0; - } - public int getLineCount() { - return 0; - } - public String getLineDelimiter() { - return ""; - } - public int getOffsetAtLine(int lineIndex) { - return 0; - } - public String getTextRange(int start, int length) { - return ""; - } - public void removeTextChangeListener(TextChangeListener listener) { - } - public void replaceTextRange(int start, int replaceLength, String text) { - } - public void setText(String text) { - } - }; - text.setContent(content); - assertEquals(content, text.getContent()); -} - -public void test_getDoubleClickEnabled() { - assertTrue(":a:", text.getDoubleClickEnabled() == true); - text.setDoubleClickEnabled(true); - assertTrue(":b:", text.getDoubleClickEnabled() == true); - text.setDoubleClickEnabled(false); - assertTrue(":c:", text.getDoubleClickEnabled() == false); - text.setDoubleClickEnabled(false); - assertTrue(":d:", text.getDoubleClickEnabled() == false); - text.setDoubleClickEnabled(true); - assertTrue(":e:", text.getDoubleClickEnabled() == true); -} - -public void test_getEditable() { - assertTrue(":a:", text.getEditable() == true); - text.setEditable(true); - assertTrue(":b:", text.getEditable() == true); - text.setEditable(false); - assertTrue(":c:", text.getEditable() == false); - text.setEditable(false); - assertTrue(":d:", text.getEditable() == false); - text.setEditable(true); - assertTrue(":e:", text.getEditable() == true); -} - -public void test_getHorizontalIndex() { - assertTrue(":a:", text.getHorizontalIndex() == 0); - text.setHorizontalIndex(-1); - assertTrue(":b:", text.getHorizontalIndex() == 0); - text.setHorizontalIndex(1); - assertTrue(":c:", text.getHorizontalIndex() == 0); - - text.setText("Line0"); - assertTrue(":d:", text.getHorizontalIndex() == 0); - text.setHorizontalIndex(-1); - assertTrue(":e:", text.getHorizontalIndex() == 0); - text.setHorizontalIndex(1); - assertTrue(":f:", text.getHorizontalIndex() == 1); - text.setHorizontalIndex(500); - assertTrue(":g:", text.getHorizontalIndex() > 0); - text.setHorizontalIndex(-1); - assertTrue(":h:", text.getHorizontalIndex() == 0); - text.setHorizontalIndex(1); - assertTrue(":i:", text.getHorizontalIndex() == 1); - // make sure the widget can be scrolled - shell.open(); - text.setSize(10, 50); - text.setText("Line0"); - text.setHorizontalIndex(1); - assertTrue(":j:", text.getHorizontalIndex() == 1); -} - -public void test_getHorizontalPixel() { - assertTrue(":a:", text.getHorizontalPixel() == 0); - text.setHorizontalIndex(-1); - assertTrue(":b:", text.getHorizontalPixel() == 0); - text.setHorizontalIndex(1); - assertTrue(":c:", text.getHorizontalPixel() == 0); - - text.setText("Line0"); - assertTrue(":d:", text.getHorizontalPixel() == 0); - text.setHorizontalIndex(-1); - assertTrue(":e:", text.getHorizontalPixel() == 0); - text.setHorizontalIndex(1); - assertTrue(":f:", text.getHorizontalPixel() > 0); - text.setHorizontalIndex(-1); - assertTrue(":g:", text.getHorizontalPixel() == 0); - text.setHorizontalIndex(1); - assertTrue(":h:", text.getHorizontalPixel() > 0); - // make sure the widget can be scrolled - shell.open(); - text.setSize(10, 50); - text.setText("Line0"); - text.setHorizontalIndex(1); - assertTrue(":i:", text.getHorizontalPixel() > 0); -} - -public void test_getKeyBindingI() { - assertTrue(":a:", text.getKeyBinding(SWT.DEL) == ST.DELETE_NEXT); - text.setKeyBinding(SWT.DEL, ST.LINE_UP); - assertTrue(":b:", text.getKeyBinding(SWT.DEL) == ST.LINE_UP); - text.setKeyBinding(SWT.DEL | SWT.SHIFT, ST.SELECT_PAGE_UP); - assertTrue(":c:", text.getKeyBinding(SWT.DEL | SWT.SHIFT) == ST.SELECT_PAGE_UP); - text.setKeyBinding(SWT.DEL | SWT.SHIFT, ST.PAGE_UP); - assertTrue(":d:", text.getKeyBinding(SWT.DEL | SWT.SHIFT) == ST.PAGE_UP); - assertTrue(":e:", text.getKeyBinding(-1) == SWT.NULL); - assertTrue(":f:", text.getKeyBinding(SWT.F2) == SWT.NULL); -} - -public void test_getCharCount() { - assertTrue(":a:", text.getCharCount() == 0); - text.setText("Line0"); - assertTrue(":b:", text.getCharCount() == 5); - text.setText(""); - assertTrue(":c:", text.getCharCount() == 0); - text.setText("Line0\n"); - assertTrue(":d:", text.getCharCount() == 6); -} - -public void test_getLineBackgroundI() { - StyleRange[] styles; - - String textString = "L1\nL2\nL3\nL4"; - text.setText(textString); - assertTrue(":1:", text.getLineBackground(0) == null); - text.setLineBackground(1,1,getColor(YELLOW)); - text.setLineBackground(2,1,getColor(BLUE)); - assertTrue(":1:", text.getLineBackground(1) == getColor(YELLOW)); - assertTrue(":1:", text.getLineBackground(2) == getColor(BLUE)); -} - -public void test_getLineCount() { - String delimiterString = "\r\n"; - assertTrue(":a:", text.getLineCount()==1); - text.append("dddasd" + delimiterString); - assertTrue(":b:", text.getLineCount()==2); - text.append("ddasdasdasdasd" + delimiterString); - assertTrue(":c:", text.getLineCount()==3); - - - text.setText("01234567890"); - text.setSelection(4); - assertTrue(":a:", text.getLineCount()==1); - text.insert(delimiterString); - assertTrue(":b:", text.getLineCount()==2); -} - -public void test_getLineAtOffsetI() { - boolean exceptionThrown = false; - - assertTrue(":a:", text.getLineAtOffset(0) == 0); - try { - text.getLineAtOffset(-1); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":b:", exceptionThrown == true); - exceptionThrown = false; - - try { - text.getLineAtOffset(100); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":c:", exceptionThrown == true); - exceptionThrown = false; - - text.setText("Line0\r\n"); - assertTrue(":d:", text.getLineAtOffset(4) == 0); - assertTrue(":e:", text.getLineAtOffset(5) == 0); - assertTrue(":f:", text.getLineAtOffset(6) == 0); - assertTrue(":g:", text.getLineAtOffset(7) == 1); - try { - text.getLineAtOffset(8); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":h:", exceptionThrown == true); - exceptionThrown = false; -} - -public void test_getLineDelimiter() { - final String lineDelimiter = "\n"; - StyledTextContent content = text.getContent(); - - assertEquals(content.getLineDelimiter(), text.getLineDelimiter()); - - content = new StyledTextContent() { - public void addTextChangeListener(TextChangeListener listener) { - } - public int getCharCount() { - return 0; - } - public String getLine(int lineIndex) { - return ""; - } - public int getLineAtOffset(int offset) { - return 0; - } - public int getLineCount() { - return 0; - } - public String getLineDelimiter() { - return lineDelimiter; - } - public int getOffsetAtLine(int lineIndex) { - return 0; - } - public String getTextRange(int start, int length) { - return ""; - } - public void removeTextChangeListener(TextChangeListener listener) { - } - public void replaceTextRange(int start, int replaceLength, String text) { - } - public void setText(String text) { - } - }; - text.setContent(content); - assertEquals(lineDelimiter, text.getLineDelimiter()); -} - -public void test_getLineHeight() { - assertTrue(":a:", text.getLineHeight() > 0); -} - -public void test_getLocationAtOffsetI(){ - // copy from StyledText, has to match value used by StyledText - final int XINSET; - if (isBidi()) XINSET = 3; - else XINSET = 0; - - assertTrue(":a:", text.getLocationAtOffset(0).equals(new Point(0, 0))); - try { - text.getLocationAtOffset(-1); - fail("No exception thrown for offset == -1"); - } - catch (IllegalArgumentException e) { - } - - try { - text.getLocationAtOffset(100); - fail("No exception thrown for illegal offset argument"); - } - catch (IllegalArgumentException e) { - } - - text.setText("Line0\r\nLine1"); - assertTrue(":d:", text.getLocationAtOffset(4).x > 0 && text.getLocationAtOffset(4).y == 0); - assertTrue(":e:", text.getLocationAtOffset(6).x > 0 && text.getLocationAtOffset(6).y == 0); - // x location will == StyledText x inset on bidi platforms - assertTrue(":f:", text.getLocationAtOffset(7).x == XINSET && text.getLocationAtOffset(7).y > 0); - try { - text.getLocationAtOffset(13); - fail("No exception thrown for illegal offset argument"); - } - catch (IllegalArgumentException e) { - } - - text.setTopIndex(1); - assertTrue(":h:", text.getLocationAtOffset(4).x > 0 && text.getLocationAtOffset(4).y < 0); - // x location will == StyledText x inset on bidi platforms - assertTrue(":i:", text.getLocationAtOffset(7).x == XINSET && text.getLocationAtOffset(7).y == 0); - - text.setHorizontalIndex(1); - assertTrue(":j:", text.getLocationAtOffset(0).x < 0 && text.getLocationAtOffset(0).y < 0); - assertTrue(":k:", text.getLocationAtOffset(7).x < 0 && text.getLocationAtOffset(7).y == 0); -} -public void test_getOffsetAtLineI() { - boolean exceptionThrown = false; - - assertEquals(":a:", 0, text.getOffsetAtLine(0)); - try { - text.getOffsetAtLine(-1); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":b:", exceptionThrown); - exceptionThrown = false; - - try { - text.getOffsetAtLine(100); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":c:", exceptionThrown); - exceptionThrown = false; - - text.setText("Line0\r\n"); - assertEquals(":d:", 0, text.getOffsetAtLine(0)); - assertEquals(":e:", 7, text.getOffsetAtLine(1)); - - try { - text.getOffsetAtLine(2); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":f:", exceptionThrown); - exceptionThrown = false; - - text.setText(""); - assertEquals(":g:", 0, text.getOffsetAtLine(0)); -} -public void test_getOffsetAtLocationLorg_eclipse_swt_graphics_Point() { - boolean exceptionThrown = false; - Point location; - - assertTrue(":a:", text.getOffsetAtLocation(new Point(0, 0)) == 0); - try { - text.getOffsetAtLocation(new Point(-1, 0)); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":b:", exceptionThrown == true); - exceptionThrown = false; - - try { - text.getOffsetAtLocation(new Point(0, -1)); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":c:", exceptionThrown == true); - exceptionThrown = false; - - text.setText("Line0\r\nLine1"); - location = text.getLocationAtOffset(5); - assertTrue(":d:", text.getOffsetAtLocation(new Point(10, 0)) > 0); - assertTrue(":e:", text.getOffsetAtLocation(new Point(location.x - 1, 0)) == 4); - location = text.getLocationAtOffset(7); - assertTrue(":f:", text.getOffsetAtLocation(location) == 7); - try { - text.getOffsetAtLocation(new Point(100, 0)); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":g:", exceptionThrown == true); - exceptionThrown = false; - - try { - text.getOffsetAtLocation(new Point(0, 50)); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":h:", exceptionThrown == true); - exceptionThrown = false; - - text.setTopIndex(1); - assertTrue(":i:", text.getOffsetAtLocation(new Point(0, -5)) == 0); - assertTrue(":j:", text.getOffsetAtLocation(new Point(0, 0)) == 7); - - text.setHorizontalIndex(1); - assertTrue(":k:", text.getOffsetAtLocation(new Point(-5, -5)) == 0); - assertTrue(":l:", text.getOffsetAtLocation(new Point(-5, 0)) == 7); - - // 1GL4ZVE - assertTrue(":m:", text.getOffsetAtLocation(text.getLocationAtOffset(2)) == 2); - text.setHorizontalIndex(0); - assertTrue(":n:", text.getOffsetAtLocation(text.getLocationAtOffset(2)) == 2); -} - -public void test_getSelection(){ - text.setText("01234567890"); - text.setSelection(new Point(2, 2)); - assertTrue(":b:", text.getSelection().equals(new Point(2, 2))); - text.setSelection(new Point(2, 3)); - assertTrue(":c:", text.getSelection().equals(new Point(2, 3))); - text.setSelection(new Point(3, 11)); - assertTrue(":d:", text.getSelection().equals(new Point(3, 11))); - text.setText("01234567890"); - text.setSelection(4); - assertTrue(":a:", text.getSelection().equals(new Point(4, 4))); - text.setSelection(11); - assertTrue(":b:", text.getSelection().equals(new Point(11, 11))); -} - -public void test_getSelectionRange() { - String testText = "Line1\r\nLine2"; - int invalidRanges [][] = {{-1, 0}, {-1, -1}, {100, 1}, {100, -1}, {12, 1}, {11, 2}}; - int selectionRanges [][] = {{0, 1}, {0, 0}, {2, 3}, {12, 0}}; - int textLength; - boolean exceptionThrown; - - for (int i = 0; i < invalidRanges.length; i++) { - int start = invalidRanges[i][0]; - int length = invalidRanges[i][1]; - - exceptionThrown = false; - try { - text.setSelectionRange(start, length); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":a:", exceptionThrown); - } - - text.setSelectionRange(0, 0); - assertTrue(":b:", text.getSelectionRange().x == 0 && text.getSelectionRange().y == 0); - text.setText(testText); - textLength = text.getCharCount(); - for (int i = 0; i < selectionRanges.length; i++) { - int start = selectionRanges[i][0]; - int length = selectionRanges[i][1]; - text.setSelectionRange(start, length); - assertTrue(":c:" + i, text.getSelectionRange().x == start && text.getSelectionRange().y == length); - } - - for (int i = 0; i < invalidRanges.length; i++) { - int start = invalidRanges[i][0]; - int length = invalidRanges[i][1]; - - exceptionThrown = false; - try { - text.setSelectionRange(start, length); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":a:", exceptionThrown); - } -} - -public void test_getSelectionCount(){ - text.setText("01234567890"); - assertTrue(":a:", text.getSelectionCount()==0); - text.setSelection(2, 4); - assertTrue(":b:", text.getSelectionCount()==2); - text.setSelection(2, 11); - assertTrue(":c:", text.getSelectionCount()==9); - text.setText("0123\n4567890"); - assertTrue(":d:", text.getSelectionCount()==0); - text.setSelection(2, 4); - assertTrue(":e:", text.getSelectionCount()==2); - text.setSelection(2, 12); - assertTrue(":f:", text.getSelectionCount()==10); -} - -public void test_getSelectionText() { - String testText = "Line1\r\nLine2"; - int selectionRanges [][] = {{0, 1}, {0, 0}, {2, 3}, {12, 0}}; - int textLength; - - text.setSelectionRange(0, 0); - assertEquals(":b:", "", text.getSelectionText()); - text.setText(testText); - textLength = text.getCharCount(); - for (int i = 0; i < selectionRanges.length; i++) { - int start = selectionRanges[i][0]; - int length = selectionRanges[i][1]; - text.setSelectionRange(start, length); - assertEquals(":c:" + i, testText.substring(start, start + length), text.getSelectionText()); - } -} - -public void test_getStyleRangeAtOffsetI() { - String line = "Line1\r\nLine2"; - int styleStart = 0; - int styleLength = 5; - int i; - boolean exceptionThrown = false; - StyleRange style = new StyleRange(styleStart, styleLength, getColor(BLUE), getColor(RED), SWT.BOLD); - - try { - text.getStyleRangeAtOffset(0); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("offset out of range no text", exceptionThrown); - - text.setText(line); - exceptionThrown = false; - try { - text.getStyleRangeAtOffset(-1); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("offset out of range negative", exceptionThrown); - - exceptionThrown = false; - try { - text.getStyleRangeAtOffset(line.length()); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("offset out of range positive", exceptionThrown); - - text.setStyleRange(style); - style.length = 1; - for (i = styleStart; i < styleStart + styleLength; i++) { - style.start = i; - assertEquals(style, text.getStyleRangeAtOffset(i)); - } - assertEquals(null, text.getStyleRangeAtOffset(i)); - - // test offset at line delimiter - style = new StyleRange(5, 2, null, getColor(BLUE), SWT.NORMAL); - text.setStyleRange(style); - style.length = 1; - assertEquals(style, text.getStyleRangeAtOffset(5)); - style.start = 6; - assertEquals(style, text.getStyleRangeAtOffset(6)); - assertEquals(null, text.getStyleRangeAtOffset(10)); -} - -public void test_getStyleRanges() { - text.setText("package test;\n/* Line 1\n * Line 2\n */\npublic class SimpleClass {\n}"); - text.setStyleRange(getStyle(0,7,BLUE,null)); - text.setStyleRange(getStyle(14,23,RED,null)); - text.setStyleRange(getStyle(38,6,BLUE,null)); - text.setStyleRange(getStyle(45,5,BLUE,null)); - text.replaceTextRange(14, 23, "\t/*Line 1\n\t * Line 2\n\t */"); - String newText = text.getTextRange(0, text.getCharCount()); - assertTrue(":1:", newText.equals("package test;\n\t/*Line 1\n\t * Line 2\n\t */\npublic class SimpleClass {\n}")); - StyleRange[] styles = text.getStyleRanges(); - assertTrue(":1:", styles.length == 3); - assertTrue(":1:", styles[0].equals(getStyle(0,7,BLUE,null))); - assertTrue(":1:", styles[1].equals(getStyle(40,6,BLUE,null))); - assertTrue(":1:", styles[2].equals(getStyle(47,5,BLUE,null))); -} - -public void test_getTabs() { - text.setTabs(1); - assertTrue(":a:", text.getTabs() == 1); - text.setTabs(8); - assertTrue(":b:", text.getTabs() == 8); - text.setText("Line\t1\r\n"); - assertTrue(":c:", text.getTabs() == 8); - text.setTabs(7); - assertTrue(":d:", text.getTabs() == 7); -} - -public void test_getText() { - String testText = "Line1\r\nLine2"; - - assertTrue(":a:", text.getText().length() == 0); - text.setText(testText); - assertTrue(":b:", text.getText().equals(testText)); - text.setText(""); - assertTrue(":c:", text.getText().length() == 0); - - text.setText(testText); - assertTrue(":a:", text.getText().equals(testText)); - text.setText(testText + "\r\n"); - assertTrue(":b:", text.getText().equals(testText + "\r\n")); - text.setText(""); - assertTrue(":c:", text.getText().length() == 0); -} - -public void test_getTextII() { - boolean exceptionThrown; - String testText = "Line1\r\nLine2"; - int invalidRanges[][] = {{-1, 0}, {0, -1}, {-1, -1}, {100, 1}, {100, -1}, {2, testText.length()}, {5, 2}}; - int ranges[][] = {{0, 1}, {0, 0}, {2, 5}, {7, 11}}; - - for (int i = 0; i < invalidRanges.length; i++) { - int start = invalidRanges[i][0]; - int end = invalidRanges[i][1]; - - exceptionThrown = false; - try { - text.getText(start, end); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":a:", exceptionThrown); - } - text.setText(testText); - for (int i = 0; i < ranges.length; i++) { - int start = ranges[i][0]; - int end = ranges[i][1]; - assertEquals(":b:" + i, testText.substring(start, end + 1), text.getText(start, end)); - } - for (int i = 0; i < invalidRanges.length; i++) { - int start = invalidRanges[i][0]; - int end = invalidRanges[i][1]; - - exceptionThrown = false; - try { - text.getText(start, end); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":a:", exceptionThrown); - } - text.setText("testing"); - assertTrue(":d:", text.getText(0,0).equals("t")); - assertTrue(":d:", text.getText(0,1).equals("te")); - assertTrue(":d:", text.getText(1,5).equals("estin")); -} - -public void test_getTextRangeII() { - boolean exceptionThrown; - String testText = "Line1\r\nLine2"; - int invalidRanges[][] = {{-1, 0}, {0, -1}, {-1, -1}, {100, 1}, {100, -1}, {1, testText.length()}, {5, -1}}; - int ranges[][] = {{0, 1}, {0, 0}, {5, 1}, {7, 5}, {12, 0}}; - - for (int i = 0; i < invalidRanges.length; i++) { - int start = invalidRanges[i][0]; - int length = invalidRanges[i][1]; - - exceptionThrown = false; - try { - text.getTextRange(start, length); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":a:", exceptionThrown); - } - text.setText(testText); - for (int i = 0; i < ranges.length; i++) { - int start = ranges[i][0]; - int length = ranges[i][1]; - assertEquals(":b:" + i, testText.substring(start, start + length), text.getTextRange(start, length)); - } - for (int i = 0; i < invalidRanges.length; i++) { - int start = invalidRanges[i][0]; - int length = invalidRanges[i][1]; - - exceptionThrown = false; - try { - text.getTextRange(start, length); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":a:", exceptionThrown); - } - text.setText("testing"); - assertTrue(":d:", text.getTextRange(0,0).equals("")); - assertTrue(":d:", text.getTextRange(0,1).equals("t")); - assertTrue(":d:", text.getTextRange(0,2).equals("te")); - assertTrue(":d:", text.getTextRange(1,5).equals("estin")); -} - -public void test_getTextLimit() { - assertTrue(":a:", text.getTextLimit() < 0); - text.setTextLimit(10); - assertTrue(":b:", text.getTextLimit() == 10); -} - -public void test_getTopIndex() { - text.setText("Line0\r\n"); - - assertTrue(":a:", text.getTopIndex() == 0); - text.setTopIndex(-2); - assertTrue(":b:", text.getTopIndex() == 0); - text.setTopIndex(-1); - assertTrue(":c:", text.getTopIndex() == 0); - text.setTopIndex(1); - assertTrue(":d:", text.getTopIndex() == 1); - text.setTopIndex(2); - assertTrue(":e:", text.getTopIndex() == 2); - text.setTopIndex(0); - assertTrue(":f:", text.getTopIndex() == 0); - text.setTopIndex(3); - assertTrue(":g:", text.getTopIndex() == 2); - text.replaceTextRange(text.getCharCount(), 0, "Line1"); - assertTrue(":h:", text.getTopIndex() == 2); - text.setText(""); - assertTrue(":i:", text.getTopIndex() == 0); -} - -public void test_getTopPixel() { - text.setText("Line0\r\n"); - - assertTrue(":a:", text.getTopPixel() == 0); - text.setTopIndex(-2); - assertTrue(":b:", text.getTopPixel() == 0); - text.setTopIndex(-1); - assertTrue(":c:", text.getTopPixel() == 0); - text.setTopIndex(1); - assertTrue(":d:", text.getTopPixel() == text.getLineHeight()); - text.setTopIndex(2); - assertTrue(":e:", text.getTopPixel() == text.getLineHeight() * 2); - text.setTopIndex(0); - assertTrue(":f:", text.getTopPixel() == 0); - text.setTopIndex(3); - assertTrue(":g:", text.getTopPixel() == text.getLineHeight() * 2); - text.replaceTextRange(text.getCharCount(), 0, "Line1"); - assertTrue(":h:", text.getTopPixel() == text.getLineHeight() * 2); - text.setText(""); - assertTrue(":i:", text.getTopPixel() == 0); -} -public void test_getWordWrap() { - assertTrue(":a:", text.getWordWrap() == false); - text.setWordWrap(true); - assertTrue(":b:", text.getWordWrap()); - text.setWordWrap(false); - assertTrue(":c:", text.getWordWrap() == false); - text.setWordWrap(false); - assertTrue(":d:", text.getWordWrap() == false); - text.setWordWrap(true); - assertTrue(":e:", text.getWordWrap()); -} -public void test_insertLjava_lang_String(){ - String delimiterString = "\n"; - try { - text.insert(null); - fail("No exception thrown for string == null"); - } - catch (IllegalArgumentException e) { - } - assertTrue(":a:", text.getText().equals("")); - text.insert(""); - assertTrue(":b:", text.getText().equals("")); - text.insert("fred"); - assertTrue(":c:", text.getText().equals("fred")); - text.setSelection(2); - text.insert("helmut"); - assertTrue(":d:", text.getText().equals("frhelmuted")); - text.setText("01234567890"); - text.setSelection(4); - assertTrue(":e:", text.getLineCount()==1); - text.insert(delimiterString); - assertTrue(":f:", text.getLineCount()==2); -} - -public void test_invokeActionI() { - // invoking actions on an empty text should not crash - text.invokeAction(ST.LINE_DOWN); - text.invokeAction(ST.LINE_UP); - text.invokeAction(ST.LINE_END); - text.invokeAction(ST.LINE_START); - text.invokeAction(ST.COLUMN_NEXT); - text.invokeAction(ST.PAGE_DOWN); - text.invokeAction(ST.PAGE_UP); - text.invokeAction(ST.WORD_NEXT); - text.invokeAction(ST.WORD_PREVIOUS); - text.invokeAction(ST.TEXT_END); - text.invokeAction(ST.TEXT_START); - text.invokeAction(ST.WINDOW_END); - text.invokeAction(ST.WINDOW_START); - text.invokeAction(ST.SELECT_LINE_DOWN); - text.invokeAction(ST.SELECT_LINE_UP); - text.invokeAction(ST.SELECT_LINE_START); - text.invokeAction(ST.SELECT_LINE_END); - text.invokeAction(ST.SELECT_COLUMN_PREVIOUS); - text.invokeAction(ST.SELECT_COLUMN_NEXT); - text.invokeAction(ST.SELECT_PAGE_UP); - text.invokeAction(ST.SELECT_PAGE_DOWN); - text.invokeAction(ST.SELECT_WORD_PREVIOUS); - text.invokeAction(ST.SELECT_WORD_NEXT); - text.invokeAction(ST.SELECT_TEXT_END); - text.invokeAction(ST.SELECT_TEXT_START); - text.invokeAction(ST.SELECT_WINDOW_START); - text.invokeAction(ST.SELECT_WINDOW_END); - text.invokeAction(ST.CUT); - text.invokeAction(ST.COPY); - text.invokeAction(ST.PASTE); - text.invokeAction(ST.DELETE_PREVIOUS); - text.invokeAction(ST.DELETE_NEXT); - text.invokeAction(ST.TOGGLE_OVERWRITE); - - text.setText("Line1\r\nLine2"); - text.invokeAction(ST.LINE_DOWN); - assertEquals(7, text.getCaretOffset()); - - text.invokeAction(ST.LINE_UP); - assertEquals(0, text.getCaretOffset()); - - text.invokeAction(ST.LINE_END); - assertEquals(5, text.getCaretOffset()); - - text.invokeAction(ST.LINE_START); - assertEquals(0, text.getCaretOffset()); - - text.invokeAction(ST.COLUMN_NEXT); - assertEquals(1, text.getCaretOffset()); - - text.invokeAction(ST.PAGE_DOWN); - assertEquals(8, text.getCaretOffset()); - - text.invokeAction(ST.PAGE_UP); - assertEquals(1, text.getCaretOffset()); - - text.invokeAction(ST.TEXT_START); - text.invokeAction(ST.WORD_NEXT); - text.invokeAction(ST.WORD_NEXT); - assertEquals(7, text.getCaretOffset()); - - text.invokeAction(ST.WORD_PREVIOUS); - assertEquals(5, text.getCaretOffset()); - - text.invokeAction(ST.TEXT_END); - assertEquals(text.getCharCount(), text.getCaretOffset()); - - text.invokeAction(ST.TEXT_START); - assertEquals(0, text.getCaretOffset()); - - text.invokeAction(ST.WINDOW_END); - assertEquals(5, text.getCaretOffset()); - - text.invokeAction(ST.WINDOW_START); - assertEquals(0, text.getCaretOffset()); - - text.invokeAction(ST.SELECT_LINE_DOWN); - assertEquals("Line1\r\n", text.getSelectionText()); - - text.invokeAction(ST.LINE_END); - text.invokeAction(ST.SELECT_LINE_UP); - assertEquals("\r\nLine2", text.getSelectionText()); - - text.invokeAction(ST.SELECT_LINE_START); - assertEquals("Line1\r\nLine2", text.getSelectionText()); - - text.invokeAction(ST.LINE_START); - text.invokeAction(ST.SELECT_LINE_END); - assertEquals("Line1", text.getSelectionText()); - - text.invokeAction(ST.LINE_END); - text.invokeAction(ST.SELECT_COLUMN_PREVIOUS); - assertEquals("1", text.getSelectionText()); - - text.invokeAction(ST.SELECT_COLUMN_NEXT); - assertEquals("", text.getSelectionText()); - - text.invokeAction(ST.SELECT_PAGE_UP); - assertEquals("", text.getSelectionText()); - - text.invokeAction(ST.SELECT_PAGE_DOWN); - assertEquals("\r\nLine2", text.getSelectionText()); - - text.invokeAction(ST.LINE_END); - text.invokeAction(ST.SELECT_WORD_PREVIOUS); - assertEquals("Line2", text.getSelectionText()); - - text.invokeAction(ST.LINE_START); - text.invokeAction(ST.SELECT_WORD_NEXT); - assertEquals("Line2", text.getSelectionText()); - - text.invokeAction(ST.LINE_START); - text.invokeAction(ST.SELECT_TEXT_END); - assertEquals("Line2", text.getSelectionText()); - - text.invokeAction(ST.SELECT_TEXT_START); - assertEquals("Line1\r\n", text.getSelectionText()); - - text.invokeAction(ST.LINE_START); - text.invokeAction(ST.SELECT_WINDOW_START); - assertEquals("", text.getSelectionText()); - - text.invokeAction(ST.SELECT_WINDOW_END); - assertEquals("Line1", text.getSelectionText()); - - text.invokeAction(ST.SELECT_LINE_END); - text.invokeAction(ST.CUT); - assertEquals("\r\nLine2", text.getText()); - - text.invokeAction(ST.SELECT_LINE_DOWN); - text.invokeAction(ST.COPY); - assertEquals("\r\nLine2", text.getText()); - - text.invokeAction(ST.LINE_END); - text.invokeAction(ST.PASTE); - assertEquals("\r\nLine2\r\n", text.getText()); - - text.invokeAction(ST.DELETE_PREVIOUS); - assertEquals("\r\nLine2", text.getText()); - - text.invokeAction(ST.TEXT_START); - text.invokeAction(ST.DELETE_NEXT); - assertEquals("Line2", text.getText()); - - text.invokeAction(ST.TOGGLE_OVERWRITE); -} - -public void test_paste(){ - Clipboard clipboard = new Clipboard(text.getDisplay()); - TextTransfer transfer = TextTransfer.getInstance(); - String convertedText; - - clipboard.setContents(new String[]{""}, new Transfer[]{transfer}); - - text.copy(); - text.paste(); - assertTrue(":a:", text.getCharCount() == 0); - - text.setSelectionRange(0, 0); - text.copy(); - text.paste(); - assertTrue(":b:", text.getCharCount() == 0); - - text.setText("0123456789"); - text.setSelectionRange(0, 1); - text.copy(); - text.setCaretOffset(0); - text.paste(); - assertTrue(":c:", text.getText().equals("00123456789")); - text.setSelectionRange(1, 2); - text.copy(); - text.setText(""); - text.paste(); - assertTrue(":d:", text.getText().equals("01")); - text.setText(""); - - // test line delimiter conversion - clipboard.setContents(new String[]{"\rLine1\nLine2\r\nLine3\n\rLine4\n"}, new Transfer[]{transfer}); - text.paste(); - if (SwtJunit.isLinux) { - convertedText = "\nLine1\nLine2\nLine3\n\nLine4\n"; - } - else { - convertedText = "\r\nLine1\r\nLine2\r\nLine3\r\n\r\nLine4\r\n"; - } - assertTrue(":f:", text.getText() != null && text.getText().equals(convertedText)); - text.setText(""); - - // test line delimiter conversion - clipboard.setContents(new String[]{"Line1\r\nLine2"}, new Transfer[]{transfer}); - text.paste(); - if (SwtJunit.isLinux) { - convertedText = "Line1\nLine2"; - } - else { - convertedText = "Line1\r\nLine2"; - } - assertTrue(":g:", text.getText() != null && text.getText().equals(convertedText)); - text.setText(""); - - // test line delimiter conversion - clipboard.setContents(new String[]{"Line1\rLine2"}, new Transfer[]{transfer}); - text.paste(); - if (SwtJunit.isLinux) { - convertedText = "Line1\nLine2"; - } - else { - convertedText = "Line1\r\nLine2"; - } - assertTrue(":h:", text.getText() != null && text.getText().equals(convertedText)); - text.setText(""); - - - // test line delimiter conversion - clipboard.setContents(new String[]{"Line1\nLine2"}, new Transfer[]{transfer}); - text.paste(); - if (SwtJunit.isLinux) { - convertedText = "Line1\nLine2"; - } - else { - convertedText = "Line1\r\nLine2"; - } - assertTrue(":i:", text.getText() != null && text.getText().equals(convertedText)); - text.setText(""); - - - clipboard.dispose(); -} - -public void test_print() { - Printer printer = new Printer(); - - text.print(); - printer.cancelJob(); - text.setText("Line1"); - text.print(); - printer.cancelJob(); - printer.dispose(); -} - -public void test_printLorg_eclipse_swt_printing_Printer() { - Printer printer = new Printer(); - boolean exceptionThrown = false; - - try { - text.print(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - - text.print(printer); - printer.cancelJob(); - text.setText("Line1"); - text.print(printer); - printer.cancelJob(); - - printer.dispose(); -} - -public void test_redraw() { - // inherited test is sufficient -} - -public void test_redrawIIIIZ() { - // inherited test is sufficient -} - -public void test_redrawRangeIIZ() { - boolean exceptionThrown = false; - - text.redrawRange(0, 0, true); - text.redrawRange(0, 0, false); - - try { - text.redrawRange(0, 1, true); - } - catch (IllegalArgumentException e) { - if (e.getMessage().equals("Index out of bounds")) { - exceptionThrown = true; - } - } - assertTrue(exceptionThrown); - - exceptionThrown = false; - try { - text.redrawRange(0, 1, false); - } - catch (IllegalArgumentException e) { - if (e.getMessage().equals("Index out of bounds")) { - exceptionThrown = true; - } - } - assertTrue(exceptionThrown); - - exceptionThrown = false; - try { - text.redrawRange(-1, 2, true); - } - catch (IllegalArgumentException e) { - if (e.getMessage().equals("Index out of bounds")) { - exceptionThrown = true; - } - } - assertTrue(exceptionThrown); - - exceptionThrown = false; - try { - text.redrawRange(-1, 2, false); - } - catch (IllegalArgumentException e) { - if (e.getMessage().equals("Index out of bounds")) { - exceptionThrown = true; - } - } - assertTrue(exceptionThrown); - - text.setText("0123456789"); - text.redrawRange(0, 0, true); - text.redrawRange(0, 0, false); - text.redrawRange(0, 1, true); - text.redrawRange(0, 1, false); - text.redrawRange(8, 2, true); - text.redrawRange(8, 2, false); - text.redrawRange(10, 0, true); - text.redrawRange(10, 0, false); - - exceptionThrown = false; - try { - text.redrawRange(10, 1, true); - } - catch (IllegalArgumentException e) { - if (e.getMessage().equals("Index out of bounds")) { - exceptionThrown = true; - } - } - assertTrue(exceptionThrown); - - exceptionThrown = false; - try { - text.redrawRange(10, 1, false); - } - catch (IllegalArgumentException e) { - if (e.getMessage().equals("Index out of bounds")) { - exceptionThrown = true; - } - } - assertTrue(exceptionThrown); -} - -public void test_removeBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener() { - // tested in test_addBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener -} - -public void test_removeExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener() { - // tested in test_addExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener -} - -public void test_removeLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener() { - // tested in test_addLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener -} - -public void test_removeLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener() { - // tested in test_addLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener -} - -public void test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener() { - // tested in test_addModifyListenerLorg_eclipse_swt_events_ModifyListener -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - // tested in test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener -} - -public void test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener() { - // tested in test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener -} - -public void test_removeVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener() { - // tested in test_addVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener -} - -public void test_replaceStyleRanges(){ - StyleRange[] styles; - String textString = textString(); - - /* - defaultStyles - - (0,48,RED,YELLOW), - (58,10,BLUE,CYAN), - (68,10,GREEN,PURPLE) - */ - - - text.setText(textString); - - text.replaceStyleRanges(0, text.getCharCount(), defaultStyles()); - text.replaceStyleRanges(0, 78, new StyleRange[] {}); - styles = text.getStyleRanges(); - assertTrue(":0:", styles.length == 0); - text.setText(textString); - styles = text.getStyleRanges(); - assertTrue(":0:", styles.length == 0); - text.replaceStyleRanges(0, 78, new StyleRange[] {}); - styles = text.getStyleRanges(); - assertTrue(":0:", styles.length == 0); - text.replaceStyleRanges(0, text.getCharCount(), defaultStyles()); - styles = text.getStyleRanges(); - assertTrue(":0:", styles.length == 3); - assertTrue(":0:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":0:", styles[1].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":0:", styles[2].equals(getStyle(68,10,GREEN,PURPLE))); - - // No overlap with existing styles - text.replaceStyleRanges(0, text.getCharCount(), defaultStyles()); - text.replaceStyleRanges(48, 5, new StyleRange[] {getStyle(48,5,YELLOW,RED)}); - styles = text.getStyleRanges(); - assertTrue(":1:", styles.length == 4); - assertTrue(":1:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":1:", styles[1].equals(getStyle(48,5,YELLOW,RED))); - assertTrue(":1:", styles[2].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":1:", styles[3].equals(getStyle(68,10,GREEN,PURPLE))); - - // Overlap middle of one style - partial - text.replaceStyleRanges(0, text.getCharCount(), defaultStyles()); - text.replaceStyleRanges(10, 10, new StyleRange[] {getStyle(10,10,YELLOW,RED)}); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 5); - assertTrue(":2:", styles[0].equals(getStyle(0,10,RED,YELLOW))); - assertTrue(":2:", styles[1].equals(getStyle(10,10,YELLOW,RED))); - assertTrue(":2:", styles[2].equals(getStyle(20,28,RED,YELLOW))); - assertTrue(":2:", styles[3].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":2:", styles[4].equals(getStyle(68,10,GREEN,PURPLE))); - text.replaceStyleRanges(0, text.getCharCount(), new StyleRange[] {}); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 0); - - // Overlap middle of one style - full - text.replaceStyleRanges(0, text.getCharCount(), defaultStyles()); - text.replaceStyleRanges(58, 10, new StyleRange[] {getStyle(58,10,YELLOW,RED)}); - styles = text.getStyleRanges(); - assertTrue(":3:", styles.length == 3); - assertTrue(":3:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":3:", styles[1].equals(getStyle(58,10,YELLOW,RED))); - assertTrue(":3:", styles[2].equals(getStyle(68,10,GREEN,PURPLE))); - - // Overlap end of one style - text.replaceStyleRanges(0, text.getCharCount(), defaultStyles()); - text.replaceStyleRanges(38, 15, new StyleRange[] {getStyle(38,15,YELLOW,RED)}); - styles = text.getStyleRanges(); - assertTrue(":4:", styles.length == 4); - assertTrue(":4:", styles[0].equals(getStyle(0,38,RED,YELLOW))); - assertTrue(":4:", styles[1].equals(getStyle(38,15,YELLOW,RED))); - assertTrue(":4:", styles[2].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":4:", styles[3].equals(getStyle(68,10,GREEN,PURPLE))); - - // Overlap beginning of one style - text.replaceStyleRanges(0, text.getCharCount(), defaultStyles()); - text.replaceStyleRanges(50, 10, new StyleRange[] {getStyle(50,10,YELLOW,RED)}); - styles = text.getStyleRanges(); - assertTrue(":5:", styles.length == 4); - assertTrue(":5:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":5:", styles[1].equals(getStyle(50,10,YELLOW,RED))); - assertTrue(":5:", styles[2].equals(getStyle(60,8,BLUE,CYAN))); - assertTrue(":5:", styles[3].equals(getStyle(68,10,GREEN,PURPLE))); - - // Overlap complete style - text.replaceStyleRanges(0, text.getCharCount(), defaultStyles()); - text.replaceStyleRanges(48, 20, new StyleRange[] {getStyle(48,20,YELLOW,RED)}); - styles = text.getStyleRanges(); - assertTrue(":6:", styles.length == 3); - assertTrue(":6:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":6:", styles[1].equals(getStyle(48,20,YELLOW,RED))); - assertTrue(":6:", styles[2].equals(getStyle(68,10,GREEN,PURPLE))); - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - text.setText(textString); - StyleRange ranges[] = new StyleRange[3]; - ranges[0] = getStyle(0,48,RED,YELLOW); - ranges[1] = getStyle(48,20,BLUE,CYAN); - ranges[2] = getStyle(68,10,GREEN,PURPLE); - text.replaceStyleRanges(0, 78, ranges); - styles = text.getStyleRanges(); - assertTrue(":7:", styles.length == 3); - assertTrue(":7:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":7:", styles[1].equals(getStyle(48,20,BLUE,CYAN))); - assertTrue(":7:", styles[2].equals(getStyle(68,10,GREEN,PURPLE))); - - text.setText("012345678901234"); - ranges = new StyleRange[2]; - ranges[0] = getStyle(0,5,RED,YELLOW); - ranges[1] = getStyle(10,5,BLUE,CYAN); - text.replaceStyleRanges(0, 15, ranges); - styles = text.getStyleRanges(); - assertTrue(":8:", styles.length == 2); - assertTrue(":8:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":8:", styles[1].equals(getStyle(10,5,BLUE,CYAN))); - - text.setText("redgreenblueyellowcyanpurple"); - ranges = new StyleRange[4]; - ranges[0] = getStyle(0,3,RED,null); - ranges[1] = getStyle(3,5,GREEN,null); - ranges[2] = getStyle(8,4,BLUE,null); - ranges[3] = getStyle(12,6,YELLOW,null); - text.replaceStyleRanges(0, 18, ranges); - styles = text.getStyleRanges(); - assertTrue(":9:", styles.length == 4); - assertTrue(":9:", styles[0].equals(getStyle(0,3,RED,null))); - assertTrue(":9:", styles[1].equals(getStyle(3,5,GREEN,null))); - assertTrue(":9:", styles[2].equals(getStyle(8,4,BLUE, null))); - assertTrue(":9:", styles[3].equals(getStyle(12,6,YELLOW,null))); - ranges = new StyleRange[2]; - ranges[0] = getStyle(18,4,CYAN,null); - ranges[1] = getStyle(22,6,PURPLE,null); - text.replaceStyleRanges(18, 10, ranges); - styles = text.getStyleRanges(); - assertTrue(":9:", styles.length == 6); - assertTrue(":9:", styles[4].equals(getStyle(18,4,CYAN,null))); - assertTrue(":9:", styles[5].equals(getStyle(22,6,PURPLE,null))); - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - textString = textString(); - - text.setText(textString); - ranges = new StyleRange[2]; - ranges[0] = getStyle(0,10,RED,YELLOW); - ranges[1] = getStyle(25,10,GREEN,PURPLE); - text.replaceStyleRanges(0, 35, ranges); - ranges = new StyleRange[2]; - ranges[0] = getStyle(5,15,BLUE,CYAN); - ranges[1] = getStyle(20,10,GREEN,PURPLE); - text.replaceStyleRanges(5, 25, ranges); - styles = text.getStyleRanges(); - assertTrue(":10:", styles.length == 4); - assertTrue(":10:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":10:", styles[1].equals(getStyle(5,15,BLUE,CYAN))); - assertTrue(":10:", styles[2].equals(getStyle(20,10,GREEN,PURPLE))); - assertTrue(":10:", styles[3].equals(getStyle(30,5,GREEN,PURPLE))); - - text.setText("01234567890123456789"); - ranges = new StyleRange[2]; - ranges[0] = getStyle(0,10,RED,YELLOW); - ranges[1] = getStyle(10,10,BLUE,CYAN); - text.replaceStyleRanges(0, 20, ranges); - ranges = new StyleRange[2]; - ranges[0] = getStyle(5,3,RED,YELLOW); - ranges[1] = getStyle(12,5,BLUE,CYAN); - text.replaceStyleRanges(5, 12, ranges); - styles = text.getStyleRanges(); - assertTrue(":11:", styles.length == 4); - assertTrue(":11:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":11:", styles[1].equals(getStyle(5,3,RED,YELLOW))); - assertTrue(":11:", styles[2].equals(getStyle(12,5,BLUE,CYAN))); - assertTrue(":11:", styles[3].equals(getStyle(17,3,BLUE,CYAN))); - - text.setText("0123456789012345"); - ranges = new StyleRange[3]; - ranges[0] = getStyle(0,5,RED,YELLOW); - ranges[1] = getStyle(5,5,BLUE,CYAN); - ranges[2] = getStyle(10,5,GREEN,PURPLE); - text.replaceStyleRanges(0, 15, ranges); - ranges = new StyleRange[2]; - ranges[0] = getStyle(5,5,RED,YELLOW); - ranges[1] = getStyle(10,5,RED,YELLOW); - text.replaceStyleRanges(5, 10, ranges); - styles = text.getStyleRanges(); - assertTrue(":12:", styles.length == 3); - assertTrue(":12:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":12:", styles[1].equals(getStyle(5,5,RED,YELLOW))); - assertTrue(":12:", styles[2].equals(getStyle(10,5,RED,YELLOW))); - - text.setText("0123456789012345"); - ranges = new StyleRange[1]; - ranges[0] = getStyle(10,5,GREEN,PURPLE); - text.replaceStyleRanges(0, 15, ranges); - ranges = new StyleRange[2]; - ranges[0] = getStyle(0,5,RED,YELLOW); - ranges[1] = getStyle(5,5,BLUE,CYAN); - text.replaceStyleRanges(0, 10, ranges); - styles = text.getStyleRanges(); - assertTrue(":13:", styles.length == 3); - assertTrue(":13:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":13:", styles[1].equals(getStyle(5,5,BLUE,CYAN))); - assertTrue(":13:", styles[2].equals(getStyle(10,5,GREEN,PURPLE))); - - text.setText("012345678901234"); - ranges = new StyleRange[2]; - ranges[0] = getStyle(0,5,RED,YELLOW); - ranges[1] = getStyle(10,5,BLUE,CYAN); - text.replaceStyleRanges(0, 15, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(5,7,BLUE,CYAN); - text.replaceStyleRanges(5, 7, ranges); - styles = text.getStyleRanges(); - assertTrue(":14:", styles.length == 3); - assertTrue(":14:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":14:", styles[1].equals(getStyle(5,7,BLUE,CYAN))); - assertTrue(":14:", styles[2].equals(getStyle(12,3,BLUE,CYAN))); - - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - textString = textString(); - - - /* - defaultStyles - - (0,48,RED,YELLOW), - (58,10,BLUE,CYAN), - (68,10,GREEN,PURPLE) - */ - - - // End/Beginning overlap - text.setText(textString); - text.setStyleRanges(defaultStyles()); - ranges = new StyleRange[1]; - ranges[0] = getStyle(38,25,YELLOW,RED); - text.replaceStyleRanges(38, 25, ranges); - styles = text.getStyleRanges(); - assertTrue(":1a:", styles.length == 4); - assertTrue(":1a:", styles[0].equals(getStyle(0,38,RED,YELLOW))); - assertTrue(":1a:", styles[1].equals(getStyle(38,25,YELLOW,RED))); - assertTrue(":1a:", styles[2].equals(getStyle(63,5,BLUE,CYAN))); - assertTrue(":1a:", styles[3].equals(getStyle(68,10,GREEN,PURPLE))); - text.setStyleRanges(defaultStyles()); - ranges = new StyleRange[1]; - ranges[0] = getStyle(63,10,YELLOW,RED); - text.replaceStyleRanges(63, 10, ranges); - styles = text.getStyleRanges(); - assertTrue(":1a:", styles.length == 4); - assertTrue(":1a:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":1a:", styles[1].equals(getStyle(58,5,BLUE,CYAN))); - assertTrue(":1a:", styles[2].equals(getStyle(63,10,YELLOW,RED))); - assertTrue(":1a:", styles[3].equals(getStyle(73,5,GREEN,PURPLE))); - - // Complete overlap - text.setStyleRanges(defaultStyles()); - ranges = new StyleRange[1]; - ranges[0] = getStyle(0,78,YELLOW,RED); - text.replaceStyleRanges(0, 78, ranges); - styles = text.getStyleRanges(); - styles = text.getStyleRanges(); - assertTrue(":2a:", styles.length == 1); - assertTrue(":2a:", styles[0].equals(getStyle(0,78,YELLOW,RED))); - - text.setStyleRanges(defaultStyles()); - ranges = new StyleRange[1]; - ranges[0] = getStyle(0,68,YELLOW,RED); - text.replaceStyleRanges(0, 68, ranges); - styles = text.getStyleRanges(); - assertTrue(":2a:", styles.length == 2); - assertTrue(":2a:", styles[0].equals(getStyle(0,68,YELLOW,RED))); - assertTrue(":2a:", styles[1].equals(getStyle(68,10,GREEN,PURPLE))); - text.setStyleRanges(defaultStyles()); - ranges = new StyleRange[1]; - ranges[0] = getStyle(58,20,YELLOW,RED); - text.replaceStyleRanges(58, 20, ranges); - styles = text.getStyleRanges(); - assertTrue(":2a:", styles.length == 2); - assertTrue(":2a:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":2a:", styles[1].equals(getStyle(58,20,YELLOW,RED))); - - // 1-N complete, beginning - text.setText("012345678901234567890123456789"); - text.setStyleRanges( - new StyleRange[] {getStyle(0,5,RED,RED), getStyle(5,5,YELLOW,YELLOW), - getStyle(10,5,CYAN,CYAN), getStyle(15,5,BLUE,BLUE), - getStyle(20,5,GREEN,GREEN), getStyle(25,5,PURPLE,PURPLE)} - ); - ranges = new StyleRange[1]; - ranges[0] = getStyle(5,23,YELLOW,RED); - text.replaceStyleRanges(5, 23, ranges); - styles = text.getStyleRanges(); - assertTrue(":3a:", styles.length == 3); - assertTrue(":3a:", styles[0].equals(getStyle(0,5,RED,RED))); - assertTrue(":3a:", styles[1].equals(getStyle(5,23,YELLOW,RED))); - assertTrue(":3a:", styles[2].equals(getStyle(28,2,PURPLE,PURPLE))); - - // end, 1-N complete, beginning - text.setStyleRanges( - new StyleRange[] {getStyle(0,5,RED,RED), getStyle(5,5,YELLOW,YELLOW), - getStyle(10,5,CYAN,CYAN), getStyle(15,5,BLUE,BLUE), - getStyle(20,5,GREEN,GREEN), getStyle(25,5,PURPLE,PURPLE)} - ); - ranges = new StyleRange[1]; - ranges[0] = getStyle(13,12,YELLOW,RED); - text.replaceStyleRanges(13, 12, ranges); - styles = text.getStyleRanges(); - assertTrue(":3a:", styles.length == 5); - assertTrue(":3a:", styles[0].equals(getStyle(0,5,RED,RED))); - assertTrue(":3a:", styles[1].equals(getStyle(5,5,YELLOW,YELLOW))); - assertTrue(":3a:", styles[2].equals(getStyle(10,3,CYAN,CYAN))); - assertTrue(":3a:", styles[3].equals(getStyle(13,12,YELLOW,RED))); - assertTrue(":3a:", styles[4].equals(getStyle(25,5,PURPLE,PURPLE))); - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - // insert with no styles - text.setText("01234567890123456789"); - ranges = new StyleRange[1]; - ranges[0] = getStyle(0,5,RED,YELLOW); - text.replaceStyleRanges(0, 10, ranges); - styles = text.getStyleRanges(); - assertTrue(":1xa:", styles.length == 1); - assertTrue(":1xa:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - - // insert before 1 style - text.setText("01234567890123456789"); - ranges = new StyleRange[1]; - ranges[0] = getStyle(5,3,RED,YELLOW); - text.replaceStyleRanges(0, 10, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(0,3,PURPLE,PURPLE); - text.replaceStyleRanges(0, 3, ranges); - styles = text.getStyleRanges(); - assertTrue(":1xb:", styles.length == 2); - assertTrue(":1xb:", styles[0].equals(getStyle(0,3,PURPLE,PURPLE))); - assertTrue(":1xb:", styles[1].equals(getStyle(5,3,RED,YELLOW))); - - // insert after 1 style - text.setText("01234567890123456789"); - ranges = new StyleRange[1]; - ranges[0] = getStyle(5,3,RED,YELLOW); - text.replaceStyleRanges(0, 10, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(8,1,PURPLE,PURPLE); - text.replaceStyleRanges(8, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":1xc:", styles.length == 2); - assertTrue(":1xc:", styles[0].equals(getStyle(5,3,RED,YELLOW))); - assertTrue(":1xc:", styles[1].equals(getStyle(8,1,PURPLE,PURPLE))); - - // insert before 2 styles - text.setText("01234567890123456789"); - ranges = new StyleRange[2]; - ranges[0] = getStyle(5,2,RED,YELLOW); - ranges[1] = getStyle(10,2,RED,YELLOW); - text.replaceStyleRanges(0, 20, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(2,1,PURPLE,PURPLE); - text.replaceStyleRanges(2, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":1xe:", styles.length == 3); - assertTrue(":1xe:", styles[0].equals(getStyle(2,1,PURPLE,PURPLE))); - assertTrue(":1xe:", styles[1].equals(getStyle(5,2,RED,YELLOW))); - assertTrue(":1xe:", styles[2].equals(getStyle(10,2,RED,YELLOW))); - - // insert after 2 styles - text.setText("01234567890123456789"); - ranges = new StyleRange[2]; - ranges[0] = getStyle(5,2,RED,YELLOW); - ranges[1] = getStyle(10,2,RED,YELLOW); - text.replaceStyleRanges(0, 20, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(12,1,PURPLE,PURPLE); - text.replaceStyleRanges(12, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":1xf:", styles.length == 3); - assertTrue(":1xf:", styles[0].equals(getStyle(5,2,RED,YELLOW))); - assertTrue(":1xf:", styles[1].equals(getStyle(10,2,RED,YELLOW))); - assertTrue(":1xf:", styles[2].equals(getStyle(12,1,PURPLE,PURPLE))); - - // insert middle 2 styles - text.setText("01234567890123456789"); - ranges = new StyleRange[2]; - ranges[0] = getStyle(1,2,RED,YELLOW); - ranges[1] = getStyle(12,2,RED,YELLOW); - text.replaceStyleRanges(0, 20, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(5,3,PURPLE,PURPLE); - text.replaceStyleRanges(5, 3, ranges); - styles = text.getStyleRanges(); - assertTrue(":1xg:", styles.length == 3); - assertTrue(":1xg:", styles[0].equals(getStyle(1,2,RED,YELLOW))); - assertTrue(":1xg:", styles[1].equals(getStyle(5,3,PURPLE,PURPLE))); - assertTrue(":1xg:", styles[2].equals(getStyle(12,2,RED,YELLOW))); - - // insert middle 3 styles - text.setText("01234567890123456789"); - ranges = new StyleRange[3]; - ranges[0] = getStyle(1,3,RED,PURPLE); - ranges[1] = getStyle(6,3,PURPLE,YELLOW); - ranges[2] = getStyle(12,3,RED,YELLOW); - text.replaceStyleRanges(0, 20, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(4,2,PURPLE,PURPLE); - text.replaceStyleRanges(4, 2, ranges); - styles = text.getStyleRanges(); - assertTrue(":1xh:", styles.length == 4); - assertTrue(":1xh:", styles[0].equals(getStyle(1,3,RED,PURPLE))); - assertTrue(":1xh:", styles[1].equals(getStyle(4,2,PURPLE,PURPLE))); - assertTrue(":1xh:", styles[2].equals(getStyle(6,3,PURPLE,YELLOW))); - assertTrue(":1xh:", styles[3].equals(getStyle(12,3,RED,YELLOW))); - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - text.setText("0"); - ranges = new StyleRange[1]; - ranges[0] = getStyle(0,1,PURPLE,PURPLE); - text.replaceStyleRanges(0, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":2xa:", styles.length == 1); - - text.setText("01"); - ranges = new StyleRange[2]; - ranges[0] = getStyle(0,1,PURPLE,PURPLE); - ranges[1] = getStyle(1,1,RED,RED); - text.replaceStyleRanges(0, 2, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(0,1,YELLOW,YELLOW); - text.replaceStyleRanges(0, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":2xb:", styles.length == 2); - assertTrue(":2xb:", styles[0].equals(getStyle(0,1,YELLOW,YELLOW))); - assertTrue(":2xb:", styles[1].equals(getStyle(1,1,RED,RED))); - - text.setText("01"); - ranges = new StyleRange[2]; - ranges[0] = getStyle(0,1,PURPLE,PURPLE); - ranges[1] = getStyle(1,1,RED,RED); - text.replaceStyleRanges(0, 2, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(1,1,YELLOW,YELLOW); - text.replaceStyleRanges(1, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":2xc:", styles.length == 2); - assertTrue(":2xc:", styles[0].equals(getStyle(0,1,PURPLE,PURPLE))); - assertTrue(":2xc:", styles[1].equals(getStyle(1,1,YELLOW,YELLOW))); - - text.setText("012"); - ranges = new StyleRange[2]; - ranges[0] = getStyle(0,1,PURPLE,PURPLE); - ranges[1] = getStyle(1,1,RED,RED); - text.replaceStyleRanges(0, 2, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(2,1,YELLOW,YELLOW); - text.replaceStyleRanges(2, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":2xd:", styles.length == 3); - assertTrue(":2xd:", styles[0].equals(getStyle(0,1,PURPLE,PURPLE))); - assertTrue(":2xd:", styles[1].equals(getStyle(1,1,RED,RED))); - assertTrue(":2xd:", styles[2].equals(getStyle(2,1,YELLOW,YELLOW))); - - text.setText("01234"); - ranges = new StyleRange[3]; - ranges[0] = getStyle(1,1,PURPLE,PURPLE); - ranges[1] = getStyle(2,1,RED,RED); - ranges[2] = getStyle(3,1,PURPLE,PURPLE); - text.setStyleRanges(ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(4,1,YELLOW,YELLOW); - text.replaceStyleRanges(4, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":2xe:", styles.length == 4); - assertTrue(":2xe:", styles[3].equals(getStyle(4,1,YELLOW,YELLOW))); - - text.setText("01234"); - ranges = new StyleRange[1]; - ranges[0] = getStyle(4,1,YELLOW,YELLOW); - text.replaceStyleRanges(4, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":2xf:", styles.length == 1); - assertTrue(":2xf:", styles[0].equals(getStyle(4,1,YELLOW,YELLOW))); - - text.setText("01234"); - ranges = new StyleRange[1]; - ranges[0] = getStyle(4,1,YELLOW,YELLOW); - text.replaceStyleRanges(4, 1, ranges); - ranges = new StyleRange[0]; - text.replaceStyleRanges(4, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":2xg:", styles.length == 0); - -} - -public void test_replaceTextRangeIILjava_lang_String(){ - String defaultText = "line0\n\rline1\n\rline2\n\r"; - int defaultTextLength = defaultText.length(); - int selectionStart = 7; - int selectionLength = 7; - int replaceStart = selectionStart + selectionLength + 1; - int replaceLength = 5; - boolean exceptionThrown = false; - String newText = "newline0\n\rnewline1"; - int newTextLength = newText.length(); - - // insert text - // within range - // after selection - text.setText(defaultText); - // select 2nd line including line break - text.setSelectionRange(selectionStart, selectionLength); - text.replaceTextRange(replaceStart, 0, newText); - assertTrue(":a:", text.getCharCount() == defaultTextLength + newTextLength); - assertTrue(":b:", text.getSelectionRange().x == selectionStart && text.getSelectionRange().y == selectionLength); - - // before selection - text.setText(defaultText); - // select 2nd line including line break - text.setSelectionRange(selectionStart, selectionLength); - text.replaceTextRange(0, 0, newText); - assertTrue(":c:", text.getCharCount() == defaultTextLength + newTextLength); - assertTrue(":d:", text.getSelectionRange().x == selectionStart + newTextLength && text.getSelectionRange().y == selectionLength); - - - // intersecting selection - text.setText(defaultText); - // select 2nd line including line break - text.setSelectionRange(selectionStart, selectionLength); - text.replaceTextRange(selectionStart + 1, 0, newText); - assertTrue(":e:", text.getCharCount() == defaultTextLength + newTextLength); - assertTrue(":f:", text.getSelectionRange().x == selectionStart + 1 + newTextLength && text.getSelectionRange().y == 0); - - // out of range - text.setText(defaultText); - // select 2nd line including line break - text.setSelectionRange(selectionStart, selectionLength); - try { - text.replaceTextRange(-1, 0, newText); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":g:", exceptionThrown); - exceptionThrown = false; - try { - text.replaceTextRange(text.getCharCount() + 1, 0, newText); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - - exceptionThrown = false; - try { - text.replaceTextRange(0, 0, null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - - assertTrue(":h:", exceptionThrown); - assertTrue(":i:", text.getSelectionRange().x == selectionStart && text.getSelectionRange().y == selectionLength); - exceptionThrown = false; - - // append text - // append in empty widget - text.setText(""); - text.replaceTextRange(text.getCharCount(), 0, newText); - assertTrue(":j:", text.getCharCount() == newTextLength); - assertTrue(":k:", text.getSelectionRange().x == 0 && text.getSelectionRange().y == 0); - - // append in non-empty widget (selection should always be preserved) - text.setText(defaultText); - // select 2nd line including line break - text.setSelectionRange(selectionStart, selectionLength); - text.replaceTextRange(text.getCharCount(), 0, newText); - assertTrue(":l:", text.getCharCount() == defaultTextLength + newTextLength); - assertTrue(":m:", text.getSelectionRange().x == selectionStart && text.getSelectionRange().y == selectionLength); - - // place caret at end of text - text.setText(defaultText); - text.setSelectionRange(text.getCharCount(), 0); - text.replaceTextRange(text.getCharCount(), 0, newText); - assertTrue(":n:", text.getCharCount() == defaultTextLength + newTextLength); - assertTrue(":o:", text.getSelectionRange().x == text.getCharCount() - newTextLength && text.getSelectionRange().y == 0); - - // replace text - // within range - // after selection - text.setText(defaultText); - // select 2nd line including line break - text.setSelectionRange(selectionStart, selectionLength); - text.replaceTextRange(replaceStart, replaceLength, newText); - assertTrue(":p:", text.getCharCount() == defaultTextLength + newTextLength - replaceLength); - assertTrue(":q:", text.getSelectionRange().x == selectionStart && text.getSelectionRange().y == selectionLength); - - // before selection - text.setText(defaultText); - // select 2nd line including line break - text.setSelectionRange(selectionStart, selectionLength); - text.replaceTextRange(0, replaceLength, newText); - assertTrue(":r:", text.getCharCount() == defaultTextLength + newTextLength - replaceLength); - assertTrue(":s:", text.getSelectionRange().x == selectionStart + newTextLength - replaceLength && text.getSelectionRange().y == selectionLength); - - // intersecting selection - text.setText(defaultText); - // select 2nd line including line break - text.setSelectionRange(selectionStart, selectionLength); - text.replaceTextRange(selectionStart + 1, replaceLength, newText); - assertTrue(":t:", text.getCharCount() == defaultTextLength + newTextLength - replaceLength); - assertTrue(":u:", text.getSelectionRange().x == selectionStart + 1 + newTextLength && text.getSelectionRange().y == 0); - - // out of range - text.setText(defaultText); - // select 2nd line including line break - text.setSelectionRange(selectionStart, selectionLength); - try { - text.replaceTextRange(-1, replaceLength, newText); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":v:", exceptionThrown); - exceptionThrown = false; - try { - text.replaceTextRange(text.getCharCount() + 1, replaceLength, newText); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":w:", exceptionThrown); - assertTrue(":x:", text.getSelectionRange().x == selectionStart && text.getSelectionRange().y == selectionLength); -} - -public void test_selectAll() { - String line = "Line1\rLine2"; - - text.selectAll(); - assertEquals("", text.getSelectionText()); - - text.setText(line); - text.selectAll(); - assertEquals(line, text.getSelectionText()); - - text.setText(""); - text.selectAll(); - assertEquals("", text.getSelectionText()); -} - -public void test_setCaretLorg_eclipse_swt_widgets_Caret() { - Caret caret = new Caret(text, SWT.NONE); - final int XINSET; - - if (isBidi()) { - XINSET = 3; - } - else { - XINSET = 0; - } - - text.setCaret(caret); - assertEquals(XINSET, text.getCaret().getLocation().x); - assertEquals(0, text.getCaret().getLocation().y); - - text.setCaret(null); - text.setText("\rLine2"); - text.setSelection(2); - - text.setTopIndex(0); - text.setCaret(caret); - assertTrue(text.getCaret().getLocation().x > 0); - assertEquals(text.getLineHeight(), text.getCaret().getLocation().y); -} - -public void test_setBidiColoringZ() { - /// setBidiColoring is deprecated and will be removed. - warnUnimpl("Test test_setBidiColoringZ not written"); -} - -public void test_setCaretOffsetI(){ - text.setCaretOffset(-2); - assertTrue(":a:", text.getCaretOffset() == 0); - text.setCaretOffset(1); - assertTrue(":b:", text.getCaretOffset() == 0); - text.setCaretOffset(0); - assertTrue(":c:", text.getCaretOffset() == 0); - - text.setText("Line0\r\n"); - text.setCaretOffset(-2); - assertTrue(":d:", text.getCaretOffset() == 0); - text.setCaretOffset(1); - assertTrue(":e:", text.getCaretOffset() == 1); - text.setCaretOffset(0); - assertTrue(":f:", text.getCaretOffset() == 0); - - text.setCaretOffset(text.getCharCount()); - assertTrue(":g:", text.getCaretOffset() == text.getCharCount()); - text.setCaretOffset(text.getCharCount() + 1); - assertTrue(":h:", text.getCaretOffset() == text.getCharCount()); - text.setCaretOffset(5); - assertTrue(":i:", text.getCaretOffset() == 5); - - text.setText(""); - text.setCaretOffset(-2); - assertTrue(":j:", text.getCaretOffset() == 0); - text.setCaretOffset(1); - assertTrue(":k:", text.getCaretOffset() == 0); - text.setCaretOffset(0); - assertTrue(":l:", text.getCaretOffset() == 0); -} - -public void test_setContentLorg_eclipse_swt_custom_StyledTextContent() { - boolean exceptionThrown; - StyledTextContent content = new StyledTextContent() { - public void addTextChangeListener(TextChangeListener listener) { - } - public int getCharCount() { - return 0; - } - public String getLine(int lineIndex) { - return ""; - } - public int getLineAtOffset(int offset) { - return 0; - } - public int getLineCount() { - return 0; - } - public String getLineDelimiter() { - return ""; - } - public int getOffsetAtLine(int lineIndex) { - return 0; - } - public String getTextRange(int start, int length) { - return ""; - } - public void removeTextChangeListener(TextChangeListener listener) { - } - public void replaceTextRange(int start, int replaceLength, String text) { - } - public void setText(String text) { - } - }; - text.setContent(content); - assertEquals(content, text.getContent()); - - exceptionThrown = false; - try { - text.setContent(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); -} - -public void test_setDoubleClickEnabledZ(){ - text.setDoubleClickEnabled(true); - assertTrue(":a:", text.getDoubleClickEnabled() == true); - text.setDoubleClickEnabled(false); - assertTrue(":b:", text.getDoubleClickEnabled() == false); - text.setDoubleClickEnabled(false); - assertTrue(":c:", text.getDoubleClickEnabled() == false); - text.setDoubleClickEnabled(true); - assertTrue(":d:", text.getDoubleClickEnabled() == true); -} - -public void test_setEditableZ(){ - text.setEditable(true); - assertTrue(":a:", text.getEditable() == true); - text.setEditable(false); - assertTrue(":b:", text.getEditable() == false); - text.setEditable(false); - assertTrue(":c:", text.getEditable() == false); - text.setEditable(true); - assertTrue(":d:", text.getEditable() == true); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font(){ - FontData fontData = text.getFont().getFontData()[0]; - int lineHeight; - Font font; - - font = new Font(text.getDisplay(), fontData.getName(), 8, fontData.getStyle()); - text.setFont(font); - font.dispose(); - lineHeight = text.getLineHeight(); - font = new Font(text.getDisplay(), fontData.getName(), 12, fontData.getStyle()); - text.setFont(font); - assertTrue(":a:", text.getLineHeight() > lineHeight && font.equals(text.getFont())); - font.dispose(); -} - -public void test_setHorizontalIndexI(){ - text.setHorizontalIndex(-1); - assertTrue(":a:", text.getHorizontalIndex() == 0); - text.setHorizontalIndex(1); - assertTrue(":b:", text.getHorizontalIndex() == 0); - - text.setText("Line0"); - text.setHorizontalIndex(-1); - assertTrue(":c:", text.getHorizontalIndex() == 0); - text.setHorizontalIndex(1); - assertTrue(":d:", text.getHorizontalIndex() == 1); - text.setHorizontalIndex(500); - assertTrue(":e:", text.getHorizontalIndex() > 0); - text.setHorizontalIndex(-1); - assertTrue(":f:", text.getHorizontalIndex() == 0); - text.setHorizontalIndex(1); - assertTrue(":g:", text.getHorizontalIndex() == 1); - - text.setText(""); - text.setHorizontalIndex(2); - assertTrue(":h:", text.getHorizontalIndex() == 0); - - // make sure the widget can be scrolled - shell.open(); - text.setSize(10, 50); - text.setText("Line0"); - text.setHorizontalIndex(1); - assertTrue(":i:", text.getHorizontalIndex() == 1); -} - -public void test_setHorizontalPixelI(){ - text.setHorizontalPixel(-1); - assertTrue(":a:", text.getHorizontalPixel() == 0); - text.setHorizontalPixel(1); - assertTrue(":b:", text.getHorizontalPixel() == 0); - - text.setText("Line0"); - text.setHorizontalPixel(-1); - assertTrue(":c:", text.getHorizontalPixel() == 0); - text.setHorizontalPixel(1); - assertTrue(":d:", text.getHorizontalPixel() == 1); - text.setHorizontalPixel(500); - assertTrue(":e:", text.getHorizontalPixel() > 0); - text.setHorizontalPixel(-1); - assertTrue(":f:", text.getHorizontalPixel() == 0); - text.setHorizontalPixel(25); - assertTrue(":g:", text.getHorizontalPixel() == 25); - - text.setText(""); - text.setHorizontalPixel(2); - assertTrue(":h:", text.getHorizontalPixel() == 0); - - // make sure the widget can be scrolled - shell.open(); - text.setSize(10, 50); - text.setText("Line0"); - text.setHorizontalPixel(5); - assertTrue(":i:", text.getHorizontalPixel() == 5); -} - -public void test_setLineBackgroundIILorg_eclipse_swt_graphics_Color(){ - StyleRange[] styles; - String textString = ""; - - textString = "L1\nL2\nL3\nL4"; - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.setLineBackground(2,1,getColor(BLUE)); - text.setLineBackground(3,1,getColor(GREEN)); - text.replaceTextRange(1,5,""); - assertTrue(":0a:", text.getLineBackground(0) == getColor(RED)); - assertTrue(":0a:", text.getLineBackground(1) == getColor(GREEN)); - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.setLineBackground(2,1,getColor(BLUE)); - text.setLineBackground(3,1,getColor(GREEN)); - text.replaceTextRange(0,4,""); - assertTrue(":0b:", text.getLineBackground(0) == getColor(YELLOW)); - assertTrue(":0b:", text.getLineBackground(1) == getColor(BLUE)); - assertTrue(":0b:", text.getLineBackground(2) == getColor(GREEN)); - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.setLineBackground(2,1,getColor(BLUE)); - text.setLineBackground(3,1,getColor(GREEN)); - text.replaceTextRange(1,1,""); - assertTrue(":0c:", text.getLineBackground(0) == getColor(RED)); - assertTrue(":0c:", text.getLineBackground(1) == getColor(YELLOW)); - assertTrue(":0c:", text.getLineBackground(2) == getColor(BLUE)); - assertTrue(":0c:", text.getLineBackground(3) == getColor(GREEN)); - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.setLineBackground(2,1,getColor(BLUE)); - text.setLineBackground(3,1,getColor(GREEN)); - text.replaceTextRange(0,6,""); - assertTrue(":0d:", text.getLineBackground(0) == getColor(BLUE)); - assertTrue(":0d:", text.getLineBackground(1) == getColor(GREEN)); - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.setLineBackground(2,1,getColor(BLUE)); - text.setLineBackground(3,1,getColor(GREEN)); - text.replaceTextRange(1,3,""); - assertTrue(":0e:", text.getLineBackground(0) == getColor(RED)); - assertTrue(":0e:", text.getLineBackground(1) == getColor(BLUE)); - assertTrue(":0e:", text.getLineBackground(2) == getColor(GREEN)); - - textString = "L1\nL2"; - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.replaceTextRange(1,4,""); - assertTrue(":0a1:", text.getLineBackground(0) == getColor(RED)); - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.replaceTextRange(0,4,""); - assertTrue(":0b1:", text.getLineBackground(0) == getColor(YELLOW)); - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.replaceTextRange(1,1,""); - assertTrue(":0c1:", text.getLineBackground(0) == getColor(RED)); - assertTrue(":0c1:", text.getLineBackground(1) == getColor(YELLOW)); - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.replaceTextRange(0,5,""); - assertTrue(":0d1:", text.getLineBackground(0) == null); - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.replaceTextRange(1,3,""); - assertTrue(":0e1:", text.getLineBackground(0) == getColor(RED)); - assertTrue(":0e1:", text.getLineBackground(1) == getColor(YELLOW)); - textString = "L1\nL2"; - text.setText(textString); - text.setLineBackground(1,1,getColor(YELLOW)); - text.replaceTextRange(1,4,""); - assertTrue(":0f1:", text.getLineBackground(0) == null); - text.setText(textString+"\n"); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.replaceTextRange(0,6,""); - assertTrue(":0g1:", text.getLineBackground(0) == null); - - text.setText(textString); - text.setLineBackground(0,0,getColor(RED)); - assertTrue(":1:", text.getLineBackground(0) == null); - text.setLineBackground(0,1,getColor(RED)); - assertTrue(":1:", text.getLineBackground(0) == getColor(RED)); - - textString = "New Line1\nNew Line2\nNew Line3\nNew Line4"; - text.setText(textString); - text.setLineBackground(0,2,getColor(RED)); - text.setLineBackground(2,2,getColor(YELLOW)); - text.replaceTextRange(0,0,"\n"); - assertTrue(":2:", text.getLineBackground(0) == null); - assertTrue(":2:", text.getLineBackground(1) == getColor(RED)); - assertTrue(":2:", text.getLineBackground(2) == getColor(RED)); - assertTrue(":2:", text.getLineBackground(3) == getColor(YELLOW)); - assertTrue(":2:", text.getLineBackground(4) == getColor(YELLOW)); - - textString = "New Line1\nNew Line2\nNew Line3\nNew Line4"; - text.setText(textString); - text.setLineBackground(0,2,getColor(RED)); - text.setLineBackground(2,2,getColor(YELLOW)); - text.replaceTextRange(0,20,""); - assertTrue(":3:", text.getLineBackground(0) == getColor(YELLOW)); - assertTrue(":3:", text.getLineBackground(1) == getColor(YELLOW)); - - textString = "Line1\nLine2\nLine3\nLine4"; - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(2,1,getColor(YELLOW)); - text.replaceTextRange(0,18,""); - assertTrue(":4:", text.getLineBackground(0) == null); - - textString = "Line1\nLine2\nLine3\nLine4"; - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(2,1,getColor(YELLOW)); - text.replaceTextRange(0,18,"L1\nL2\nL3\n"); - assertTrue(":5:", text.getLineBackground(0) == null); - assertTrue(":5:", text.getLineBackground(1) == null); - assertTrue(":5:", text.getLineBackground(2) == null); - assertTrue(":5:", text.getLineBackground(3) == null); - - textString = "Line1\nLine2\nLine3\nLine4"; - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.setLineBackground(2,1,getColor(BLUE)); - text.setLineBackground(3,1,getColor(GREEN)); - text.replaceTextRange(3,9,"L1\nL2\n"); - assertTrue(":6a:", text.getLineBackground(0) == getColor(RED)); - assertTrue(":6a:", text.getLineBackground(1) == null); - textString = "Line1\nLine2\nLine3\nLine4"; - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.setLineBackground(2,1,getColor(BLUE)); - text.setLineBackground(3,1,getColor(GREEN)); - text.replaceTextRange(11,11,"L3\nL4"); - assertTrue(":6b:", text.getLineBackground(2) == null); - assertTrue(":6b:", text.getLineBackground(3) == getColor(GREEN)); - - textString = "Line1\nLine2\nLine3\nLine4"; - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.setLineBackground(2,1,getColor(BLUE)); - text.setLineBackground(3,1,getColor(GREEN)); - text.replaceTextRange(0,18,"L1\n"); - assertTrue(":7:", text.getLineBackground(0) == null); - assertTrue(":7:", text.getLineBackground(1) == getColor(GREEN)); -} - -public void test_setSelectionI() { - int[] invalid = {-1, 100, 12}; - boolean exceptionThrown; - - for (int i = 0; i < invalid.length; i++) { - exceptionThrown = false; - try { - text.setSelection(invalid[i]); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - } - text.setText("01234567890"); - assertEquals(0, text.getCaretOffset()); - text.setSelection(1); - assertEquals(1, text.getCaretOffset()); - text.setSelection(11); - assertEquals(11, text.getCaretOffset()); - - for (int i = 0; i < invalid.length; i++) { - exceptionThrown = false; - try { - text.setSelection(invalid[i]); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - } -} - -public void test_setSelectionLorg_eclipse_swt_graphics_Point() { - Point[] invalidRanges = {new Point(-1, 0), new Point(-1, -1), new Point(100, 1), - new Point(100, -1), new Point(11, 12), new Point(10, 12)}; - boolean exceptionThrown; - - for (int i = 0; i < invalidRanges.length; i++) { - exceptionThrown = false; - try { - text.setSelection(invalidRanges[i]); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - } - text.setText("01234567890"); - assertEquals("", text.getSelectionText()); - text.setSelection(3, 7); - assertEquals("3456", text.getSelectionText()); - - for (int i = 0; i < invalidRanges.length; i++) { - exceptionThrown = false; - try { - text.setSelection(invalidRanges[i]); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - } -} - -public void test_setSelectionII(){ - int[][] invalidRanges = {{-1, 0}, {-1, -1}, {100, 1}, {100, -1}, {11, 12}, {10, 12}}; - boolean exceptionThrown; - - for (int i = 0; i < invalidRanges.length; i++) { - int start = invalidRanges[i][0]; - int end = invalidRanges[i][1]; - - exceptionThrown = false; - try { - text.setSelection(start, end); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - } - text.setText("01234567890"); - assertEquals("", text.getSelectionText()); - text.setSelection(3, 7); - assertEquals("3456", text.getSelectionText()); - - for (int i = 0; i < invalidRanges.length; i++) { - int start = invalidRanges[i][0]; - int end = invalidRanges[i][1]; - - exceptionThrown = false; - try { - text.setSelection(start, end); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - } -} - -public void test_setSelectionRangeII(){ - // setSelectionRange already tested in test_getSelectionRange -} - -public void test_setStyleRangeLorg_eclipse_swt_custom_StyleRange(){ - StyleRange[] styles; - String textString = textString(); - - /* - defaultStyles - - (0,48,RED,YELLOW), - (58,10,BLUE,CYAN), - (68,10,GREEN,PURPLE) - */ - - - text.setText(textString); - - // No overlap with existing styles - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(48,5,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":1:", styles.length == 4); - assertTrue(":1:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":1:", styles[1].equals(getStyle(48,5,YELLOW,RED))); - assertTrue(":1:", styles[2].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":1:", styles[3].equals(getStyle(68,10,GREEN,PURPLE))); - - // Overlap middle of one style - partial - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(10,10,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 5); - assertTrue(":2:", styles[0].equals(getStyle(0,10,RED,YELLOW))); - assertTrue(":2:", styles[1].equals(getStyle(10,10,YELLOW,RED))); - assertTrue(":2:", styles[2].equals(getStyle(20,28,RED,YELLOW))); - assertTrue(":2:", styles[3].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":2:", styles[4].equals(getStyle(68,10,GREEN,PURPLE))); - text.setStyleRange(null); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 0); - - // Overlap middle of one style - full - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(58,10,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":3:", styles.length == 3); - assertTrue(":3:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":3:", styles[1].equals(getStyle(58,10,YELLOW,RED))); - assertTrue(":3:", styles[2].equals(getStyle(68,10,GREEN,PURPLE))); - - // Overlap end of one style - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(38,15,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":4:", styles.length == 4); - assertTrue(":4:", styles[0].equals(getStyle(0,38,RED,YELLOW))); - assertTrue(":4:", styles[1].equals(getStyle(38,15,YELLOW,RED))); - assertTrue(":4:", styles[2].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":4:", styles[3].equals(getStyle(68,10,GREEN,PURPLE))); - - // Overlap beginning of one style - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(50,10,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":5:", styles.length == 4); - assertTrue(":5:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":5:", styles[1].equals(getStyle(50,10,YELLOW,RED))); - assertTrue(":5:", styles[2].equals(getStyle(60,8,BLUE,CYAN))); - assertTrue(":5:", styles[3].equals(getStyle(68,10,GREEN,PURPLE))); - - // Overlap complete style - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(48,20,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":6:", styles.length == 3); - assertTrue(":6:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":6:", styles[1].equals(getStyle(48,20,YELLOW,RED))); - assertTrue(":6:", styles[2].equals(getStyle(68,10,GREEN,PURPLE))); - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - text.setText(textString); - text.setStyleRange(getStyle(0,48,RED,YELLOW)); - text.setStyleRange(getStyle(48,20,BLUE,CYAN)); - text.setStyleRange(getStyle(68,10,GREEN,PURPLE)); - // should be merged with style before it - text.setStyleRange(getStyle(48,10,RED,YELLOW)); - styles = text.getStyleRanges(); - assertTrue(":1:", styles.length == 3); - assertTrue(":1:", styles[0].equals(getStyle(0,58,RED,YELLOW))); - assertTrue(":1:", styles[1].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":1:", styles[2].equals(getStyle(68,10,GREEN,PURPLE))); - - text.setText(textString); - text.setStyleRange(getStyle(0,10,RED,YELLOW)); - text.setStyleRange(getStyle(15,10,BLUE,CYAN)); - text.setStyleRange(getStyle(25,10,GREEN,PURPLE)); - // should be merged with style after it - text.setStyleRange(getStyle(11,4,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 3); - assertTrue(":2:", styles[0].equals(getStyle(0,10,RED,YELLOW))); - assertTrue(":2:", styles[1].equals(getStyle(11,14,BLUE,CYAN))); - assertTrue(":2:", styles[2].equals(getStyle(25,10,GREEN,PURPLE))); - - text.setText(textString); - text.setStyleRange(getStyle(0,10,RED,YELLOW)); - text.setStyleRange(getStyle(15,10,BLUE,CYAN)); - text.setStyleRange(getStyle(25,10,GREEN,PURPLE)); - // should be merged with style after it - text.setStyleRange(getStyle(5,15,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":3:", styles.length == 3); - assertTrue(":3:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":3:", styles[1].equals(getStyle(5,20,BLUE,CYAN))); - assertTrue(":3:", styles[2].equals(getStyle(25,10,GREEN,PURPLE))); - - text.setText("01234567890123456789"); - text.setStyleRange(getStyle(0,10,RED,YELLOW)); - text.setStyleRange(getStyle(10,10,BLUE,CYAN)); - text.setStyleRange(getStyle(5,3,RED,YELLOW)); - text.setStyleRange(getStyle(12,5,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":4:", styles.length == 2); - assertTrue(":4:", styles[0].equals(getStyle(0,10,RED,YELLOW))); - assertTrue(":4:", styles[1].equals(getStyle(10,10,BLUE,CYAN))); - - text.setText("0123456789012345"); - text.setStyleRange(getStyle(0,5,RED,YELLOW)); - text.setStyleRange(getStyle(5,5,BLUE,CYAN)); - text.setStyleRange(getStyle(10,5,GREEN,PURPLE)); - // no merging since styles are completely overlapping existing - // styles - text.setStyleRange(getStyle(5,5,RED,YELLOW)); - text.setStyleRange(getStyle(10,5,RED,YELLOW)); - styles = text.getStyleRanges(); - assertTrue(":5:", styles.length == 3); - assertTrue(":5:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":5:", styles[1].equals(getStyle(5,5,RED,YELLOW))); - assertTrue(":5:", styles[2].equals(getStyle(10,5,RED,YELLOW))); - - text.setText("012345678901234"); - text.setStyleRange(getStyle(0,5,RED,YELLOW)); - text.setStyleRange(getStyle(10,5,BLUE,CYAN)); - // should be merged - text.setStyleRange(getStyle(5,7,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":6:", styles.length == 2); - assertTrue(":6:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":6:", styles[1].equals(getStyle(5,10,BLUE,CYAN))); - - text.setText("123 456 789"); - text.setStyleRange(getStyle(4,3,BLUE,null)); - text.setStyleRange(getStyle(8,3,RED,null)); - text.setStyleRange(getStyle(5,2,BLUE,null)); - styles = text.getStyleRanges(); - assertTrue(":7:", styles.length == 2); - assertTrue(":7:", styles[0].equals(getStyle(4,3,BLUE,null))); - assertTrue(":7:", styles[1].equals(getStyle(8,3,RED,null))); - - text.setText("123 456 789"); - text.setStyleRange(getStyle(4,3,BLUE,null)); - text.setStyleRange(getStyle(8,3,RED,null)); - text.setStyleRange(getStyle(7,4,BLUE,null)); - styles = text.getStyleRanges(); - assertTrue(":8:", styles.length == 2); - assertTrue(":8:", styles[0].equals(getStyle(4,3,BLUE,null))); - assertTrue(":8:", styles[1].equals(getStyle(7,4,BLUE,null))); - - text.setText("123 456 789 ABC DEF"); - text.setStyleRange(getStyle(0,4,BLUE,null)); - text.setStyleRange(getStyle(4,4,RED,null)); - text.setStyleRange(getStyle(8,4,BLUE,null)); - text.setStyleRange(getStyle(12,4,RED,null)); - text.setStyleRange(getStyle(16,3,BLUE,null)); - text.setStyleRange(getStyle(5,14,RED,null)); - styles = text.getStyleRanges(); - assertTrue(":9:", styles.length == 2); - assertTrue(":9:", styles[0].equals(getStyle(0,4,BLUE,null))); - assertTrue(":9:", styles[1].equals(getStyle(4,15,RED,null))); - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - text.setText(textString); - text.setStyleRange(getStyle(0,48,RED,YELLOW)); - text.setStyleRange(getStyle(48,20,BLUE,CYAN)); - text.setStyleRange(getStyle(68,10,GREEN,PURPLE)); - text.setStyleRange(getStyle(38,20,null,null)); - styles = text.getStyleRanges(); - assertTrue(":1:", styles.length == 3); - assertTrue(":1:", styles[0].equals(getStyle(0,38,RED,YELLOW))); - assertTrue(":1:", styles[1].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":1:", styles[2].equals(getStyle(68,10,GREEN,PURPLE))); - - text.setText(textString); - int length = textString.length(); - text.setStyleRange(getStyle(0,48,RED,YELLOW)); - text.setStyleRange(getStyle(48,20,BLUE,CYAN)); - text.setStyleRange(getStyle(68,10,GREEN,PURPLE)); - text.setStyleRange(getStyle(0,length,null,null)); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 0); - - text.setText("01234567890123456789"); - text.setStyleRange(getStyle(0,3,RED,YELLOW)); - text.setStyleRange(getStyle(5,3,BLUE,CYAN)); - text.setStyleRange(getStyle(9,8,GREEN,PURPLE)); - text.setStyleRange(getStyle(0,10,GREEN,PURPLE)); - styles = text.getStyleRanges(); - assertTrue(":3:", styles.length == 2); - assertTrue(":3:", styles[0].equals(getStyle(0,10,GREEN,PURPLE))); - assertTrue(":3:", styles[1].equals(getStyle(10,7,GREEN,PURPLE))); - - text.setText("0123456789012345"); - text.setStyleRange(getStyle(0,5,RED,YELLOW)); - text.setStyleRange(getStyle(5,5,BLUE,CYAN)); - text.setStyleRange(getStyle(10,5,GREEN,PURPLE)); - text.setStyleRange(getStyle(7,9,RED,YELLOW)); - styles = text.getStyleRanges(); - assertTrue(":4:", styles.length == 3); - assertTrue(":4:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":4:", styles[1].equals(getStyle(5,2,BLUE,CYAN))); - assertTrue(":4:", styles[2].equals(getStyle(7,9,RED,YELLOW))); - - text.setText("012345678901234"); - text.setStyleRange(getStyle(0,5,RED,YELLOW)); - text.setStyleRange(getStyle(10,5,BLUE,CYAN)); - text.setStyleRange(getStyle(3,10,GREEN,PURPLE)); - styles = text.getStyleRanges(); - assertTrue(":5:", styles.length == 3); - assertTrue(":5:", styles[0].equals(getStyle(0,3,RED,YELLOW))); - assertTrue(":5:", styles[1].equals(getStyle(3,10,GREEN,PURPLE))); - assertTrue(":5:", styles[2].equals(getStyle(13,2,BLUE,CYAN))); - - text.setText("redgreenblueyellowcyanpurple"); - text.setStyleRange(getStyle(0,3,RED,null)); - text.setStyleRange(getStyle(3,5,GREEN,null)); - text.setStyleRange(getStyle(8,4,BLUE,null)); - text.setStyleRange(getStyle(12,6,YELLOW,null)); - text.setStyleRange(getStyle(18,4,CYAN,null)); - text.setStyleRange(getStyle(22,6,PURPLE,null)); - text.setStyleRange(getStyle(8,14,null,RED)); - styles = text.getStyleRanges(); - assertTrue(":6:", styles.length == 4); - assertTrue(":6:", styles[0].equals(getStyle(0,3,RED,null))); - assertTrue(":6:", styles[1].equals(getStyle(3,5,GREEN,null))); - assertTrue(":6:", styles[2].equals(getStyle(8,14,null,RED))); - assertTrue(":6:", styles[3].equals(getStyle(22,6,PURPLE,null))); - - - text.setText("redgreenblueyellowcyanpurple"); - text.setStyleRange(getStyle(0,3,RED,null)); - text.setStyleRange(getStyle(3,5,GREEN,null)); - text.setStyleRange(getStyle(8,4,BLUE,null)); - text.setStyleRange(getStyle(12,6,YELLOW,null)); - text.setStyleRange(getStyle(18,4,CYAN,null)); - text.setStyleRange(getStyle(22,6,PURPLE,null)); - text.setStyleRange(getStyle(0,28,null,null)); - styles = text.getStyleRanges(); - assertTrue(":7:", styles.length == 0); - - -/* - text.setText("This\r\na\tAnother line."); - text.setStyleRange(getStyle(3,3,BLUE,null)); - text.setStyleRange(getStyle(7,8,BLUE,null)); - text.setStyleRange(getStyle(6,1,BLUE,null)); - StyledTextEvent event = new StyledTextEvent(); - event.detail = 6; - event.text = "a\tAnother line."; - text.notifyListener(ST.LineGetStyle, event); - assertTrue(":8:", event.styles[0].equals(getStyle(3,4,BLUE,null))); -*/ - - - text.setText("123 456 789"); - text.setStyleRange(getStyle(4,3,BLUE,null)); - text.setStyleRange(getStyle(8,3,RED,null)); - text.setStyleRange(getStyle(5,5,BLUE,null)); - styles = text.getStyleRanges(); - assertTrue(":9:", styles.length == 2); - assertTrue(":9:", styles[0].equals(getStyle(4,6,BLUE,null))); - assertTrue(":9:", styles[1].equals(getStyle(10,1,RED,null))); - - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - textString = textString(); - - text.setText(textString); - text.setStyleRange(getStyle(0,48,RED,YELLOW)); - text.setStyleRange(getStyle(48,20,BLUE,CYAN)); - text.setStyleRange(getStyle(68,10,GREEN,PURPLE)); - // should be merged with style before it - text.setStyleRange(getStyle(48,10,RED,YELLOW)); - styles = text.getStyleRanges(); - assertTrue(":1:", styles.length == 3); - assertTrue(":1:", styles[0].equals(getStyle(0,58,RED,YELLOW))); - assertTrue(":1:", styles[1].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":1:", styles[2].equals(getStyle(68,10,GREEN,PURPLE))); - - - text.setText(textString); - text.setStyleRange(getStyle(0,10,RED,YELLOW)); - text.setStyleRange(getStyle(15,10,BLUE,CYAN)); - text.setStyleRange(getStyle(25,10,GREEN,PURPLE)); - // should be merged with style after it - text.setStyleRange(getStyle(11,4,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 3); - assertTrue(":2:", styles[0].equals(getStyle(0,10,RED,YELLOW))); - assertTrue(":2:", styles[1].equals(getStyle(11,14,BLUE,CYAN))); - assertTrue(":2:", styles[2].equals(getStyle(25,10,GREEN,PURPLE))); - - text.setText(textString); - text.setStyleRange(getStyle(0,10,RED,YELLOW)); - text.setStyleRange(getStyle(15,10,BLUE,CYAN)); - text.setStyleRange(getStyle(25,10,GREEN,PURPLE)); - // should be merged with style after it - text.setStyleRange(getStyle(5,15,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":3:", styles.length == 3); - assertTrue(":3:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":3:", styles[1].equals(getStyle(5,20,BLUE,CYAN))); - assertTrue(":3:", styles[2].equals(getStyle(25,10,GREEN,PURPLE))); - - - - text.setText("01234567890123456789"); - text.setStyleRange(getStyle(0,10,RED,YELLOW)); - text.setStyleRange(getStyle(10,10,BLUE,CYAN)); - text.setStyleRange(getStyle(5,3,RED,YELLOW)); - text.setStyleRange(getStyle(12,5,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":4:", styles.length == 2); - assertTrue(":4:", styles[0].equals(getStyle(0,10,RED,YELLOW))); - assertTrue(":4:", styles[1].equals(getStyle(10,10,BLUE,CYAN))); - - text.setText("0123456789012345"); - text.setStyleRange(getStyle(0,5,RED,YELLOW)); - text.setStyleRange(getStyle(5,5,BLUE,CYAN)); - text.setStyleRange(getStyle(10,5,GREEN,PURPLE)); - // no merging since styles are completely overlapping existing - // styles - text.setStyleRange(getStyle(5,5,RED,YELLOW)); - text.setStyleRange(getStyle(10,5,RED,YELLOW)); - styles = text.getStyleRanges(); - assertTrue(":5:", styles.length == 3); - assertTrue(":5:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":5:", styles[1].equals(getStyle(5,5,RED,YELLOW))); - assertTrue(":5:", styles[2].equals(getStyle(10,5,RED,YELLOW))); - - text.setText("012345678901234"); - text.setStyleRange(getStyle(0,5,RED,YELLOW)); - text.setStyleRange(getStyle(10,5,BLUE,CYAN)); - // should be merged - text.setStyleRange(getStyle(5,7,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":6:", styles.length == 2); - assertTrue(":6:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":6:", styles[1].equals(getStyle(5,10,BLUE,CYAN))); - - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - textString = textString(); - - - /* - defaultStyles - - (0,48,RED,YELLOW), - (58,10,BLUE,CYAN), - (68,10,GREEN,PURPLE) - */ - - - text.setText(textString); - - // End/Beginning overlap - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(38,25,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":1:", styles.length == 4); - assertTrue(":1:", styles[0].equals(getStyle(0,38,RED,YELLOW))); - assertTrue(":1:", styles[1].equals(getStyle(38,25,YELLOW,RED))); - assertTrue(":1:", styles[2].equals(getStyle(63,5,BLUE,CYAN))); - assertTrue(":1:", styles[3].equals(getStyle(68,10,GREEN,PURPLE))); - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(63,10,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":1:", styles.length == 4); - assertTrue(":1:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":1:", styles[1].equals(getStyle(58,5,BLUE,CYAN))); - assertTrue(":1:", styles[2].equals(getStyle(63,10,YELLOW,RED))); - assertTrue(":1:", styles[3].equals(getStyle(73,5,GREEN,PURPLE))); - - - // Complete overlap - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(0,78,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 1); - assertTrue(":2:", styles[0].equals(getStyle(0,78,YELLOW,RED))); - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(0,68,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 2); - assertTrue(":2:", styles[0].equals(getStyle(0,68,YELLOW,RED))); - assertTrue(":2:", styles[1].equals(getStyle(68,10,GREEN,PURPLE))); - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(58,20,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 2); - assertTrue(":2:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":2:", styles[1].equals(getStyle(58,20,YELLOW,RED))); - - - // 1-N complete, beginning - text.setText("012345678901234567890123456789"); - text.setStyleRanges( - new StyleRange[] {getStyle(0,5,RED,RED), getStyle(5,5,YELLOW,YELLOW), - getStyle(10,5,CYAN,CYAN), getStyle(15,5,BLUE,BLUE), - getStyle(20,5,GREEN,GREEN), getStyle(25,5,PURPLE,PURPLE)} - ); - text.setStyleRange(getStyle(5,23,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":3:", styles.length == 3); - assertTrue(":3:", styles[0].equals(getStyle(0,5,RED,RED))); - assertTrue(":3:", styles[1].equals(getStyle(5,23,YELLOW,RED))); - assertTrue(":3:", styles[2].equals(getStyle(28,2,PURPLE,PURPLE))); - - // end, 1-N complete, beginning - text.setStyleRanges( - new StyleRange[] {getStyle(0,5,RED,RED), getStyle(5,5,YELLOW,YELLOW), - getStyle(10,5,CYAN,CYAN), getStyle(15,5,BLUE,BLUE), - getStyle(20,5,GREEN,GREEN), getStyle(25,5,PURPLE,PURPLE)} - ); - text.setStyleRange(getStyle(13,12,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":3:", styles.length == 5); - assertTrue(":3:", styles[0].equals(getStyle(0,5,RED,RED))); - assertTrue(":3:", styles[1].equals(getStyle(5,5,YELLOW,YELLOW))); - assertTrue(":3:", styles[2].equals(getStyle(10,3,CYAN,CYAN))); - assertTrue(":3:", styles[3].equals(getStyle(13,12,YELLOW,RED))); - assertTrue(":3:", styles[4].equals(getStyle(25,5,PURPLE,PURPLE))); - - - text.setText("x/"); - text.setStyleRange(getStyle(0,2,YELLOW,null)); - styles = text.getStyleRanges(); - assertTrue(":4:", styles.length == 1); - assertTrue(":4:", styles[0].equals(getStyle(0,2,YELLOW,null))); - text.replaceTextRange(2,0,"/"); - styles = text.getStyleRanges(); - assertTrue(":4:", styles.length == 1); - assertTrue(":4:", styles[0].equals(getStyle(0,2,YELLOW,null))); - text.setStyleRange(getStyle(0,1,YELLOW,null)); - assertTrue(":4:", styles.length == 1); - assertTrue(":4:", styles[0].equals(getStyle(0,2,YELLOW,null))); - text.setStyleRange(getStyle(1,2,RED,null)); - styles = text.getStyleRanges(); - assertTrue(":4:", styles.length == 2); - assertTrue(":4:", styles[0].equals(getStyle(0,1,YELLOW,null))); - assertTrue(":4:", styles[1].equals(getStyle(1,2,RED,null))); - - - text.setText("xxx/"); - text.setStyleRange(getStyle(0,2,RED,null)); - text.setStyleRange(getStyle(2,2,YELLOW,null)); - styles = text.getStyleRanges(); - assertTrue(":4a:", styles.length == 2); - assertTrue(":4a:", styles[0].equals(getStyle(0,2,RED,null))); - assertTrue(":4a:", styles[1].equals(getStyle(2,2,YELLOW,null))); - text.replaceTextRange(4,0,"/"); - styles = text.getStyleRanges(); - assertTrue(":4a:", styles.length == 2); - assertTrue(":4a:", styles[0].equals(getStyle(0,2,RED,null))); - assertTrue(":4a:", styles[1].equals(getStyle(2,2,YELLOW,null))); - text.setStyleRange(getStyle(2,1,YELLOW,null)); - assertTrue(":4a:", styles.length == 2); - assertTrue(":4a:", styles[0].equals(getStyle(0,2,RED,null))); - assertTrue(":4a:", styles[1].equals(getStyle(2,2,YELLOW,null))); - text.setStyleRange(getStyle(3,2,RED,null)); - styles = text.getStyleRanges(); - assertTrue(":4a:", styles.length == 3); - assertTrue(":4a:", styles[0].equals(getStyle(0,2,RED,null))); - assertTrue(":4a:", styles[1].equals(getStyle(2,1,YELLOW,null))); - assertTrue(":4a:", styles[2].equals(getStyle(3,2,RED,null))); - - - text.setText("xxx/"); - text.setStyleRange(getStyle(0,2,RED,null)); - text.setStyleRange(getStyle(2,2,YELLOW,null)); - text.replaceTextRange(4,0,"/"); - styles = text.getStyleRanges(); - text.setStyleRange(getStyle(2,1,YELLOW,null)); - text.setStyleRange(getStyle(2,3,RED,null)); - styles = text.getStyleRanges(); - assertTrue(":4b:", styles.length == 2); - assertTrue(":4b:", styles[0].equals(getStyle(0,2,RED,null))); - assertTrue(":4b:", styles[1].equals(getStyle(2,3,RED,null))); - - - text.setText("xxx/"); - text.setStyleRange(getStyle(0,2,RED,null)); - text.setStyleRange(getStyle(2,2,YELLOW,null)); - text.replaceTextRange(4,0,"/"); - styles = text.getStyleRanges(); - text.setStyleRange(getStyle(2,1,YELLOW,null)); - text.setStyleRange(getStyle(1,4,YELLOW,null)); - styles = text.getStyleRanges(); - assertTrue(":4c:", styles.length == 2); - assertTrue(":4c:", styles[0].equals(getStyle(0,1,RED,null))); - assertTrue(":4c:", styles[1].equals(getStyle(1,4,YELLOW,null))); - - - text.setText("New\r\n"); - StyleRange style = getStyle(0,5,null,null); - style.fontStyle = SWT.BOLD; - text.setStyleRange(style); - // styles (0,5,BOLD) - text.replaceTextRange(3,0,"a"); // "Newa\r\n" - // styles (0,3,BOLD), (4,2,BOLD) - style = text.getStyleRangeAtOffset(4); - style.start = 3; - style.length = 1; - text.setStyleRange(style); - // styles (0,6,BOLD) - text.replaceTextRange(0,0,"a"); // "aNewa\r\n" - // styles (1,6,BOLD) - style = text.getStyleRangeAtOffset(1); - style.start = 0; - style.length = 1; - text.setStyleRange(style); - // styles (0,7,BOLD) - text.replaceTextRange(0,1,""); // "Newa\r\n" - // styles (0,6,BOLD) - for (int i=0; i<6; i++) { - style = text.getStyleRangeAtOffset(i); - assertTrue(":5:", style.fontStyle == SWT.BOLD); - } - - - text.setText("New L 1\r\nNew L 2\r\n"); - style = getStyle(0,9,null,null); - style.fontStyle = SWT.BOLD; - text.setStyleRange(style); - // styles (0,9,BOLD) - text.replaceTextRange(7,0,"a"); - // styles (0,7,BOLD), (8,2,BOLD) - style = text.getStyleRangeAtOffset(8); - if (style != null) { - style.start = 7; - style.length = 1; - text.setStyleRange(style); - } - // styles (0,10,BOLD) - text.replaceTextRange(4,0,"a"); - // styles (0,4,BOLD), (5,6,BOLD) - style = text.getStyleRangeAtOffset(5); - if (style != null) { - style.start = 4; - style.length = 1; - text.setStyleRange(style); - } - // styles (0,11,BOLD) - text.replaceTextRange(2,3,""); - // styles (0,8,BOLD) - for (int i=0; i<8; i++) { - style = text.getStyleRangeAtOffset(i); - assertTrue(":5a:", style.fontStyle == SWT.BOLD); - } - - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - - // "01234567890123" - textString = "1234 1234 1234"; - - - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(5,2,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":1a:", styles.length == 1); - assertTrue(":1a:", styles[0].equals(getStyle(5,4,YELLOW,RED))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(7,2,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":2a:", styles.length == 1); - assertTrue(":2a:", styles[0].equals(getStyle(5,4,YELLOW,RED))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(6,2,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":3a:", styles.length == 1); - assertTrue(":3a:", styles[0].equals(getStyle(5,4,YELLOW,RED))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(3,4,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":4a:", styles.length == 1); - assertTrue(":4a:", styles[0].equals(getStyle(3,6,YELLOW,RED))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(7,4,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":5a:", styles.length == 1); - assertTrue(":5a:", styles[0].equals(getStyle(5,6,YELLOW,RED))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":6a:", styles.length == 1); - assertTrue(":6a:", styles[0].equals(getStyle(5,4,YELLOW,RED))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(3,10,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":7a:", styles.length == 1); - assertTrue(":7a:", styles[0].equals(getStyle(3,10,YELLOW,RED))); - - - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(5,2,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":1b:", styles.length == 2); - assertTrue(":1b:", styles[0].equals(getStyle(5,2,BLUE,CYAN))); - assertTrue(":1b:", styles[1].equals(getStyle(7,2,YELLOW,RED))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(7,2,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":2b:", styles.length == 2); - assertTrue(":2b:", styles[0].equals(getStyle(5,2,YELLOW,RED))); - assertTrue(":2b:", styles[1].equals(getStyle(7,2,BLUE,CYAN))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(6,2,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":3b:", styles.length == 3); - assertTrue(":3b:", styles[0].equals(getStyle(5,1,YELLOW,RED))); - assertTrue(":3b:", styles[1].equals(getStyle(6,2,BLUE,CYAN))); - assertTrue(":3b:", styles[2].equals(getStyle(8,1,YELLOW,RED))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(3,4,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":4b:", styles.length == 2); - assertTrue(":4b:", styles[0].equals(getStyle(3,4,BLUE,CYAN))); - assertTrue(":4b:", styles[1].equals(getStyle(7,2,YELLOW,RED))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(7,4,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":5b:", styles.length == 2); - assertTrue(":5b:", styles[0].equals(getStyle(5,2,YELLOW,RED))); - assertTrue(":5b:", styles[1].equals(getStyle(7,4,BLUE,CYAN))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":6b:", styles.length == 1); - assertTrue(":6b:", styles[0].equals(getStyle(5,4,BLUE,CYAN))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(3,10,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":7b:", styles.length == 1); - assertTrue(":7b:", styles[0].equals(getStyle(3,10,BLUE,CYAN))); - - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - // "012345678901234567890123" - String testString= "1234 1234 1234 1234 1234"; - - text.setText(testString); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(12,2,""); - styles = text.getStyleRanges(); - assertTrue(":1:", styles.length == 1); - assertTrue(":1:", styles[0].equals(getStyle(10,2,YELLOW,RED))); - text.setText(testString); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(10,2,""); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 1); - assertTrue(":2:", styles[0].equals(getStyle(10,2,YELLOW,RED))); - - - text.setText(testString); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(12,4,""); - styles = text.getStyleRanges(); - assertTrue(":3:", styles.length == 1); - assertTrue(":3:", styles[0].equals(getStyle(10,2,YELLOW,RED))); - text.setText(testString); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(8,4,""); - styles = text.getStyleRanges(); - assertTrue(":4:", styles.length == 1); - assertTrue(":4:", styles[0].equals(getStyle(8,2,YELLOW,RED))); - - - text.setText(testString); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(8,6,""); - styles = text.getStyleRanges(); - assertTrue(":5:", styles.length == 0); - text.setText(testString); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(10,6,""); - styles = text.getStyleRanges(); - assertTrue(":6:", styles.length == 0); - text.setText(testString); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(8,12,""); - styles = text.getStyleRanges(); - assertTrue(":7:", styles.length == 0); - - // "012345678901234567890123" - // String testString= "1234 1234 1234 1234 1234"; - - text.setText(testString); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(5,7,""); - styles = text.getStyleRanges(); - assertTrue(":8:", styles.length == 1); - assertTrue(":8:", styles[0].equals(getStyle(5,2,YELLOW,RED))); - text.setText(testString); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(7,7,""); - styles = text.getStyleRanges(); - assertTrue(":9:", styles.length == 1); - assertTrue(":9:", styles[0].equals(getStyle(5,2,BLUE,CYAN))); - - - text.setText(testString); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(2,10,""); - styles = text.getStyleRanges(); - assertTrue(":10:", styles.length == 1); - assertTrue(":10:", styles[0].equals(getStyle(2,2,YELLOW,RED))); - text.setText(testString); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(7,9,""); - styles = text.getStyleRanges(); - assertTrue(":11:", styles.length == 1); - assertTrue(":11:", styles[0].equals(getStyle(5,2,BLUE,CYAN))); - - - text.setText(testString); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(5,9,""); - styles = text.getStyleRanges(); - assertTrue(":12:", styles.length == 0); - text.setText(testString); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(3,13,""); - styles = text.getStyleRanges(); - assertTrue(":11:", styles.length == 0); - - - // "012345678901234567890123" - // String testString= "1234 1234 1234 1234 1234"; - - text.setText(testString); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.setStyleRange(getStyle(15,4,GREEN,PURPLE)); - text.replaceTextRange(7,12,""); - styles = text.getStyleRanges(); - assertTrue(":14:", styles.length == 1); - assertTrue(":14:", styles[0].equals(getStyle(5,2,BLUE,CYAN))); - text.setText(testString); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.setStyleRange(getStyle(15,4,GREEN,PURPLE)); - text.replaceTextRange(5,12,""); - styles = text.getStyleRanges(); - assertTrue(":15:", styles.length == 1); - assertTrue(":15:", styles[0].equals(getStyle(5,2,GREEN,PURPLE))); - - - text.setText(testString); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.setStyleRange(getStyle(15,4,GREEN,PURPLE)); - text.replaceTextRange(9,10,""); - styles = text.getStyleRanges(); - assertTrue(":16:", styles.length == 1); - assertTrue(":16:", styles[0].equals(getStyle(5,4,BLUE,CYAN))); - - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - StyleRange style1 = getStyle(0,0,null,null); - - - StyleRange style2 = getStyle(0,0,RED,YELLOW); - - - assertTrue(":1:", !style1.equals(style2)); - assertTrue(":1:", !style1.similarTo(style2)); - - - assertTrue(":1:", !style2.equals(style1)); - - - assertTrue(":1:", !style2.similarTo(style1)); - - - - style1 = getStyle(0,10,RED,YELLOW); - style2 = getStyle(11,5,RED,YELLOW); - - - assertTrue(":2:", !style1.equals(style2)); - - - assertTrue(":2:", !style2.equals(style1)); - assertTrue(":2:", style1.similarTo(style2)); - - - assertTrue(":2:", style2.similarTo(style1)); - - -} - -public void test_setStyleRanges$Lorg_eclipse_swt_custom_StyleRange() { - boolean exceptionThrown = false; - StyleRange[] ranges = new StyleRange[] { - new StyleRange(0, 1, getColor(RED), null), - new StyleRange(2, 1, getColor(RED), null)}; - - text.setText("Line0\r\n"); - try { - text.setStyleRanges(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - - text.setStyleRanges(ranges); - StyleRange[] currentRanges = text.getStyleRanges(); - assertEquals(ranges.length, currentRanges.length); - for (int i = 0; i < currentRanges.length; i++) { - assertEquals(ranges[i], currentRanges[i]); - } - text.setStyleRanges(new StyleRange[] {}); - assertEquals(0, text.getStyleRanges().length); -} - -public void test_setTabsI(){ - text.setTabs(1); - assertTrue(":a:", text.getTabs() == 1); - - text.setTabs(8); - assertTrue(":b:", text.getTabs() == 8); - text.setText("Line\t1\r\n"); - text.setTabs(7); - assertTrue(":c:", text.getTabs() == 7); -} - -public void test_setTextLjava_lang_String(){ - boolean exceptionThrown = false; - - text.setText(""); - assertEquals("", text.getText()); - text.setText("01234567890"); - assertEquals("01234567890", text.getText()); - - try { - text.setText(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - - assertEquals("01234567890", text.getText()); - text.setText(""); - assertEquals("", text.getText()); -} - -public void test_setTextLimitI(){ - boolean exceptionThrown = false; - - text.setTextLimit(10); - assertTrue(":a:", text.getTextLimit() == 10); - - text.setTextLimit(-1); - assertTrue(":b:", text.getTextLimit() == -1); - - try { - text.setTextLimit(0); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":c:", exceptionThrown == true); - exceptionThrown = false; -} - -public void test_setTopIndexI(){ - text.setTopIndex(-1); - assertTrue(":a:", text.getTopIndex() == 0); - text.setTopIndex(1); - assertTrue(":b:", text.getTopIndex() == 0); - - text.setText("Line0\r\n"); - - text.setTopIndex(-2); - assertTrue(":c:", text.getTopIndex() == 0); - text.setTopIndex(-1); - assertTrue(":d:", text.getTopIndex() == 0); - text.setTopIndex(1); - assertTrue(":e:", text.getTopIndex() == 1); - text.setTopIndex(2); - assertTrue(":f:", text.getTopIndex() == 2); - text.setTopIndex(0); - assertTrue(":g:", text.getTopIndex() == 0); - text.setTopIndex(3); - assertTrue(":h:", text.getTopIndex() == 2); - - text.setText(""); - text.setTopIndex(2); - assertTrue(":i:", text.getTopIndex() == 0); -} -public void test_setTopPixelI(){ - int lineHeight = text.getLineHeight(); - - text.setTopPixel(-1); - assertTrue(":a:", text.getTopPixel() == 0); - text.setTopPixel(1); - assertTrue(":b:", text.getTopPixel() == 0); - - text.setText("Line0\r\n"); - - text.setTopPixel(-2); - assertTrue(":c:", text.getTopPixel() == 0); - text.setTopPixel(-1); - assertTrue(":d:", text.getTopPixel() == 0); - text.setTopPixel(1); - assertTrue(":e:", text.getTopPixel() == 1); - text.setTopPixel(2 * lineHeight); - assertTrue(":f:", text.getTopPixel() == 2 * lineHeight); - text.setTopPixel(0); - assertTrue(":g:", text.getTopPixel() == 0); - text.setTopPixel(3 * lineHeight); - assertTrue(":h:", text.getTopPixel() == 2 * lineHeight); - - text.setText(""); - text.setTopPixel(2 * lineHeight); - assertTrue(":i:", text.getTopPixel() == 0); -} -public void test_setWordWrapZ(){ - String testString = "Line1\nLine2"; - - text.setWordWrap(true); - assertTrue(":a:", text.getWordWrap()); - text.setWordWrap(false); - assertTrue(":b:", text.getWordWrap() == false); - text.setWordWrap(false); - assertTrue(":c:", text.getWordWrap() == false); - text.setWordWrap(true); - assertTrue(":d:", text.getWordWrap()); - - text.setText(testString); - assertEquals(":e:", testString, text.getText()); - assertEquals(":f:", 2, text.getLineCount()); -} - -public void test_showSelection() { - text.showSelection(); - text.setSelectionRange(0, 0); - text.showSelection(); - text.setText("Line0\r\n"); - text.showSelection(); - text.setSelectionRange(5, 2); - text.showSelection(); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_StyledText((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener"); - methodNames.addElement("test_setKeyBindingII"); - methodNames.addElement("test_addBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener"); - methodNames.addElement("test_addLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener"); - methodNames.addElement("test_addLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener"); - methodNames.addElement("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_addVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener"); - methodNames.addElement("test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener"); - methodNames.addElement("test_appendLjava_lang_String"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_copy"); - methodNames.addElement("test_cut"); - methodNames.addElement("test_getBidiColoring"); - methodNames.addElement("test_getCaretOffset"); - methodNames.addElement("test_getContent"); - methodNames.addElement("test_getDoubleClickEnabled"); - methodNames.addElement("test_getEditable"); - methodNames.addElement("test_getHorizontalIndex"); - methodNames.addElement("test_getHorizontalPixel"); - methodNames.addElement("test_getKeyBindingI"); - methodNames.addElement("test_getCharCount"); - methodNames.addElement("test_getLineBackgroundI"); - methodNames.addElement("test_getLineCount"); - methodNames.addElement("test_getLineAtOffsetI"); - methodNames.addElement("test_getLineDelimiter"); - methodNames.addElement("test_getLineHeight"); - methodNames.addElement("test_getLocationAtOffsetI"); - methodNames.addElement("test_getOffsetAtLineI"); - methodNames.addElement("test_getOffsetAtLocationLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionRange"); - methodNames.addElement("test_getSelectionCount"); - methodNames.addElement("test_getSelectionText"); - methodNames.addElement("test_getStyleRangeAtOffsetI"); - methodNames.addElement("test_getStyleRanges"); - methodNames.addElement("test_getTabs"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_getTextII"); - methodNames.addElement("test_getTextRangeII"); - methodNames.addElement("test_getTextLimit"); - methodNames.addElement("test_getTopIndex"); - methodNames.addElement("test_getTopPixel"); - methodNames.addElement("test_getWordWrap"); - methodNames.addElement("test_insertLjava_lang_String"); - methodNames.addElement("test_invokeActionI"); - methodNames.addElement("test_paste"); - methodNames.addElement("test_print"); - methodNames.addElement("test_printLorg_eclipse_swt_printing_Printer"); - methodNames.addElement("test_redraw"); - methodNames.addElement("test_redrawIIIIZ"); - methodNames.addElement("test_redrawRangeIIZ"); - methodNames.addElement("test_removeBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener"); - methodNames.addElement("test_removeExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener"); - methodNames.addElement("test_removeLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener"); - methodNames.addElement("test_removeLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener"); - methodNames.addElement("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener"); - methodNames.addElement("test_removeVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener"); - methodNames.addElement("test_replaceStyleRanges"); - methodNames.addElement("test_replaceTextRangeIILjava_lang_String"); - methodNames.addElement("test_selectAll"); - methodNames.addElement("test_setCaretLorg_eclipse_swt_widgets_Caret"); - methodNames.addElement("test_setBidiColoringZ"); - methodNames.addElement("test_setCaretOffsetI"); - methodNames.addElement("test_setContentLorg_eclipse_swt_custom_StyledTextContent"); - methodNames.addElement("test_setDoubleClickEnabledZ"); - methodNames.addElement("test_setEditableZ"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setHorizontalIndexI"); - methodNames.addElement("test_setHorizontalPixelI"); - methodNames.addElement("test_setLineBackgroundIILorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setSelectionI"); - methodNames.addElement("test_setSelectionLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setSelectionII"); - methodNames.addElement("test_setSelectionRangeII"); - methodNames.addElement("test_setStyleRangeLorg_eclipse_swt_custom_StyleRange"); - methodNames.addElement("test_setStyleRanges$Lorg_eclipse_swt_custom_StyleRange"); - methodNames.addElement("test_setTabsI"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_setTextLimitI"); - methodNames.addElement("test_setTopIndexI"); - methodNames.addElement("test_setTopPixelI"); - methodNames.addElement("test_setWordWrapZ"); - methodNames.addElement("test_showSelection"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Canvas.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener")) test_addExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener(); - else if (getName().equals("test_setKeyBindingII")) test_setKeyBindingII(); - else if (getName().equals("test_addBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener")) test_addBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener(); - else if (getName().equals("test_addLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener")) test_addLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener(); - else if (getName().equals("test_addLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener")) test_addLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener(); - else if (getName().equals("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_addModifyListenerLorg_eclipse_swt_events_ModifyListener(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_addVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener")) test_addVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener(); - else if (getName().equals("test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener")) test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener(); - else if (getName().equals("test_appendLjava_lang_String")) test_appendLjava_lang_String(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_copy")) test_copy(); - else if (getName().equals("test_cut")) test_cut(); - else if (getName().equals("test_getBidiColoring")) test_getBidiColoring(); - else if (getName().equals("test_getCaretOffset")) test_getCaretOffset(); - else if (getName().equals("test_getContent")) test_getContent(); - else if (getName().equals("test_getDoubleClickEnabled")) test_getDoubleClickEnabled(); - else if (getName().equals("test_getEditable")) test_getEditable(); - else if (getName().equals("test_getHorizontalIndex")) test_getHorizontalIndex(); - else if (getName().equals("test_getHorizontalPixel")) test_getHorizontalPixel(); - else if (getName().equals("test_getKeyBindingI")) test_getKeyBindingI(); - else if (getName().equals("test_getCharCount")) test_getCharCount(); - else if (getName().equals("test_getLineBackgroundI")) test_getLineBackgroundI(); - else if (getName().equals("test_getLineCount")) test_getLineCount(); - else if (getName().equals("test_getLineAtOffsetI")) test_getLineAtOffsetI(); - else if (getName().equals("test_getLineDelimiter")) test_getLineDelimiter(); - else if (getName().equals("test_getLineHeight")) test_getLineHeight(); - else if (getName().equals("test_getLocationAtOffsetI")) test_getLocationAtOffsetI(); - else if (getName().equals("test_getOffsetAtLineI")) test_getOffsetAtLineI(); - else if (getName().equals("test_getOffsetAtLocationLorg_eclipse_swt_graphics_Point")) test_getOffsetAtLocationLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionRange")) test_getSelectionRange(); - else if (getName().equals("test_getSelectionCount")) test_getSelectionCount(); - else if (getName().equals("test_getSelectionText")) test_getSelectionText(); - else if (getName().equals("test_getStyleRangeAtOffsetI")) test_getStyleRangeAtOffsetI(); - else if (getName().equals("test_getStyleRanges")) test_getStyleRanges(); - else if (getName().equals("test_getTabs")) test_getTabs(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_getTextII")) test_getTextII(); - else if (getName().equals("test_getTextRangeII")) test_getTextRangeII(); - else if (getName().equals("test_getTextLimit")) test_getTextLimit(); - else if (getName().equals("test_getTopIndex")) test_getTopIndex(); - else if (getName().equals("test_getTopPixel")) test_getTopPixel(); - else if (getName().equals("test_getWordWrap")) test_getWordWrap(); - else if (getName().equals("test_insertLjava_lang_String")) test_insertLjava_lang_String(); - else if (getName().equals("test_invokeActionI")) test_invokeActionI(); - else if (getName().equals("test_paste")) test_paste(); - else if (getName().equals("test_print")) test_print(); - else if (getName().equals("test_printLorg_eclipse_swt_printing_Printer")) test_printLorg_eclipse_swt_printing_Printer(); - else if (getName().equals("test_redraw")) test_redraw(); - else if (getName().equals("test_redrawIIIIZ")) test_redrawIIIIZ(); - else if (getName().equals("test_redrawRangeIIZ")) test_redrawRangeIIZ(); - else if (getName().equals("test_removeBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener")) test_removeBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener(); - else if (getName().equals("test_removeExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener")) test_removeExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener(); - else if (getName().equals("test_removeLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener")) test_removeLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener(); - else if (getName().equals("test_removeLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener")) test_removeLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener(); - else if (getName().equals("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener")) test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener(); - else if (getName().equals("test_removeVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener")) test_removeVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener(); - else if (getName().equals("test_replaceTextRangeIILjava_lang_String")) test_replaceTextRangeIILjava_lang_String(); - else if (getName().equals("test_replaceStyleRanges")) test_replaceStyleRanges(); - else if (getName().equals("test_selectAll")) test_selectAll(); - else if (getName().equals("test_setCaretLorg_eclipse_swt_widgets_Caret")) test_setCaretLorg_eclipse_swt_widgets_Caret(); - else if (getName().equals("test_setBidiColoringZ")) test_setBidiColoringZ(); - else if (getName().equals("test_setCaretOffsetI")) test_setCaretOffsetI(); - else if (getName().equals("test_setContentLorg_eclipse_swt_custom_StyledTextContent")) test_setContentLorg_eclipse_swt_custom_StyledTextContent(); - else if (getName().equals("test_setDoubleClickEnabledZ")) test_setDoubleClickEnabledZ(); - else if (getName().equals("test_setEditableZ")) test_setEditableZ(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setHorizontalIndexI")) test_setHorizontalIndexI(); - else if (getName().equals("test_setHorizontalPixelI")) test_setHorizontalPixelI(); - else if (getName().equals("test_setLineBackgroundIILorg_eclipse_swt_graphics_Color")) test_setLineBackgroundIILorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else if (getName().equals("test_setSelectionLorg_eclipse_swt_graphics_Point")) test_setSelectionLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setSelectionII")) test_setSelectionII(); - else if (getName().equals("test_setSelectionRangeII")) test_setSelectionRangeII(); - else if (getName().equals("test_setStyleRangeLorg_eclipse_swt_custom_StyleRange")) test_setStyleRangeLorg_eclipse_swt_custom_StyleRange(); - else if (getName().equals("test_setStyleRanges$Lorg_eclipse_swt_custom_StyleRange")) test_setStyleRanges$Lorg_eclipse_swt_custom_StyleRange(); - else if (getName().equals("test_setTabsI")) test_setTabsI(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_setTextLimitI")) test_setTextLimitI(); - else if (getName().equals("test_setTopIndexI")) test_setTopIndexI(); - else if (getName().equals("test_setTopPixelI")) test_setTopPixelI(); - else if (getName().equals("test_setWordWrapZ")) test_setWordWrapZ(); - else if (getName().equals("test_showSelection")) test_showSelection(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledTextContent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledTextContent.java deleted file mode 100644 index fc2a46fb23..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledTextContent.java +++ /dev/null @@ -1,169 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.internal.BidiUtil; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.StyledTextContent - * - * @see org.eclipse.swt.custom.StyledTextContent - */ -public class Test_org_eclipse_swt_custom_StyledTextContent extends SwtTestCase { - int XINSET = 0; - - class ContentImplementation implements StyledTextContent { - String textContent = ""; - - public void addTextChangeListener(TextChangeListener listener){ - } - public int getCharCount() { - return 0; - } - public String getLine(int lineIndex) { - return "getLine"; - } - public int getLineAtOffset(int offset) { - return 0; - } - public int getLineCount() { - return 0; - } - public String getLineDelimiter() { - return "getLineDelimiter"; - } - public int getOffsetAtLine(int lineIndex) { - return 0; - } - public String getTextRange(int start, int length) { - return textContent; - } - public void removeTextChangeListener(TextChangeListener listener) { - } - public void replaceTextRange(int start, int replaceLength, String text) { - textContent = text; - } - public void setText(String text) { - textContent = text; - } - } - StyledTextContent content = new ContentImplementation(); - Shell shell; - StyledText styledText; - -public Test_org_eclipse_swt_custom_StyledTextContent(String name) { - super(name); -} -private boolean isBidi() { - return BidiUtil.isBidiPlatform(); -} -protected void setUp() { - if (isBidi()) XINSET = 3; - else XINSET = 0; - shell = new Shell(); - styledText = new StyledText(shell, SWT.NULL); - styledText.setContent(content); -} - -protected void tearDown() { -} - -public void test_addTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener() { - // does not make sense to test, not called by StyledText -} - -public void test_getCharCount() { - assertTrue(":a:", styledText.getCharCount() == 0); -} - -public void test_getLineI() { - // will indirectly cause getLine to be called - assertTrue(":b:", styledText.getLocationAtOffset(0).equals(new Point(XINSET,0))); -} - -public void test_getLineAtOffsetI() { - assertTrue(":c:", styledText.getLineAtOffset(0) == 0); -} - -public void test_getLineCount() { - assertTrue(":d:", styledText.getLineCount() == 1); -} - -public void test_getLineDelimiter() { - assertTrue(":e:", styledText.getLineDelimiter().equals("getLineDelimiter")); -} - -public void test_getOffsetAtLineI() { - // will indirectly cause getOffsetAtLine to be called - assertTrue(":f:", styledText.getLocationAtOffset(0).equals(new Point(XINSET,0))); -} - -public void test_getTextRangeII() { - assertTrue(":g:", styledText.getTextRange(0,0).equals("")); -} - -public void test_removeTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener() { - // does not make sense to test, not called by StyledText -} - -public void test_replaceTextRangeIILjava_lang_String() { - styledText.replaceTextRange(0,0,"test1"); - assertTrue(":h:", styledText.getText().equals("test1")); -} - -public void test_setTextLjava_lang_String() { - styledText.replaceTextRange(0,0,"test2"); - assertTrue(":i:", styledText.getText().equals("test2")); -} -public static void main(String[] args) { - TestRunner.run(suite()); -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_addTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener"); - methodNames.addElement("test_getCharCount"); - methodNames.addElement("test_getLineI"); - methodNames.addElement("test_getLineAtOffsetI"); - methodNames.addElement("test_getLineCount"); - methodNames.addElement("test_getLineDelimiter"); - methodNames.addElement("test_getOffsetAtLineI"); - methodNames.addElement("test_getTextRangeII"); - methodNames.addElement("test_removeTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener"); - methodNames.addElement("test_replaceTextRangeIILjava_lang_String"); - methodNames.addElement("test_setTextLjava_lang_String"); - return methodNames; -} -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_StyledTextContent((String)e.nextElement())); - } - return suite; -} -protected void runTest() throws Throwable { - if (getName().equals("test_addTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener")) test_addTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener(); - else if (getName().equals("test_getCharCount")) test_getCharCount(); - else if (getName().equals("test_getLineI")) test_getLineI(); - else if (getName().equals("test_getLineAtOffsetI")) test_getLineAtOffsetI(); - else if (getName().equals("test_getLineCount")) test_getLineCount(); - else if (getName().equals("test_getLineDelimiter")) test_getLineDelimiter(); - else if (getName().equals("test_getOffsetAtLineI")) test_getOffsetAtLineI(); - else if (getName().equals("test_getTextRangeII")) test_getTextRangeII(); - else if (getName().equals("test_removeTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener")) test_removeTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener(); - else if (getName().equals("test_replaceTextRangeIILjava_lang_String")) test_replaceTextRangeIILjava_lang_String(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableEditor.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableEditor.java deleted file mode 100644 index 537c01faf9..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableEditor.java +++ /dev/null @@ -1,102 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.TableEditor - * - * @see org.eclipse.swt.custom.TableEditor - */ -public class Test_org_eclipse_swt_custom_TableEditor extends Test_org_eclipse_swt_custom_ControlEditor { - -public Test_org_eclipse_swt_custom_TableEditor(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Table() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Table not written"); -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_getColumn() { - warnUnimpl("Test test_getColumn not written"); -} - -public void test_setColumnI() { - warnUnimpl("Test test_setColumnI not written"); -} - -public void test_getItem() { - warnUnimpl("Test test_getItem not written"); -} - -public void test_setItemLorg_eclipse_swt_widgets_TableItem() { - warnUnimpl("Test test_setItemLorg_eclipse_swt_widgets_TableItem not written"); -} - -public void test_setEditorLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setEditorLorg_eclipse_swt_widgets_Control not written"); -} - -public void test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TableItemI() { - warnUnimpl("Test test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TableItemI not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_TableEditor((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Table"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getColumn"); - methodNames.addElement("test_setColumnI"); - methodNames.addElement("test_getItem"); - methodNames.addElement("test_setItemLorg_eclipse_swt_widgets_TableItem"); - methodNames.addElement("test_setEditorLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TableItemI"); - methodNames.addAll(Test_org_eclipse_swt_custom_ControlEditor.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Table")) test_ConstructorLorg_eclipse_swt_widgets_Table(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getColumn")) test_getColumn(); - else if (getName().equals("test_setColumnI")) test_setColumnI(); - else if (getName().equals("test_getItem")) test_getItem(); - else if (getName().equals("test_setItemLorg_eclipse_swt_widgets_TableItem")) test_setItemLorg_eclipse_swt_widgets_TableItem(); - else if (getName().equals("test_setEditorLorg_eclipse_swt_widgets_Control")) test_setEditorLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TableItemI")) test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TableItemI(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTree.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTree.java deleted file mode 100644 index 0c0294ebee..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTree.java +++ /dev/null @@ -1,216 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.TableTree - * - * @see org.eclipse.swt.custom.TableTree - */ -public class Test_org_eclipse_swt_custom_TableTree extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_custom_TableTree(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_addTreeListenerLorg_eclipse_swt_events_TreeListener() { - warnUnimpl("Test test_addTreeListenerLorg_eclipse_swt_events_TreeListener not written"); -} - -public void test_computeSizeII() { - warnUnimpl("Test test_computeSizeII not written"); -} - -public void test_computeTrimIIII() { - warnUnimpl("Test test_computeTrimIIII not written"); -} - -public void test_deselectAll() { - warnUnimpl("Test test_deselectAll not written"); -} - -public void test_getItemCount() { - warnUnimpl("Test test_getItemCount not written"); -} - -public void test_getItemHeight() { - warnUnimpl("Test test_getItemHeight not written"); -} - -public void test_getItems() { - warnUnimpl("Test test_getItems not written"); -} - -public void test_getSelection() { - warnUnimpl("Test test_getSelection not written"); -} - -public void test_getSelectionCount() { - warnUnimpl("Test test_getSelectionCount not written"); -} - -public void test_getTable() { - warnUnimpl("Test test_getTable not written"); -} - -public void test_indexOfLorg_eclipse_swt_custom_TableTreeItem() { - warnUnimpl("Test test_indexOfLorg_eclipse_swt_custom_TableTreeItem not written"); -} - -public void test_getItemLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_getItemLorg_eclipse_swt_graphics_Point not written"); -} - -public void test_removeAll() { - warnUnimpl("Test test_removeAll not written"); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_removeTreeListenerLorg_eclipse_swt_events_TreeListener() { - warnUnimpl("Test test_removeTreeListenerLorg_eclipse_swt_events_TreeListener not written"); -} - -public void test_selectAll() { - warnUnimpl("Test test_selectAll not written"); -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setBackgroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setEnabledZ() { - warnUnimpl("Test test_setEnabledZ not written"); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written"); -} - -public void test_setForegroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setForegroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setMenuLorg_eclipse_swt_widgets_Menu() { - warnUnimpl("Test test_setMenuLorg_eclipse_swt_widgets_Menu not written"); -} - -public void test_setSelection$Lorg_eclipse_swt_custom_TableTreeItem() { - warnUnimpl("Test test_setSelection$Lorg_eclipse_swt_custom_TableTreeItem not written"); -} - -public void test_setToolTipTextLjava_lang_String() { - warnUnimpl("Test test_setToolTipTextLjava_lang_String not written"); -} - -public void test_showItemLorg_eclipse_swt_custom_TableTreeItem() { - warnUnimpl("Test test_showItemLorg_eclipse_swt_custom_TableTreeItem not written"); -} - -public void test_showSelection() { - warnUnimpl("Test test_showSelection not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_TableTree((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_addTreeListenerLorg_eclipse_swt_events_TreeListener"); - methodNames.addElement("test_computeSizeII"); - methodNames.addElement("test_computeTrimIIII"); - methodNames.addElement("test_deselectAll"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItemHeight"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionCount"); - methodNames.addElement("test_getTable"); - methodNames.addElement("test_indexOfLorg_eclipse_swt_custom_TableTreeItem"); - methodNames.addElement("test_getItemLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_removeAll"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_removeTreeListenerLorg_eclipse_swt_events_TreeListener"); - methodNames.addElement("test_selectAll"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setEnabledZ"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setForegroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setMenuLorg_eclipse_swt_widgets_Menu"); - methodNames.addElement("test_setSelection$Lorg_eclipse_swt_custom_TableTreeItem"); - methodNames.addElement("test_setToolTipTextLjava_lang_String"); - methodNames.addElement("test_showItemLorg_eclipse_swt_custom_TableTreeItem"); - methodNames.addElement("test_showSelection"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_addTreeListenerLorg_eclipse_swt_events_TreeListener")) test_addTreeListenerLorg_eclipse_swt_events_TreeListener(); - else if (getName().equals("test_computeSizeII")) test_computeSizeII(); - else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII(); - else if (getName().equals("test_deselectAll")) test_deselectAll(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItemHeight")) test_getItemHeight(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionCount")) test_getSelectionCount(); - else if (getName().equals("test_getTable")) test_getTable(); - else if (getName().equals("test_indexOfLorg_eclipse_swt_custom_TableTreeItem")) test_indexOfLorg_eclipse_swt_custom_TableTreeItem(); - else if (getName().equals("test_getItemLorg_eclipse_swt_graphics_Point")) test_getItemLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_removeAll")) test_removeAll(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_removeTreeListenerLorg_eclipse_swt_events_TreeListener")) test_removeTreeListenerLorg_eclipse_swt_events_TreeListener(); - else if (getName().equals("test_selectAll")) test_selectAll(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setEnabledZ")) test_setEnabledZ(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setForegroundLorg_eclipse_swt_graphics_Color")) test_setForegroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setMenuLorg_eclipse_swt_widgets_Menu")) test_setMenuLorg_eclipse_swt_widgets_Menu(); - else if (getName().equals("test_setSelection$Lorg_eclipse_swt_custom_TableTreeItem")) test_setSelection$Lorg_eclipse_swt_custom_TableTreeItem(); - else if (getName().equals("test_setToolTipTextLjava_lang_String")) test_setToolTipTextLjava_lang_String(); - else if (getName().equals("test_showItemLorg_eclipse_swt_custom_TableTreeItem")) test_showItemLorg_eclipse_swt_custom_TableTreeItem(); - else if (getName().equals("test_showSelection")) test_showSelection(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeEditor.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeEditor.java deleted file mode 100644 index c8581adc03..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeEditor.java +++ /dev/null @@ -1,102 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.TableTreeEditor - * - * @see org.eclipse.swt.custom.TableTreeEditor - */ -public class Test_org_eclipse_swt_custom_TableTreeEditor extends Test_org_eclipse_swt_custom_ControlEditor { - -public Test_org_eclipse_swt_custom_TableTreeEditor(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_custom_TableTree() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_TableTree not written"); -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_getColumn() { - warnUnimpl("Test test_getColumn not written"); -} - -public void test_setColumnI() { - warnUnimpl("Test test_setColumnI not written"); -} - -public void test_getItem() { - warnUnimpl("Test test_getItem not written"); -} - -public void test_setItemLorg_eclipse_swt_custom_TableTreeItem() { - warnUnimpl("Test test_setItemLorg_eclipse_swt_custom_TableTreeItem not written"); -} - -public void test_setEditorLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setEditorLorg_eclipse_swt_widgets_Control not written"); -} - -public void test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_custom_TableTreeItemI() { - warnUnimpl("Test test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_custom_TableTreeItemI not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_TableTreeEditor((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_TableTree"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getColumn"); - methodNames.addElement("test_setColumnI"); - methodNames.addElement("test_getItem"); - methodNames.addElement("test_setItemLorg_eclipse_swt_custom_TableTreeItem"); - methodNames.addElement("test_setEditorLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_custom_TableTreeItemI"); - methodNames.addAll(Test_org_eclipse_swt_custom_ControlEditor.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_TableTree")) test_ConstructorLorg_eclipse_swt_custom_TableTree(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getColumn")) test_getColumn(); - else if (getName().equals("test_setColumnI")) test_setColumnI(); - else if (getName().equals("test_getItem")) test_getItem(); - else if (getName().equals("test_setItemLorg_eclipse_swt_custom_TableTreeItem")) test_setItemLorg_eclipse_swt_custom_TableTreeItem(); - else if (getName().equals("test_setEditorLorg_eclipse_swt_widgets_Control")) test_setEditorLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_custom_TableTreeItemI")) test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_custom_TableTreeItemI(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeItem.java deleted file mode 100644 index cab0b5204f..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeItem.java +++ /dev/null @@ -1,204 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.TableTreeItem - * - * @see org.eclipse.swt.custom.TableTreeItem - */ -public class Test_org_eclipse_swt_custom_TableTreeItem extends Test_org_eclipse_swt_widgets_Item { - - TableTree tableTree; - TableTreeItem tableTreeItem; - -public Test_org_eclipse_swt_custom_TableTreeItem(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - tableTree = new TableTree(shell, 0); - tableTreeItem = new TableTreeItem(tableTree, 0); - setWidget(tableTreeItem); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_custom_TableTreeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_TableTreeI not written"); -} - -public void test_ConstructorLorg_eclipse_swt_custom_TableTreeII() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_TableTreeII not written"); -} - -public void test_ConstructorLorg_eclipse_swt_custom_TableTreeItemI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_TableTreeItemI not written"); -} - -public void test_ConstructorLorg_eclipse_swt_custom_TableTreeItemII() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_TableTreeItemII not written"); -} - -public void test_getBoundsI() { - warnUnimpl("Test test_getBoundsI not written"); -} - -public void test_getChecked() { - warnUnimpl("Test test_getChecked not written"); -} - -public void test_getDisplay() { - warnUnimpl("Test test_getDisplay not written"); -} - -public void test_getExpanded() { - warnUnimpl("Test test_getExpanded not written"); -} - -public void test_getImage() { - warnUnimpl("Test test_getImage not written"); -} - -public void test_getImageI() { - warnUnimpl("Test test_getImageI not written"); -} - -public void test_getItemCount() { - warnUnimpl("Test test_getItemCount not written"); -} - -public void test_getItems() { - warnUnimpl("Test test_getItems not written"); -} - -public void test_getParent() { - warnUnimpl("Test test_getParent not written"); -} - -public void test_getParentItem() { - warnUnimpl("Test test_getParentItem not written"); -} - -public void test_getText() { - warnUnimpl("Test test_getText not written"); -} - -public void test_getTextI() { - warnUnimpl("Test test_getTextI not written"); -} - -public void test_indexOfLorg_eclipse_swt_custom_TableTreeItem() { - warnUnimpl("Test test_indexOfLorg_eclipse_swt_custom_TableTreeItem not written"); -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_setCheckedZ() { - warnUnimpl("Test test_setCheckedZ not written"); -} - -public void test_setExpandedZ() { - warnUnimpl("Test test_setExpandedZ not written"); -} - -public void test_setImageILorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageILorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setTextILjava_lang_String() { - warnUnimpl("Test test_setTextILjava_lang_String not written"); -} - -public void test_setTextLjava_lang_String() { - warnUnimpl("Test test_setTextLjava_lang_String not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_TableTreeItem((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_TableTreeI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_TableTreeII"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_TableTreeItemI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_TableTreeItemII"); - methodNames.addElement("test_getBoundsI"); - methodNames.addElement("test_getChecked"); - methodNames.addElement("test_getDisplay"); - methodNames.addElement("test_getExpanded"); - methodNames.addElement("test_getImage"); - methodNames.addElement("test_getImageI"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getParentItem"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_getTextI"); - methodNames.addElement("test_indexOfLorg_eclipse_swt_custom_TableTreeItem"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_setCheckedZ"); - methodNames.addElement("test_setExpandedZ"); - methodNames.addElement("test_setImageILorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setTextILjava_lang_String"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_TableTreeI")) test_ConstructorLorg_eclipse_swt_custom_TableTreeI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_TableTreeII")) test_ConstructorLorg_eclipse_swt_custom_TableTreeII(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_TableTreeItemI")) test_ConstructorLorg_eclipse_swt_custom_TableTreeItemI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_TableTreeItemII")) test_ConstructorLorg_eclipse_swt_custom_TableTreeItemII(); - else if (getName().equals("test_getBoundsI")) test_getBoundsI(); - else if (getName().equals("test_getChecked")) test_getChecked(); - else if (getName().equals("test_getDisplay")) test_getDisplay(); - else if (getName().equals("test_getExpanded")) test_getExpanded(); - else if (getName().equals("test_getImage")) test_getImage(); - else if (getName().equals("test_getImageI")) test_getImageI(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getParentItem")) test_getParentItem(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_getTextI")) test_getTextI(); - else if (getName().equals("test_indexOfLorg_eclipse_swt_custom_TableTreeItem")) test_indexOfLorg_eclipse_swt_custom_TableTreeItem(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_setCheckedZ")) test_setCheckedZ(); - else if (getName().equals("test_setExpandedZ")) test_setExpandedZ(); - else if (getName().equals("test_setImageILorg_eclipse_swt_graphics_Image")) test_setImageILorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setTextILjava_lang_String")) test_setTextILjava_lang_String(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangeListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangeListener.java deleted file mode 100644 index 780d2c4b70..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangeListener.java +++ /dev/null @@ -1,560 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.TextChangeListener - * - * @see org.eclipse.swt.custom.TextChangeListener - */ -public class Test_org_eclipse_swt_custom_TextChangeListener extends SwtTestCase { - Shell shell; - StyledText styledText; - int verify = -1; - -public Test_org_eclipse_swt_custom_TextChangeListener(String name) { - super(name); -} -public static void main(String[] args) { - TestRunner.run(suite()); -} -protected void setUp() { - shell = new Shell(); - styledText = new StyledText(shell, SWT.NULL); -} -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_TextChangeListener((String)e.nextElement())); - } - return suite; -} -protected void tearDown() { -} -public void test_textChangingLorg_eclipse_swt_custom_TextChangingEvent() { - StyledTextContent content = styledText.getContent(); - TextChangeListener listener = new TextChangeListener() { - public void textChanging(TextChangingEvent event) { - switch(verify) { - case 1 : { - assertTrue(":1a:", event.replaceLineCount == 0); - assertTrue(":1b:", event.newLineCount == 1); - break; - } - case 2 : { - assertTrue(":2a:", event.replaceLineCount == 2); - assertTrue(":2b:", event.newLineCount == 0); - break; - } - case 3 : { - assertTrue(":3a:", event.replaceLineCount == 0); - assertTrue(":3b:", event.newLineCount == 2); - break; - } - case 4: { - assertTrue(":4:", false); - break; - } - case 5 : { - assertTrue(":5a:", event.replaceLineCount == 0); - assertTrue(":5b:", event.newLineCount == 1); - break; - } - case 6 : { - assertTrue(":6a:", event.replaceLineCount == 1); - assertTrue(":6b:", event.newLineCount == 0); - break; - } - case 7 : { - assertTrue(":7a:", event.replaceLineCount == 0); - assertTrue(":7b:", event.newLineCount == 0); - break; - } - case 8 : { - assertTrue(":8a:", event.replaceLineCount == 1); - assertTrue(":8b:", event.newLineCount == 0); - break; - } - case 9 : { - assertTrue(":9a:", event.replaceLineCount == 1); - assertTrue(":9b:", event.newLineCount == 0); - break; - } - case 10:{ - assertTrue(":10:", false); - break; - } - case 11: { - assertTrue(":11:", false); - break; - } - case 12: { - assertTrue(":12a:", event.replaceLineCount == 0); - assertTrue(":12b:", event.newLineCount == 1); - break; - } - case 13: { - assertTrue(":13a:", event.replaceLineCount == 0); - assertTrue(":13b:", event.newLineCount == 1); - break; - } - case 14: { - assertTrue(":14:", false); - break; - } - case 15: { - assertTrue(":15a:", event.replaceLineCount == 1); - assertTrue(":15b:", event.newLineCount == 2); - break; - } - case 16:{ - assertTrue(":16:", false); - break; - } - case 17: { - assertTrue(":17:", false); - break; - } - case 18: { - assertTrue(":18a:", event.replaceLineCount == 0); - assertTrue(":18b:", event.newLineCount == 2); - break; - } - case 19: { - assertTrue(":19a:", event.replaceLineCount == 0); - assertTrue(":19b:", event.newLineCount == 3); - break; - } - case 20: { - assertTrue(":20:", false); - break; - } - } - } - public void textChanged(TextChangedEvent event) { - } - public void textSet(TextChangedEvent event) { - } - }; - content.addTextChangeListener(listener); - - boolean exceptionHandled = false; - verify = 1; - styledText.setText("testing"); - styledText.replaceTextRange(0, 0, "\n"); - - verify = 2; - styledText.setText("\n\n"); - styledText.replaceTextRange(0, 2, "a"); - - verify = 3; - styledText.setText("a"); - styledText.replaceTextRange(0, 1, "\n\n"); - - verify = 4; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - try {styledText.replaceTextRange(3, 1, "test\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":4: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 5; - styledText.setText("Line 1\r\nLine 2"); - styledText.replaceTextRange(0, 0, "\r"); - - verify = 6; - styledText.setText("This\nis a test\nline 3\nline 4"); - styledText.replaceTextRange(21, 7, ""); - - verify = 7; - styledText.setText("This\nis a test\r"); - styledText.replaceTextRange(5, 9, ""); - - verify = 8; - styledText.setText("\nL1\r\nL2\r\n"); - styledText.replaceTextRange(7, 2, ""); - - verify = 9; - styledText.setText("L1\r\n"); - styledText.replaceTextRange(2, 2, "test"); - - verify = 10; - styledText.setText("L1\r\n"); - try {styledText.replaceTextRange(3, 1, "");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":10: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 11; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - try {styledText.replaceTextRange(1, 2, "");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":11: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 12; - styledText.setText("L1\r"); - styledText.replaceTextRange(3, 0, "\n"); - - verify = 13; - styledText.setText("L1\n"); - styledText.replaceTextRange(2, 0, "\r"); - - verify = 14; - styledText.setText("L1\r\n"); - try {styledText.replaceTextRange(3, 0, "test");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":14: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 15; - styledText.setText("L1\r\n"); - styledText.replaceTextRange(2, 2, "test\n\n"); - - verify = 16; - styledText.setText("L1\r\n"); - try {styledText.replaceTextRange(3, 1, "test\r\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":16: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 17; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - try {styledText.replaceTextRange(1, 2, "test\n\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":17: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 18; - styledText.setText("L1\r"); - styledText.replaceTextRange(3, 0, "\ntest\r\n"); - - verify = 19; - styledText.setText("L1\n"); - styledText.replaceTextRange(2, 0, "test\r\r\r"); - verify = 20; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - try {styledText.replaceTextRange(3, 1, "test\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":20: exception not thrown", exceptionHandled); - exceptionHandled = false; - content.removeTextChangeListener(listener); -} - -public void test_textSetLorg_eclipse_swt_custom_TextChangedEvent() { - StyledTextContent content = styledText.getContent(); - TextChangeListener listener = new TextChangeListener() { - public void textChanging(TextChangingEvent event) { - } - public void textChanged(TextChangedEvent event) { - } - public void textSet(TextChangedEvent event) { - switch (verify) { - case 1 : { - assertTrue(":1:", styledText.getText().equals("testing")); - break; - } - case 2 : { - assertTrue(":2:", styledText.getText().equals("\n\n")); - break; - } - case 3 : { - assertTrue(":3:", styledText.getText().equals("a")); - break; - } - case 4 : { - assertTrue(":4:", styledText.getText().equals("")); - break; - } - } - } - }; - content.addTextChangeListener(listener); - - verify = 1; - styledText.setText("testing"); - - verify = 2; - styledText.setText("\n\n"); - - verify = 3; - styledText.setText("a"); - - verify = 4; - try {styledText.setText(null);} - catch (IllegalArgumentException ex) {assertTrue(":4:", true);} - content.removeTextChangeListener(listener); -} - -public void test_textChangedLorg_eclipse_swt_custom_TextChangedEvent() { - StyledTextContent content = styledText.getContent(); - TextChangeListener listener = new TextChangeListener() { - public void textChanged(TextChangedEvent event) { - switch (verify) { - case 1 : { - assertTrue(":1:", styledText.getText().equals("\ntesting")); - break; - } - case 2 : { - assertTrue(":2:", styledText.getText().equals("a")); - break; - } - case 3 : { - assertTrue(":3:", styledText.getText().equals("\n\n")); - break; - } - case 4: { - assertTrue(":4:", false); - break; - } - case 5 : { - assertTrue(":5:", styledText.getText().equals("\rLine 1\r\nLine 2")); - break; - } - case 6 : { - assertTrue(":6:", styledText.getText().equals("This\nis a test\nline 3")); - break; - } - case 7 : { - assertTrue(":7:", styledText.getText().equals("This\n\r")); - break; - } - case 8 : { - assertTrue(":8:", styledText.getText().equals("\nL1\r\nL2")); - break; - } - case 9 : { - assertTrue(":9:", styledText.getText().equals("L1test")); - break; - } - case 10:{ - assertTrue(":10:", false); - break; - } - case 11: { - assertTrue(":11:", false); - break; - } - case 12: { - assertTrue(":12:", styledText.getText().equals("L1\r\n")); - break; - } - case 13: { - assertTrue(":13:", styledText.getText().equals("L1\r\n")); - break; - } - case 14: { - assertTrue(":14:", false); - break; - } - case 15: { - assertTrue(":15:", styledText.getText().equals("L1test\n\n")); - break; - } - case 16:{ - assertTrue(":16:", false); - break; - } - case 17: { - assertTrue(":17:", false); - break; - } - case 18: { - assertTrue(":18:", styledText.getText().equals("L1\r\ntest\r\n")); - break; - } - case 19: { - assertTrue(":19:", styledText.getText().equals("L1test\r\r\r\n")); - break; - } - case 20: { - assertTrue(":20:", false); - break; - } - } - } - public void textChanging(TextChangingEvent event) { - } - public void textSet(TextChangedEvent event) { - } - }; - content.addTextChangeListener(listener); - - boolean exceptionHandled = false; - verify = 0; - styledText.setText("testing"); - verify = 1; - styledText.replaceTextRange(0, 0, "\n"); - - verify = 0; - styledText.setText("\n\n"); - verify = 2; - styledText.replaceTextRange(0, 2, "a"); - - verify = 0; - styledText.setText("a"); - verify = 3; - styledText.replaceTextRange(0, 1, "\n\n"); - - verify = 0; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - verify = 4; - try {styledText.replaceTextRange(3, 1, "test\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":4: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("Line 1\r\nLine 2"); - verify = 5; - styledText.replaceTextRange(0, 0, "\r"); - - verify = 0; - styledText.setText("This\nis a test\nline 3\nline 4"); - verify = 6; - styledText.replaceTextRange(21, 7, ""); - - verify = 0; - styledText.setText("This\nis a test\r"); - verify = 7; - styledText.replaceTextRange(5, 9, ""); - - verify = 0; - styledText.setText("\nL1\r\nL2\r\n"); - verify = 8; - styledText.replaceTextRange(7, 2, ""); - - verify = 0; - styledText.setText("L1\r\n"); - verify = 9; - styledText.replaceTextRange(2, 2, "test"); - - verify = 0; - styledText.setText("L1\r\n"); - verify = 10; - try {styledText.replaceTextRange(3, 1, "");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":10: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - verify = 11; - try {styledText.replaceTextRange(1, 2, "");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":11: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r"); - verify = 12; - styledText.replaceTextRange(3, 0, "\n"); - - verify = 0; - styledText.setText("L1\n"); - verify = 13; - styledText.replaceTextRange(2, 0, "\r"); - - verify = 0; - styledText.setText("L1\r\n"); - verify = 14; - try {styledText.replaceTextRange(3, 0, "test");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":14: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r\n"); - verify = 15; - styledText.replaceTextRange(2, 2, "test\n\n"); - - verify = 0; - styledText.setText("L1\r\n"); - verify = 16; - try {styledText.replaceTextRange(3, 1, "test\r\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":16: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - verify = 17; - try {styledText.replaceTextRange(1, 2, "test\n\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":17: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r"); - verify = 18; - styledText.replaceTextRange(3, 0, "\ntest\r\n"); - - verify = 0; - styledText.setText("L1\n"); - verify = 19; - styledText.replaceTextRange(2, 0, "test\r\r\r"); - - verify = 0; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - verify = 20; - try {styledText.replaceTextRange(3, 1, "test\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":20: exception not thrown", exceptionHandled); - exceptionHandled = false; - content.removeTextChangeListener(listener); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_textChangingLorg_eclipse_swt_custom_TextChangingEvent"); - methodNames.addElement("test_textChangedLorg_eclipse_swt_custom_TextChangedEvent"); - methodNames.addElement("test_textSetLorg_eclipse_swt_custom_TextChangedEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_textChangingLorg_eclipse_swt_custom_TextChangingEvent")) test_textChangingLorg_eclipse_swt_custom_TextChangingEvent(); - else if (getName().equals("test_textChangedLorg_eclipse_swt_custom_TextChangedEvent")) test_textChangedLorg_eclipse_swt_custom_TextChangedEvent(); - else if (getName().equals("test_textSetLorg_eclipse_swt_custom_TextChangedEvent")) test_textSetLorg_eclipse_swt_custom_TextChangedEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangedEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangedEvent.java deleted file mode 100644 index 750c8c5f15..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangedEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.TextChangedEvent - * - * @see org.eclipse.swt.custom.TextChangedEvent - */ -public class Test_org_eclipse_swt_custom_TextChangedEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_custom_TextChangedEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_custom_StyledTextContent() { - // this method tested by other test classes -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_TextChangedEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_StyledTextContent"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_StyledTextContent")) test_ConstructorLorg_eclipse_swt_custom_StyledTextContent(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangingEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangingEvent.java deleted file mode 100644 index 7b06e95d3e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangingEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.TextChangingEvent - * - * @see org.eclipse.swt.custom.TextChangingEvent - */ -public class Test_org_eclipse_swt_custom_TextChangingEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_custom_TextChangingEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_custom_StyledTextContent() { - // this method tested by other test classes -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_TextChangingEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_StyledTextContent"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_StyledTextContent")) test_ConstructorLorg_eclipse_swt_custom_StyledTextContent(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TreeEditor.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TreeEditor.java deleted file mode 100644 index 25da5cbf06..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TreeEditor.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.TreeEditor - * - * @see org.eclipse.swt.custom.TreeEditor - */ -public class Test_org_eclipse_swt_custom_TreeEditor extends Test_org_eclipse_swt_custom_ControlEditor { - -public Test_org_eclipse_swt_custom_TreeEditor(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Tree() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Tree not written"); -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_getItem() { - warnUnimpl("Test test_getItem not written"); -} - -public void test_setItemLorg_eclipse_swt_widgets_TreeItem() { - warnUnimpl("Test test_setItemLorg_eclipse_swt_widgets_TreeItem not written"); -} - -public void test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TreeItem() { - warnUnimpl("Test test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TreeItem not written"); -} - -public void test_setEditorLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setEditorLorg_eclipse_swt_widgets_Control not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_TreeEditor((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Tree"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getItem"); - methodNames.addElement("test_setItemLorg_eclipse_swt_widgets_TreeItem"); - methodNames.addElement("test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TreeItem"); - methodNames.addElement("test_setEditorLorg_eclipse_swt_widgets_Control"); - methodNames.addAll(Test_org_eclipse_swt_custom_ControlEditor.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Tree")) test_ConstructorLorg_eclipse_swt_widgets_Tree(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getItem")) test_getItem(); - else if (getName().equals("test_setItemLorg_eclipse_swt_widgets_TreeItem")) test_setItemLorg_eclipse_swt_widgets_TreeItem(); - else if (getName().equals("test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TreeItem")) test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TreeItem(); - else if (getName().equals("test_setEditorLorg_eclipse_swt_widgets_Control")) test_setEditorLorg_eclipse_swt_widgets_Control(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_VerifyKeyListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_VerifyKeyListener.java deleted file mode 100644 index f7ca74057c..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_VerifyKeyListener.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.VerifyKeyListener - * - * @see org.eclipse.swt.custom.VerifyKeyListener - */ -public class Test_org_eclipse_swt_custom_VerifyKeyListener extends SwtTestCase { - Shell shell; - StyledText styledText; - int verify = -1; - -public Test_org_eclipse_swt_custom_VerifyKeyListener(String name) { - super(name); -} -public static void main(String[] args) { - TestRunner.run(suite()); -} -protected void setUp() { - shell = new Shell(); - styledText = new StyledText(shell, SWT.NULL); - shell.open(); -} -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_VerifyKeyListener((String)e.nextElement())); - } - return suite; -} -protected void tearDown() { -} - -public void test_verifyKeyLorg_eclipse_swt_events_VerifyEvent() { - VerifyKeyListener listener = new VerifyKeyListener() { - public void verifyKey(VerifyEvent event) { - if (verify != 1) {event.doit = false;} - } - }; - styledText.addVerifyKeyListener(listener); - verify = 1; - Event e = new Event(); - e.character = 'a'; - styledText.notifyListeners(SWT.KeyDown, e); - assertTrue(":1:", styledText.getText().equals("a")); - - verify = 2; - styledText.setText(""); - e = new Event(); - e.character = 'a'; - styledText.notifyListeners(SWT.KeyDown, e); - assertTrue(":2:", styledText.getText().equals("")); - styledText.removeVerifyKeyListener(listener); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_verifyKeyLorg_eclipse_swt_events_VerifyEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_verifyKeyLorg_eclipse_swt_events_VerifyEvent")) test_verifyKeyLorg_eclipse_swt_events_VerifyEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ViewForm.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ViewForm.java deleted file mode 100644 index 6dc8fa61f9..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ViewForm.java +++ /dev/null @@ -1,150 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.ViewForm - * - * @see org.eclipse.swt.custom.ViewForm - */ -public class Test_org_eclipse_swt_custom_ViewForm extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_custom_ViewForm(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_getClientArea() { - warnUnimpl("Test test_getClientArea not written"); -} - -public void test_getContent() { - warnUnimpl("Test test_getContent not written"); -} - -public void test_getTopCenter() { - warnUnimpl("Test test_getTopCenter not written"); -} - -public void test_getTopLeft() { - warnUnimpl("Test test_getTopLeft not written"); -} - -public void test_getTopRight() { - warnUnimpl("Test test_getTopRight not written"); -} - -public void test_layoutZ() { - warnUnimpl("Test test_layoutZ not written"); -} - -public void test_setContentLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setContentLorg_eclipse_swt_widgets_Control not written"); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written"); -} - -public void test_setLayoutLorg_eclipse_swt_widgets_Layout() { - warnUnimpl("Test test_setLayoutLorg_eclipse_swt_widgets_Layout not written"); -} - -public void test_setTopCenterLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setTopCenterLorg_eclipse_swt_widgets_Control not written"); -} - -public void test_setTopLeftLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setTopLeftLorg_eclipse_swt_widgets_Control not written"); -} - -public void test_setTopRightLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setTopRightLorg_eclipse_swt_widgets_Control not written"); -} - -public void test_setBorderVisibleZ() { - warnUnimpl("Test test_setBorderVisibleZ not written"); -} - -public void test_setTopCenterSeparateZ() { - warnUnimpl("Test test_setTopCenterSeparateZ not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_ViewForm((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_getClientArea"); - methodNames.addElement("test_getContent"); - methodNames.addElement("test_getTopCenter"); - methodNames.addElement("test_getTopLeft"); - methodNames.addElement("test_getTopRight"); - methodNames.addElement("test_layoutZ"); - methodNames.addElement("test_setContentLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setLayoutLorg_eclipse_swt_widgets_Layout"); - methodNames.addElement("test_setTopCenterLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setTopLeftLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setTopRightLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setBorderVisibleZ"); - methodNames.addElement("test_setTopCenterSeparateZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_getClientArea")) test_getClientArea(); - else if (getName().equals("test_getContent")) test_getContent(); - else if (getName().equals("test_getTopCenter")) test_getTopCenter(); - else if (getName().equals("test_getTopLeft")) test_getTopLeft(); - else if (getName().equals("test_getTopRight")) test_getTopRight(); - else if (getName().equals("test_layoutZ")) test_layoutZ(); - else if (getName().equals("test_setContentLorg_eclipse_swt_widgets_Control")) test_setContentLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setLayoutLorg_eclipse_swt_widgets_Layout")) test_setLayoutLorg_eclipse_swt_widgets_Layout(); - else if (getName().equals("test_setTopCenterLorg_eclipse_swt_widgets_Control")) test_setTopCenterLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setTopLeftLorg_eclipse_swt_widgets_Control")) test_setTopLeftLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setTopRightLorg_eclipse_swt_widgets_Control")) test_setTopRightLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setBorderVisibleZ")) test_setBorderVisibleZ(); - else if (getName().equals("test_setTopCenterSeparateZ")) test_setTopCenterSeparateZ(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_ByteArrayTransfer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_ByteArrayTransfer.java deleted file mode 100644 index 0581cfe848..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_ByteArrayTransfer.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.dnd.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.ByteArrayTransfer - * - * @see org.eclipse.swt.dnd.ByteArrayTransfer - */ -public class Test_org_eclipse_swt_dnd_ByteArrayTransfer extends Test_org_eclipse_swt_dnd_Transfer { - -public Test_org_eclipse_swt_dnd_ByteArrayTransfer(String name) { - super(name); -} - - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_getSupportedTypes() { - warnUnimpl("Test test_getSupportedTypes not written"); -} - -public void test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData not written"); -} - -public void test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData not written"); -} - -public void test_nativeToJavaLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_nativeToJavaLorg_eclipse_swt_dnd_TransferData not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_getSupportedTypes"); - methodNames.addElement("test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData"); - methodNames.addElement("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData"); - methodNames.addElement("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData"); - methodNames.addAll(Test_org_eclipse_swt_dnd_Transfer.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_getSupportedTypes")) test_getSupportedTypes(); - else if (getName().equals("test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData")) test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData(); - else if (getName().equals("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData")) test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData(); - else if (getName().equals("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData")) test_nativeToJavaLorg_eclipse_swt_dnd_TransferData(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Clipboard.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Clipboard.java deleted file mode 100644 index 1af0a7874f..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Clipboard.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.dnd.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.Clipboard - * - * @see org.eclipse.swt.dnd.Clipboard - */ -public class Test_org_eclipse_swt_dnd_Clipboard extends SwtTestCase { - -public Test_org_eclipse_swt_dnd_Clipboard(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Display() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Display not written"); -} - -public void test_checkSubclass() { - warnUnimpl("Test test_checkSubclass not written"); -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_getContentsLorg_eclipse_swt_dnd_Transfer() { - warnUnimpl("Test test_getContentsLorg_eclipse_swt_dnd_Transfer not written"); -} - -public void test_setContents$Ljava_lang_Object$Lorg_eclipse_swt_dnd_Transfer() { - warnUnimpl("Test test_setContents$Ljava_lang_Object$Lorg_eclipse_swt_dnd_Transfer not written"); -} - -public void test_getAvailableTypeNames() { - warnUnimpl("Test test_getAvailableTypeNames not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_Clipboard((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Display"); - methodNames.addElement("test_checkSubclass"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getContentsLorg_eclipse_swt_dnd_Transfer"); - methodNames.addElement("test_setContents$Ljava_lang_Object$Lorg_eclipse_swt_dnd_Transfer"); - methodNames.addElement("test_getAvailableTypeNames"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Display")) test_ConstructorLorg_eclipse_swt_widgets_Display(); - else if (getName().equals("test_checkSubclass")) test_checkSubclass(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getContentsLorg_eclipse_swt_dnd_Transfer")) test_getContentsLorg_eclipse_swt_dnd_Transfer(); - else if (getName().equals("test_setContents$Ljava_lang_Object$Lorg_eclipse_swt_dnd_Transfer")) test_setContents$Ljava_lang_Object$Lorg_eclipse_swt_dnd_Transfer(); - else if (getName().equals("test_getAvailableTypeNames")) test_getAvailableTypeNames(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DND.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DND.java deleted file mode 100644 index 2cd7eafad2..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DND.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.dnd.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.DND - * - * @see org.eclipse.swt.dnd.DND - */ -public class Test_org_eclipse_swt_dnd_DND extends SwtTestCase { - -public Test_org_eclipse_swt_dnd_DND(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_errorI() { - warnUnimpl("Test test_errorI not written"); -} - -public void test_errorII() { - warnUnimpl("Test test_errorII not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_DND((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_errorI"); - methodNames.addElement("test_errorII"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_errorI")) test_errorI(); - else if (getName().equals("test_errorII")) test_errorII(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSource.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSource.java deleted file mode 100644 index f9ef470869..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSource.java +++ /dev/null @@ -1,102 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.dnd.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.DragSource - * - * @see org.eclipse.swt.dnd.DragSource - */ -public class Test_org_eclipse_swt_dnd_DragSource extends Test_org_eclipse_swt_widgets_Widget { - -public Test_org_eclipse_swt_dnd_DragSource(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ControlI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ControlI not written"); -} - -public void test_addDragListenerLorg_eclipse_swt_dnd_DragSourceListener() { - warnUnimpl("Test test_addDragListenerLorg_eclipse_swt_dnd_DragSourceListener not written"); -} - -public void test_getControl() { - warnUnimpl("Test test_getControl not written"); -} - -public void test_getDisplay() { - warnUnimpl("Test test_getDisplay not written"); -} - -public void test_getTransfer() { - warnUnimpl("Test test_getTransfer not written"); -} - -public void test_removeDragListenerLorg_eclipse_swt_dnd_DragSourceListener() { - warnUnimpl("Test test_removeDragListenerLorg_eclipse_swt_dnd_DragSourceListener not written"); -} - -public void test_setTransfer$Lorg_eclipse_swt_dnd_Transfer() { - warnUnimpl("Test test_setTransfer$Lorg_eclipse_swt_dnd_Transfer not written"); -} - -public void test_checkSubclass() { - warnUnimpl("Test test_checkSubclass not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_DragSource((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ControlI"); - methodNames.addElement("test_addDragListenerLorg_eclipse_swt_dnd_DragSourceListener"); - methodNames.addElement("test_getControl"); - methodNames.addElement("test_getDisplay"); - methodNames.addElement("test_getTransfer"); - methodNames.addElement("test_removeDragListenerLorg_eclipse_swt_dnd_DragSourceListener"); - methodNames.addElement("test_setTransfer$Lorg_eclipse_swt_dnd_Transfer"); - methodNames.addElement("test_checkSubclass"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ControlI")) test_ConstructorLorg_eclipse_swt_widgets_ControlI(); - else if (getName().equals("test_addDragListenerLorg_eclipse_swt_dnd_DragSourceListener")) test_addDragListenerLorg_eclipse_swt_dnd_DragSourceListener(); - else if (getName().equals("test_getControl")) test_getControl(); - else if (getName().equals("test_getDisplay")) test_getDisplay(); - else if (getName().equals("test_getTransfer")) test_getTransfer(); - else if (getName().equals("test_removeDragListenerLorg_eclipse_swt_dnd_DragSourceListener")) test_removeDragListenerLorg_eclipse_swt_dnd_DragSourceListener(); - else if (getName().equals("test_setTransfer$Lorg_eclipse_swt_dnd_Transfer")) test_setTransfer$Lorg_eclipse_swt_dnd_Transfer(); - else if (getName().equals("test_checkSubclass")) test_checkSubclass(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceAdapter.java deleted file mode 100644 index 1a21e4c275..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceAdapter.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.dnd.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.DragSourceAdapter - * - * @see org.eclipse.swt.dnd.DragSourceAdapter - */ -public class Test_org_eclipse_swt_dnd_DragSourceAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_dnd_DragSourceAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent() { - warnUnimpl("Test test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent not written"); -} - -public void test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent() { - warnUnimpl("Test test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent not written"); -} - -public void test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent() { - warnUnimpl("Test test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_DragSourceAdapter((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent"); - methodNames.addElement("test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent"); - methodNames.addElement("test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent")) test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent(); - else if (getName().equals("test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent")) test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent(); - else if (getName().equals("test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent")) test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceEvent.java deleted file mode 100644 index 692cd1d0eb..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.dnd.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.DragSourceEvent - * - * @see org.eclipse.swt.dnd.DragSourceEvent - */ -public class Test_org_eclipse_swt_dnd_DragSourceEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_dnd_DragSourceEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_dnd_DNDEvent() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_dnd_DNDEvent not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_DragSourceEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_dnd_DNDEvent"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_dnd_DNDEvent")) test_ConstructorLorg_eclipse_swt_dnd_DNDEvent(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceListener.java deleted file mode 100644 index ca0e632c69..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceListener.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.dnd.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.DragSourceListener - * - * @see org.eclipse.swt.dnd.DragSourceListener - */ -public class Test_org_eclipse_swt_dnd_DragSourceListener extends SwtTestCase { - -public Test_org_eclipse_swt_dnd_DragSourceListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent() { - warnUnimpl("Test test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent not written"); -} - -public void test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent() { - warnUnimpl("Test test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent not written"); -} - -public void test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent() { - warnUnimpl("Test test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent"); - methodNames.addElement("test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent"); - methodNames.addElement("test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent")) test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent(); - else if (getName().equals("test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent")) test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent(); - else if (getName().equals("test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent")) test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTarget.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTarget.java deleted file mode 100644 index a0a1f6bcea..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTarget.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.dnd.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.DropTarget - * - * @see org.eclipse.swt.dnd.DropTarget - */ -public class Test_org_eclipse_swt_dnd_DropTarget extends Test_org_eclipse_swt_widgets_Widget { - -public Test_org_eclipse_swt_dnd_DropTarget(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ControlI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ControlI not written"); -} - -public void test_addDropListenerLorg_eclipse_swt_dnd_DropTargetListener() { - warnUnimpl("Test test_addDropListenerLorg_eclipse_swt_dnd_DropTargetListener not written"); -} - -public void test_getControl() { - warnUnimpl("Test test_getControl not written"); -} - -public void test_getDisplay() { - warnUnimpl("Test test_getDisplay not written"); -} - -public void test_getTransfer() { - warnUnimpl("Test test_getTransfer not written"); -} - -public void test_notifyListenersILorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_notifyListenersILorg_eclipse_swt_widgets_Event not written"); -} - -public void test_removeDropListenerLorg_eclipse_swt_dnd_DropTargetListener() { - warnUnimpl("Test test_removeDropListenerLorg_eclipse_swt_dnd_DropTargetListener not written"); -} - -public void test_setTransfer$Lorg_eclipse_swt_dnd_Transfer() { - warnUnimpl("Test test_setTransfer$Lorg_eclipse_swt_dnd_Transfer not written"); -} - -public void test_checkSubclass() { - warnUnimpl("Test test_checkSubclass not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_DropTarget((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ControlI"); - methodNames.addElement("test_addDropListenerLorg_eclipse_swt_dnd_DropTargetListener"); - methodNames.addElement("test_getControl"); - methodNames.addElement("test_getDisplay"); - methodNames.addElement("test_getTransfer"); - methodNames.addElement("test_notifyListenersILorg_eclipse_swt_widgets_Event"); - methodNames.addElement("test_removeDropListenerLorg_eclipse_swt_dnd_DropTargetListener"); - methodNames.addElement("test_setTransfer$Lorg_eclipse_swt_dnd_Transfer"); - methodNames.addElement("test_checkSubclass"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ControlI")) test_ConstructorLorg_eclipse_swt_widgets_ControlI(); - else if (getName().equals("test_addDropListenerLorg_eclipse_swt_dnd_DropTargetListener")) test_addDropListenerLorg_eclipse_swt_dnd_DropTargetListener(); - else if (getName().equals("test_getControl")) test_getControl(); - else if (getName().equals("test_getDisplay")) test_getDisplay(); - else if (getName().equals("test_getTransfer")) test_getTransfer(); - else if (getName().equals("test_notifyListenersILorg_eclipse_swt_widgets_Event")) test_notifyListenersILorg_eclipse_swt_widgets_Event(); - else if (getName().equals("test_removeDropListenerLorg_eclipse_swt_dnd_DropTargetListener")) test_removeDropListenerLorg_eclipse_swt_dnd_DropTargetListener(); - else if (getName().equals("test_setTransfer$Lorg_eclipse_swt_dnd_Transfer")) test_setTransfer$Lorg_eclipse_swt_dnd_Transfer(); - else if (getName().equals("test_checkSubclass")) test_checkSubclass(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetAdapter.java deleted file mode 100644 index fdaec68606..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetAdapter.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.dnd.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.DropTargetAdapter - * - * @see org.eclipse.swt.dnd.DropTargetAdapter - */ -public class Test_org_eclipse_swt_dnd_DropTargetAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_dnd_DropTargetAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dropLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dropLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_DropTargetAdapter((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dropLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dropLorg_eclipse_swt_dnd_DropTargetEvent")) test_dropLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent")) test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetEvent.java deleted file mode 100644 index 7c4e19bca1..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.dnd.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.DropTargetEvent - * - * @see org.eclipse.swt.dnd.DropTargetEvent - */ -public class Test_org_eclipse_swt_dnd_DropTargetEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_dnd_DropTargetEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_dnd_DNDEvent() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_dnd_DNDEvent not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_DropTargetEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_dnd_DNDEvent"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_dnd_DNDEvent")) test_ConstructorLorg_eclipse_swt_dnd_DNDEvent(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetListener.java deleted file mode 100644 index 27236a8187..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetListener.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.dnd.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.DropTargetListener - * - * @see org.eclipse.swt.dnd.DropTargetListener - */ -public class Test_org_eclipse_swt_dnd_DropTargetListener extends SwtTestCase { - -public Test_org_eclipse_swt_dnd_DropTargetListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dropLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dropLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dropLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dropLorg_eclipse_swt_dnd_DropTargetEvent")) test_dropLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent")) test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_FileTransfer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_FileTransfer.java deleted file mode 100644 index 15e6776eee..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_FileTransfer.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.dnd.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.FileTransfer - * - * @see org.eclipse.swt.dnd.FileTransfer - */ -public class Test_org_eclipse_swt_dnd_FileTransfer extends Test_org_eclipse_swt_dnd_ByteArrayTransfer { - -public Test_org_eclipse_swt_dnd_FileTransfer(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_getInstance() { - warnUnimpl("Test test_getInstance not written"); -} - -public void test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData not written"); -} - -public void test_nativeToJavaLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_nativeToJavaLorg_eclipse_swt_dnd_TransferData not written"); -} - -public void test_getTypeIds() { - warnUnimpl("Test test_getTypeIds not written"); -} - -public void test_getTypeNames() { - warnUnimpl("Test test_getTypeNames not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_FileTransfer((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_getInstance"); - methodNames.addElement("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData"); - methodNames.addElement("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData"); - methodNames.addElement("test_getTypeIds"); - methodNames.addElement("test_getTypeNames"); - methodNames.addAll(Test_org_eclipse_swt_dnd_ByteArrayTransfer.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_getInstance")) test_getInstance(); - else if (getName().equals("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData")) test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData(); - else if (getName().equals("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData")) test_nativeToJavaLorg_eclipse_swt_dnd_TransferData(); - else if (getName().equals("test_getTypeIds")) test_getTypeIds(); - else if (getName().equals("test_getTypeNames")) test_getTypeNames(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_RTFTransfer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_RTFTransfer.java deleted file mode 100644 index e5b7ca402e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_RTFTransfer.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.dnd.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.RTFTransfer - * - * @see org.eclipse.swt.dnd.RTFTransfer - */ -public class Test_org_eclipse_swt_dnd_RTFTransfer extends Test_org_eclipse_swt_dnd_ByteArrayTransfer { - -public Test_org_eclipse_swt_dnd_RTFTransfer(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_getInstance() { - warnUnimpl("Test test_getInstance not written"); -} - -public void test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData not written"); -} - -public void test_nativeToJavaLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_nativeToJavaLorg_eclipse_swt_dnd_TransferData not written"); -} - -public void test_getTypeIds() { - warnUnimpl("Test test_getTypeIds not written"); -} - -public void test_getTypeNames() { - warnUnimpl("Test test_getTypeNames not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_RTFTransfer((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_getInstance"); - methodNames.addElement("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData"); - methodNames.addElement("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData"); - methodNames.addElement("test_getTypeIds"); - methodNames.addElement("test_getTypeNames"); - methodNames.addAll(Test_org_eclipse_swt_dnd_ByteArrayTransfer.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_getInstance")) test_getInstance(); - else if (getName().equals("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData")) test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData(); - else if (getName().equals("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData")) test_nativeToJavaLorg_eclipse_swt_dnd_TransferData(); - else if (getName().equals("test_getTypeIds")) test_getTypeIds(); - else if (getName().equals("test_getTypeNames")) test_getTypeNames(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TextTransfer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TextTransfer.java deleted file mode 100644 index 65e7021f37..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TextTransfer.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.dnd.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.TextTransfer - * - * @see org.eclipse.swt.dnd.TextTransfer - */ -public class Test_org_eclipse_swt_dnd_TextTransfer extends Test_org_eclipse_swt_dnd_ByteArrayTransfer { - -public Test_org_eclipse_swt_dnd_TextTransfer(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_getInstance() { - warnUnimpl("Test test_getInstance not written"); -} - -public void test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData not written"); -} - -public void test_nativeToJavaLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_nativeToJavaLorg_eclipse_swt_dnd_TransferData not written"); -} - -public void test_getTypeIds() { - warnUnimpl("Test test_getTypeIds not written"); -} - -public void test_getTypeNames() { - warnUnimpl("Test test_getTypeNames not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_TextTransfer((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_getInstance"); - methodNames.addElement("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData"); - methodNames.addElement("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData"); - methodNames.addElement("test_getTypeIds"); - methodNames.addElement("test_getTypeNames"); - methodNames.addAll(Test_org_eclipse_swt_dnd_ByteArrayTransfer.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_getInstance")) test_getInstance(); - else if (getName().equals("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData")) test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData(); - else if (getName().equals("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData")) test_nativeToJavaLorg_eclipse_swt_dnd_TransferData(); - else if (getName().equals("test_getTypeIds")) test_getTypeIds(); - else if (getName().equals("test_getTypeNames")) test_getTypeNames(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Transfer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Transfer.java deleted file mode 100644 index 04e4eac5b1..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Transfer.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.dnd.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.Transfer - * - * @see org.eclipse.swt.dnd.Transfer - */ -public class Test_org_eclipse_swt_dnd_Transfer extends SwtTestCase { - -public Test_org_eclipse_swt_dnd_Transfer(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_getSupportedTypes() { - warnUnimpl("Test test_getSupportedTypes not written"); -} - -public void test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData not written"); -} - -public void test_getTypeIds() { - warnUnimpl("Test test_getTypeIds not written"); -} - -public void test_getTypeNames() { - warnUnimpl("Test test_getTypeNames not written"); -} - -public void test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData not written"); -} - -public void test_nativeToJavaLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_nativeToJavaLorg_eclipse_swt_dnd_TransferData not written"); -} - -public void test_registerTypeLjava_lang_String() { - warnUnimpl("Test test_registerTypeLjava_lang_String not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_getSupportedTypes"); - methodNames.addElement("test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData"); - methodNames.addElement("test_getTypeIds"); - methodNames.addElement("test_getTypeNames"); - methodNames.addElement("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData"); - methodNames.addElement("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData"); - methodNames.addElement("test_registerTypeLjava_lang_String"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_getSupportedTypes")) test_getSupportedTypes(); - else if (getName().equals("test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData")) test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData(); - else if (getName().equals("test_getTypeIds")) test_getTypeIds(); - else if (getName().equals("test_getTypeNames")) test_getTypeNames(); - else if (getName().equals("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData")) test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData(); - else if (getName().equals("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData")) test_nativeToJavaLorg_eclipse_swt_dnd_TransferData(); - else if (getName().equals("test_registerTypeLjava_lang_String")) test_registerTypeLjava_lang_String(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TransferData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TransferData.java deleted file mode 100644 index 21a390167a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TransferData.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.dnd.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.TransferData - * - * @see org.eclipse.swt.dnd.TransferData - */ -public class Test_org_eclipse_swt_dnd_TransferData extends SwtTestCase { - -public Test_org_eclipse_swt_dnd_TransferData(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_TransferData((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmEvent.java deleted file mode 100644 index acb5545e8e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ArmEvent - * - * @see org.eclipse.swt.events.ArmEvent - */ -public class Test_org_eclipse_swt_events_ArmEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_ArmEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_ArmEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmListener.java deleted file mode 100644 index 1ba1c0e33e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmListener.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ArmListener - * - * @see org.eclipse.swt.events.ArmListener - */ -public class Test_org_eclipse_swt_events_ArmListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_ArmListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_widgetArmedLorg_eclipse_swt_events_ArmEvent() { - warnUnimpl("Test test_widgetArmedLorg_eclipse_swt_events_ArmEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_widgetArmedLorg_eclipse_swt_events_ArmEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_widgetArmedLorg_eclipse_swt_events_ArmEvent")) test_widgetArmedLorg_eclipse_swt_events_ArmEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlAdapter.java deleted file mode 100644 index ba5dab7aeb..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlAdapter.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ControlAdapter - * - * @see org.eclipse.swt.events.ControlAdapter - */ -public class Test_org_eclipse_swt_events_ControlAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_events_ControlAdapter(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_controlMovedLorg_eclipse_swt_events_ControlEvent() { - warnUnimpl("Test test_controlMovedLorg_eclipse_swt_events_ControlEvent not written"); -} - -public void test_controlResizedLorg_eclipse_swt_events_ControlEvent() { - warnUnimpl("Test test_controlResizedLorg_eclipse_swt_events_ControlEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_controlMovedLorg_eclipse_swt_events_ControlEvent"); - methodNames.addElement("test_controlResizedLorg_eclipse_swt_events_ControlEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_controlMovedLorg_eclipse_swt_events_ControlEvent")) test_controlMovedLorg_eclipse_swt_events_ControlEvent(); - else if (getName().equals("test_controlResizedLorg_eclipse_swt_events_ControlEvent")) test_controlResizedLorg_eclipse_swt_events_ControlEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlEvent.java deleted file mode 100644 index ceaa0e9469..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ControlEvent - * - * @see org.eclipse.swt.events.ControlEvent - */ -public class Test_org_eclipse_swt_events_ControlEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_ControlEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_ControlEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlListener.java deleted file mode 100644 index d3fc9925a4..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlListener.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ControlListener - * - * @see org.eclipse.swt.events.ControlListener - */ -public class Test_org_eclipse_swt_events_ControlListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_ControlListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_controlMovedLorg_eclipse_swt_events_ControlEvent() { - warnUnimpl("Test test_controlMovedLorg_eclipse_swt_events_ControlEvent not written"); -} - -public void test_controlResizedLorg_eclipse_swt_events_ControlEvent() { - warnUnimpl("Test test_controlResizedLorg_eclipse_swt_events_ControlEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_controlMovedLorg_eclipse_swt_events_ControlEvent"); - methodNames.addElement("test_controlResizedLorg_eclipse_swt_events_ControlEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_controlMovedLorg_eclipse_swt_events_ControlEvent")) test_controlMovedLorg_eclipse_swt_events_ControlEvent(); - else if (getName().equals("test_controlResizedLorg_eclipse_swt_events_ControlEvent")) test_controlResizedLorg_eclipse_swt_events_ControlEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeEvent.java deleted file mode 100644 index 526c658899..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.DisposeEvent - * - * @see org.eclipse.swt.events.DisposeEvent - */ -public class Test_org_eclipse_swt_events_DisposeEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_DisposeEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_DisposeEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeListener.java deleted file mode 100644 index cabf654c7e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeListener.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.DisposeListener - * - * @see org.eclipse.swt.events.DisposeListener - */ -public class Test_org_eclipse_swt_events_DisposeListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_DisposeListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_widgetDisposedLorg_eclipse_swt_events_DisposeEvent() { - warnUnimpl("Test test_widgetDisposedLorg_eclipse_swt_events_DisposeEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_widgetDisposedLorg_eclipse_swt_events_DisposeEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_widgetDisposedLorg_eclipse_swt_events_DisposeEvent")) test_widgetDisposedLorg_eclipse_swt_events_DisposeEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusAdapter.java deleted file mode 100644 index e970b05abd..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusAdapter.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.FocusAdapter - * - * @see org.eclipse.swt.events.FocusAdapter - */ -public class Test_org_eclipse_swt_events_FocusAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_events_FocusAdapter(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_focusGainedLorg_eclipse_swt_events_FocusEvent() { - warnUnimpl("Test test_focusGainedLorg_eclipse_swt_events_FocusEvent not written"); -} - -public void test_focusLostLorg_eclipse_swt_events_FocusEvent() { - warnUnimpl("Test test_focusLostLorg_eclipse_swt_events_FocusEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_focusGainedLorg_eclipse_swt_events_FocusEvent"); - methodNames.addElement("test_focusLostLorg_eclipse_swt_events_FocusEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_focusGainedLorg_eclipse_swt_events_FocusEvent")) test_focusGainedLorg_eclipse_swt_events_FocusEvent(); - else if (getName().equals("test_focusLostLorg_eclipse_swt_events_FocusEvent")) test_focusLostLorg_eclipse_swt_events_FocusEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusEvent.java deleted file mode 100644 index fdb31f53ba..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.FocusEvent - * - * @see org.eclipse.swt.events.FocusEvent - */ -public class Test_org_eclipse_swt_events_FocusEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_FocusEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_FocusEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusListener.java deleted file mode 100644 index a67219e930..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusListener.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.FocusListener - * - * @see org.eclipse.swt.events.FocusListener - */ -public class Test_org_eclipse_swt_events_FocusListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_FocusListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_focusGainedLorg_eclipse_swt_events_FocusEvent() { - warnUnimpl("Test test_focusGainedLorg_eclipse_swt_events_FocusEvent not written"); -} - -public void test_focusLostLorg_eclipse_swt_events_FocusEvent() { - warnUnimpl("Test test_focusLostLorg_eclipse_swt_events_FocusEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_focusGainedLorg_eclipse_swt_events_FocusEvent"); - methodNames.addElement("test_focusLostLorg_eclipse_swt_events_FocusEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_focusGainedLorg_eclipse_swt_events_FocusEvent")) test_focusGainedLorg_eclipse_swt_events_FocusEvent(); - else if (getName().equals("test_focusLostLorg_eclipse_swt_events_FocusEvent")) test_focusLostLorg_eclipse_swt_events_FocusEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpEvent.java deleted file mode 100644 index bd226540cd..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.HelpEvent - * - * @see org.eclipse.swt.events.HelpEvent - */ -public class Test_org_eclipse_swt_events_HelpEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_HelpEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_HelpEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpListener.java deleted file mode 100644 index bb5422f20d..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpListener.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.HelpListener - * - * @see org.eclipse.swt.events.HelpListener - */ -public class Test_org_eclipse_swt_events_HelpListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_HelpListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_helpRequestedLorg_eclipse_swt_events_HelpEvent() { - warnUnimpl("Test test_helpRequestedLorg_eclipse_swt_events_HelpEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_helpRequestedLorg_eclipse_swt_events_HelpEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_helpRequestedLorg_eclipse_swt_events_HelpEvent")) test_helpRequestedLorg_eclipse_swt_events_HelpEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyAdapter.java deleted file mode 100644 index a68e1f5872..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyAdapter.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.KeyAdapter - * - * @see org.eclipse.swt.events.KeyAdapter - */ -public class Test_org_eclipse_swt_events_KeyAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_events_KeyAdapter(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_keyPressedLorg_eclipse_swt_events_KeyEvent() { - warnUnimpl("Test test_keyPressedLorg_eclipse_swt_events_KeyEvent not written"); -} - -public void test_keyReleasedLorg_eclipse_swt_events_KeyEvent() { - warnUnimpl("Test test_keyReleasedLorg_eclipse_swt_events_KeyEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_keyPressedLorg_eclipse_swt_events_KeyEvent"); - methodNames.addElement("test_keyReleasedLorg_eclipse_swt_events_KeyEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_keyPressedLorg_eclipse_swt_events_KeyEvent")) test_keyPressedLorg_eclipse_swt_events_KeyEvent(); - else if (getName().equals("test_keyReleasedLorg_eclipse_swt_events_KeyEvent")) test_keyReleasedLorg_eclipse_swt_events_KeyEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyEvent.java deleted file mode 100644 index edafd10c1f..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.KeyEvent - * - * @see org.eclipse.swt.events.KeyEvent - */ -public class Test_org_eclipse_swt_events_KeyEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_KeyEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_KeyEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyListener.java deleted file mode 100644 index fbc5ecc6de..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyListener.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.KeyListener - * - * @see org.eclipse.swt.events.KeyListener - */ -public class Test_org_eclipse_swt_events_KeyListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_KeyListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_keyPressedLorg_eclipse_swt_events_KeyEvent() { - warnUnimpl("Test test_keyPressedLorg_eclipse_swt_events_KeyEvent not written"); -} - -public void test_keyReleasedLorg_eclipse_swt_events_KeyEvent() { - warnUnimpl("Test test_keyReleasedLorg_eclipse_swt_events_KeyEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_keyPressedLorg_eclipse_swt_events_KeyEvent"); - methodNames.addElement("test_keyReleasedLorg_eclipse_swt_events_KeyEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_keyPressedLorg_eclipse_swt_events_KeyEvent")) test_keyPressedLorg_eclipse_swt_events_KeyEvent(); - else if (getName().equals("test_keyReleasedLorg_eclipse_swt_events_KeyEvent")) test_keyReleasedLorg_eclipse_swt_events_KeyEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuAdapter.java deleted file mode 100644 index fdde80527f..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuAdapter.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.MenuAdapter - * - * @see org.eclipse.swt.events.MenuAdapter - */ -public class Test_org_eclipse_swt_events_MenuAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_events_MenuAdapter(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_menuHiddenLorg_eclipse_swt_events_MenuEvent() { - warnUnimpl("Test test_menuHiddenLorg_eclipse_swt_events_MenuEvent not written"); -} - -public void test_menuShownLorg_eclipse_swt_events_MenuEvent() { - warnUnimpl("Test test_menuShownLorg_eclipse_swt_events_MenuEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_menuHiddenLorg_eclipse_swt_events_MenuEvent"); - methodNames.addElement("test_menuShownLorg_eclipse_swt_events_MenuEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_menuHiddenLorg_eclipse_swt_events_MenuEvent")) test_menuHiddenLorg_eclipse_swt_events_MenuEvent(); - else if (getName().equals("test_menuShownLorg_eclipse_swt_events_MenuEvent")) test_menuShownLorg_eclipse_swt_events_MenuEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuEvent.java deleted file mode 100644 index 8accf1e919..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.MenuEvent - * - * @see org.eclipse.swt.events.MenuEvent - */ -public class Test_org_eclipse_swt_events_MenuEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_MenuEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_MenuEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuListener.java deleted file mode 100644 index 8bc0433db2..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuListener.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.MenuListener - * - * @see org.eclipse.swt.events.MenuListener - */ -public class Test_org_eclipse_swt_events_MenuListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_MenuListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_menuHiddenLorg_eclipse_swt_events_MenuEvent() { - warnUnimpl("Test test_menuHiddenLorg_eclipse_swt_events_MenuEvent not written"); -} - -public void test_menuShownLorg_eclipse_swt_events_MenuEvent() { - warnUnimpl("Test test_menuShownLorg_eclipse_swt_events_MenuEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_menuHiddenLorg_eclipse_swt_events_MenuEvent"); - methodNames.addElement("test_menuShownLorg_eclipse_swt_events_MenuEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_menuHiddenLorg_eclipse_swt_events_MenuEvent")) test_menuHiddenLorg_eclipse_swt_events_MenuEvent(); - else if (getName().equals("test_menuShownLorg_eclipse_swt_events_MenuEvent")) test_menuShownLorg_eclipse_swt_events_MenuEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyEvent.java deleted file mode 100644 index 2c958b08d5..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ModifyEvent - * - * @see org.eclipse.swt.events.ModifyEvent - */ -public class Test_org_eclipse_swt_events_ModifyEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_ModifyEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_ModifyEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyListener.java deleted file mode 100644 index 8a8dc6b550..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyListener.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ModifyListener - * - * @see org.eclipse.swt.events.ModifyListener - */ -public class Test_org_eclipse_swt_events_ModifyListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_ModifyListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_modifyTextLorg_eclipse_swt_events_ModifyEvent() { - warnUnimpl("Test test_modifyTextLorg_eclipse_swt_events_ModifyEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_modifyTextLorg_eclipse_swt_events_ModifyEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_modifyTextLorg_eclipse_swt_events_ModifyEvent")) test_modifyTextLorg_eclipse_swt_events_ModifyEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseAdapter.java deleted file mode 100644 index c64d2d4301..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseAdapter.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.MouseAdapter - * - * @see org.eclipse.swt.events.MouseAdapter - */ -public class Test_org_eclipse_swt_events_MouseAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_events_MouseAdapter(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent not written"); -} - -public void test_mouseDownLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseDownLorg_eclipse_swt_events_MouseEvent not written"); -} - -public void test_mouseUpLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseUpLorg_eclipse_swt_events_MouseEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent"); - methodNames.addElement("test_mouseDownLorg_eclipse_swt_events_MouseEvent"); - methodNames.addElement("test_mouseUpLorg_eclipse_swt_events_MouseEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent")) test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent(); - else if (getName().equals("test_mouseDownLorg_eclipse_swt_events_MouseEvent")) test_mouseDownLorg_eclipse_swt_events_MouseEvent(); - else if (getName().equals("test_mouseUpLorg_eclipse_swt_events_MouseEvent")) test_mouseUpLorg_eclipse_swt_events_MouseEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseEvent.java deleted file mode 100644 index c84317d646..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.MouseEvent - * - * @see org.eclipse.swt.events.MouseEvent - */ -public class Test_org_eclipse_swt_events_MouseEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_MouseEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_MouseEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseListener.java deleted file mode 100644 index e4f576c298..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseListener.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.MouseListener - * - * @see org.eclipse.swt.events.MouseListener - */ -public class Test_org_eclipse_swt_events_MouseListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_MouseListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent not written"); -} - -public void test_mouseDownLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseDownLorg_eclipse_swt_events_MouseEvent not written"); -} - -public void test_mouseUpLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseUpLorg_eclipse_swt_events_MouseEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent"); - methodNames.addElement("test_mouseDownLorg_eclipse_swt_events_MouseEvent"); - methodNames.addElement("test_mouseUpLorg_eclipse_swt_events_MouseEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent")) test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent(); - else if (getName().equals("test_mouseDownLorg_eclipse_swt_events_MouseEvent")) test_mouseDownLorg_eclipse_swt_events_MouseEvent(); - else if (getName().equals("test_mouseUpLorg_eclipse_swt_events_MouseEvent")) test_mouseUpLorg_eclipse_swt_events_MouseEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseMoveListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseMoveListener.java deleted file mode 100644 index 640de13561..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseMoveListener.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.MouseMoveListener - * - * @see org.eclipse.swt.events.MouseMoveListener - */ -public class Test_org_eclipse_swt_events_MouseMoveListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_MouseMoveListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_mouseMoveLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseMoveLorg_eclipse_swt_events_MouseEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_mouseMoveLorg_eclipse_swt_events_MouseEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_mouseMoveLorg_eclipse_swt_events_MouseEvent")) test_mouseMoveLorg_eclipse_swt_events_MouseEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackAdapter.java deleted file mode 100644 index 214b553e3e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackAdapter.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.MouseTrackAdapter - * - * @see org.eclipse.swt.events.MouseTrackAdapter - */ -public class Test_org_eclipse_swt_events_MouseTrackAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_events_MouseTrackAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_mouseEnterLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseEnterLorg_eclipse_swt_events_MouseEvent not written"); -} - -public void test_mouseExitLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseExitLorg_eclipse_swt_events_MouseEvent not written"); -} - -public void test_mouseHoverLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseHoverLorg_eclipse_swt_events_MouseEvent not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_MouseTrackAdapter((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_mouseEnterLorg_eclipse_swt_events_MouseEvent"); - methodNames.addElement("test_mouseExitLorg_eclipse_swt_events_MouseEvent"); - methodNames.addElement("test_mouseHoverLorg_eclipse_swt_events_MouseEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_mouseEnterLorg_eclipse_swt_events_MouseEvent")) test_mouseEnterLorg_eclipse_swt_events_MouseEvent(); - else if (getName().equals("test_mouseExitLorg_eclipse_swt_events_MouseEvent")) test_mouseExitLorg_eclipse_swt_events_MouseEvent(); - else if (getName().equals("test_mouseHoverLorg_eclipse_swt_events_MouseEvent")) test_mouseHoverLorg_eclipse_swt_events_MouseEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackListener.java deleted file mode 100644 index cf702a4482..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackListener.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.MouseTrackListener - * - * @see org.eclipse.swt.events.MouseTrackListener - */ -public class Test_org_eclipse_swt_events_MouseTrackListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_MouseTrackListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_mouseEnterLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseEnterLorg_eclipse_swt_events_MouseEvent not written"); -} - -public void test_mouseExitLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseExitLorg_eclipse_swt_events_MouseEvent not written"); -} - -public void test_mouseHoverLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseHoverLorg_eclipse_swt_events_MouseEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_mouseEnterLorg_eclipse_swt_events_MouseEvent"); - methodNames.addElement("test_mouseExitLorg_eclipse_swt_events_MouseEvent"); - methodNames.addElement("test_mouseHoverLorg_eclipse_swt_events_MouseEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_mouseEnterLorg_eclipse_swt_events_MouseEvent")) test_mouseEnterLorg_eclipse_swt_events_MouseEvent(); - else if (getName().equals("test_mouseExitLorg_eclipse_swt_events_MouseEvent")) test_mouseExitLorg_eclipse_swt_events_MouseEvent(); - else if (getName().equals("test_mouseHoverLorg_eclipse_swt_events_MouseEvent")) test_mouseHoverLorg_eclipse_swt_events_MouseEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintEvent.java deleted file mode 100644 index ea25a62895..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.PaintEvent - * - * @see org.eclipse.swt.events.PaintEvent - */ -public class Test_org_eclipse_swt_events_PaintEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_PaintEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_PaintEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintListener.java deleted file mode 100644 index 11e541bd93..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintListener.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.PaintListener - * - * @see org.eclipse.swt.events.PaintListener - */ -public class Test_org_eclipse_swt_events_PaintListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_PaintListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_paintControlLorg_eclipse_swt_events_PaintEvent() { - warnUnimpl("Test test_paintControlLorg_eclipse_swt_events_PaintEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_paintControlLorg_eclipse_swt_events_PaintEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_paintControlLorg_eclipse_swt_events_PaintEvent")) test_paintControlLorg_eclipse_swt_events_PaintEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionAdapter.java deleted file mode 100644 index 4f4f4bd4ab..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionAdapter.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.SelectionAdapter - * - * @see org.eclipse.swt.events.SelectionAdapter - */ -public class Test_org_eclipse_swt_events_SelectionAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_events_SelectionAdapter(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent() { - warnUnimpl("Test test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent not written"); -} - -public void test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent() { - warnUnimpl("Test test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent"); - methodNames.addElement("test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent")) test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent(); - else if (getName().equals("test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent")) test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionEvent.java deleted file mode 100644 index dae7f0b291..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.SelectionEvent - * - * @see org.eclipse.swt.events.SelectionEvent - */ -public class Test_org_eclipse_swt_events_SelectionEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_SelectionEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_SelectionEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionListener.java deleted file mode 100644 index b031cbfb96..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionListener.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.SelectionListener - * - * @see org.eclipse.swt.events.SelectionListener - */ -public class Test_org_eclipse_swt_events_SelectionListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_SelectionListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent() { - warnUnimpl("Test test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent not written"); -} - -public void test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent() { - warnUnimpl("Test test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent"); - methodNames.addElement("test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent")) test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent(); - else if (getName().equals("test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent")) test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellAdapter.java deleted file mode 100644 index 45d2fcc5db..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellAdapter.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ShellAdapter - * - * @see org.eclipse.swt.events.ShellAdapter - */ -public class Test_org_eclipse_swt_events_ShellAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_events_ShellAdapter(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_shellActivatedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellActivatedLorg_eclipse_swt_events_ShellEvent not written"); -} - -public void test_shellClosedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellClosedLorg_eclipse_swt_events_ShellEvent not written"); -} - -public void test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent not written"); -} - -public void test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent not written"); -} - -public void test_shellIconifiedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellIconifiedLorg_eclipse_swt_events_ShellEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_shellActivatedLorg_eclipse_swt_events_ShellEvent"); - methodNames.addElement("test_shellClosedLorg_eclipse_swt_events_ShellEvent"); - methodNames.addElement("test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent"); - methodNames.addElement("test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent"); - methodNames.addElement("test_shellIconifiedLorg_eclipse_swt_events_ShellEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_shellActivatedLorg_eclipse_swt_events_ShellEvent")) test_shellActivatedLorg_eclipse_swt_events_ShellEvent(); - else if (getName().equals("test_shellClosedLorg_eclipse_swt_events_ShellEvent")) test_shellClosedLorg_eclipse_swt_events_ShellEvent(); - else if (getName().equals("test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent")) test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent(); - else if (getName().equals("test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent")) test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent(); - else if (getName().equals("test_shellIconifiedLorg_eclipse_swt_events_ShellEvent")) test_shellIconifiedLorg_eclipse_swt_events_ShellEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellEvent.java deleted file mode 100644 index d3e82744f7..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ShellEvent - * - * @see org.eclipse.swt.events.ShellEvent - */ -public class Test_org_eclipse_swt_events_ShellEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_ShellEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_ShellEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellListener.java deleted file mode 100644 index d43cc3f40e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellListener.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ShellListener - * - * @see org.eclipse.swt.events.ShellListener - */ -public class Test_org_eclipse_swt_events_ShellListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_ShellListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_shellActivatedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellActivatedLorg_eclipse_swt_events_ShellEvent not written"); -} - -public void test_shellClosedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellClosedLorg_eclipse_swt_events_ShellEvent not written"); -} - -public void test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent not written"); -} - -public void test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent not written"); -} - -public void test_shellIconifiedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellIconifiedLorg_eclipse_swt_events_ShellEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_shellActivatedLorg_eclipse_swt_events_ShellEvent"); - methodNames.addElement("test_shellClosedLorg_eclipse_swt_events_ShellEvent"); - methodNames.addElement("test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent"); - methodNames.addElement("test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent"); - methodNames.addElement("test_shellIconifiedLorg_eclipse_swt_events_ShellEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_shellActivatedLorg_eclipse_swt_events_ShellEvent")) test_shellActivatedLorg_eclipse_swt_events_ShellEvent(); - else if (getName().equals("test_shellClosedLorg_eclipse_swt_events_ShellEvent")) test_shellClosedLorg_eclipse_swt_events_ShellEvent(); - else if (getName().equals("test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent")) test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent(); - else if (getName().equals("test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent")) test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent(); - else if (getName().equals("test_shellIconifiedLorg_eclipse_swt_events_ShellEvent")) test_shellIconifiedLorg_eclipse_swt_events_ShellEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseEvent.java deleted file mode 100644 index bdd3c17f30..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.TraverseEvent - * - * @see org.eclipse.swt.events.TraverseEvent - */ -public class Test_org_eclipse_swt_events_TraverseEvent extends Test_org_eclipse_swt_events_KeyEvent { - -public Test_org_eclipse_swt_events_TraverseEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_TraverseEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_KeyEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseListener.java deleted file mode 100644 index ce6fb118cf..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseListener.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.TraverseListener - * - * @see org.eclipse.swt.events.TraverseListener - */ -public class Test_org_eclipse_swt_events_TraverseListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_TraverseListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_keyTraversedLorg_eclipse_swt_events_TraverseEvent() { - warnUnimpl("Test test_keyTraversedLorg_eclipse_swt_events_TraverseEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_keyTraversedLorg_eclipse_swt_events_TraverseEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_keyTraversedLorg_eclipse_swt_events_TraverseEvent")) test_keyTraversedLorg_eclipse_swt_events_TraverseEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeAdapter.java deleted file mode 100644 index 924f710126..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeAdapter.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.TreeAdapter - * - * @see org.eclipse.swt.events.TreeAdapter - */ -public class Test_org_eclipse_swt_events_TreeAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_events_TreeAdapter(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_treeCollapsedLorg_eclipse_swt_events_TreeEvent() { - warnUnimpl("Test test_treeCollapsedLorg_eclipse_swt_events_TreeEvent not written"); -} - -public void test_treeExpandedLorg_eclipse_swt_events_TreeEvent() { - warnUnimpl("Test test_treeExpandedLorg_eclipse_swt_events_TreeEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_treeCollapsedLorg_eclipse_swt_events_TreeEvent"); - methodNames.addElement("test_treeExpandedLorg_eclipse_swt_events_TreeEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_treeCollapsedLorg_eclipse_swt_events_TreeEvent")) test_treeCollapsedLorg_eclipse_swt_events_TreeEvent(); - else if (getName().equals("test_treeExpandedLorg_eclipse_swt_events_TreeEvent")) test_treeExpandedLorg_eclipse_swt_events_TreeEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeEvent.java deleted file mode 100644 index 8e9d9b2f7e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.TreeEvent - * - * @see org.eclipse.swt.events.TreeEvent - */ -public class Test_org_eclipse_swt_events_TreeEvent extends Test_org_eclipse_swt_events_SelectionEvent { - -public Test_org_eclipse_swt_events_TreeEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_TreeEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_SelectionEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeListener.java deleted file mode 100644 index 190894f422..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeListener.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.TreeListener - * - * @see org.eclipse.swt.events.TreeListener - */ -public class Test_org_eclipse_swt_events_TreeListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_TreeListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_treeCollapsedLorg_eclipse_swt_events_TreeEvent() { - warnUnimpl("Test test_treeCollapsedLorg_eclipse_swt_events_TreeEvent not written"); -} - -public void test_treeExpandedLorg_eclipse_swt_events_TreeEvent() { - warnUnimpl("Test test_treeExpandedLorg_eclipse_swt_events_TreeEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_treeCollapsedLorg_eclipse_swt_events_TreeEvent"); - methodNames.addElement("test_treeExpandedLorg_eclipse_swt_events_TreeEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_treeCollapsedLorg_eclipse_swt_events_TreeEvent")) test_treeCollapsedLorg_eclipse_swt_events_TreeEvent(); - else if (getName().equals("test_treeExpandedLorg_eclipse_swt_events_TreeEvent")) test_treeExpandedLorg_eclipse_swt_events_TreeEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TypedEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TypedEvent.java deleted file mode 100644 index 0b15741ece..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TypedEvent.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.TypedEvent - * - * @see org.eclipse.swt.events.TypedEvent - */ -public class Test_org_eclipse_swt_events_TypedEvent extends SwtTestCase { - -public Test_org_eclipse_swt_events_TypedEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorLjava_lang_Object() { - warnUnimpl("Test test_ConstructorLjava_lang_Object not written"); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_TypedEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLjava_lang_Object"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLjava_lang_Object")) test_ConstructorLjava_lang_Object(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyEvent.java deleted file mode 100644 index 8b1438ab79..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.VerifyEvent - * - * @see org.eclipse.swt.events.VerifyEvent - */ -public class Test_org_eclipse_swt_events_VerifyEvent extends Test_org_eclipse_swt_events_KeyEvent { - -public Test_org_eclipse_swt_events_VerifyEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_VerifyEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_KeyEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyListener.java deleted file mode 100644 index fd4b59067b..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyListener.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.VerifyListener - * - * @see org.eclipse.swt.events.VerifyListener - */ -public class Test_org_eclipse_swt_events_VerifyListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_VerifyListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_verifyTextLorg_eclipse_swt_events_VerifyEvent() { - warnUnimpl("Test test_verifyTextLorg_eclipse_swt_events_VerifyEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_verifyTextLorg_eclipse_swt_events_VerifyEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_verifyTextLorg_eclipse_swt_events_VerifyEvent")) test_verifyTextLorg_eclipse_swt_events_VerifyEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Color.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Color.java deleted file mode 100644 index 0684a9fad2..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Color.java +++ /dev/null @@ -1,282 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.Color - * - * @see org.eclipse.swt.graphics.Color - */ -public class Test_org_eclipse_swt_graphics_Color extends SwtTestCase { - -Display display; - -public Test_org_eclipse_swt_graphics_Color(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- display = new Display();
-} - -protected void tearDown() {
- display.dispose();
-} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceIII() {
- // Test new Color(Device device, int red, int green, int blue)
- // IllegalArgumentException if the red, green or blue argument is not between 0 and 255
-
- // valid color (black)
- Color color = new Color(display, 0, 0, 0);
- color.dispose();
-
- // valid color (white)
- color = new Color(display, 255, 255, 255);
- color.dispose();
-
- // valid color (random grey)
- color = new Color(display, 20, 20, 20);
- color.dispose();
-
- // valid color (random)
- color = new Color(display, 102, 255, 0);
- color.dispose();
-
- // device == null (valid)
- color = new Color(null, 0, 0, 0);
- color.dispose();
-
- // illegal argument, rgb < 0
- try {
- color = new Color(display, -10, -10, -10);
- color.dispose();
- fail("No exception thrown for rgb < 0");
- } catch (IllegalArgumentException e) {
- }
-
- // illegal argument, rgb > 255
- try {
- color = new Color(display, 1000, 2000, 3000);
- color.dispose();
- fail("No exception thrown for rgb > 255");
- } catch (IllegalArgumentException e) {
- }
- // illegal argument, blue > 255
- try {
- color = new Color(display, 10, 10, 256);
- color.dispose();
- fail("No exception thrown for blue > 255");
- } catch (IllegalArgumentException e) {
- }
-} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_RGB() {
- // Test new Color(Device device, RGB rgb)
- // IllegalArgumentException if the red, green or blue argument is not between 0 and 255; or rgb is null
-
- // valid color (black)
- Color color = new Color(display, new RGB(0, 0, 0));
- color.dispose();
-
- // valid color (white)
- color = new Color(display, new RGB(255, 255, 255));
- color.dispose();
-
- // valid color (random grey)
- color = new Color(display, new RGB(10, 10, 10));
- color.dispose();
-
- // valid color (random)
- color = new Color(display, new RGB(102, 255, 0));
- color.dispose();
-
- // device == null (valid)
- color = new Color(null, new RGB(0, 0, 0));
- color.dispose();
-
- // illegal argument, rgb < 0
- try {
- color = new Color(display, new RGB(-10, -10, -10));
- color.dispose();
- fail("No exception thrown for rgb < 0");
- }
- catch (IllegalArgumentException e) {
- }
- // illegal argument, rgb > 255
- try {
- color = new Color(display, new RGB(1000, 2000, 3000));
- color.dispose();
- fail("No exception thrown for rgb > 255");
- }
- catch (IllegalArgumentException e) {
- }
- // illegal argument, blue > 255
- try {
- color = new Color(display, new RGB(10, 10, 256));
- color.dispose();
- fail("No exception thrown for blue > 255");
- }
- catch (IllegalArgumentException e) {
- }
-
- // illegal argument, rgb == null
- try {
- color = new Color(display, null);
- color.dispose();
- fail("No exception thrown for rgb == null");
- }
- catch (IllegalArgumentException e) {
- }
-} - -public void test_dispose() { - // tested in test_isDisposed -} - -public void test_equalsLjava_lang_Object() {
- Color color = new Color(display, 1, 2, 3);
- Color sameColor = new Color(display, 1, 2, 3);
- Color sameColor2 = new Color(display, new RGB(1, 2, 3));
- Color otherColor = new Color(display, 5, 6, 7);
- try {
- // Test Color.equals(Object)
- assertTrue("!color.equals((Object)null)", !color.equals((Object)null));
-
- // Test Color.equals(Color)
- assertTrue("!color.equals((Color)null)", !color.equals((Color)null));
- assertTrue("color.equals(color)", color.equals(color));
- assertTrue("color.equals(sameColor)", color.equals(sameColor));
- assertTrue("color.equals(sameColor2)", color.equals(sameColor2));
- assertTrue("!color.equals(otherColor)", !color.equals(otherColor));
- } finally {
- color.dispose();
- sameColor.dispose();
- sameColor2.dispose();
- otherColor.dispose();
- }
-} - -public void test_getBlue() {
- // Test Color.getBlue()
- Color color = new Color(display, 1, 2, 4);
- try {
- assertEquals("color.getBlue() == 4", color.getBlue(), 4);
- } finally {
- color.dispose();
- }
-
-} - -public void test_getGreen() {
- // Test Color.getGreen()
- Color color = new Color(display, 1, 2, 4);
- try {
- assertEquals("color.getGreen() == 2", color.getGreen(), 2);
- } finally {
- color.dispose();
- }
-} - -public void test_getRed() {
- // Test Color.getRed()
- Color color = new Color(display, 1, 2, 4);
- try {
- assertEquals("color.getRed() == 1", color.getRed(), 1);
- } finally {
- color.dispose();
- }
-} - -public void test_getRGB() { - Color color = new Color(display, 12, 34, 56); - assertNotNull(color.getRGB()); - assertEquals(new RGB(12, 34, 56), color.getRGB()); -} - -public void test_hashCode() { - Color color = new Color(display, 12, 34, 56); - Color otherColor = new Color(display, 12, 34, 56); - if (color.equals(otherColor)) { - assertEquals("Hash codes of equal objects should be equal", color.hashCode(), otherColor.hashCode()); - } -} - -public void test_isDisposed() {
- // Test Color.isDisposed() false
- Color color = new Color(display, 34, 67, 98);
- try {
- assertTrue("Color should not be disposed", !color.isDisposed());
- } finally {
- // Test Color.isDisposed() true
- color.dispose();
- assertTrue("Color should be disposed", color.isDisposed());
- }
-} - -public void test_toString() { - Color color = new Color(display, 12, 34, 56); - assertNotNull(color.toString()); - assertTrue(color.toString().length() > 0); - assertEquals("Color {12, 34, 56}", color.toString()); -} - -public void test_win32_newLorg_eclipse_swt_graphics_DeviceI() { - // do not test - Windows platform only -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_Color((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceIII"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_RGB"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_getBlue"); - methodNames.addElement("test_getGreen"); - methodNames.addElement("test_getRed"); - methodNames.addElement("test_getRGB"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_isDisposed"); - methodNames.addElement("test_toString"); - methodNames.addElement("test_win32_newLorg_eclipse_swt_graphics_DeviceI"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceIII")) test_ConstructorLorg_eclipse_swt_graphics_DeviceIII(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_RGB")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_RGB(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_getBlue")) test_getBlue(); - else if (getName().equals("test_getGreen")) test_getGreen(); - else if (getName().equals("test_getRed")) test_getRed(); - else if (getName().equals("test_getRGB")) test_getRGB(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_isDisposed")) test_isDisposed(); - else if (getName().equals("test_toString")) test_toString(); - else if (getName().equals("test_win32_newLorg_eclipse_swt_graphics_DeviceI")) test_win32_newLorg_eclipse_swt_graphics_DeviceI(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Cursor.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Cursor.java deleted file mode 100644 index 72ed0f2661..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Cursor.java +++ /dev/null @@ -1,222 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.Cursor - * - * @see org.eclipse.swt.graphics.Cursor - */ -public class Test_org_eclipse_swt_graphics_Cursor extends SwtTestCase { - -Display display; - -public Test_org_eclipse_swt_graphics_Cursor(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- display = new Display();
-} - -protected void tearDown() {
- display.dispose();
-} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceI() {
- // Test new Cursor(Device device, int style)
- // IllegalArgumentException when an unknown style is specified
-
- Cursor cursor = new Cursor(display, SWT.CURSOR_ARROW);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_WAIT);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_CROSS);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_APPSTARTING);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_HELP);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZEALL);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZENESW);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZENS);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZENWSE);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZEWE);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZEN);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZES);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZEE);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZEW);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZENE);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZESE);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZESW);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_SIZENW);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_UPARROW);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_IBEAM);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_NO);
- cursor.dispose();
-
- cursor = new Cursor(display, SWT.CURSOR_HAND);
- cursor.dispose();
-
- // device == null (valid)
- cursor = new Cursor(null, SWT.CURSOR_ARROW);
- cursor.dispose();
-
- // illegal argument, style > SWT.CURSOR_HAND (21)
- try {
- cursor = new Cursor(display, 100);
- cursor.dispose();
- fail("No exception thrown for style > SWT.CURSOR_HAND (21)");
- } catch (IllegalArgumentException e) {
- }
-
- // illegal argument, style < 0
- try {
- cursor = new Cursor(display, -100);
- cursor.dispose();
- fail("No exception thrown for style < 0");
- } catch (IllegalArgumentException e) {
- }
-} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageDataII() { - // Test new Cursor(Device device, ImageData source, ImageData mask, int hotspotX, int hotspotY) - ImageLoader loader = new ImageLoader(); - ImageData source = loader.load(SwtTestCase.class.getResourceAsStream("dot.gif"))[0]; - ImageData mask = source.getTransparencyMask(); - Cursor cursor = new Cursor(display, source, mask, 0, 0); - cursor.dispose(); -} -public void test_dispose() { - // tested in test_isDisposed -} - -public void test_equalsLjava_lang_Object() {
- /* Note: Two cursors are only considered equal if their handles are equal.
- * So since Windows reuses cursor handles, and other platforms do not,
- * it does not make sense to test whether cursor.equals(sameCursor).
- */
- Cursor cursor = new Cursor(display, SWT.CURSOR_WAIT);
- Cursor otherCursor = new Cursor(display, SWT.CURSOR_CROSS);
- try {
- // Test Cursor.equals(Object)
- assertTrue("!cursor.equals((Object)null)", !cursor.equals((Object)null));
-
- // Test Cursor.equals(Cursor)
- assertTrue("!cursor.equals((Cursor)null)", !cursor.equals((Cursor)null));
- assertTrue("cursor.equals(cursor)", cursor.equals(cursor));
- assertTrue("!cursor.equals(otherCursor)", !cursor.equals(otherCursor));
- } finally {
- cursor.dispose();
- otherCursor.dispose();
- }
-} - -public void test_hashCode() { - warnUnimpl("Test test_hashCode not written"); -} - -public void test_isDisposed() {
- // Test Cursor.isDisposed() false
- Cursor cursor = new Cursor(display, SWT.CURSOR_WAIT);
- try {
- assertTrue("Cursor should not be disposed", !cursor.isDisposed());
- } finally {
- // Test Cursor.isDisposed() true
- cursor.dispose();
- assertTrue("Cursor should be disposed", cursor.isDisposed());
- }
-} - -public void test_toString() { - Cursor cursor = new Cursor(display, SWT.CURSOR_WAIT); - assertNotNull(cursor.toString()); - assertTrue(cursor.toString().length() > 0); -} - -public void test_win32_newLorg_eclipse_swt_graphics_DeviceI() { - // do not test - Windows only -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_Cursor((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageDataII"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_isDisposed"); - methodNames.addElement("test_toString"); - methodNames.addElement("test_win32_newLorg_eclipse_swt_graphics_DeviceI"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceI")) test_ConstructorLorg_eclipse_swt_graphics_DeviceI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageDataII")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageDataII(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_isDisposed")) test_isDisposed(); - else if (getName().equals("test_toString")) test_toString(); - else if (getName().equals("test_win32_newLorg_eclipse_swt_graphics_DeviceI")) test_win32_newLorg_eclipse_swt_graphics_DeviceI(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Device.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Device.java deleted file mode 100644 index 12e2e9c536..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Device.java +++ /dev/null @@ -1,158 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.Device - * - * @see org.eclipse.swt.graphics.Device - */ -public class Test_org_eclipse_swt_graphics_Device extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_Device(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceData() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceData not written"); -} - -public void test_checkDevice() { - warnUnimpl("Test test_checkDevice not written"); -} - -public void test_createLorg_eclipse_swt_graphics_DeviceData() { - warnUnimpl("Test test_createLorg_eclipse_swt_graphics_DeviceData not written"); -} - -public void test_destroy() { - warnUnimpl("Test test_destroy not written"); -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_getBounds() { - warnUnimpl("Test test_getBounds not written"); -} - -public void test_getDeviceData() { - warnUnimpl("Test test_getDeviceData not written"); -} - -public void test_getClientArea() { - warnUnimpl("Test test_getClientArea not written"); -} - -public void test_getDepth() { - warnUnimpl("Test test_getDepth not written"); -} - -public void test_getDPI() { - warnUnimpl("Test test_getDPI not written"); -} - -public void test_getFontListLjava_lang_StringZ() { - warnUnimpl("Test test_getFontListLjava_lang_StringZ not written"); -} - -public void test_getSystemColorI() { - warnUnimpl("Test test_getSystemColorI not written"); -} - -public void test_getSystemFont() { - warnUnimpl("Test test_getSystemFont not written"); -} - -public void test_getWarnings() { - warnUnimpl("Test test_getWarnings not written"); -} - -public void test_init() { - warnUnimpl("Test test_init not written"); -} - -public void test_internal_new_GCLorg_eclipse_swt_graphics_GCData() { - warnUnimpl("Test test_internal_new_GCLorg_eclipse_swt_graphics_GCData not written"); -} - -public void test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData() { - warnUnimpl("Test test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData not written"); -} - -public void test_isDisposed() { - warnUnimpl("Test test_isDisposed not written"); -} - -public void test_release() { - warnUnimpl("Test test_release not written"); -} - -public void test_setWarningsZ() { - warnUnimpl("Test test_setWarningsZ not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceData"); - methodNames.addElement("test_checkDevice"); - methodNames.addElement("test_createLorg_eclipse_swt_graphics_DeviceData"); - methodNames.addElement("test_destroy"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getDeviceData"); - methodNames.addElement("test_getClientArea"); - methodNames.addElement("test_getDepth"); - methodNames.addElement("test_getDPI"); - methodNames.addElement("test_getFontListLjava_lang_StringZ"); - methodNames.addElement("test_getSystemColorI"); - methodNames.addElement("test_getSystemFont"); - methodNames.addElement("test_getWarnings"); - methodNames.addElement("test_init"); - methodNames.addElement("test_internal_new_GCLorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_isDisposed"); - methodNames.addElement("test_release"); - methodNames.addElement("test_setWarningsZ"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceData")) test_ConstructorLorg_eclipse_swt_graphics_DeviceData(); - else if (getName().equals("test_checkDevice")) test_checkDevice(); - else if (getName().equals("test_createLorg_eclipse_swt_graphics_DeviceData")) test_createLorg_eclipse_swt_graphics_DeviceData(); - else if (getName().equals("test_destroy")) test_destroy(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getDeviceData")) test_getDeviceData(); - else if (getName().equals("test_getClientArea")) test_getClientArea(); - else if (getName().equals("test_getDepth")) test_getDepth(); - else if (getName().equals("test_getDPI")) test_getDPI(); - else if (getName().equals("test_getFontListLjava_lang_StringZ")) test_getFontListLjava_lang_StringZ(); - else if (getName().equals("test_getSystemColorI")) test_getSystemColorI(); - else if (getName().equals("test_getSystemFont")) test_getSystemFont(); - else if (getName().equals("test_getWarnings")) test_getWarnings(); - else if (getName().equals("test_init")) test_init(); - else if (getName().equals("test_internal_new_GCLorg_eclipse_swt_graphics_GCData")) test_internal_new_GCLorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData")) test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_isDisposed")) test_isDisposed(); - else if (getName().equals("test_release")) test_release(); - else if (getName().equals("test_setWarningsZ")) test_setWarningsZ(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_DeviceData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_DeviceData.java deleted file mode 100644 index 2b5c394dad..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_DeviceData.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.DeviceData - * - * @see org.eclipse.swt.graphics.DeviceData - */ -public class Test_org_eclipse_swt_graphics_DeviceData extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_DeviceData(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - DeviceData data = new DeviceData(); - data.debug = true; - data.tracking = true; -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_DeviceData((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Drawable.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Drawable.java deleted file mode 100644 index a04c4ae9cb..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Drawable.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.Drawable - * - * @see org.eclipse.swt.graphics.Drawable - */ -public class Test_org_eclipse_swt_graphics_Drawable extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_Drawable(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_internal_new_GCLorg_eclipse_swt_graphics_GCData() { - warnUnimpl("Test test_internal_new_GCLorg_eclipse_swt_graphics_GCData not written"); -} - -public void test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData() { - warnUnimpl("Test test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_internal_new_GCLorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_internal_new_GCLorg_eclipse_swt_graphics_GCData")) test_internal_new_GCLorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData")) test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Font.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Font.java deleted file mode 100644 index 0c9f504405..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Font.java +++ /dev/null @@ -1,304 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.Font - * - * @see org.eclipse.swt.graphics.Font - */ -public class Test_org_eclipse_swt_graphics_Font extends SwtTestCase { - -Display display; - -public Test_org_eclipse_swt_graphics_Font(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- display = new Display();
-} - -protected void tearDown() {
- display.dispose();
-} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_FontData() {
- // Test new Font(Device device, FontData fd)
- // IllegalArgumentException if the fd argument is null
- // SWTError: ERROR_NO_HANDLES, if a font could not be created from the given font data
-
- // valid font with no name (strange, but apparently valid)
- Font font = new Font(display, new FontData("", 10, SWT.NORMAL));
- font.dispose();
-
- // valid font with unknown name (strange, but apparently valid)
- font = new Font(display, new FontData("bad-font", 10, SWT.NORMAL));
- font.dispose();
-
- // valid font with 0 height (strange, but apparently valid)
- font = new Font(display, new FontData(SwtJunit.testFontName, 0, SWT.NORMAL));
- font.dispose();
-
- // valid normal 1000-point font (pretty big, but apparently valid)
- font = new Font(display, new FontData(SwtJunit.testFontName, 1000, SWT.NORMAL));
- font.dispose();
-
- // valid normal 10-point font
- font = new Font(display, new FontData(SwtJunit.testFontName, 10, SWT.NORMAL));
- font.dispose();
-
- // valid bold 10-point font
- font = new Font(display, new FontData(SwtJunit.testFontName, 10, SWT.BOLD));
- font.dispose();
-
- // valid italic 10-point font
- font = new Font(display, new FontData(SwtJunit.testFontName, 10, SWT.ITALIC));
- font.dispose();
-
- // valid bold italic 10-point font
- font = new Font(display, new FontData(SwtJunit.testFontName, 10, SWT.BOLD | SWT.ITALIC));
- font.dispose();
-
- // illegal argument, fontData == null
- try {
- font = new Font(display, null);
- font.dispose();
- fail("No exception thrown for fontData == null");
- } catch (IllegalArgumentException e) {
- }
-
- // illegal argument, name == null
- try {
- font = new Font(display, new FontData(null, 10, SWT.NORMAL));
- font.dispose();
- fail("No exception thrown for name == null");
- } catch (IllegalArgumentException e) {
- }
-
- // illegal argument, height < 0
- try {
- font = new Font(display, new FontData(SwtJunit.testFontName, -10, SWT.NORMAL));
- font.dispose();
- fail("No exception thrown for height < 0");
- } catch (IllegalArgumentException e) {
- }
-} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_StringII() {
- // Test new Font(Device device, String name, int height, int style)
- // IllegalArgumentException if the name argument is null or the height is negative
- // SWTError: ERROR_NO_HANDLES, if a font could not be created from the given arguments
-
- // valid font with no name (strange, but apparently valid)
- Font font = new Font(display, "", 10, SWT.NORMAL);
- font.dispose();
-
- // valid font with unknown name (strange, but apparently valid)
- font = new Font(display, "bad-font", 10, SWT.NORMAL);
- font.dispose();
-
- // valid font with 0 height (strange, but apparently valid)
- font = new Font(display, SwtJunit.testFontName, 0, SWT.NORMAL);
- font.dispose();
-
- // valid normal 1000-point font (pretty big, but apparently valid)
- font = new Font(display, SwtJunit.testFontName, 1000, SWT.NORMAL);
- font.dispose();
-
- // valid normal 10-point font
- font = new Font(display, SwtJunit.testFontName, 10, SWT.NORMAL);
- font.dispose();
-
- // valid bold 10-point font
- font = new Font(display, SwtJunit.testFontName, 10, SWT.BOLD);
- font.dispose();
-
- // valid italic 10-point font
- font = new Font(display, SwtJunit.testFontName, 10, SWT.ITALIC);
- font.dispose();
-
- // valid bold italic 10-point font
- font = new Font(display, SwtJunit.testFontName, 10, SWT.BOLD | SWT.ITALIC);
- font.dispose();
-
- // device == null (valid)
- font = new Font(null, SwtJunit.testFontName, 10, SWT.NORMAL);
- font.dispose();
-
- // illegal argument, name == null
- try {
- font = new Font(display, null, 10, SWT.NORMAL);
- font.dispose();
- fail("No exception thrown for name == null");
- } catch (IllegalArgumentException e) {
- }
-
- // illegal argument, height < 0
- try {
- font = new Font(display, SwtJunit.testFontName, -10, SWT.NORMAL);
- font.dispose();
- fail("No exception thrown for height < 0");
- } catch (IllegalArgumentException e) {
- }
-} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_equalsLjava_lang_Object() {
- // Fonts are only equal if their handles are the same (?!)
- Font font = new Font(display, SwtJunit.testFontName, 10, SWT.NORMAL);
- Font otherFont = new Font(display, SwtJunit.testFontName, 20, SWT.NORMAL);
- try {
- // Test Font.equals(Object)
- assertTrue("!font.equals((Object)null)", !font.equals((Object)null));
-
- // Test Font.equals(Font)
- assertTrue("!font.equals((Font)null)", !font.equals((Font)null));
- assertTrue("font.equals(font)", font.equals(font));
- assertTrue("!font.equals(otherFont)", !font.equals(otherFont));
- } finally {
- font.dispose();
- otherFont.dispose();
- }
-} - -public void test_getFontData() {
- // Test Font.getFontData()
- // valid normal 10-point font
- Font font = new Font(display, SwtJunit.testFontName, 10, SWT.NORMAL);
- try {
- FontData fontData[] = font.getFontData();
- assertTrue("No font data", fontData != null && fontData.length > 0);
- assertEquals("Wrong font name", SwtJunit.testFontName, fontData[0].getName());
- assertEquals("Wrong font height", 10, fontData[0].getHeight());
- assertEquals("Wrong font style", SWT.NORMAL, fontData[0].getStyle());
- } finally {
- font.dispose();
- }
-
- // valid bold 20-point font
- font = new Font(display, SwtJunit.testFontName, 20, SWT.BOLD);
- try {
- FontData fontData[] = font.getFontData();
- assertTrue("No font data", fontData != null && fontData.length > 0);
- assertEquals("Wrong font name", SwtJunit.testFontName, fontData[0].getName());
- assertEquals("Wrong font height", 20, fontData[0].getHeight());
- assertEquals("Wrong font style", SWT.BOLD, fontData[0].getStyle());
- } finally {
- font.dispose();
- }
-
- // valid italic 30-point font
- font = new Font(display, SwtJunit.testFontName, 30, SWT.ITALIC);
- try {
- FontData fontData[] = font.getFontData();
- assertTrue("No font data", fontData != null && fontData.length > 0);
-// assertEquals("Wrong font name", SwtJunit.testFontName, fontData[0].getName());
- assertEquals("Wrong font height", 30, fontData[0].getHeight());
- assertEquals("Wrong font style", SWT.ITALIC, fontData[0].getStyle());
- } finally {
- font.dispose();
- }
-
- // valid bold italic 40-point font
- font = new Font(display, SwtJunit.testFontName, 40, SWT.BOLD | SWT.ITALIC);
- try {
- FontData fontData[] = font.getFontData();
- font.dispose();
- assertTrue("No font data", fontData != null && fontData.length > 0);
-// assertEquals("Wrong font name", SwtJunit.testFontName, fontData[0].getName());
- assertEquals("Wrong font height", 40, fontData[0].getHeight());
- assertEquals("Wrong font style", SWT.BOLD | SWT.ITALIC, fontData[0].getStyle());
- } finally {
- font.dispose();
- }
-
- // valid 10-point font with unknown name
- font = new Font(display, "bad-font", 10, SWT.NORMAL);
- try {
- FontData fontData[] = font.getFontData();
- assertTrue("No font data", fontData != null && fontData.length > 0);
-// assertEquals("Wrong font name", "bad-font", fontData[0].getName());
- assertEquals("Wrong font height", 10, fontData[0].getHeight());
- assertEquals("Wrong font style", SWT.NORMAL, fontData[0].getStyle());
- } finally {
- font.dispose();
- }
-} - -public void test_hashCode() { - warnUnimpl("Test test_hashCode not written"); -} - -public void test_isDisposed() {
- // Test Font.isDisposed() false
- Font font = new Font(display, SwtJunit.testFontName, 10, SWT.NORMAL);
- try {
- assertTrue("Font should not be disposed", !font.isDisposed());
- } finally {
- // Test Font.isDisposed() true
- font.dispose();
- assertTrue("Font should be disposed", font.isDisposed());
- }
-} - -public void test_toString() { - warnUnimpl("Test test_toString not written"); -} - -public void test_win32_newLorg_eclipse_swt_graphics_DeviceI() { - // do not test - Windows only -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_Font((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_FontData"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_StringII"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_getFontData"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_isDisposed"); - methodNames.addElement("test_toString"); - methodNames.addElement("test_win32_newLorg_eclipse_swt_graphics_DeviceI"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_FontData")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_FontData(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_StringII")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_StringII(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_getFontData")) test_getFontData(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_isDisposed")) test_isDisposed(); - else if (getName().equals("test_toString")) test_toString(); - else if (getName().equals("test_win32_newLorg_eclipse_swt_graphics_DeviceI")) test_win32_newLorg_eclipse_swt_graphics_DeviceI(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontData.java deleted file mode 100644 index 2788ec22df..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontData.java +++ /dev/null @@ -1,251 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.FontData - * - * @see org.eclipse.swt.graphics.FontData - */ -public class Test_org_eclipse_swt_graphics_FontData extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_FontData(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - // Test new FontData() - FontData fd = new FontData(); -} - -public void test_ConstructorLjava_lang_String() { - // Test new FontData(String string) - FontData fd = new FontData(SwtJunit.testFontName, 10, SWT.NORMAL); - FontData reconstructedFontData = new FontData(fd.toString()); - assertEquals(fd, reconstructedFontData); -} - -public void test_ConstructorLjava_lang_StringII() {
- // Test new FontData(String name, int height, int style)
- // valid font data with no name (strange, but apparently valid)
- FontData fd = new FontData("", 10, SWT.NORMAL);
-
- // valid font data with unknown name (strange, but apparently valid)
- fd = new FontData("bad-font", 10, SWT.NORMAL);
-
- // valid font data with 0 height (strange, but apparently valid)
- fd = new FontData(SwtJunit.testFontName, 0, SWT.NORMAL);
-
- // valid font data with 1000 height (pretty big, but apparently valid)
- fd = new FontData(SwtJunit.testFontName, 1000, SWT.NORMAL);
-
- // valid normal 10-point font data
- fd = new FontData(SwtJunit.testFontName, 10, SWT.NORMAL);
-
- // valid bold 10-point font data
- fd = new FontData(SwtJunit.testFontName, 10, SWT.BOLD);
-
- // valid italic 10-point font data
- fd = new FontData(SwtJunit.testFontName, 10, SWT.ITALIC);
-
- // valid bold italic 10-point font data
- fd = new FontData(SwtJunit.testFontName, 10, SWT.BOLD | SWT.ITALIC);
-
- // illegal argument, name == null
- try {
- fd = new FontData(null, 10, SWT.NORMAL);
- fail("No exception thrown for name == null");
- } catch (IllegalArgumentException e) {
- }
-
- // illegal argument, height < 0
- try {
- fd = new FontData(SwtJunit.testFontName, -10, SWT.NORMAL);
- fail("No exception thrown for height < 0");
- } catch (IllegalArgumentException e) {
- }
-} - -public void test_equalsLjava_lang_Object() { - warnUnimpl("Test test_equalsLjava_lang_Object not written"); -} - -public void test_getHeight() {
- // Font.getHeight() tested in test_setHeightI
-} - -public void test_getName() {
- // Font.getName() tested in test_setNameLjava_lang_String
-} - -public void test_getStyle() {
- // Font.getStyle() tested in test_setStyleI
-} - -public void test_hashCode() { - warnUnimpl("Test test_hashCode not written"); -} - -public void test_setHeightI() {
- // Test Font.setHeight(int height)
- // valid normal font data for various heights
- FontData fontData = new FontData(SwtJunit.testFontName, 10, SWT.NORMAL);
- for (int height = 0; height < 1000; height++) {
- fontData.setHeight(height);
- assertEquals("Wrong height", fontData.getHeight(), height);
- }
-
- // valid bold font data for various heights
- fontData = new FontData(SwtJunit.testFontName, 10, SWT.BOLD);
- for (int height = 0; height < 1000; height++) {
- fontData.setHeight(height);
- assertEquals("Wrong height", fontData.getHeight(), height);
- }
-
- // valid italic font data for various heights
- fontData = new FontData(SwtJunit.testFontName, 10, SWT.ITALIC);
- for (int height = 0; height < 1000; height++) {
- fontData.setHeight(height);
- assertEquals("Wrong height", fontData.getHeight(), height);
- }
-
- // valid bold italic font data for various heights
- fontData = new FontData(SwtJunit.testFontName, 10, SWT.BOLD | SWT.ITALIC);
- for (int height = 0; height < 1000; height++) {
- fontData.setHeight(height);
- assertEquals("Wrong height", fontData.getHeight(), height);
- }
-} - -public void test_setLocaleLjava_lang_String() { - warnUnimpl("Test test_setLocaleLjava_lang_String not written"); -} - -public void test_setNameLjava_lang_String() {
- // Test Font.setName(String name)
- // valid name
- FontData fontData = new FontData(SwtJunit.testFontName, 10, SWT.NORMAL);
- assertEquals("Wrong name", fontData.getName(), SwtJunit.testFontName);
-
- // valid name (unknown name, but valid)
- fontData.setName("bad-font");
- assertEquals("Wrong name", fontData.getName(), "bad-font");
-
- // valid name (empty string, but valid) - // only on windows since motif supports separate font foundries - if (SwtJunit.isWindows) {
- fontData.setName(""); - assertEquals("Wrong name", fontData.getName(), ""); - } -
- // valid name
- fontData.setName(SwtJunit.testFontName);
- assertEquals("Wrong name", fontData.getName(), SwtJunit.testFontName);
-System.out.println(4);
- // illegal argument, name == null
- try {
- fontData.setName(null);
- fail("No exception thrown for name == null");
- } catch (IllegalArgumentException e) {
- } -System.out.println(5);
-} - -public void test_setStyleI() {
- // Test Font.setStyle(int style)
- for (int height = 0; height < 1000; height++) {
- // valid normal font data
- FontData fontData = new FontData(SwtJunit.testFontName, height, SWT.NORMAL);
- assertEquals("Wrong style", fontData.getStyle(), SWT.NORMAL);
-
- // valid bold font data
- fontData.setStyle(SWT.BOLD);
- assertEquals("Wrong style", fontData.getStyle(), SWT.BOLD);
-
- // valid italic font data
- fontData.setStyle(SWT.ITALIC);
- assertEquals("Wrong style", fontData.getStyle(), SWT.ITALIC);
-
- // valid bold italic font data
- fontData.setStyle(SWT.ITALIC | SWT.BOLD);
- assertEquals("Wrong style", fontData.getStyle(), SWT.BOLD | SWT.ITALIC);
-
- // valid normal font data
- fontData.setStyle(SWT.NORMAL);
- assertEquals("Wrong style", fontData.getStyle(), SWT.NORMAL);
- }
-} - -public void test_toString() { - warnUnimpl("Test test_toString not written"); -} - -public void test_win32_newLorg_eclipse_swt_internal_win32_LOGFONTI() { - // do not test - Windows only -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_FontData((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorLjava_lang_String"); - methodNames.addElement("test_ConstructorLjava_lang_StringII"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_getHeight"); - methodNames.addElement("test_getName"); - methodNames.addElement("test_getStyle"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_setHeightI"); - methodNames.addElement("test_setLocaleLjava_lang_String"); - methodNames.addElement("test_setNameLjava_lang_String"); - methodNames.addElement("test_setStyleI"); - methodNames.addElement("test_toString"); - methodNames.addElement("test_win32_newLorg_eclipse_swt_internal_win32_LOGFONTI"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorLjava_lang_String")) test_ConstructorLjava_lang_String(); - else if (getName().equals("test_ConstructorLjava_lang_StringII")) test_ConstructorLjava_lang_StringII(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_getHeight")) test_getHeight(); - else if (getName().equals("test_getName")) test_getName(); - else if (getName().equals("test_getStyle")) test_getStyle(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_setHeightI")) test_setHeightI(); - else if (getName().equals("test_setLocaleLjava_lang_String")) test_setLocaleLjava_lang_String(); - else if (getName().equals("test_setNameLjava_lang_String")) test_setNameLjava_lang_String(); - else if (getName().equals("test_setStyleI")) test_setStyleI(); - else if (getName().equals("test_toString")) test_toString(); - else if (getName().equals("test_win32_newLorg_eclipse_swt_internal_win32_LOGFONTI")) test_win32_newLorg_eclipse_swt_internal_win32_LOGFONTI(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontMetrics.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontMetrics.java deleted file mode 100644 index fef2e7e75c..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontMetrics.java +++ /dev/null @@ -1,121 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.FontMetrics - * - * @see org.eclipse.swt.graphics.FontMetrics - */ -public class Test_org_eclipse_swt_graphics_FontMetrics extends SwtTestCase { - - Display display; - Shell shell; - GC gc; - -public Test_org_eclipse_swt_graphics_FontMetrics(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - display = new Display(); - shell = new Shell(display); - gc = new GC(shell); -} - -protected void tearDown() { - gc.dispose(); - shell.dispose(); - display.dispose(); -} - -public void test_equalsLjava_lang_Object() { - FontMetrics fm1 = gc.getFontMetrics(); - FontMetrics fm2 = gc.getFontMetrics(); - assertTrue(fm1.equals(fm2)); -} - -public void test_getAscent() { - FontMetrics fm = gc.getFontMetrics(); - fm.getAscent(); -} - -public void test_getAverageCharWidth() { - FontMetrics fm = gc.getFontMetrics(); - fm.getAverageCharWidth(); -} - -public void test_getDescent() { - FontMetrics fm = gc.getFontMetrics(); - fm.getDescent(); -} - -public void test_getHeight() { - FontMetrics fm = gc.getFontMetrics(); - fm.getHeight(); -} - -public void test_getLeading() { - FontMetrics fm = gc.getFontMetrics(); - fm.getLeading(); -} - -public void test_hashCode() { - FontMetrics fm1 = gc.getFontMetrics(); - FontMetrics fm2 = gc.getFontMetrics(); - if (fm1.equals(fm2)) { - assertEquals(fm1.hashCode(), fm2.hashCode()); - } -} - -public void test_win32_newLorg_eclipse_swt_internal_win32_TEXTMETRIC() { - // do not test - Windows only -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_FontMetrics((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_getAscent"); - methodNames.addElement("test_getAverageCharWidth"); - methodNames.addElement("test_getDescent"); - methodNames.addElement("test_getHeight"); - methodNames.addElement("test_getLeading"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_win32_newLorg_eclipse_swt_internal_win32_TEXTMETRIC"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_getAscent")) test_getAscent(); - else if (getName().equals("test_getAverageCharWidth")) test_getAverageCharWidth(); - else if (getName().equals("test_getDescent")) test_getDescent(); - else if (getName().equals("test_getHeight")) test_getHeight(); - else if (getName().equals("test_getLeading")) test_getLeading(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_win32_newLorg_eclipse_swt_internal_win32_TEXTMETRIC")) test_win32_newLorg_eclipse_swt_internal_win32_TEXTMETRIC(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java deleted file mode 100644 index 22ed6aeb63..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java +++ /dev/null @@ -1,380 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.GC - * - * @see org.eclipse.swt.graphics.GC - */ -public class Test_org_eclipse_swt_graphics_GC extends SwtTestCase { - -Display display; - -public Test_org_eclipse_swt_graphics_GC(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- display = new Display();
-} - -protected void tearDown() {
- display.dispose();
-} - -public void test_ConstructorLorg_eclipse_swt_graphics_Drawable() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_Drawable not written"); -} - -public void test_copyAreaLorg_eclipse_swt_graphics_ImageII() { - warnUnimpl("Test test_copyAreaLorg_eclipse_swt_graphics_ImageII not written"); -} - -public void test_copyAreaIIIIII() { - warnUnimpl("Test test_copyAreaIIIIII not written"); -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_drawArcIIIIII() { - warnUnimpl("Test test_drawArcIIIIII not written"); -} - -public void test_drawFocusIIII() { - warnUnimpl("Test test_drawFocusIIII not written"); -} - -public void test_drawImageLorg_eclipse_swt_graphics_ImageII() { - warnUnimpl("Test test_drawImageLorg_eclipse_swt_graphics_ImageII not written"); -} - -public void test_drawImageLorg_eclipse_swt_graphics_ImageIIIIIIII() { - warnUnimpl("Test test_drawImageLorg_eclipse_swt_graphics_ImageIIIIIIII not written"); -} - -public void test_drawLineIIII() { - warnUnimpl("Test test_drawLineIIII not written"); -} - -public void test_drawOvalIIII() { - warnUnimpl("Test test_drawOvalIIII not written"); -} - -public void test_drawPolygon$I() { - warnUnimpl("Test test_drawPolygon$I not written"); -} - -public void test_drawPolyline$I() { - warnUnimpl("Test test_drawPolyline$I not written"); -} - -public void test_drawRectangleIIII() { - warnUnimpl("Test test_drawRectangleIIII not written"); -} - -public void test_drawRectangleLorg_eclipse_swt_graphics_Rectangle() { - warnUnimpl("Test test_drawRectangleLorg_eclipse_swt_graphics_Rectangle not written"); -} - -public void test_drawRoundRectangleIIIIII() { - warnUnimpl("Test test_drawRoundRectangleIIIIII not written"); -} - -public void test_drawStringLjava_lang_StringII() { - warnUnimpl("Test test_drawStringLjava_lang_StringII not written"); -} - -public void test_drawStringLjava_lang_StringIIZ() { - warnUnimpl("Test test_drawStringLjava_lang_StringIIZ not written"); -} - -public void test_drawTextLjava_lang_StringII() { - warnUnimpl("Test test_drawTextLjava_lang_StringII not written"); -} - -public void test_drawTextLjava_lang_StringIIZ() { - warnUnimpl("Test test_drawTextLjava_lang_StringIIZ not written"); -} - -public void test_equalsLjava_lang_Object() { - warnUnimpl("Test test_equalsLjava_lang_Object not written"); -} - -public void test_fillArcIIIIII() { - warnUnimpl("Test test_fillArcIIIIII not written"); -} - -public void test_fillGradientRectangleIIIIZ() { - warnUnimpl("Test test_fillGradientRectangleIIIIZ not written"); -} - -public void test_fillOvalIIII() { - warnUnimpl("Test test_fillOvalIIII not written"); -} - -public void test_fillPolygon$I() { - warnUnimpl("Test test_fillPolygon$I not written"); -} - -public void test_fillRectangleIIII() { - warnUnimpl("Test test_fillRectangleIIII not written"); -} - -public void test_fillRectangleLorg_eclipse_swt_graphics_Rectangle() { - warnUnimpl("Test test_fillRectangleLorg_eclipse_swt_graphics_Rectangle not written"); -} - -public void test_fillRoundRectangleIIIIII() { - warnUnimpl("Test test_fillRoundRectangleIIIIII not written"); -} - -public void test_getAdvanceWidthC() { - warnUnimpl("Test test_getAdvanceWidthC not written"); -} - -public void test_getBackground() { - warnUnimpl("Test test_getBackground not written"); -} - -public void test_getCharWidthC() { - warnUnimpl("Test test_getCharWidthC not written"); -} - -public void test_getClipping() { - warnUnimpl("Test test_getClipping not written"); -} - -public void test_getClippingLorg_eclipse_swt_graphics_Region() { - warnUnimpl("Test test_getClippingLorg_eclipse_swt_graphics_Region not written"); -} - -public void test_getFont() { - warnUnimpl("Test test_getFont not written"); -} - -public void test_getFontMetrics() { - warnUnimpl("Test test_getFontMetrics not written"); -} - -public void test_getForeground() { - warnUnimpl("Test test_getForeground not written"); -} - -public void test_getLineStyle() { - warnUnimpl("Test test_getLineStyle not written"); -} - -public void test_getLineWidth() { - warnUnimpl("Test test_getLineWidth not written"); -} - -public void test_getXORMode() { - warnUnimpl("Test test_getXORMode not written"); -} - -public void test_hashCode() { - warnUnimpl("Test test_hashCode not written"); -} - -public void test_isClipped() { - warnUnimpl("Test test_isClipped not written"); -} - -public void test_isDisposed() { - warnUnimpl("Test test_isDisposed not written"); -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setBackgroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setClippingIIII() { - warnUnimpl("Test test_setClippingIIII not written"); -} - -public void test_setClippingLorg_eclipse_swt_graphics_Rectangle() { - warnUnimpl("Test test_setClippingLorg_eclipse_swt_graphics_Rectangle not written"); -} - -public void test_setClippingLorg_eclipse_swt_graphics_Region() { - warnUnimpl("Test test_setClippingLorg_eclipse_swt_graphics_Region not written"); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written"); -} - -public void test_setForegroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setForegroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setLineStyleI() { - warnUnimpl("Test test_setLineStyleI not written"); -} - -public void test_setLineWidthI() { - warnUnimpl("Test test_setLineWidthI not written"); -} - -public void test_setXORModeZ() { - warnUnimpl("Test test_setXORModeZ not written"); -} - -public void test_stringExtentLjava_lang_String() { - warnUnimpl("Test test_stringExtentLjava_lang_String not written"); -} - -public void test_textExtentLjava_lang_String() { - warnUnimpl("Test test_textExtentLjava_lang_String not written"); -} - -public void test_toString() { - warnUnimpl("Test test_toString not written"); -} - -public void test_win32_newLorg_eclipse_swt_graphics_DrawableLorg_eclipse_swt_graphics_GCData() { - // do not test - Windows only -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_GC((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_Drawable"); - methodNames.addElement("test_copyAreaLorg_eclipse_swt_graphics_ImageII"); - methodNames.addElement("test_copyAreaIIIIII"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_drawArcIIIIII"); - methodNames.addElement("test_drawFocusIIII"); - methodNames.addElement("test_drawImageLorg_eclipse_swt_graphics_ImageII"); - methodNames.addElement("test_drawImageLorg_eclipse_swt_graphics_ImageIIIIIIII"); - methodNames.addElement("test_drawLineIIII"); - methodNames.addElement("test_drawOvalIIII"); - methodNames.addElement("test_drawPolygon$I"); - methodNames.addElement("test_drawPolyline$I"); - methodNames.addElement("test_drawRectangleIIII"); - methodNames.addElement("test_drawRectangleLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_drawRoundRectangleIIIIII"); - methodNames.addElement("test_drawStringLjava_lang_StringII"); - methodNames.addElement("test_drawStringLjava_lang_StringIIZ"); - methodNames.addElement("test_drawTextLjava_lang_StringII"); - methodNames.addElement("test_drawTextLjava_lang_StringIIZ"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_fillArcIIIIII"); - methodNames.addElement("test_fillGradientRectangleIIIIZ"); - methodNames.addElement("test_fillOvalIIII"); - methodNames.addElement("test_fillPolygon$I"); - methodNames.addElement("test_fillRectangleIIII"); - methodNames.addElement("test_fillRectangleLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_fillRoundRectangleIIIIII"); - methodNames.addElement("test_getAdvanceWidthC"); - methodNames.addElement("test_getBackground"); - methodNames.addElement("test_getCharWidthC"); - methodNames.addElement("test_getClipping"); - methodNames.addElement("test_getClippingLorg_eclipse_swt_graphics_Region"); - methodNames.addElement("test_getFont"); - methodNames.addElement("test_getFontMetrics"); - methodNames.addElement("test_getForeground"); - methodNames.addElement("test_getLineStyle"); - methodNames.addElement("test_getLineWidth"); - methodNames.addElement("test_getXORMode"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_isClipped"); - methodNames.addElement("test_isDisposed"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setClippingIIII"); - methodNames.addElement("test_setClippingLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_setClippingLorg_eclipse_swt_graphics_Region"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setForegroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setLineStyleI"); - methodNames.addElement("test_setLineWidthI"); - methodNames.addElement("test_setXORModeZ"); - methodNames.addElement("test_stringExtentLjava_lang_String"); - methodNames.addElement("test_textExtentLjava_lang_String"); - methodNames.addElement("test_toString"); - methodNames.addElement("test_win32_newLorg_eclipse_swt_graphics_DrawableLorg_eclipse_swt_graphics_GCData"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_Drawable")) test_ConstructorLorg_eclipse_swt_graphics_Drawable(); - else if (getName().equals("test_copyAreaLorg_eclipse_swt_graphics_ImageII")) test_copyAreaLorg_eclipse_swt_graphics_ImageII(); - else if (getName().equals("test_copyAreaIIIIII")) test_copyAreaIIIIII(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_drawArcIIIIII")) test_drawArcIIIIII(); - else if (getName().equals("test_drawFocusIIII")) test_drawFocusIIII(); - else if (getName().equals("test_drawImageLorg_eclipse_swt_graphics_ImageII")) test_drawImageLorg_eclipse_swt_graphics_ImageII(); - else if (getName().equals("test_drawImageLorg_eclipse_swt_graphics_ImageIIIIIIII")) test_drawImageLorg_eclipse_swt_graphics_ImageIIIIIIII(); - else if (getName().equals("test_drawLineIIII")) test_drawLineIIII(); - else if (getName().equals("test_drawOvalIIII")) test_drawOvalIIII(); - else if (getName().equals("test_drawPolygon$I")) test_drawPolygon$I(); - else if (getName().equals("test_drawPolyline$I")) test_drawPolyline$I(); - else if (getName().equals("test_drawRectangleIIII")) test_drawRectangleIIII(); - else if (getName().equals("test_drawRectangleLorg_eclipse_swt_graphics_Rectangle")) test_drawRectangleLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_drawRoundRectangleIIIIII")) test_drawRoundRectangleIIIIII(); - else if (getName().equals("test_drawStringLjava_lang_StringII")) test_drawStringLjava_lang_StringII(); - else if (getName().equals("test_drawStringLjava_lang_StringIIZ")) test_drawStringLjava_lang_StringIIZ(); - else if (getName().equals("test_drawTextLjava_lang_StringII")) test_drawTextLjava_lang_StringII(); - else if (getName().equals("test_drawTextLjava_lang_StringIIZ")) test_drawTextLjava_lang_StringIIZ(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_fillArcIIIIII")) test_fillArcIIIIII(); - else if (getName().equals("test_fillGradientRectangleIIIIZ")) test_fillGradientRectangleIIIIZ(); - else if (getName().equals("test_fillOvalIIII")) test_fillOvalIIII(); - else if (getName().equals("test_fillPolygon$I")) test_fillPolygon$I(); - else if (getName().equals("test_fillRectangleIIII")) test_fillRectangleIIII(); - else if (getName().equals("test_fillRectangleLorg_eclipse_swt_graphics_Rectangle")) test_fillRectangleLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_fillRoundRectangleIIIIII")) test_fillRoundRectangleIIIIII(); - else if (getName().equals("test_getAdvanceWidthC")) test_getAdvanceWidthC(); - else if (getName().equals("test_getBackground")) test_getBackground(); - else if (getName().equals("test_getCharWidthC")) test_getCharWidthC(); - else if (getName().equals("test_getClipping")) test_getClipping(); - else if (getName().equals("test_getClippingLorg_eclipse_swt_graphics_Region")) test_getClippingLorg_eclipse_swt_graphics_Region(); - else if (getName().equals("test_getFont")) test_getFont(); - else if (getName().equals("test_getFontMetrics")) test_getFontMetrics(); - else if (getName().equals("test_getForeground")) test_getForeground(); - else if (getName().equals("test_getLineStyle")) test_getLineStyle(); - else if (getName().equals("test_getLineWidth")) test_getLineWidth(); - else if (getName().equals("test_getXORMode")) test_getXORMode(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_isClipped")) test_isClipped(); - else if (getName().equals("test_isDisposed")) test_isDisposed(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setClippingIIII")) test_setClippingIIII(); - else if (getName().equals("test_setClippingLorg_eclipse_swt_graphics_Rectangle")) test_setClippingLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_setClippingLorg_eclipse_swt_graphics_Region")) test_setClippingLorg_eclipse_swt_graphics_Region(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setForegroundLorg_eclipse_swt_graphics_Color")) test_setForegroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setLineStyleI")) test_setLineStyleI(); - else if (getName().equals("test_setLineWidthI")) test_setLineWidthI(); - else if (getName().equals("test_setXORModeZ")) test_setXORModeZ(); - else if (getName().equals("test_stringExtentLjava_lang_String")) test_stringExtentLjava_lang_String(); - else if (getName().equals("test_textExtentLjava_lang_String")) test_textExtentLjava_lang_String(); - else if (getName().equals("test_toString")) test_toString(); - else if (getName().equals("test_win32_newLorg_eclipse_swt_graphics_DrawableLorg_eclipse_swt_graphics_GCData")) test_win32_newLorg_eclipse_swt_graphics_DrawableLorg_eclipse_swt_graphics_GCData(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GCData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GCData.java deleted file mode 100644 index 432a5e7d20..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GCData.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.GCData - * - * @see org.eclipse.swt.graphics.GCData - */ -public class Test_org_eclipse_swt_graphics_GCData extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_GCData(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_GCData((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java deleted file mode 100644 index 360b693468..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java +++ /dev/null @@ -1,177 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.Image - * - * @see org.eclipse.swt.graphics.Image - */ -public class Test_org_eclipse_swt_graphics_Image extends SwtTestCase { - -Display display; - -public Test_org_eclipse_swt_graphics_Image(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- display = new Display();
-} - -protected void tearDown() {
- display.dispose();
-} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceII() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceII not written"); -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageI not written"); -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_Rectangle() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_Rectangle not written"); -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageData() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageData not written"); -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageData() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageData not written"); -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_io_InputStream() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_io_InputStream not written"); -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_String() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_String not written"); -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_equalsLjava_lang_Object() { - warnUnimpl("Test test_equalsLjava_lang_Object not written"); -} - -public void test_getBackground() { - warnUnimpl("Test test_getBackground not written"); -} - -public void test_getBounds() { - warnUnimpl("Test test_getBounds not written"); -} - -public void test_getImageData() { - ImageLoader loader = new ImageLoader(); - ImageData data1 = loader.load(SwtTestCase.class.getResourceAsStream("dot.gif"))[0]; - - Image image = new Image(display, data1); - ImageData data2 = image.getImageData(); - - assertEquals("Image width should be the same", data1.width, data2.width); - assertEquals("Image height should be the same", data1.height, data2.height); -} - -public void test_hashCode() { - warnUnimpl("Test test_hashCode not written"); -} - -public void test_internal_new_GCLorg_eclipse_swt_graphics_GCData() { - warnUnimpl("Test test_internal_new_GCLorg_eclipse_swt_graphics_GCData not written"); -} - -public void test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData() { - warnUnimpl("Test test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData not written"); -} - -public void test_isDisposed() { - warnUnimpl("Test test_isDisposed not written"); -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setBackgroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_toString() { - warnUnimpl("Test test_toString not written"); -} - -public void test_win32_newLorg_eclipse_swt_graphics_DeviceII() { - // do not test - Windows only -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_Image((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceII"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageData"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageData"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_io_InputStream"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_String"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_getBackground"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getImageData"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_internal_new_GCLorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_isDisposed"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_toString"); - methodNames.addElement("test_win32_newLorg_eclipse_swt_graphics_DeviceII"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceII")) test_ConstructorLorg_eclipse_swt_graphics_DeviceII(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageI")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_Rectangle")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageData")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageData(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageData")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageData(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_io_InputStream")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_io_InputStream(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_String")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_String(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_getBackground")) test_getBackground(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getImageData")) test_getImageData(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_internal_new_GCLorg_eclipse_swt_graphics_GCData")) test_internal_new_GCLorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData")) test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_isDisposed")) test_isDisposed(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_toString")) test_toString(); - else if (getName().equals("test_win32_newLorg_eclipse_swt_graphics_DeviceII")) test_win32_newLorg_eclipse_swt_graphics_DeviceII(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageData.java deleted file mode 100644 index 1ab02d8047..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageData.java +++ /dev/null @@ -1,170 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.ImageData - * - * @see org.eclipse.swt.graphics.ImageData - */ -public class Test_org_eclipse_swt_graphics_ImageData extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_ImageData(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorIIILorg_eclipse_swt_graphics_PaletteData() { - warnUnimpl("Test test_ConstructorIIILorg_eclipse_swt_graphics_PaletteData not written"); -} - -public void test_ConstructorIIILorg_eclipse_swt_graphics_PaletteDataI$B() { - warnUnimpl("Test test_ConstructorIIILorg_eclipse_swt_graphics_PaletteDataI$B not written"); -} - -public void test_ConstructorLjava_io_InputStream() { - warnUnimpl("Test test_ConstructorLjava_io_InputStream not written"); -} - -public void test_ConstructorLjava_lang_String() { - warnUnimpl("Test test_ConstructorLjava_lang_String not written"); -} - -public void test_internal_newIIILorg_eclipse_swt_graphics_PaletteDataI$BI$B$BIIIIIII() { - warnUnimpl("Test test_internal_newIIILorg_eclipse_swt_graphics_PaletteDataI$BI$B$BIIIIIII not written"); -} - -public void test_clone() { - warnUnimpl("Test test_clone not written"); -} - -public void test_getAlphaII() { - warnUnimpl("Test test_getAlphaII not written"); -} - -public void test_getAlphasIII$BI() { - warnUnimpl("Test test_getAlphasIII$BI not written"); -} - -public void test_getPixelII() { - warnUnimpl("Test test_getPixelII not written"); -} - -public void test_getPixelsIII$BI() { - warnUnimpl("Test test_getPixelsIII$BI not written"); -} - -public void test_getPixelsIII$II() { - warnUnimpl("Test test_getPixelsIII$II not written"); -} - -public void test_getRGBs() { - warnUnimpl("Test test_getRGBs not written"); -} - -public void test_getTransparencyMask() { - warnUnimpl("Test test_getTransparencyMask not written"); -} - -public void test_getTransparencyType() { - warnUnimpl("Test test_getTransparencyType not written"); -} - -public void test_scaledToII() { - warnUnimpl("Test test_scaledToII not written"); -} - -public void test_setAlphaIII() { - warnUnimpl("Test test_setAlphaIII not written"); -} - -public void test_setAlphasIII$BI() { - warnUnimpl("Test test_setAlphasIII$BI not written"); -} - -public void test_setPixelIII() { - warnUnimpl("Test test_setPixelIII not written"); -} - -public void test_setPixelsIII$BI() { - warnUnimpl("Test test_setPixelsIII$BI not written"); -} - -public void test_setPixelsIII$II() { - warnUnimpl("Test test_setPixelsIII$II not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_ImageData((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorIIILorg_eclipse_swt_graphics_PaletteData"); - methodNames.addElement("test_ConstructorIIILorg_eclipse_swt_graphics_PaletteDataI$B"); - methodNames.addElement("test_ConstructorLjava_io_InputStream"); - methodNames.addElement("test_ConstructorLjava_lang_String"); - methodNames.addElement("test_internal_newIIILorg_eclipse_swt_graphics_PaletteDataI$BI$B$BIIIIIII"); - methodNames.addElement("test_clone"); - methodNames.addElement("test_getAlphaII"); - methodNames.addElement("test_getAlphasIII$BI"); - methodNames.addElement("test_getPixelII"); - methodNames.addElement("test_getPixelsIII$BI"); - methodNames.addElement("test_getPixelsIII$II"); - methodNames.addElement("test_getRGBs"); - methodNames.addElement("test_getTransparencyMask"); - methodNames.addElement("test_getTransparencyType"); - methodNames.addElement("test_scaledToII"); - methodNames.addElement("test_setAlphaIII"); - methodNames.addElement("test_setAlphasIII$BI"); - methodNames.addElement("test_setPixelIII"); - methodNames.addElement("test_setPixelsIII$BI"); - methodNames.addElement("test_setPixelsIII$II"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorIIILorg_eclipse_swt_graphics_PaletteData")) test_ConstructorIIILorg_eclipse_swt_graphics_PaletteData(); - else if (getName().equals("test_ConstructorIIILorg_eclipse_swt_graphics_PaletteDataI$B")) test_ConstructorIIILorg_eclipse_swt_graphics_PaletteDataI$B(); - else if (getName().equals("test_ConstructorLjava_io_InputStream")) test_ConstructorLjava_io_InputStream(); - else if (getName().equals("test_ConstructorLjava_lang_String")) test_ConstructorLjava_lang_String(); - else if (getName().equals("test_internal_newIIILorg_eclipse_swt_graphics_PaletteDataI$BI$B$BIIIIIII")) test_internal_newIIILorg_eclipse_swt_graphics_PaletteDataI$BI$B$BIIIIIII(); - else if (getName().equals("test_clone")) test_clone(); - else if (getName().equals("test_getAlphaII")) test_getAlphaII(); - else if (getName().equals("test_getAlphasIII$BI")) test_getAlphasIII$BI(); - else if (getName().equals("test_getPixelII")) test_getPixelII(); - else if (getName().equals("test_getPixelsIII$BI")) test_getPixelsIII$BI(); - else if (getName().equals("test_getPixelsIII$II")) test_getPixelsIII$II(); - else if (getName().equals("test_getRGBs")) test_getRGBs(); - else if (getName().equals("test_getTransparencyMask")) test_getTransparencyMask(); - else if (getName().equals("test_getTransparencyType")) test_getTransparencyType(); - else if (getName().equals("test_scaledToII")) test_scaledToII(); - else if (getName().equals("test_setAlphaIII")) test_setAlphaIII(); - else if (getName().equals("test_setAlphasIII$BI")) test_setAlphasIII$BI(); - else if (getName().equals("test_setPixelIII")) test_setPixelIII(); - else if (getName().equals("test_setPixelsIII$BI")) test_setPixelsIII$BI(); - else if (getName().equals("test_setPixelsIII$II")) test_setPixelsIII$II(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoader.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoader.java deleted file mode 100644 index f98b3487dd..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoader.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.ImageLoader - * - * @see org.eclipse.swt.graphics.ImageLoader - */ -public class Test_org_eclipse_swt_graphics_ImageLoader extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_ImageLoader(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_loadLjava_io_InputStream() { - warnUnimpl("Test test_loadLjava_io_InputStream not written"); -} - -public void test_loadLjava_lang_String() { - warnUnimpl("Test test_loadLjava_lang_String not written"); -} - -public void test_saveLjava_io_OutputStreamI() { - warnUnimpl("Test test_saveLjava_io_OutputStreamI not written"); -} - -public void test_saveLjava_lang_StringI() { - warnUnimpl("Test test_saveLjava_lang_StringI not written"); -} - -public void test_addImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener() { - warnUnimpl("Test test_addImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener not written"); -} - -public void test_removeImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener() { - warnUnimpl("Test test_removeImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener not written"); -} - -public void test_hasListeners() { - warnUnimpl("Test test_hasListeners not written"); -} - -public void test_notifyListenersLorg_eclipse_swt_graphics_ImageLoaderEvent() { - warnUnimpl("Test test_notifyListenersLorg_eclipse_swt_graphics_ImageLoaderEvent not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_ImageLoader((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_loadLjava_io_InputStream"); - methodNames.addElement("test_loadLjava_lang_String"); - methodNames.addElement("test_saveLjava_io_OutputStreamI"); - methodNames.addElement("test_saveLjava_lang_StringI"); - methodNames.addElement("test_addImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener"); - methodNames.addElement("test_removeImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener"); - methodNames.addElement("test_hasListeners"); - methodNames.addElement("test_notifyListenersLorg_eclipse_swt_graphics_ImageLoaderEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_loadLjava_io_InputStream")) test_loadLjava_io_InputStream(); - else if (getName().equals("test_loadLjava_lang_String")) test_loadLjava_lang_String(); - else if (getName().equals("test_saveLjava_io_OutputStreamI")) test_saveLjava_io_OutputStreamI(); - else if (getName().equals("test_saveLjava_lang_StringI")) test_saveLjava_lang_StringI(); - else if (getName().equals("test_addImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener")) test_addImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener(); - else if (getName().equals("test_removeImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener")) test_removeImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener(); - else if (getName().equals("test_hasListeners")) test_hasListeners(); - else if (getName().equals("test_notifyListenersLorg_eclipse_swt_graphics_ImageLoaderEvent")) test_notifyListenersLorg_eclipse_swt_graphics_ImageLoaderEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderEvent.java deleted file mode 100644 index 5d3ee58458..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderEvent.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.ImageLoaderEvent - * - * @see org.eclipse.swt.graphics.ImageLoaderEvent - */ -public class Test_org_eclipse_swt_graphics_ImageLoaderEvent extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_ImageLoaderEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_graphics_ImageLoaderLorg_eclipse_swt_graphics_ImageDataIZ() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_ImageLoaderLorg_eclipse_swt_graphics_ImageDataIZ not written"); -} - -public void test_toString() { - warnUnimpl("Test test_toString not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_ImageLoaderEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_ImageLoaderLorg_eclipse_swt_graphics_ImageDataIZ"); - methodNames.addElement("test_toString"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_ImageLoaderLorg_eclipse_swt_graphics_ImageDataIZ")) test_ConstructorLorg_eclipse_swt_graphics_ImageLoaderLorg_eclipse_swt_graphics_ImageDataIZ(); - else if (getName().equals("test_toString")) test_toString(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderListener.java deleted file mode 100644 index c7955e722a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderListener.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.ImageLoaderListener - * - * @see org.eclipse.swt.graphics.ImageLoaderListener - */ -public class Test_org_eclipse_swt_graphics_ImageLoaderListener extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_ImageLoaderListener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_imageDataLoadedLorg_eclipse_swt_graphics_ImageLoaderEvent() { - warnUnimpl("Test test_imageDataLoadedLorg_eclipse_swt_graphics_ImageLoaderEvent not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_imageDataLoadedLorg_eclipse_swt_graphics_ImageLoaderEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_imageDataLoadedLorg_eclipse_swt_graphics_ImageLoaderEvent")) test_imageDataLoadedLorg_eclipse_swt_graphics_ImageLoaderEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_PaletteData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_PaletteData.java deleted file mode 100644 index 5b75ab774a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_PaletteData.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.PaletteData - * - * @see org.eclipse.swt.graphics.PaletteData - */ -public class Test_org_eclipse_swt_graphics_PaletteData extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_PaletteData(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor$Lorg_eclipse_swt_graphics_RGB() { - warnUnimpl("Test test_Constructor$Lorg_eclipse_swt_graphics_RGB not written"); -} - -public void test_ConstructorIII() { - warnUnimpl("Test test_ConstructorIII not written"); -} - -public void test_getPixelLorg_eclipse_swt_graphics_RGB() { - warnUnimpl("Test test_getPixelLorg_eclipse_swt_graphics_RGB not written"); -} - -public void test_getRGBI() { - warnUnimpl("Test test_getRGBI not written"); -} - -public void test_getRGBs() { - warnUnimpl("Test test_getRGBs not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_PaletteData((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor$Lorg_eclipse_swt_graphics_RGB"); - methodNames.addElement("test_ConstructorIII"); - methodNames.addElement("test_getPixelLorg_eclipse_swt_graphics_RGB"); - methodNames.addElement("test_getRGBI"); - methodNames.addElement("test_getRGBs"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor$Lorg_eclipse_swt_graphics_RGB")) test_Constructor$Lorg_eclipse_swt_graphics_RGB(); - else if (getName().equals("test_ConstructorIII")) test_ConstructorIII(); - else if (getName().equals("test_getPixelLorg_eclipse_swt_graphics_RGB")) test_getPixelLorg_eclipse_swt_graphics_RGB(); - else if (getName().equals("test_getRGBI")) test_getRGBI(); - else if (getName().equals("test_getRGBs")) test_getRGBs(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Point.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Point.java deleted file mode 100644 index d7c94bdffa..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Point.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.Point - * - * @see org.eclipse.swt.graphics.Point - */ -public class Test_org_eclipse_swt_graphics_Point extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_Point(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorII(){
- // Test new Point (int x, int y)
- Point p = new Point(3, 4);
- assertEquals(3, p.x);
- assertEquals(4, p.y);
-
- p = new Point(-4, -3);
- assertEquals(-4, p.x);
- assertEquals(-3, p.y);
-
- p = new Point(500000, 700000);
- assertEquals(500000, p.x);
- assertEquals(700000, p.y);
-} - -public void test_equalsLjava_lang_Object(){
- Point p1 = new Point(5, 5);
- Point p2 = new Point(5, 5);
- assertTrue("Points should be equal", p1.equals(p2));
-
- p1 = new Point(-5, -5);
- p2 = new Point(-5, -5);
- assertTrue("Points should be equal", p1.equals(p2));
-
- p2 = new Point(3, 4);
- assertTrue("Points should not be equal", !p1.equals(p2));
-} - -public void test_hashCode(){
- Point p1 = new Point(5, 5);
- Point p2 = new Point(5, 5);
- assertTrue("Points should have the same hashCode", p1.hashCode() == p2.hashCode());
-} - -public void test_toString(){
- Point p = new Point(3, 4);
- assertNotNull(p.toString()); - assertTrue(p.toString().length() > 0); - assertEquals("Point {3, 4}", p.toString());
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_Point((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorII"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_toString"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorII")) test_ConstructorII(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_toString")) test_toString(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_RGB.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_RGB.java deleted file mode 100644 index 3458daf64f..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_RGB.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.RGB - * - * @see org.eclipse.swt.graphics.RGB - */ -public class Test_org_eclipse_swt_graphics_RGB extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_RGB(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorIII() { - // Test RGB(int red, int green, int blue) - RGB rgb = new RGB(20,100,200); - - rgb = new RGB(0,0,0); - - rgb = new RGB(255,255,255); - - try { - rgb = new RGB(-1, 20, 50); - fail("No exception thrown for red < 0"); - } - catch (IllegalArgumentException e) { - } - - try { - rgb = new RGB(256, 20, 50); - fail("No exception thrown for red > 255"); - } - catch (IllegalArgumentException e) { - } - - try { - rgb = new RGB(20, -1, 50); - fail("No exception thrown for green < 0"); - } - catch (IllegalArgumentException e) { - } - - try { - rgb = new RGB(20, 256, 50); - fail("No exception thrown for green > 255"); - } - catch (IllegalArgumentException e) { - } - - try { - rgb = new RGB(20, 50, -1); - fail("No exception thrown for blue < 0"); - } - catch (IllegalArgumentException e) { - } - - try { - rgb = new RGB(20, 50, 256); - fail("No exception thrown for blue > 255"); - } - catch (IllegalArgumentException e) { - } - -} - -public void test_equalsLjava_lang_Object() { - int r = 0, g = 127, b = 254; - RGB rgb1 = new RGB(r, g, b); - RGB rgb2; - - rgb2 = rgb1; - if (!rgb1.equals(rgb2)) { - fail("Two references to the same RGB instance not found equal"); - } - - rgb2 = new RGB(r, g, b); - if (!rgb1.equals(rgb2)) { - fail("References to two different RGB instances with same R G B parameters not found equal"); - } - - if (rgb1.equals(new RGB(r+1, g, b)) || - rgb1.equals(new RGB(r, g+1, b)) || - rgb1.equals(new RGB(r, g, b+1)) || - rgb1.equals(new RGB(r+1, g+1, b+1))) { - fail("Comparing two RGB instances with different combination of R G B parameters found equal"); - } -} - -public void test_hashCode() { - int r = 255, g = 100, b = 0; - RGB rgb1 = new RGB(r, g, b); - RGB rgb2 = new RGB(r, g, b); - - int hash1 = rgb1.hashCode(); - int hash2 = rgb2.hashCode(); - - if (hash1 != hash2) { - fail("Two RGB instances with same R G B parameters returned different hash codes"); - } - - if (rgb1.hashCode() == new RGB(g, b, r).hashCode() || - rgb1.hashCode() == new RGB(b, r, g).hashCode()) { - fail("Two RGB instances with different R G B parameters returned the same hash code"); - } -} - -public void test_toString() { - RGB rgb = new RGB(0, 100, 200); - - String s = rgb.toString(); - - if (s == null || s.length() == 0) { - fail("RGB.toString returns a null or empty String"); - } -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_RGB((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorIII"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_toString"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorIII")) test_ConstructorIII(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_toString")) test_toString(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Rectangle.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Rectangle.java deleted file mode 100644 index 0c05ffaef9..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Rectangle.java +++ /dev/null @@ -1,322 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.Rectangle - * - * @see org.eclipse.swt.graphics.Rectangle - */ -public class Test_org_eclipse_swt_graphics_Rectangle extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_Rectangle(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorIIII(){
- // Test new Rectangle (int x, int y, int width, int height)
- Rectangle r = new Rectangle(3, 4, 5, 6);
- assertEquals(3, r.x);
- assertEquals(4, r.y);
- assertEquals(5, r.width);
- assertEquals(6, r.height);
-
- r = new Rectangle(-4, -3, -2, -1);
- assertEquals(-4, r.x);
- assertEquals(-3, r.y);
- assertEquals(-2, r.width);
- assertEquals(-1, r.height);
-
- r = new Rectangle(500000, 700000, 200000, 100000);
- assertEquals(500000, r.x);
- assertEquals(700000, r.y);
- assertEquals(200000, r.width);
- assertEquals(100000, r.height);
-} - -/**
- * Destructively replaces the x, y, width and height values
- * in the receiver with ones which represent the union of the
- * rectangles specified by the receiver and the given rectangle.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- */
-public void test_addLorg_eclipse_swt_graphics_Rectangle(){
- Rectangle r1 = new Rectangle(1, 2, 3, 4);
- Rectangle r2 = new Rectangle(3, 3, 2, 2);
- r1.add(r2);
- assertEquals("Rectangle add incorrect", new Rectangle(1, 2, 4, 4), r1);
-
- r1.add(r2);
- assertEquals("Rectangle add incorrect", new Rectangle(1, 2, 4, 4), r1);
-
- r1 = new Rectangle(1, 2, 3, 4);
- r2 = new Rectangle(3, 3, 0, 0);
- r1.add(r2);
- assertEquals("Rectangle add incorrect", new Rectangle(1, 2, 3, 4), r1);
-
- r1 = new Rectangle(1, 2, 3, 4);
- r2 = new Rectangle(6, 6, 0, 0);
- r1.add(r2);
- assertEquals("Rectangle add incorrect", new Rectangle(1, 2, 5, 4), r1);
-
- try {
- r1.add(null);
- fail("No exception thrown for rectangle == null");
- } catch (IllegalArgumentException e) {
- }
-} - -/**
- * Returns <code>true</code> if the point specified by the
- * arguments is inside the area specified by the receiver.
- */
-public void test_containsII(){
- Rectangle r = new Rectangle(1, 2, 3, 4);
- assertTrue("Rectangle should contain point (1, 2)", r.contains(1, 2));
-
- assertTrue("Rectangle should contain point (3, 4)", r.contains(3, 4));
-
- assertTrue("Rectangle should contain point (3, 5)", r.contains(3, 5));
-
-// assertTrue("Rectangle should contain point (3, 6)", r.contains(3, 6));
-//
-// assertTrue("Rectangle should contain point (4, 5)", r.contains(4, 5));
-//
-// assertTrue("Rectangle should contain point (4, 6)", r.contains(4, 6));
-
- assertTrue("Rectangle should not contain point (9, 10)", !r.contains(9, 10));
-
- assertTrue("Rectangle should not contain point (-1, -1)", !r.contains(-1, -1));
-} - -/**
- * Returns <code>true</code> if the given point is inside the
- * area specified by the receiver.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- */
-public void test_containsLorg_eclipse_swt_graphics_Point(){
- Rectangle r = new Rectangle(1, 2, 3, 4);
- assertTrue("Rectangle should contain Point(1, 2)", r.contains(new Point(1, 2)));
-
- assertTrue("Rectangle should contain Point(3, 4)", r.contains(new Point(3, 4)));
-
- assertTrue("Rectangle should contain point (3, 5)", r.contains(new Point(3, 5)));
-
-// assertTrue("Rectangle should contain point (3, 6)", r.contains(new Point(3, 6)));
-//
-// assertTrue("Rectangle should contain point (4, 5)", r.contains(new Point(4, 5)));
-//
-// assertTrue("Rectangle should contain Point(4, 6)", r.contains(new Point(4, 6)));
-
- assertTrue("Rectangle should not contain Point(9, 10)", !r.contains(new Point(9, 10)));
-
- assertTrue("Rectangle should not contain point (-1, -1)", !r.contains(new Point(-1, -1)));
-
- try {
- r.contains(null);
- fail("No exception thrown for rectangle == null");
- } catch (IllegalArgumentException e) {
- }
-} - -public void test_equalsLjava_lang_Object(){
- Rectangle r1 = new Rectangle(5, 4, 3, 2);
- Rectangle r2 = new Rectangle(5, 4, 3, 2);
- assertTrue("Rectangles should be equal", r1.equals(r2));
-
- r2 = new Rectangle(3, 4, 5, 6);
- assertTrue("Rectangles should not be equal", !r1.equals(r2));
-
- r2 = new Rectangle(2, 3, 4, 5);
- assertTrue("Rectangles should not be equal", !r1.equals(r2));
-
- r2 = new Rectangle(5, 4, 2, 3);
- assertTrue("Rectangles should not be equal", !r1.equals(r2));
-
- r2 = new Rectangle(4, 5, 3, 2);
- assertTrue("Rectangles should not be equal", !r1.equals(r2));
-} - -public void test_hashCode(){
- Rectangle r1 = new Rectangle(5, 4, 3, 2);
- Rectangle r2 = new Rectangle(5, 4, 3, 2);
- assertTrue("Rectangles should have the same hashCode", r1.hashCode() == r2.hashCode());
-} - -/**
- * Returns a new rectangle which represents the intersection
- * of the receiver and the given rectangle.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- */
-public void test_intersectionLorg_eclipse_swt_graphics_Rectangle(){
- Rectangle r1 = new Rectangle(1, 2, 3, 4);
- Rectangle r2 = new Rectangle(3, 3, 2, 2);
- assertEquals("Rectangle intersection incorrect", new Rectangle(3, 3, 1, 2), r1.intersection(r2));
-
- r2 = new Rectangle(3, 3, 0, 0);
- assertEquals("Rectangle intersection incorrect", new Rectangle(3, 3, 0, 0), r1.intersection(r2));
-
- r2 = new Rectangle(3, 3, -1, -1);
- assertEquals("Rectangle intersection incorrect", new Rectangle(0, 0, 0, 0), r1.intersection(r2));
-
- try {
- r1.intersection(null);
- fail("No exception thrown for rectangle == null");
- } catch (IllegalArgumentException e) {
- }
-} - -/**
- * Returns <code>true</code> if the given rectangle intersects
- * with the receiver and <code>false</code> otherwise.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- */
-public void test_intersectsLorg_eclipse_swt_graphics_Rectangle(){
- Rectangle r1 = new Rectangle(1, 2, 3, 4);
- Rectangle r2 = new Rectangle(2, 3, 7, 8);
- assertTrue("Rectangle(1, 2, 3, 4) should intersect Rectangle(2, 3, 7, 8)", r1.intersects(r2));
- assertTrue("Rectangle(2, 3, 7, 8) should intersect Rectangle(1, 2, 3, 4)", r2.intersects(r1));
-
- r2 = new Rectangle(200, 300, 400, 500);
- assertTrue("Rectangle(1, 2, 3, 4) should not intersect Rectangle(200, 300, 400, 500)", !r1.intersects(r2));
- assertTrue("Rectangle(200, 300, 400, 500) should not intersect Rectangle(1, 2, 3, 4)", !r2.intersects(r1));
-
- r2 = new Rectangle(3, 3, 0, 0);
- assertTrue("Rectangle(1, 2, 3, 4) should intersect Rectangle(3, 3, 0, 0)", r1.intersects(r2));
- assertTrue("Rectangle(3, 3, 0, 0) should intersect Rectangle(1, 2, 3, 4)", r2.intersects(r1));
-
- r2 = new Rectangle(3, 3, -1, -1);
- assertTrue("Rectangle(1, 2, 3, 4) should not intersect Rectangle(3, 3, -1, -1)", !r1.intersects(r2));
- assertTrue("Rectangle(3, 3, -1, -1) should not intersect Rectangle(1, 2, 3, 4)", !r2.intersects(r1));
-
- try {
- r1.intersects(null);
- fail("No exception thrown for rectangle == null");
- } catch (IllegalArgumentException e) {
- }
-} - -/**
- * Returns <code>true</code> if the receiver does not cover any
- * area in the (x, y) coordinate plane, and <code>false</code> if
- * the receiver does cover some area in the plane.
- * <p>
- * A rectangle is considered to <em>cover area</em> in the
- * (x, y) coordinate plane if both its width and height are
- * non-zero.
- * </p>
- */
-public void test_isEmpty(){
- Rectangle r = new Rectangle(1, 2, 0, 0);
- assertTrue("Rectangle is empty", r.isEmpty());
-
- r = new Rectangle(1, 2, -3, -4);
- assertTrue("Rectangle is empty", r.isEmpty());
-
- r = new Rectangle(1, 2, 3, 4);
- assertTrue("Rectangle is not empty", !r.isEmpty());
-} - -public void test_toString(){
- Rectangle r = new Rectangle(3, 4, 5, 6); - assertNotNull(r.toString()); - assertTrue(r.toString().length() > 0);
- assertEquals("Rectangle {3, 4, 5, 6}", r.toString());
-} - -/**
- * Returns a new rectangle which represents the union of
- * the receiver and the given rectangle.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
- */
-public void test_unionLorg_eclipse_swt_graphics_Rectangle(){
- Rectangle r1 = new Rectangle(1, 2, 3, 4);
- Rectangle r2 = new Rectangle(3, 3, 2, 2);
- assertEquals("Rectangle union incorrect", new Rectangle(1, 2, 4, 4), r1.union(r2));
-
- r2 = new Rectangle(3, 3, 0, 0);
- assertEquals("Rectangle union incorrect", new Rectangle(1, 2, 3, 4), r1.union(r2));
-
- r2 = new Rectangle(3, 3, -1, -1);
- assertEquals("Rectangle union incorrect", new Rectangle(1, 2, 3, 4), r1.union(r2));
-
- try {
- r1.union(null);
- fail("No exception thrown for rectangle == null");
- } catch (IllegalArgumentException e) {
- }
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_Rectangle((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorIIII"); - methodNames.addElement("test_addLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_containsII"); - methodNames.addElement("test_containsLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_intersectionLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_intersectsLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_isEmpty"); - methodNames.addElement("test_toString"); - methodNames.addElement("test_unionLorg_eclipse_swt_graphics_Rectangle"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorIIII")) test_ConstructorIIII(); - else if (getName().equals("test_addLorg_eclipse_swt_graphics_Rectangle")) test_addLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_containsII")) test_containsII(); - else if (getName().equals("test_containsLorg_eclipse_swt_graphics_Point")) test_containsLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_intersectionLorg_eclipse_swt_graphics_Rectangle")) test_intersectionLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_intersectsLorg_eclipse_swt_graphics_Rectangle")) test_intersectsLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_isEmpty")) test_isEmpty(); - else if (getName().equals("test_toString")) test_toString(); - else if (getName().equals("test_unionLorg_eclipse_swt_graphics_Rectangle")) test_unionLorg_eclipse_swt_graphics_Rectangle(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Region.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Region.java deleted file mode 100644 index 78c62e8c99..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Region.java +++ /dev/null @@ -1,530 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.Region - * - * @see org.eclipse.swt.graphics.Region - */ -public class Test_org_eclipse_swt_graphics_Region extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_Region(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor(){
- // test Region() - Region reg = new Region(); - if (reg.isDisposed()) { - fail("Constructor for Region didn't initialize handle field"); - } - reg.dispose();
-} - -public void test_addLorg_eclipse_swt_graphics_Rectangle(){ - Region reg = new Region(); - // add a rectangle - reg.add(new Rectangle(0, 0, 100, 50)); - // add a second rectangle - reg.add(new Rectangle(200, 200, 10,10)); - - try { - reg.add((Rectangle)null); - fail("no exception thrown for adding a null rectangle"); - } - catch (IllegalArgumentException e) { - } - - reg.dispose(); - - try { - reg.add(new Rectangle(20,30,10,5)); - fail("no exception thrown for adding a rectangle after Region got disposed"); - } - catch (SWTException e) { - }
-} - -public void test_addLorg_eclipse_swt_graphics_Region(){ - Region reg1 = new Region(); - // make a second region and add it to the first one - Region reg2 = new Region(); - reg2.add(new Rectangle(40, 50, 10, 20)); - reg1.add(reg2); - - try { - reg1.add((Region)null); - fail("no exception thrown for adding a null region"); - } - catch (IllegalArgumentException e) { - } - - try { - reg2 = new Region(); - reg2.add(new Rectangle(1,1,100,200)); - reg2.dispose(); - reg1.add(reg2); - fail("no exception thrown for adding to a Region a Region which got disposed"); - } - catch (IllegalArgumentException e) { - } - - reg1.dispose(); - - try { - reg2 = new Region(); - reg2.add(new Rectangle(1,1,100,200)); - reg1.add(reg2); - fail("no exception thrown for adding a Region to a Region which got disposed"); - } - catch (SWTException e) { - }
-} - -public void test_containsII(){ - Rectangle rect1 = new Rectangle(10,10,200,100); - Point pointInRect1 = new Point(10,10); - Rectangle rect2 = new Rectangle(50,50,1000,1000); - Point pointInRect2 = new Point(1049,1009); - Point pointNotInRect12 = new Point(49,110); - - Region reg = new Region(); - reg.dispose(); - try { - boolean res = reg.contains(pointInRect1.x, pointInRect1.y); - fail("no exception thrown on disposed region"); - } - catch (Exception e) { - } - - reg = new Region(); - if (reg.contains(pointInRect1.x, pointInRect1.y)) { - reg.dispose(); - fail("Empty region should not contain point"); - } - reg.add(rect1); - if (!reg.contains(pointInRect1.x, pointInRect1.y)) { - reg.dispose(); - fail("Region should contain point"); - } - reg.add(rect2); - if (!reg.contains(pointInRect1.x, pointInRect1.y) || - !reg.contains(pointInRect2.x, pointInRect2.y)) { - reg.dispose(); - fail("Region should contain point"); - } - if (reg.contains(pointNotInRect12.x, pointNotInRect12.y)) { - reg.dispose(); - fail("Region should not contain point"); - } - reg.dispose();
-} - -public void test_containsLorg_eclipse_swt_graphics_Point(){
- Rectangle rect1 = new Rectangle(10,10,200,100); - Point pointInRect1 = new Point(10,10); - Rectangle rect2 = new Rectangle(50,50,1000,1000); - Point pointInRect2 = new Point(1049,1009); - Point pointNotInRect12 = new Point(49,110); - - Region reg = new Region(); - reg.dispose(); - try { - boolean res = reg.contains(pointInRect1); - fail("no exception thrown on disposed region"); - } - catch (Exception e) { - } - - reg = new Region(); - if (reg.contains(pointInRect1)) { - reg.dispose(); - fail("Empty region should not contain point"); - } - reg.add(rect1); - if (!reg.contains(pointInRect1)) { - reg.dispose(); - fail("Region should contain point"); - } - reg.add(rect2); - if (!reg.contains(pointInRect1) || - !reg.contains(pointInRect2)) { - reg.dispose(); - fail("Region should contain point"); - } - if (reg.contains(pointNotInRect12)) { - reg.dispose(); - fail("Region should not contain point"); - } - reg.dispose();
-} - -public void test_dispose(){
- Region reg = new Region(); - reg.add(new Rectangle(1,1,50,100)); - if (reg.isDisposed()) { - fail("Region should not be in the disposed state"); - } - - // dispose twice as this is allowed - for (int i = 0; i < 2; i++) { - reg.dispose(); - if (!reg.isDisposed()) { - fail("Region should be in the disposed state"); - } - }
-} - -public void test_equalsLjava_lang_Object(){
- Rectangle rect1 = new Rectangle(25, 100, 200, 780); - Rectangle rect2 = new Rectangle(30, 105, 205, 785); - - Region reg1 = new Region(); - reg1.add(rect1); - - Region reg2 = reg1; - - if (!reg1.equals(reg2)) { - reg1.dispose(); - reg2.dispose(); - fail("references to the same instance of Region should be considered equal"); - } - - reg2 = new Region(); - reg2.add(rect1); - -// Currently, Regions are only "equal" if they have the same handle. -// This is so that identical objects are properly hashed. -// We are considering adding a new method that will compare Regions for the same area. -// if (!reg1.equals(reg2)) { -// reg1.dispose(); -// reg2.dispose(); -// fail("two instances of Region representing the same area should be considered equal"); -// } - - reg2.dispose(); - reg2 = new Region(); - if (reg1.equals(reg2)) { - reg1.dispose(); - reg2.dispose(); - fail("Non empty region considered equal to empty one"); - } - - reg2.add(rect2); - if (reg1.equals(reg2)) { - reg1.dispose(); - reg2.dispose(); - fail("two different regions considered equal"); - } - - reg1.dispose(); - reg2.dispose();
-} - -public void test_getBounds(){
- Region reg = new Region(); - reg.dispose(); - - try { - Rectangle rect = reg.getBounds(); - fail("Region disposed should throw Exception"); - } - catch (Exception e) { - } - - Rectangle rect1 = new Rectangle(10,10,50,30); - Rectangle rect2 = new Rectangle(100,100,10,10); - // the rectangle enclosing the two preceding rectangles - Rectangle rect12Bounds = new Rectangle(10,10,100,100); - - reg = new Region(); - reg.add(rect1); - Rectangle rect1Bis = reg.getBounds(); - if (rect1Bis.x != rect1.x || rect1Bis.y != rect1.y || - rect1Bis.height != rect1.height || rect1Bis.width != rect1.width) { - reg.dispose(); - fail("getBounds doesn't return the borders of the rectangle area which was set up"); - } - - reg.add(rect2); - Rectangle rect12 = reg.getBounds(); - if (rect12.x != rect12Bounds.x || rect12.y != rect12Bounds.y || - rect12.height != rect12Bounds.height || rect12.width != rect12Bounds.width) { - reg.dispose(); - fail("getBounds doesn't return the borders of the resulting rectangle area which was set up"); - } - - reg.dispose();
-} - -public void test_hashCode(){ - Region reg1 = new Region(); - Region reg2 = new Region(); - - Rectangle rect1 = new Rectangle(25, 100, 200, 780); - Rectangle rect2 = new Rectangle(30, 105, 205, 785); - - reg1.add(rect1); - reg2.add(rect2); - - if (reg1.hashCode() == reg2.hashCode()) { - reg1.dispose(); - reg2.dispose(); - fail("two different regions should have different hashCode"); - } - reg2.dispose(); - - reg2 = new Region(); - reg2.add(rect1); - - -// BUG: this should pass -// if (reg1.hashCode() != reg2.hashCode()) { -// reg1.dispose(); -// reg2.dispose(); -// fail("two regions representing same area should have same hashCode"); -// } - - reg1.dispose(); - reg2.dispose();
-} - -public void test_intersectsIIII(){ - Rectangle rect1 = new Rectangle(10,20,50,30); - Rectangle rectInter1 = new Rectangle(59,49,10,20); - Rectangle rectNotInter1 = new Rectangle(0,5,10,15); - - Rectangle rect2 = new Rectangle(30,40,10,100); - Rectangle rectInter2 = new Rectangle(39,139,1,5); - Rectangle rectNotInter12 = new Rectangle(40,50,5,15); - -
- Region reg = new Region(); - reg.dispose(); - try { - boolean res = reg.intersects(rectInter1.x, rectInter1.y, rectInter1.width, rectInter1.height); - fail("no exception thrown on disposed region"); - } - catch (Exception e) { - } - - reg = new Region(); - if (reg.intersects(rect1.x, rect1.y, rect1.width, rect1.height)) { - reg.dispose(); - fail("intersects can't return true on empty region"); - } - reg.add(rect1); - if (!reg.intersects(rect1.x, rect1.y, rect1.width, rect1.height)) { - reg.dispose(); - fail("intersects didn't return true"); - } - if (!reg.intersects(rectInter1.x, rectInter1.y, rectInter1.width, rectInter1.height)) { - reg.dispose(); - fail("intersects didn't return true "); - } - if (reg.intersects(rectNotInter1.x, rectNotInter1.y, rectNotInter1.width, rectNotInter1.height)) { - reg.dispose(); - fail("intersects return true on rectangle not intersecting with region"); - } - - reg.add(rect2); - if (!reg.intersects(rect2.x, rect2.y, rect2.width, rect2.height)) { - reg.dispose(); - fail("intersects didn't return true"); - } - if (!reg.intersects(rectInter2.x, rectInter2.y, rectInter2.width, rectInter2.height)) { - reg.dispose(); - fail("intersects didn't return true "); - } - if (reg.intersects(rectNotInter12.x, rectNotInter12.y, rectNotInter12.width, rectNotInter12.height)) { - reg.dispose(); - fail("intersects return true on rectangle not intersecting with region"); - } - reg.dispose();
-} - -public void test_intersectsLorg_eclipse_swt_graphics_Rectangle(){
- Rectangle rect1 = new Rectangle(10,20,50,30); - Rectangle rectInter1 = new Rectangle(59,49,10,20); - Rectangle rectNotInter1 = new Rectangle(0,5,10,15); - - Rectangle rect2 = new Rectangle(30,40,10,100); - Rectangle rectInter2 = new Rectangle(39,139,1,5); - Rectangle rectNotInter12 = new Rectangle(40,50,5,15); - - - Region reg = new Region(); - reg.dispose(); - try { - boolean res = reg.intersects(rectInter1); - fail("no exception thrown on disposed region"); - } - catch (Exception e) { - } - - reg = new Region(); - if (reg.intersects(rect1)) { - reg.dispose(); - fail("intersects can't return true on empty region"); - } - reg.add(rect1); - if (!reg.intersects(rect1)) { - reg.dispose(); - fail("intersects didn't return true"); - } - if (!reg.intersects(rectInter1)) { - reg.dispose(); - fail("intersects didn't return true "); - } - if (reg.intersects(rectNotInter1)) { - reg.dispose(); - fail("intersects return true on rectangle not intersecting with region"); - } - - reg.add(rect2); - if (!reg.intersects(rect2)) { - reg.dispose(); - fail("intersects didn't return true"); - } - if (!reg.intersects(rectInter2)) { - reg.dispose(); - fail("intersects didn't return true "); - } - if (reg.intersects(rectNotInter12)) { - reg.dispose(); - fail("intersects return true on rectangle not intersecting with region"); - } - reg.dispose(); -} - -public void test_isDisposed(){
- // test in dispose()
-} - -public void test_isEmpty(){
- Region reg = new Region(); - Rectangle emptyRect1 = new Rectangle(10,20,0,200); - Rectangle emptyRect2 = new Rectangle(10,20,10,0); - Rectangle rect = new Rectangle(10,20,50,100); - - if (!reg.isEmpty()) { - reg.dispose(); - fail("isEmpty didn't return true on empty region"); - } - - reg.add(emptyRect1); - if (!reg.isEmpty()) { - reg.dispose(); - fail("isEmpty didn't return true on empty region"); - } - - reg.add(emptyRect2); - if (!reg.isEmpty()) { - reg.dispose(); - fail("isEmpty didn't return true on empty region"); - } - - reg.add(rect); - if (reg.isEmpty()) { - reg.dispose(); - fail("isEmpty returned true on non empty region"); - } - - reg.dispose(); -} - -public void test_win32_newI(){
- // not part of public api
-} - -public void test_toString(){
- Region reg = new Region(); - - String s = reg.toString(); - - if (s == null || s.length() == 0) { - fail("toString returns null or empty string"); - } - - reg.add(new Rectangle(1,1,10,20)); - s = reg.toString(); - - if (s == null || s.length() == 0) { - fail("toString returns null or empty string"); - } - - reg.dispose(); - s = reg.toString(); - - if (s == null || s.length() == 0) { - fail("toString returns null or empty string"); - }
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_Region((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_addLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_addLorg_eclipse_swt_graphics_Region"); - methodNames.addElement("test_containsII"); - methodNames.addElement("test_containsLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_intersectsIIII"); - methodNames.addElement("test_intersectsLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_isDisposed"); - methodNames.addElement("test_isEmpty"); - methodNames.addElement("test_win32_newI"); - methodNames.addElement("test_toString"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_addLorg_eclipse_swt_graphics_Rectangle")) test_addLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_addLorg_eclipse_swt_graphics_Region")) test_addLorg_eclipse_swt_graphics_Region(); - else if (getName().equals("test_containsII")) test_containsII(); - else if (getName().equals("test_containsLorg_eclipse_swt_graphics_Point")) test_containsLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_intersectsIIII")) test_intersectsIIII(); - else if (getName().equals("test_intersectsLorg_eclipse_swt_graphics_Rectangle")) test_intersectsLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_isDisposed")) test_isDisposed(); - else if (getName().equals("test_isEmpty")) test_isEmpty(); - else if (getName().equals("test_win32_newI")) test_win32_newI(); - else if (getName().equals("test_toString")) test_toString(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FillLayout.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FillLayout.java deleted file mode 100644 index a4708e015d..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FillLayout.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.layout.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.layout.FillLayout - * - * @see org.eclipse.swt.layout.FillLayout - */ -public class Test_org_eclipse_swt_layout_FillLayout extends Test_org_eclipse_swt_widgets_Layout { - -public Test_org_eclipse_swt_layout_FillLayout(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ() { - warnUnimpl("Test test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ not written"); -} - -public void test_layoutLorg_eclipse_swt_widgets_CompositeZ() { - warnUnimpl("Test test_layoutLorg_eclipse_swt_widgets_CompositeZ not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_layout_FillLayout((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ"); - methodNames.addElement("test_layoutLorg_eclipse_swt_widgets_CompositeZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Layout.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ")) test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ(); - else if (getName().equals("test_layoutLorg_eclipse_swt_widgets_CompositeZ")) test_layoutLorg_eclipse_swt_widgets_CompositeZ(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridData.java deleted file mode 100644 index b8a89528ad..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridData.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.layout.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.layout.GridData - * - * @see org.eclipse.swt.layout.GridData - */ -public class Test_org_eclipse_swt_layout_GridData extends SwtTestCase { - -public Test_org_eclipse_swt_layout_GridData(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_ConstructorI() { - warnUnimpl("Test test_ConstructorI not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_layout_GridData((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorI"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorI")) test_ConstructorI(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridLayout.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridLayout.java deleted file mode 100644 index 124b662354..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridLayout.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.layout.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.layout.GridLayout - * - * @see org.eclipse.swt.layout.GridLayout - */ -public class Test_org_eclipse_swt_layout_GridLayout extends Test_org_eclipse_swt_widgets_Layout { - -public Test_org_eclipse_swt_layout_GridLayout(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ() { - warnUnimpl("Test test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ not written"); -} - -public void test_layoutLorg_eclipse_swt_widgets_CompositeZ() { - warnUnimpl("Test test_layoutLorg_eclipse_swt_widgets_CompositeZ not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_layout_GridLayout((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ"); - methodNames.addElement("test_layoutLorg_eclipse_swt_widgets_CompositeZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Layout.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ")) test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ(); - else if (getName().equals("test_layoutLorg_eclipse_swt_widgets_CompositeZ")) test_layoutLorg_eclipse_swt_widgets_CompositeZ(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowData.java deleted file mode 100644 index 5a3b66bb0e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowData.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.layout.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.layout.RowData - * - * @see org.eclipse.swt.layout.RowData - */ -public class Test_org_eclipse_swt_layout_RowData extends SwtTestCase { - -public Test_org_eclipse_swt_layout_RowData(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_ConstructorII() { - warnUnimpl("Test test_ConstructorII not written"); -} - -public void test_ConstructorLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_Point not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_layout_RowData((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorII"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_Point"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorII")) test_ConstructorII(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_Point")) test_ConstructorLorg_eclipse_swt_graphics_Point(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowLayout.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowLayout.java deleted file mode 100644 index 70ea1f40f6..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowLayout.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.layout.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.layout.RowLayout - * - * @see org.eclipse.swt.layout.RowLayout - */ -public class Test_org_eclipse_swt_layout_RowLayout extends Test_org_eclipse_swt_widgets_Layout { - -public Test_org_eclipse_swt_layout_RowLayout(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ() { - warnUnimpl("Test test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ not written"); -} - -public void test_layoutLorg_eclipse_swt_widgets_CompositeZ() { - warnUnimpl("Test test_layoutLorg_eclipse_swt_widgets_CompositeZ not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_layout_RowLayout((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ"); - methodNames.addElement("test_layoutLorg_eclipse_swt_widgets_CompositeZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Layout.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ")) test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ(); - else if (getName().equals("test_layoutLorg_eclipse_swt_widgets_CompositeZ")) test_layoutLorg_eclipse_swt_widgets_CompositeZ(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrintDialog.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrintDialog.java deleted file mode 100644 index c8cf6024a3..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrintDialog.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.printing.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.printing.PrintDialog - * - * @see org.eclipse.swt.printing.PrintDialog - */ -public class Test_org_eclipse_swt_printing_PrintDialog extends Test_org_eclipse_swt_widgets_Dialog { - - PrintDialog printDialog; - -public Test_org_eclipse_swt_printing_PrintDialog(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - printDialog = new PrintDialog(shell, SWT.NONE); - setDialog(printDialog); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Shell() { - new PrintDialog(shell); - - try { - new PrintDialog(null); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() { - new PrintDialog(shell, SWT.NONE); - - try { - new PrintDialog(null, SWT.NONE); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_getScope() { - warnUnimpl("Test test_getScope not written"); -} - -public void test_setScopeI() { - warnUnimpl("Test test_setScopeI not written"); -} - -public void test_getStartPage() { - warnUnimpl("Test test_getStartPage not written"); -} - -public void test_setStartPageI() { - warnUnimpl("Test test_setStartPageI not written"); -} - -public void test_getEndPage() { - warnUnimpl("Test test_getEndPage not written"); -} - -public void test_setEndPageI() { - warnUnimpl("Test test_setEndPageI not written"); -} - -public void test_getPrintToFile() { - warnUnimpl("Test test_getPrintToFile not written"); -} - -public void test_setPrintToFileZ() { - warnUnimpl("Test test_setPrintToFileZ not written"); -} - -public void test_checkSubclass() { - warnUnimpl("Test test_checkSubclass not written"); -} - -public void test_open() { - warnUnimpl("Test test_open not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_printing_PrintDialog((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI"); - methodNames.addElement("test_getScope"); - methodNames.addElement("test_setScopeI"); - methodNames.addElement("test_getStartPage"); - methodNames.addElement("test_setStartPageI"); - methodNames.addElement("test_getEndPage"); - methodNames.addElement("test_setEndPageI"); - methodNames.addElement("test_getPrintToFile"); - methodNames.addElement("test_setPrintToFileZ"); - methodNames.addElement("test_checkSubclass"); - methodNames.addElement("test_open"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Dialog.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI(); - else if (getName().equals("test_getScope")) test_getScope(); - else if (getName().equals("test_setScopeI")) test_setScopeI(); - else if (getName().equals("test_getStartPage")) test_getStartPage(); - else if (getName().equals("test_setStartPageI")) test_setStartPageI(); - else if (getName().equals("test_getEndPage")) test_getEndPage(); - else if (getName().equals("test_setEndPageI")) test_setEndPageI(); - else if (getName().equals("test_getPrintToFile")) test_getPrintToFile(); - else if (getName().equals("test_setPrintToFileZ")) test_setPrintToFileZ(); - else if (getName().equals("test_checkSubclass")) test_checkSubclass(); - else if (getName().equals("test_open")) test_open(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_Printer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_Printer.java deleted file mode 100644 index 5fcd3bef69..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_Printer.java +++ /dev/null @@ -1,168 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.printing.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.printing.Printer - * - * @see org.eclipse.swt.printing.Printer - */ -public class Test_org_eclipse_swt_printing_Printer extends Test_org_eclipse_swt_graphics_Device { - -public Test_org_eclipse_swt_printing_Printer(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_getPrinterList() { - warnUnimpl("Test test_getPrinterList not written"); -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_ConstructorLorg_eclipse_swt_printing_PrinterData() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_printing_PrinterData not written"); -} - -public void test_createLorg_eclipse_swt_graphics_DeviceData() { - warnUnimpl("Test test_createLorg_eclipse_swt_graphics_DeviceData not written"); -} - -public void test_internal_new_GCLorg_eclipse_swt_graphics_GCData() { - warnUnimpl("Test test_internal_new_GCLorg_eclipse_swt_graphics_GCData not written"); -} - -public void test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData() { - warnUnimpl("Test test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData not written"); -} - -public void test_startJobLjava_lang_String() { - warnUnimpl("Test test_startJobLjava_lang_String not written"); -} - -public void test_endJob() { - warnUnimpl("Test test_endJob not written"); -} - -public void test_cancelJob() { - warnUnimpl("Test test_cancelJob not written"); -} - -public void test_startPage() { - warnUnimpl("Test test_startPage not written"); -} - -public void test_endPage() { - warnUnimpl("Test test_endPage not written"); -} - -public void test_getDPI() { - warnUnimpl("Test test_getDPI not written"); -} - -public void test_getBounds() { - warnUnimpl("Test test_getBounds not written"); -} - -public void test_getClientArea() { - warnUnimpl("Test test_getClientArea not written"); -} - -public void test_computeTrimIIII() { - warnUnimpl("Test test_computeTrimIIII not written"); -} - -public void test_getPrinterData() { - warnUnimpl("Test test_getPrinterData not written"); -} - -public void test_checkDevice() { - warnUnimpl("Test test_checkDevice not written"); -} - -public void test_release() { - warnUnimpl("Test test_release not written"); -} - -public void test_destroy() { - warnUnimpl("Test test_destroy not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_printing_Printer((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_getPrinterList"); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_printing_PrinterData"); - methodNames.addElement("test_createLorg_eclipse_swt_graphics_DeviceData"); - methodNames.addElement("test_internal_new_GCLorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_startJobLjava_lang_String"); - methodNames.addElement("test_endJob"); - methodNames.addElement("test_cancelJob"); - methodNames.addElement("test_startPage"); - methodNames.addElement("test_endPage"); - methodNames.addElement("test_getDPI"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getClientArea"); - methodNames.addElement("test_computeTrimIIII"); - methodNames.addElement("test_getPrinterData"); - methodNames.addElement("test_checkDevice"); - methodNames.addElement("test_release"); - methodNames.addElement("test_destroy"); - methodNames.addAll(Test_org_eclipse_swt_graphics_Device.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_getPrinterList")) test_getPrinterList(); - else if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_printing_PrinterData")) test_ConstructorLorg_eclipse_swt_printing_PrinterData(); - else if (getName().equals("test_createLorg_eclipse_swt_graphics_DeviceData")) test_createLorg_eclipse_swt_graphics_DeviceData(); - else if (getName().equals("test_internal_new_GCLorg_eclipse_swt_graphics_GCData")) test_internal_new_GCLorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData")) test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_startJobLjava_lang_String")) test_startJobLjava_lang_String(); - else if (getName().equals("test_endJob")) test_endJob(); - else if (getName().equals("test_cancelJob")) test_cancelJob(); - else if (getName().equals("test_startPage")) test_startPage(); - else if (getName().equals("test_endPage")) test_endPage(); - else if (getName().equals("test_getDPI")) test_getDPI(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getClientArea")) test_getClientArea(); - else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII(); - else if (getName().equals("test_getPrinterData")) test_getPrinterData(); - else if (getName().equals("test_checkDevice")) test_checkDevice(); - else if (getName().equals("test_release")) test_release(); - else if (getName().equals("test_destroy")) test_destroy(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrinterData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrinterData.java deleted file mode 100644 index 13aa24b090..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrinterData.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.printing.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.printing.PrinterData - * - * @see org.eclipse.swt.printing.PrinterData - */ -public class Test_org_eclipse_swt_printing_PrinterData extends Test_org_eclipse_swt_graphics_DeviceData { - -public Test_org_eclipse_swt_printing_PrinterData(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_Constructor() { - PrinterData data = new PrinterData(); -} - -public void test_ConstructorLjava_lang_StringLjava_lang_String() { - PrinterData data = new PrinterData("hello", "there"); -} - -public void test_toString() { - PrinterData data = new PrinterData(); - assertNotNull(data.toString()); - assertTrue(data.toString().length() > 0); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_printing_PrinterData((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorLjava_lang_StringLjava_lang_String"); - methodNames.addElement("test_toString"); - methodNames.addAll(Test_org_eclipse_swt_graphics_DeviceData.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorLjava_lang_StringLjava_lang_String")) test_ConstructorLjava_lang_StringLjava_lang_String(); - else if (getName().equals("test_toString")) test_toString(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_program_Program.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_program_Program.java deleted file mode 100644 index 57f20014e7..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_program_Program.java +++ /dev/null @@ -1,110 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.program.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.program.Program - * - * @see org.eclipse.swt.program.Program - */ -public class Test_org_eclipse_swt_program_Program extends SwtTestCase { - -public Test_org_eclipse_swt_program_Program(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_findProgramLjava_lang_String() { - warnUnimpl("Test test_findProgramLjava_lang_String not written"); -} - -public void test_getExtensions() { - warnUnimpl("Test test_getExtensions not written"); -} - -public void test_getPrograms() { - warnUnimpl("Test test_getPrograms not written"); -} - -public void test_launchLjava_lang_String() { - warnUnimpl("Test test_launchLjava_lang_String not written"); -} - -public void test_executeLjava_lang_String() { - warnUnimpl("Test test_executeLjava_lang_String not written"); -} - -public void test_getImageData() { - warnUnimpl("Test test_getImageData not written"); -} - -public void test_getName() { - warnUnimpl("Test test_getName not written"); -} - -public void test_equalsLjava_lang_Object() { - warnUnimpl("Test test_equalsLjava_lang_Object not written"); -} - -public void test_hashCode() { - warnUnimpl("Test test_hashCode not written"); -} - -public void test_toString() { - warnUnimpl("Test test_toString not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_program_Program((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_findProgramLjava_lang_String"); - methodNames.addElement("test_getExtensions"); - methodNames.addElement("test_getPrograms"); - methodNames.addElement("test_launchLjava_lang_String"); - methodNames.addElement("test_executeLjava_lang_String"); - methodNames.addElement("test_getImageData"); - methodNames.addElement("test_getName"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_toString"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_findProgramLjava_lang_String")) test_findProgramLjava_lang_String(); - else if (getName().equals("test_getExtensions")) test_getExtensions(); - else if (getName().equals("test_getPrograms")) test_getPrograms(); - else if (getName().equals("test_launchLjava_lang_String")) test_launchLjava_lang_String(); - else if (getName().equals("test_executeLjava_lang_String")) test_executeLjava_lang_String(); - else if (getName().equals("test_getImageData")) test_getImageData(); - else if (getName().equals("test_getName")) test_getName(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_toString")) test_toString(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Button.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Button.java deleted file mode 100644 index 73ee6f349f..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Button.java +++ /dev/null @@ -1,272 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Button - * - * @see org.eclipse.swt.widgets.Button - */ -public class Test_org_eclipse_swt_widgets_Button extends Test_org_eclipse_swt_widgets_Control { - -Button button; - -public Test_org_eclipse_swt_widgets_Button(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- button = new Button(shell, SWT.PUSH);
- setWidget(button);
-} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- // Test Button(Composite parent, int style)
- Button button = new Button(shell, SWT.NULL);
-
- button = new Button(shell, SWT.PUSH);
-
- button = new Button(shell, SWT.CHECK);
-
- button = new Button(shell, SWT.TOGGLE);
-
- button = new Button(shell, SWT.ARROW);
-
- button = new Button(shell, SWT.PUSH | SWT.CHECK);
-
- try {
- button = new Button(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_computeSizeIIZ() {
- button.computeSize(0, 0);
-
- button.computeSize(0, 0, false);
-
- button.computeSize(-10, -10);
-
- button.computeSize(-10, -10, false);
-
- button.computeSize(10, 10);
-
- button.computeSize(10, 10, false);
-
- button.computeSize(10000, 10000);
-
- button.computeSize(10000, 10000, false);
-} - -public void test_getAlignment() { - warnUnimpl("Test test_getAlignment not written"); -} - -public void test_getImage() {
- // tested in test_setImageLorg_eclipse_swt_graphics_Image
-} - -public void test_getSelection() {
- // tested in test_setSelectionZ
-} - -public void test_getText() { - warnUnimpl("Test test_getText not written"); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_setAlignmentI() {
- button.setAlignment(SWT.LEFT);
- assertEquals(SWT.LEFT, button.getAlignment());
-
- button.setAlignment(SWT.RIGHT);
- assertEquals(SWT.RIGHT, button.getAlignment());
-
- button.setAlignment(SWT.CENTER);
- assertEquals(SWT.CENTER, button.getAlignment());
-
- button.setAlignment(SWT.UP); // bad value for push button
- assertTrue(SWT.UP != button.getAlignment());
-
- Button arrowButton = new Button(shell, SWT.ARROW);
- arrowButton.setAlignment(SWT.LEFT);
- assertEquals(SWT.LEFT, arrowButton.getAlignment());
-
- arrowButton.setAlignment(SWT.RIGHT);
- assertEquals(SWT.RIGHT, arrowButton.getAlignment());
-
- arrowButton.setAlignment(SWT.UP);
- assertEquals(SWT.UP, arrowButton.getAlignment());
-
- arrowButton.setAlignment(SWT.DOWN);
- assertEquals(SWT.DOWN, arrowButton.getAlignment());
-
- arrowButton.setAlignment(SWT.CENTER); // bad value for arrow button
- assertTrue(SWT.CENTER != arrowButton.getAlignment());
- arrowButton.dispose();
-
- int alignment = 55; // some bogus number
- button.setAlignment(alignment);
- assertTrue(alignment != button.getAlignment());
-} - -public void test_setFocus() { - warnUnimpl("Test test_setFocus not written"); -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - Image image = button.getImage();
- button.setImage(image); - assertEquals(image, button.getImage());
-
- button.setImage(null); - assertNull(button.getImage());
-
- image = new Image(shell.getDisplay(), 10, 10);
- button.setImage(image); - assertEquals(image, button.getImage()); - - button.setImage(null); - image.dispose();
- try {
- button.setImage(image);
- button.setImage(null); - fail("No exception thrown for disposed image"); - } catch (IllegalArgumentException e) {
- }
-} - -public void test_setSelectionZ() {
- // test setSelection for check box
- button = new Button(shell, SWT.CHECK);
- button.setSelection(true);
- assertTrue(button.getSelection());
- button.setSelection(false);
- assertTrue(!button.getSelection());
-
- // test setSelection for arrow button
- Button newButton = new Button(shell, SWT.ARROW);
- newButton.setSelection(true);
- assertTrue(!newButton.getSelection());
- newButton.setSelection(false);
- assertTrue(!newButton.getSelection());
- newButton.dispose();
-
- // test setSelection for push button
- newButton = new Button(shell, SWT.PUSH);
- newButton.setSelection(true);
- assertTrue(!newButton.getSelection());
- newButton.setSelection(false);
- assertTrue(!newButton.getSelection());
- newButton.dispose();
-
- // test setSelection for radio button
- newButton = new Button(shell, SWT.RADIO);
- newButton.setSelection(true);
- assertTrue(newButton.getSelection());
- newButton.setSelection(false);
- assertTrue(!newButton.getSelection());
- newButton.dispose();
-
- // test setSelection for toggle button
- newButton = new Button(shell, SWT.TOGGLE);
- newButton.setSelection(true);
- assertTrue(newButton.getSelection());
- newButton.setSelection(false);
- assertTrue(!newButton.getSelection());
- newButton.dispose();
-} - -public void test_setTextLjava_lang_String() {
- String[] cases = {"", "some text", "ldkashdoehufweovcnhslvhregojebckreavbkuhxbiufvcyhbifuyewvbiureyd.,cmnesljliewjfchvbwoifivbeworixuieurvbiuvbohflksjeahfcliureafgyciabelitvyrwtlicuyrtliureybcliuyreuceyvbliureybct", "\n \n \b \t ", "\0"};
- int goodCases = 4;
- for (int i=0; i<goodCases; i++){
- button.setText(cases[i]);
- assertTrue("good case: " + String.valueOf(i), button.getText().equals(cases[i]));
- };
-
- try {
- button.setText(null);
- fail("No exception thrown for text == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- button.setText("");
-
- button.setText("some name ");
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Button((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_getAlignment"); - methodNames.addElement("test_getImage"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_setAlignmentI"); - methodNames.addElement("test_setFocus"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setSelectionZ"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_getAlignment")) test_getAlignment(); - else if (getName().equals("test_getImage")) test_getImage(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_setAlignmentI")) test_setAlignmentI(); - else if (getName().equals("test_setFocus")) test_setFocus(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setSelectionZ")) test_setSelectionZ(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Canvas.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Canvas.java deleted file mode 100644 index 96929f2ea6..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Canvas.java +++ /dev/null @@ -1,113 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Canvas - * - * @see org.eclipse.swt.widgets.Canvas - */ -public class Test_org_eclipse_swt_widgets_Canvas extends Test_org_eclipse_swt_widgets_Composite { - -Canvas canvas; - -public Test_org_eclipse_swt_widgets_Canvas(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- canvas = new Canvas(shell, 0);
- super.setWidget(canvas);
-} - -protected void tearDown() { - super.tearDown(); -} - -protected void setWidget(Widget w) { - if (!canvas.isDisposed()) - canvas.dispose();
- canvas = (Canvas)w;
- super.setWidget(w);
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- Canvas newCanvas;
- try {
- newCanvas = new Canvas(null, SWT.NONE);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-} - -public void test_getCaret() {
- // tested in test_setCaretLorg_eclipse_swt_widgets_Caret
-} - -public void test_scrollIIIIIIZ() { - warnUnimpl("Test test_scrollIIIIIIZ not written"); -} - -public void test_setCaretLorg_eclipse_swt_widgets_Caret() {
- int number = 5;
- Caret[] carets = new Caret[number];
- for (int i = 0; i < number; i++) {
- carets[i] = new Caret(canvas, SWT.NONE);
- }
- for (int i = 0; i < number; i++) {
- canvas.setCaret(carets[i]);
- assertEquals("Caret # " + i + "not set properly", canvas.getCaret(), carets[i]);
- }
-
- canvas.setCaret(null);
- assertNull("Caret should be null" , canvas.getCaret());
-} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Canvas((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_getCaret"); - methodNames.addElement("test_scrollIIIIIIZ"); - methodNames.addElement("test_setCaretLorg_eclipse_swt_widgets_Caret"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_getCaret")) test_getCaret(); - else if (getName().equals("test_scrollIIIIIIZ")) test_scrollIIIIIIZ(); - else if (getName().equals("test_setCaretLorg_eclipse_swt_widgets_Caret")) test_setCaretLorg_eclipse_swt_widgets_Caret(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Caret.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Caret.java deleted file mode 100644 index 3e3e519bbd..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Caret.java +++ /dev/null @@ -1,210 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Caret - * - * @see org.eclipse.swt.widgets.Caret - */ -public class Test_org_eclipse_swt_widgets_Caret extends Test_org_eclipse_swt_widgets_Widget { - -Canvas canvas; -Caret caret; - -public Test_org_eclipse_swt_widgets_Caret(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- canvas = new Canvas(shell, SWT.NULL);
- caret = new Caret(canvas, SWT.NULL);
- setWidget(caret);
-} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CanvasI() {
- Caret newCaret;
- try {
- newCaret = new Caret(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-} - -public void test_getBounds() {
- Rectangle rect = new Rectangle(0,0,30,30);
- caret.setBounds(rect);
- assertTrue(caret.getBounds().equals(rect));
-
- rect = new Rectangle(0,0,30,30);
- caret.setBounds(rect);
- assertTrue(!caret.getBounds().equals(new Rectangle (0,0,60,70)));
-} - -public void test_getFont() { - // tested in test_setFontLorg_eclipse_swt_graphics_Font -} - -public void test_getImage() { - // tested in test_setImageLorg_eclipse_swt_graphics_Image -} - -public void test_getParent() {
- assertEquals(canvas, caret.getParent());
-
- assertTrue(caret.getDisplay()==shell.getDisplay());
-} - -public void test_getVisible() {
- // tested in test_setVisibleZ
-} - -public void test_isVisible() {
- caret.setVisible(true);
- assertTrue(!caret.isVisible()); //because the shell is not visible
-
- caret.setVisible(false);
- assertTrue(!caret.isVisible());
-
- caret.setVisible(true);
- canvas.setVisible(true);
- shell.setVisible(true);
- assertTrue(caret.getVisible() == true);
- canvas.setVisible(false);
- if (fCheckVisibility) {
- assertTrue(!caret.getVisible());
- }
-
- shell.setVisible(false);
- canvas.setVisible(false);
- caret.setVisible(false);
- assertTrue(!caret.getVisible());
-} - -public void test_setBoundsIIII() {
- caret.setBounds(0, 0, 30, 30);
-} - -public void test_setBoundsLorg_eclipse_swt_graphics_Rectangle() {
- caret.setBounds(new Rectangle(0,0,30,30));
-
- try {
- caret.setBounds(null);
- fail("No exception thrown for bounds == null");
- }
- catch (IllegalArgumentException e) {
- }
-} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - Font font = caret.getFont(); - caret.setFont(font); - assertEquals(font, caret.getFont()); - - font = new Font(caret.getDisplay(), SwtJunit.testFontName, 10, SWT.NORMAL); - caret.setFont(font); - assertEquals(font, caret.getFont()); - - caret.setFont(null); - font.dispose(); - try { - caret.setFont(font); - caret.setFont(null); - fail("No exception thrown for disposed font"); - } catch (IllegalArgumentException e) { - } -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - Image image = caret.getImage(); - caret.setImage(image); - assertEquals(image, caret.getImage()); - - caret.setImage(null); - assertNull(caret.getImage()); - - image = new Image(shell.getDisplay(), 10, 10); - caret.setImage(image); - assertEquals(image, caret.getImage()); - - caret.setImage(null); - image.dispose(); - try { - caret.setImage(image); - caret.setImage(null); - fail("No exception thrown for disposed image"); - } catch (IllegalArgumentException e) { - } -} - -public void test_setVisibleZ() {
- caret.setVisible(true);
- assertTrue("Caret should be visible", caret.getVisible()==true);
-
- caret.setVisible(false);
- assertTrue("Caret should not be visible", caret.getVisible()==false);
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Caret((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CanvasI"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getFont"); - methodNames.addElement("test_getImage"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getVisible"); - methodNames.addElement("test_isVisible"); - methodNames.addElement("test_setBoundsIIII"); - methodNames.addElement("test_setBoundsLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setVisibleZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CanvasI")) test_ConstructorLorg_eclipse_swt_widgets_CanvasI(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getFont")) test_getFont(); - else if (getName().equals("test_getImage")) test_getImage(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getVisible")) test_getVisible(); - else if (getName().equals("test_isVisible")) test_isVisible(); - else if (getName().equals("test_setBoundsIIII")) test_setBoundsIIII(); - else if (getName().equals("test_setBoundsLorg_eclipse_swt_graphics_Rectangle")) test_setBoundsLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setVisibleZ")) test_setVisibleZ(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ColorDialog.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ColorDialog.java deleted file mode 100644 index d8f2bb4de3..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ColorDialog.java +++ /dev/null @@ -1,118 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.ColorDialog - * - * @see org.eclipse.swt.widgets.ColorDialog - */ -public class Test_org_eclipse_swt_widgets_ColorDialog extends Test_org_eclipse_swt_widgets_Dialog { - -ColorDialog colorDialog; - -public Test_org_eclipse_swt_widgets_ColorDialog(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- colorDialog = new ColorDialog(shell, SWT.NULL);
- setDialog(colorDialog);
-} - -protected void tearDown() {
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_Shell() {
- new ColorDialog(shell);
-
- try { - new ColorDialog(null); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - }
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() {
- new ColorDialog(shell, SWT.NULL);
-
- try { - new ColorDialog(null, SWT.NULL); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - }
-} - -public void test_getRGB() {
- // tested in test_setRGBLorg_eclipse_swt_graphics_RGB
-} - -public void test_open() { - warnUnimpl("Test test_open not written"); -} - -public void test_setRGBLorg_eclipse_swt_graphics_RGB() {
- RGB rgb = new RGB(0, 0, 0);
-
- assertTrue(":a:", colorDialog.getRGB() == null);
-
- colorDialog.setRGB(rgb);
- assertTrue(":b:", colorDialog.getRGB() == rgb);
-
- if (fCheckSwtNullExceptions) {
- try {
- colorDialog.setRGB(null);
- fail("No exception thrown for rgb == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
- assertTrue(":c:", colorDialog.getRGB() == rgb);
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_ColorDialog((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI"); - methodNames.addElement("test_getRGB"); - methodNames.addElement("test_open"); - methodNames.addElement("test_setRGBLorg_eclipse_swt_graphics_RGB"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Dialog.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI(); - else if (getName().equals("test_getRGB")) test_getRGB(); - else if (getName().equals("test_open")) test_open(); - else if (getName().equals("test_setRGBLorg_eclipse_swt_graphics_RGB")) test_setRGBLorg_eclipse_swt_graphics_RGB(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java deleted file mode 100644 index cf5324a140..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java +++ /dev/null @@ -1,681 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Combo - * - * @see org.eclipse.swt.widgets.Combo - */ -public class Test_org_eclipse_swt_widgets_Combo extends Test_org_eclipse_swt_widgets_Composite { - -Combo combo; - -public Test_org_eclipse_swt_widgets_Combo(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- combo = new Combo(shell, 0);
- setWidget(combo);
-} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- try {
- combo = new Combo(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {SWT.DROP_DOWN, SWT.SIMPLE};
- for (int i = 0; i < cases.length; i++) {
- combo = new Combo(shell, cases[i]);
- assertTrue(":a:" + String.valueOf(i), combo.getStyle() == cases[i]);
- }
-} - -public void test_addLjava_lang_String() {
- try {
- combo.add(null);
- fail("No exception thrown for item == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- combo.add("");
- assertEquals(":a:", new String[]{""}, combo.getItems());
- combo.add("");
- assertEquals(":b:", new String[]{"", ""}, combo.getItems());
- combo.add("fred");
- assertEquals(":c:", new String[]{"", "", "fred"}, combo.getItems());
-
-} - -public void test_addLjava_lang_StringI() {
- combo.add("fred", 0);
- assertEquals("fred", new String[]{"fred"}, combo.getItems());
- combo.add("fred", 0);
- assertEquals("fred fred", new String[]{"fred", "fred"}, combo.getItems());
- combo.add("fred");
- assertEquals("fred fred fred", new String[]{"fred", "fred", "fred"}, combo.getItems());
- combo.removeAll();
-
- int number = 3;
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- combo.add("fred", number);
- assertEquals("fred0 fred1 fred2 fred", new String[]{"fred0", "fred1", "fred2", "fred"}, combo.getItems());
-
- combo.removeAll();
- number = 3;
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- combo.add("fred", 1);
- assertEquals("fred0 fred fred1 fred2", new String[]{"fred0", "fred", "fred1", "fred2"}, combo.getItems());
- combo.add("fred", 0);
- assertEquals("fred fred0 fred fred1 fred2", new String[]{"fred", "fred0", "fred", "fred1", "fred2"}, combo.getItems());
- combo.add("fred", 4);
- assertEquals("fred fred0 fred fred1 fred fred2", new String[]{"fred", "fred0", "fred", "fred1", "fred", "fred2"}, combo.getItems());
-} - -public void test_addModifyListenerLorg_eclipse_swt_events_ModifyListener() { - warnUnimpl("Test test_addModifyListenerLorg_eclipse_swt_events_ModifyListener not written"); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_checkSubclass() { - warnUnimpl("Test test_checkSubclass not written"); -} - -public void test_clearSelection() {
- int number = 5;
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- combo.clearSelection();
- assertTrue(":a:", combo.getSelection().equals(new Point(0, 0)));
- combo.setSelection(new Point(0, 5));
- assertTrue(":b:", combo.getSelection().equals(new Point(0, 0))); //nothing is selected
- combo.setText("some text");
- combo.setSelection(new Point(0, 5));
- assertTrue(":c:", combo.getSelection().equals(new Point(0, 5)));
- combo.clearSelection();
- assertTrue(":d:", combo.getSelection().x==combo.getSelection().y);
-} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_deselectI() {
- combo.deselect(2);
-
- int number = 10;
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- for (int i = 0; i < number; i++) {
- combo.select(i);
- assertTrue(":a:" + i, combo.getSelectionIndex()==i);
- combo.deselect(i);
- assertTrue(":b:" + i, combo.getSelectionIndex()==-1);
- }
-} - -public void test_deselectAll() { - warnUnimpl("Test test_deselectAll not written"); -} - -public void test_getChildren() { - // Combo cannot have children -} - -public void test_getItemI() {
- try {
- combo.getItem(0);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- int number = 10;
- for (int i = 0; i < number; i++) {
- combo.add("fred" + i);
- }
- for (int i = 0; i < number; i++)
- assertTrue(combo.getItem(i).equals("fred" + i));
-} - -public void test_getItemCount() {
- int number = 10;
- for (int i = 0; i < number; i++) {
- assertTrue(":a:" + i, combo.getItemCount() == i);
- combo.add("fred" + i);
- }
- assertTrue(":aa:", combo.getItemCount() == number);
-
- for (int i = 0; i < number; i++) {
- assertTrue(":b:" + i, combo.getItemCount() == number-i);
- combo.remove(0);
- }
- combo.removeAll();
- assertTrue(":c:", combo.getItemCount() == 0);
-} - -public void test_getItemHeight() {
- combo.getItemHeight();
-} - -public void test_getItems() { - warnUnimpl("Test test_getItems not written"); -} - -public void test_getSelection() { - warnUnimpl("Test test_getSelection not written"); -} - -public void test_getSelectionIndex() {
- int number = 5;
- for (int i = 0; i < number; i++) {
- combo.add("fred");
- }
- assertEquals(-1, combo.getSelectionIndex());
- for (int i = 0; i < number; i++) {
- combo.select(i);
- assertEquals(i, combo.getSelectionIndex());
- }
-
- combo.removeAll();
- for (int i = 0; i < number; i++) {
- combo.add("fred");
- }
- assertEquals(-1, combo.getSelectionIndex());
- for (int i = 0; i < number; i++) {
- combo.select(i);
- combo.deselect(i);
- assertEquals(-1, combo.getSelectionIndex());
- }
-} - -public void test_getText() {
- String[] cases = {"", "fred", "fredfred"};
- for (int i = 0; i < cases.length; i++) {
- combo.setText(cases[i]);
- assertTrue(":a:" + String.valueOf(i), cases[i].equals(combo.getText()));
- }
-} - -public void test_getTextHeight() {
- combo.getTextHeight();
-} - -public void test_getTextLimit() { - warnUnimpl("Test test_getTextLimit not written"); -} - -public void test_hasFocus() { - warnUnimpl("Test test_hasFocus not written"); -} - -public void test_indexOfLjava_lang_String() {
- int number = 5;
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- for (int i = 0; i < number; i++)
- assertEquals(i, combo.indexOf("fred" + i));
-
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- combo.removeAll();
- for (int i = 0; i < number; i++)
- assertEquals(-1, combo.indexOf("fred" + i));
-
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- combo.remove("fred3");
- for (int i = 0; i < 3; i++)
- assertEquals(i, combo.indexOf("fred" + i));
- assertEquals(-1, combo.indexOf("fred3"));
- for (int i = 4; i < number; i++)
- assertEquals(i - 1, combo.indexOf("fred" + i));
-
- combo.removeAll();
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- combo.remove(2);
- for (int i = 0; i < 2; i++)
- assertEquals(i, combo.indexOf("fred" + i));
- assertEquals(-1, combo.indexOf("fred2"));
- for (int i = 3; i < number; i++)
- assertEquals(i - 1, combo.indexOf("fred" + i));
-} - -public void test_indexOfLjava_lang_StringI() {
- int number = 5;
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- for (int i = 0; i < number; i++)
- assertTrue(":a:" + i, combo.indexOf("fred" + i, 0) == i);
- for (int i = 0; i < number; i++)
- assertTrue(":b:" + i, combo.indexOf("fred" + i, i + 1) == -1);
-
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- for (int i = 0; i < 3; i++)
- assertTrue(":a:" + i, combo.indexOf("fred" + i, 0) == i);
- for (int i = 3; i < number; i++)
- assertTrue(":b:" + i, combo.indexOf("fred" + i, 3) == i);
- for (int i = 0; i < number; i++)
- assertTrue(":b:" + i, combo.indexOf("fred" + i, i) == i);
-} - -public void test_removeI() {
- try {
- combo.remove(0);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- combo.remove(3);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- int number = 5;
- for (int i = 0; i < number; i++) {
- combo.add("fred" + i);
- }
- for (int i = 0; i < number; i++) {
- assertEquals("Wrong number of items", number - i, combo.getItemCount());
- combo.remove(0);
- }
-
- for (int i = 0; i < number; i++) {
- combo.add("fred"); // all items the same
- }
- for (int i = 0; i < number; i++) {
- assertEquals("Wrong number of items", number - i, combo.getItemCount());
- combo.remove(0);
- }
-
- for (int i = 0; i < number; i++) {
- combo.add("fred" + i); // different items
- }
- for (int i = 0; i < number; i++) {
- assertEquals("index " + i, number - i, combo.getItemCount());
- combo.select(0);
- assertEquals("index " + i, 0, combo.getSelectionIndex());
- combo.remove(0); - if (SwtJunit.isWindows) { - // The behavior on Windows when the selected item is removed - // is to simply say that no items are selected.
- assertEquals("index " + i, -1, combo.getSelectionIndex()); - } else { - // The behavior on other platforms when the selected item is removed - // is to select the item that is now at the same index, and send a - // selection event. If there is no item at the selected index, then - // the platform says that no items are selected. - if (i < number - 1) { - assertEquals("index " + i, 0, combo.getSelectionIndex()); - } else { - assertEquals("index " + i, -1, combo.getSelectionIndex()); - } - }
- }
-
- for (int i = 0; i < number; i++)
- combo.add("fred" + i); // different items
- for (int i = 0; i < number; i++) {
- assertEquals("index " + i, number - i, combo.getItemCount());
- combo.remove(number-i-1);
- }
-} - -public void test_removeII() {
- int number = 5;
- for (int i = 0; i < number; i++) {
- combo.add("fred");
- }
- combo.remove(0, 4);
- assertEquals(0, combo.getItemCount());
-
- combo.removeAll();
- for (int i = 0; i < number; i++) {
- combo.add("fred");
- }
- combo.remove(0, 2);
- assertEquals(2, combo.getItemCount());
-
- combo.removeAll();
- for (int i = 0; i < number; i++) {
- combo.add("fred");
- }
- combo.remove(2, 4);
- assertEquals(2, combo.getItemCount());
-
- combo.removeAll();
- for (int i = 0; i < number; i++) {
- combo.add("fred");
- }
- combo.remove(3, 2);
- assertEquals(number, combo.getItemCount());
-
- combo.removeAll();
- for (int i = 0; i < number; i++) {
- combo.add("fred");
- }
-
- try {
- combo.remove(2, 100);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-} - -public void test_removeLjava_lang_String() {
- int number = 5;
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- for (int i = 0; i < number; i++) {
- assertEquals(number - i, combo.getItemCount());
- combo.remove("fred" + i);
- }
-
- for (int i = 0; i < number; i++)
- combo.add("fred");
- for (int i = 0; i < number; i++) {
- assertEquals(number - i, combo.getItemCount());
- combo.remove("fred");
- }
-
- for (int i = 0; i < number; i++)
- combo.add("fred");
- try {
- combo.remove(null);
- fail("No exception thrown for item == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- combo.removeAll();
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- try {
- combo.remove("fred");
- fail("No exception thrown for item not found");
- }
- catch (IllegalArgumentException e) {
- }
-
- assertEquals(number, combo.getItemCount());
-} - -public void test_removeAll() { - warnUnimpl("Test test_removeAll not written"); -} - -public void test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener() { - warnUnimpl("Test test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener not written"); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_selectI() { - warnUnimpl("Test test_selectI not written"); -} - -public void test_setBoundsIIII() { - combo.setBounds(10, 20, 30, 40); - // only check x, y, and width - you can't set the height of a combo - assertTrue(combo.getBounds().x == 10); - assertTrue(combo.getBounds().y == 20); - assertTrue(combo.getBounds().width == 30); -} - -public void test_setBoundsLorg_eclipse_swt_graphics_Rectangle() { - combo.setBounds(new Rectangle(10, 20, 30, 40)); - // only check x, y, and width - you can't set the height of a combo - assertTrue(combo.getBounds().x == 10); - assertTrue(combo.getBounds().y == 20); - assertTrue(combo.getBounds().width == 30); -} - -public void test_setItemILjava_lang_String() {
- try {
- combo.setItem(0, null);
- fail("No exception thrown for item == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- combo.setItem(3, null);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- combo.setItem(0, "fred");
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
- combo.add("joe");
- combo.setItem(0, "fred");
- assertTrue("fred", combo.getItem(0).equals("fred"));
-
- try {
- combo.setItem(4, "fred");
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- combo.removeAll();
- int number = 5;
- for (int i = 0; i < number; i++)
- combo.add("fred");
- for (int i = 0; i < number; i++)
- combo.setItem(i, "fred" + i);
- assertEquals(":a:", new String[]{"fred0", "fred1", "fred2", "fred3", "fred4"}, combo.getItems());
-} - -public void test_setItems$Ljava_lang_String() {
- try {
- combo.setItems(null);
- fail("No exception thrown for items == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- String[][] items = {{}, {""}, {"", ""}, {"fred"}, {"fred0", "fred0"}, {"fred", "fred"}};
-
- for (int i = 0 ; i< items.length; i++){
- combo.setItems(items[i]);
- assertEquals(":a:" + i, items[i], combo.getItems());}
-} - -public void test_setSelectionLorg_eclipse_swt_graphics_Point() {
- int number = 5;
- for (int i = 0; i < number; i++)
- combo.add("fred" + i);
- combo.setSelection(new Point(0, 5));
- assertTrue(":a:", combo.getSelection().equals(new Point(0, 0)));
- combo.setText("some text");
- combo.setSelection(new Point(0, 5));
- assertTrue(":b:", combo.getSelection().equals(new Point(0, 5)));
-} - -public void test_setSizeII() { - combo.setSize(30, 40); - // only check the width - you can't set the height of a combo - assertTrue(combo.getSize().x == 30); - - combo.setSize(32, 43); - // only check the width - you can't set the height of a combo - assertTrue(combo.getSize().x == 32); -} - -public void test_setSizeLorg_eclipse_swt_graphics_Point() { - combo.setSize(new Point(30, 40)); - // only check the width - you can't set the height of a combo - assertTrue(combo.getSize().x == 30); - - combo.setBounds(32, 43, 33, 44); - // only check the width - you can't set the height of a combo - assertTrue(combo.getSize().x == 33); - - combo.setBounds(32, 43, 30, 40); - combo.setLocation(11, 22); - combo.setSize(new Point(32, 43)); - // only check the width - you can't set the height of a combo - assertTrue(combo.getSize().x == 32); -} - -public void test_setTabGroupFocus() { - warnUnimpl("Test test_setTabGroupFocus not written"); -} - -public void test_setTextLjava_lang_String() {
- String[] cases = {"", "fred", "fred0"};
- for (int i = 0; i < cases.length; i++) {
- combo.setText(cases[i]);
- assertTrue(":a:" + i, combo.getText().equals(cases[i]));
- }
- for (int i = 0; i < 5; i++) {
- combo.add("fred");
- }
- for (int i = 0; i < cases.length; i++) {
- combo.setText(cases[i]);
- assertTrue(":b:" + i, combo.getText().equals(cases[i]));
- }
- for (int i = 0; i < 5; i++) {
- combo.add("fred" + i);
- }
- for (int i = 0; i < cases.length; i++) {
- combo.setText(cases[i]);
- assertTrue(":c:" + i, combo.getText().equals(cases[i]));
- }
-} - -public void test_setTextLimitI() { - warnUnimpl("Test test_setTextLimitI not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Combo((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addLjava_lang_String"); - methodNames.addElement("test_addLjava_lang_StringI"); - methodNames.addElement("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_checkSubclass"); - methodNames.addElement("test_clearSelection"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_deselectI"); - methodNames.addElement("test_deselectAll"); - methodNames.addElement("test_getItemI"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItemHeight"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionIndex"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_getTextHeight"); - methodNames.addElement("test_getTextLimit"); - methodNames.addElement("test_hasFocus"); - methodNames.addElement("test_indexOfLjava_lang_String"); - methodNames.addElement("test_indexOfLjava_lang_StringI"); - methodNames.addElement("test_removeI"); - methodNames.addElement("test_removeII"); - methodNames.addElement("test_removeLjava_lang_String"); - methodNames.addElement("test_removeAll"); - methodNames.addElement("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_selectI"); - methodNames.addElement("test_setItemILjava_lang_String"); - methodNames.addElement("test_setItems$Ljava_lang_String"); - methodNames.addElement("test_setSelectionLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setTabGroupFocus"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_setTextLimitI"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addLjava_lang_String")) test_addLjava_lang_String(); - else if (getName().equals("test_addLjava_lang_StringI")) test_addLjava_lang_StringI(); - else if (getName().equals("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_addModifyListenerLorg_eclipse_swt_events_ModifyListener(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_checkSubclass")) test_checkSubclass(); - else if (getName().equals("test_clearSelection")) test_clearSelection(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_deselectI")) test_deselectI(); - else if (getName().equals("test_deselectAll")) test_deselectAll(); - else if (getName().equals("test_getItemI")) test_getItemI(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItemHeight")) test_getItemHeight(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionIndex")) test_getSelectionIndex(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_getTextHeight")) test_getTextHeight(); - else if (getName().equals("test_getTextLimit")) test_getTextLimit(); - else if (getName().equals("test_hasFocus")) test_hasFocus(); - else if (getName().equals("test_indexOfLjava_lang_String")) test_indexOfLjava_lang_String(); - else if (getName().equals("test_indexOfLjava_lang_StringI")) test_indexOfLjava_lang_StringI(); - else if (getName().equals("test_removeI")) test_removeI(); - else if (getName().equals("test_removeII")) test_removeII(); - else if (getName().equals("test_removeLjava_lang_String")) test_removeLjava_lang_String(); - else if (getName().equals("test_removeAll")) test_removeAll(); - else if (getName().equals("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_selectI")) test_selectI(); - else if (getName().equals("test_setItemILjava_lang_String")) test_setItemILjava_lang_String(); - else if (getName().equals("test_setItems$Ljava_lang_String")) test_setItems$Ljava_lang_String(); - else if (getName().equals("test_setSelectionLorg_eclipse_swt_graphics_Point")) test_setSelectionLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setTabGroupFocus")) test_setTabGroupFocus(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_setTextLimitI")) test_setTextLimitI(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java deleted file mode 100644 index 04d979292c..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java +++ /dev/null @@ -1,157 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Composite - * - * @see org.eclipse.swt.widgets.Composite - */ -public class Test_org_eclipse_swt_widgets_Composite extends Test_org_eclipse_swt_widgets_Scrollable { - -Composite composite; - -public Test_org_eclipse_swt_widgets_Composite(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- composite = new Composite(shell, 0);
- super.setWidget(composite);
-} - -protected void tearDown() { - super.tearDown(); -} - -protected void setWidget(Widget w) {
- if (composite != null)
- composite.dispose();
- composite = (Composite)w;
- super.setWidget(w);
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- try {
- composite = new Composite(null, 0);
- fail("No exception thrown");
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {SWT.H_SCROLL, SWT.V_SCROLL, SWT.H_SCROLL | SWT.V_SCROLL};
- for (int i = 0; i < cases.length; i++)
- composite = new Composite(shell, cases[i]);
-} - -public void test_getChildren() {
- assertEquals(":a:", new Control[]{}, composite.getChildren());
- Composite c1 = new Composite(composite, 0);
- assertEquals(":b:", new Control[]{c1}, composite.getChildren());
-
- List c2 = new List(composite, 0);
- assertEquals(":c:", new Control[]{c1, c2}, composite.getChildren());
-
- Scale c3 = new Scale(composite, 0);
- assertEquals(":d:", new Control[]{c1, c2, c3}, composite.getChildren());
-
- c2.dispose();
- assertEquals(":e:", new Control[]{c1, c3}, composite.getChildren());
-
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++)
- children[i].dispose();
-
- assertEquals(":f:", new Control[]{}, composite.getChildren());
-} - -public void test_getLayout() {
- // tested in test_setLayoutLorg_eclipse_swt_widgets_Layout
-} - -public void test_getTabList() { - // tested in test_setTabList$Lorg_eclipse_swt_widgets_Control -} - -public void test_layout() { - // tested in test_layoutZ -} - -public void test_layoutZ() {
- Layout[] layouts = {null, new FillLayout(), new RowLayout(), new GridLayout()};
- for (int i = 0; i < layouts.length; i++) {
- composite.setLayout(layouts[i]);
- composite.layout(false);
- composite.layout(true); - composite.layout();
- }
-} - -public void test_setLayoutLorg_eclipse_swt_widgets_Layout() {
- Layout[] layouts = {null, new FillLayout(), new RowLayout(), new GridLayout()};
- for (int i = 0; i < layouts.length; i++) {
- composite.setLayout(layouts[i]);
- assertEquals(layouts[i], composite.getLayout());
- }
-} - -public void test_setTabList$Lorg_eclipse_swt_widgets_Control() { - Button button1 = new Button(composite, SWT.PUSH); - Button button2 = new Button(composite, SWT.PUSH); - Control[] tablist = new Control[] {button1, button2}; - composite.setTabList(tablist); - assertEquals(tablist, composite.getTabList()); - button1.dispose(); - button2.dispose(); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Composite((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_getChildren"); - methodNames.addElement("test_getLayout"); - methodNames.addElement("test_getTabList"); - methodNames.addElement("test_layout"); - methodNames.addElement("test_layoutZ"); - methodNames.addElement("test_setLayoutLorg_eclipse_swt_widgets_Layout"); - methodNames.addElement("test_setTabList$Lorg_eclipse_swt_widgets_Control"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Scrollable.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_getChildren")) test_getChildren(); - else if (getName().equals("test_getLayout")) test_getLayout(); - else if (getName().equals("test_getTabList")) test_getTabList(); - else if (getName().equals("test_layout")) test_layout(); - else if (getName().equals("test_layoutZ")) test_layoutZ(); - else if (getName().equals("test_setLayoutLorg_eclipse_swt_widgets_Layout")) test_setLayoutLorg_eclipse_swt_widgets_Layout(); - else if (getName().equals("test_setTabList$Lorg_eclipse_swt_widgets_Control")) test_setTabList$Lorg_eclipse_swt_widgets_Control(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java deleted file mode 100644 index 9038fedbca..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java +++ /dev/null @@ -1,825 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.events.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Control - * - * @see org.eclipse.swt.widgets.Control - */ -public class Test_org_eclipse_swt_widgets_Control extends Test_org_eclipse_swt_widgets_Widget { - - Control control; - boolean eventOccurred; - -public Test_org_eclipse_swt_widgets_Control(String name) { - super(name); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -protected void setWidget(Widget w) { - control = (Control)w;
- super.setWidget(w);
-} - -public void test_addControlListenerLorg_eclipse_swt_events_ControlListener() { - ControlListener listener = new ControlListener() { - public void controlMoved(ControlEvent e) { - eventOccurred = true; - }; - public void controlResized(ControlEvent e) { - eventOccurred = true; - }; - }; - control.addControlListener(listener); - eventOccurred = false; - control.notifyListeners(SWT.Move, new Event()); - assertTrue(eventOccurred); - eventOccurred = false; - control.notifyListeners(SWT.Resize, new Event()); - assertTrue(eventOccurred); - control.removeControlListener(listener); -} - -public void test_addFocusListenerLorg_eclipse_swt_events_FocusListener() { - FocusListener listener = new FocusListener() { - public void focusGained(FocusEvent e) { - eventOccurred = true; - }; - public void focusLost(FocusEvent e) { - eventOccurred = true; - }; - }; - control.addFocusListener(listener); - eventOccurred = false; - control.notifyListeners(SWT.FocusIn, new Event()); - assertTrue(eventOccurred); - eventOccurred = false; - control.notifyListeners(SWT.FocusOut, new Event()); - assertTrue(eventOccurred); - control.removeFocusListener(listener); -} - -public void test_addHelpListenerLorg_eclipse_swt_events_HelpListener() { - HelpListener listener = new HelpListener() { - public void helpRequested(HelpEvent e) { - eventOccurred = true; - }; - }; - control.addHelpListener(listener); - eventOccurred = false; - control.notifyListeners(SWT.Help, new Event()); - assertTrue(eventOccurred); - control.removeHelpListener(listener); -} - -public void test_addKeyListenerLorg_eclipse_swt_events_KeyListener() { - KeyListener listener = new KeyListener() { - public void keyPressed(KeyEvent e) { - eventOccurred = true; - }; - public void keyReleased(KeyEvent e) { - eventOccurred = true; - }; - }; - control.addKeyListener(listener); - eventOccurred = false; - control.notifyListeners(SWT.KeyDown, new Event()); - assertTrue(eventOccurred); - eventOccurred = false; - control.notifyListeners(SWT.KeyUp, new Event()); - assertTrue(eventOccurred); - control.removeKeyListener(listener); -} - -public void test_addMouseListenerLorg_eclipse_swt_events_MouseListener() { - MouseListener listener = new MouseListener() { - public void mouseDown(MouseEvent e) { - eventOccurred = true; - }; - public void mouseUp(MouseEvent e) { - eventOccurred = true; - }; - public void mouseDoubleClick(MouseEvent e) { - eventOccurred = true; - }; - }; - control.addMouseListener(listener); - eventOccurred = false; - control.notifyListeners(SWT.MouseDown, new Event()); - assertTrue(eventOccurred); - eventOccurred = false; - control.notifyListeners(SWT.MouseUp, new Event()); - assertTrue(eventOccurred); - eventOccurred = false; - control.notifyListeners(SWT.MouseDoubleClick, new Event()); - assertTrue(eventOccurred); - control.removeMouseListener(listener); -} - -public void test_addMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener() { - MouseTrackListener listener = new MouseTrackListener() { - public void mouseEnter(MouseEvent e) { - eventOccurred = true; - }; - public void mouseExit(MouseEvent e) { - eventOccurred = true; - }; - public void mouseHover(MouseEvent e) { - eventOccurred = true; - }; - }; - control.addMouseTrackListener(listener); - eventOccurred = false; - control.notifyListeners(SWT.MouseEnter, new Event()); - assertTrue(eventOccurred); - eventOccurred = false; - control.notifyListeners(SWT.MouseExit, new Event()); - assertTrue(eventOccurred); - eventOccurred = false; - control.notifyListeners(SWT.MouseHover, new Event()); - assertTrue(eventOccurred); - control.removeMouseTrackListener(listener); -} - -public void test_addMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener() { - MouseMoveListener listener = new MouseMoveListener() { - public void mouseMove(MouseEvent e) { - eventOccurred = true; - }; - }; - control.addMouseMoveListener(listener); - eventOccurred = false; - control.notifyListeners(SWT.MouseMove, new Event()); - assertTrue(eventOccurred); - control.removeMouseMoveListener(listener); -} - -public void test_addPaintListenerLorg_eclipse_swt_events_PaintListener() { - PaintListener listener = new PaintListener() { - public void paintControl(PaintEvent e) { - eventOccurred = true; - }; - }; - control.addPaintListener(listener); - eventOccurred = false; - control.notifyListeners(SWT.Paint, new Event()); - assertTrue(eventOccurred); - control.removePaintListener(listener); -} - -public void test_addTraverseListenerLorg_eclipse_swt_events_TraverseListener() { - TraverseListener listener = new TraverseListener() { - public void keyTraversed(TraverseEvent e) { - eventOccurred = true; - }; - }; - control.addTraverseListener(listener); - eventOccurred = false; - control.notifyListeners(SWT.Traverse, new Event()); - assertTrue(eventOccurred); - control.removeTraverseListener(listener); -} - -public void test_computeSizeII() { - control.computeSize(SWT.DEFAULT, SWT.DEFAULT); - Point size = control.getSize(); - control.computeSize(size.x, size.y); - assertEquals(size.x, control.getSize().x); - assertEquals(size.y, control.getSize().y); -} - -public void test_computeSizeIIZ() { - control.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); - Point size = control.getSize(); - control.computeSize(size.x, size.y, false); - assertEquals(size.x, control.getSize().x); - assertEquals(size.y, control.getSize().y); -} - -public void test_forceFocus() { - // this is difficult to test in Control. - // subclasses that wish to test this should override. -} - -public void test_getBackground() { - // tested in test_setBackgroundLorg_eclipse_swt_graphics_Color
-} - -public void test_getBorderWidth() {
- control.getBorderWidth();
-} - -public void test_getBounds() { - // tested in test_setBoundsIIII and test_setBoundsLorg_eclipse_swt_graphics_Rectangle -} - -public void test_getDisplay() {
- assertEquals(control.getDisplay(), control.getShell().getDisplay());
-} - -public void test_getEnabled() { - // tested in test_setEnabledZ
-} - -public void test_getFont() { - // tested in test_setFontLorg_eclipse_swt_graphics_Font
-} - -public void test_getForeground() {
- // tested in test_setForegroundLorg_eclipse_swt_graphics_Color
-} - -public void test_getLayoutData() { - // tested in test_setLayoutDataLjava_lang_Object
-} - -public void test_getLocation() {
- control.setBounds(32, 43, 30, 40);
- assertTrue(control.getLocation().equals(new Point(32, 43)));
-} - -public void test_getMenu() { - // tested in test_setMenuLorg_eclipse_swt_widgets_Menu
-} - -public void test_getParent() {
- assertEquals(shell, control.getParent());
-} - -public void test_getShell() {
- assertEquals(shell, control.getShell());
-} - -public void test_getSize() { - // tested in test_setSizeII -} - -public void test_getToolTipText() {
- // tested in test_setToolTipTextLjava_lang_String
-} - -public void test_getVisible() {
- // tested in test_setVisibleZ
-} - -public void test_internal_new_GCLorg_eclipse_swt_graphics_GCData() { - GCData data = new GCData(); - int hDC = control.internal_new_GC(data); - control.internal_dispose_GC(hDC, data); -} - -public void test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData() { - // tested in test_internal_new_GCLorg_eclipse_swt_graphics_GCData -} - -public void test_isDisposed() {
- assertTrue(!control.isDisposed());
-} - -public void test_isEnabled() {
- control.setEnabled(true);
- assertTrue(control.isEnabled());
-
- control.setEnabled(false);
- assertTrue(!control.isEnabled());
-} - -public void test_isFocusControl() {
- assertTrue(!control.isFocusControl());
-} - -public void test_isReparentable() { - if (SwtJunit.isWindows) { - assertTrue(control.isReparentable()); - } else { - assertTrue(!control.isReparentable()); - } -} - -public void test_isVisible() {
- control.setVisible(true);
- assertTrue(!control.isVisible()); //because the shell is not visible
-
- control.setVisible(false);
- assertTrue(!control.isVisible());
-
- if (!SwtJunit.isAIX) {
- control.setVisible(true);
- shell.setVisible(true);
- assertTrue("Window should be visible", control.isVisible());
- shell.setVisible(false);
- assertTrue("Window should not be visible", !control.isVisible());
- }
-} - -public void test_moveAboveLorg_eclipse_swt_widgets_Control() {
- control.moveAbove(null);
-
- control.moveAbove(control);
-
- Button b = new Button(shell, 0);
- control.moveAbove(b); - b.dispose();
-} - -public void test_moveBelowLorg_eclipse_swt_widgets_Control() {
- control.moveBelow(null);
-
- control.moveBelow(control);
-
- Button b = new Button(shell, 0);
- control.moveBelow(b); - b.dispose();
-} - -public void test_pack() { - control.pack(); -} - -public void test_packZ() { - control.pack(true); - control.pack(false); -} - -public void test_redraw() {
- control.redraw();
-} - -public void test_redrawIIIIZ() {
- control.redraw(0, 0, 0, 0, false);
-
- control.redraw(0, 0, 0, 0, true);
-
- control.redraw(-10, -10, -10, -10, true);
-
- control.redraw(10, 10, 10, 10, true);
-
- control.redraw(10, 10, 10, 10, false);
-
- control.redraw(10000, 10000, 10000, 10000, false);
-} - -public void test_removeControlListenerLorg_eclipse_swt_events_ControlListener() { - // tested in test_addControlListenerLorg_eclipse_swt_events_ControlListener -} - -public void test_removeFocusListenerLorg_eclipse_swt_events_FocusListener() { - // tested in test_addFocusListenerLorg_eclipse_swt_events_FocusListener -} - -public void test_removeHelpListenerLorg_eclipse_swt_events_HelpListener() { - // tested in test_addHelpListenerLorg_eclipse_swt_events_HelpListener -} - -public void test_removeKeyListenerLorg_eclipse_swt_events_KeyListener() { - // tested in test_addKeyListenerLorg_eclipse_swt_events_KeyListener -} - -public void test_removeMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener() { - // tested in test_addMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener -} - -public void test_removeMouseListenerLorg_eclipse_swt_events_MouseListener() { - // tested in test_addMouseListenerLorg_eclipse_swt_events_MouseListener -} - -public void test_removeMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener() { - // tested in test_addMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener -} - -public void test_removePaintListenerLorg_eclipse_swt_events_PaintListener() { - // tested in test_addPaintListenerLorg_eclipse_swt_events_PaintListener -} - -public void test_removeTraverseListenerLorg_eclipse_swt_events_TraverseListener() { - // tested in test_addTraverseListenerLorg_eclipse_swt_events_TraverseListener -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(control.getDisplay(), 255, 0, 0);
- control.setBackground(color); - assertEquals(color, control.getBackground()); - control.setBackground(null); - assertTrue(!control.getBackground().equals(color)); - color.dispose(); -} - -public void test_setBoundsIIII() {
- control.setBounds(10, 20, 30, 40);
- assertEquals(new Rectangle(10, 20, 30, 40), control.getBounds()); - - control.setBounds(20, 30, 40, 50); - assertEquals(false, control.getBounds().equals(new Rectangle(10, 20, 30, 40))); - - control.setBounds(10, 20, 30, 40); -} - -public void test_setBoundsLorg_eclipse_swt_graphics_Rectangle() {
- control.setBounds(new Rectangle(10, 20, 30, 40));
- assertEquals(new Rectangle(10, 20, 30, 40), control.getBounds());
-
- control.setBounds(new Rectangle(20, 30, 40, 50));
- assertEquals(false, control.getBounds().equals(new Rectangle(10, 20, 30, 40)));
-
- try {
- control.setBounds(null);
- fail("No exception thrown for rectangle == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- control.setBounds(new Rectangle(10, 20, 30, 40));
-} - -public void test_setCaptureZ() {
- control.setCapture(true);
-
- control.setCapture(false);
-} - -public void test_setCursorLorg_eclipse_swt_graphics_Cursor() {
- control.setCursor(null);
-
- Cursor c = new Cursor(control.getDisplay(), 0);
- control.setCursor(c);
- c.dispose();
-} - -public void test_setEnabledZ() { - control.setEnabled(true); - assertTrue(control.getEnabled()); - - control.setEnabled(false); - assertTrue(!control.getEnabled()); -} - -public void test_setFocus() {
- control.setFocus();
-} - -public void test_setFontLorg_eclipse_swt_graphics_Font() {
- Font font = control.getFont();
- control.setFont(font); - assertEquals(font, control.getFont()); -
- font = new Font(control.getDisplay(), SwtJunit.testFontName, 10, SWT.NORMAL);
- control.setFont(font); - assertEquals(font, control.getFont());
-
- control.setFont(null);
- font.dispose();
- try { - control.setFont(font); - control.setFont(null); - fail("No exception thrown for disposed font"); - } catch (IllegalArgumentException e) { - } -} - -public void test_setForegroundLorg_eclipse_swt_graphics_Color() {
- Color color = new Color(control.getDisplay(), 255, 0, 0); - control.setForeground(color); - assertEquals(color, control.getForeground()); - control.setForeground(null); - assertTrue(!control.getForeground().equals(color)); - color.dispose(); -} - -public void test_setLayoutDataLjava_lang_Object() {
- control.setLayoutData(this);
- assertEquals(this, control.getLayoutData()); -
- control.setLayoutData("asldsahdahcaslcshdac");
- assertEquals("asldsahdahcaslcshdac", control.getLayoutData()); -
- control.setLayoutData(this.getClass());
- assertEquals(this.getClass(), control.getLayoutData()); - - control.setLayoutData(null); - assertNull(control.getLayoutData()); -} - -public void test_setLocationII() {
- control.setBounds(32, 43, 30, 40);
- control.setLocation(11, 22);
- control.setSize(32, 43);
- assertEquals(control.getLocation(), new Point(11, 22));
-
- control.setLocation(10, 10);
- assertEquals(control.getLocation(), new Point(10, 10));
-} - -public void test_setLocationLorg_eclipse_swt_graphics_Point() {
- try {
- control.setLocation(null);
- fail("No exception thrown for location == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- Point loc = new Point(30, 40);
- control.setLocation(loc);
- assertEquals(control.getLocation(), loc);
-
- loc = new Point(10, 10);
- control.setLocation(loc);
- assertEquals(control.getLocation(), loc);
-
- loc = new Point(10000, 10000);
- control.setLocation(loc);
- assertEquals(control.getLocation(), loc);
-
- loc = new Point(-10, -10);
- control.setLocation(loc);
- assertEquals(control.getLocation(), loc);
-} - -public void test_setMenuLorg_eclipse_swt_widgets_Menu () {
- /* this is a valid thing to do, you can reset a menu to nothing */
- control.setMenu(null);
-
- Menu m = new Menu(control); - control.setMenu(m); - assertEquals(m, control.getMenu()); -} - -public void test_setRedrawZ() {
- control.setRedraw(false);
-
- control.setRedraw(true);
-} - -public void test_setSizeII() {
- control.setBounds(32, 43, 30, 40);
- assertEquals(new Point(30, 40), control.getSize());
-
- control.setBounds(32, 43, 30, 40);
- control.setLocation(11, 22);
- control.setSize(32, 43);
- assertEquals(new Point(32, 43), control.getSize());
-
- control.setSize(0, 0);
-
- control.setSize(10, 10);
-
- control.setSize(10000, 10000);
-
- control.setSize(-10, -10);
-} - -public void test_setSizeLorg_eclipse_swt_graphics_Point() {
- control.setSize(new Point(30, 40));
- assertEquals(new Point(30, 40), control.getSize());
-
- try {
- control.setSize(null);
- fail("No exception thrown for size == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- control.setSize(new Point(0, 0));
-
- control.setSize(new Point(10, 10));
-
- control.setSize(new Point(10000, 10000));
-
- control.setSize(new Point(-10, -10));
-} - -public void test_setToolTipTextLjava_lang_String() {
- control.setToolTipText("This is a tip");
- assertEquals("This is a tip", control.getToolTipText());
-
- control.setToolTipText(null);
- assertNull(control.getToolTipText());
-} - -public void test_setVisibleZ() {
- control.setVisible(true);
- assertTrue(control.getVisible());
-
- control.setVisible(false);
- assertTrue(!control.getVisible());
-} - -public void test_toControlLorg_eclipse_swt_graphics_Point() { - Point controlCoords = control.toControl(new Point(0, 0)); - assertEquals(new Point(0, 0), control.toDisplay(controlCoords)); - try { - control.toControl(null); - fail("No exception thrown for size == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_toDisplayLorg_eclipse_swt_graphics_Point() { - Point displayCoords = control.toDisplay(new Point(0, 0)); - assertEquals(new Point(0, 0), control.toControl(displayCoords)); - try { - control.toDisplay(null); - fail("No exception thrown for size == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_traverseI() { - control.traverse(SWT.TRAVERSE_ESCAPE); - control.traverse(SWT.TRAVERSE_RETURN); - control.traverse(SWT.TRAVERSE_TAB_NEXT); - control.traverse(SWT.TRAVERSE_TAB_PREVIOUS); - control.traverse(SWT.TRAVERSE_ARROW_NEXT); - control.traverse(SWT.TRAVERSE_ARROW_PREVIOUS); -} - -public void test_update() {
- control.update();
-} - -public void test_setParentLorg_eclipse_swt_widgets_Composite() { - if (control.isReparentable()) { - Shell originalParent = new Shell(); - Shell newParent = new Shell(); - Button b = new Button(originalParent, SWT.PUSH); - b.setParent(newParent); - originalParent.dispose(); - assertTrue(!b.isDisposed()); - newParent.dispose(); - } -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_addControlListenerLorg_eclipse_swt_events_ControlListener"); - methodNames.addElement("test_addFocusListenerLorg_eclipse_swt_events_FocusListener"); - methodNames.addElement("test_addHelpListenerLorg_eclipse_swt_events_HelpListener"); - methodNames.addElement("test_addKeyListenerLorg_eclipse_swt_events_KeyListener"); - methodNames.addElement("test_addMouseListenerLorg_eclipse_swt_events_MouseListener"); - methodNames.addElement("test_addMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener"); - methodNames.addElement("test_addMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener"); - methodNames.addElement("test_addPaintListenerLorg_eclipse_swt_events_PaintListener"); - methodNames.addElement("test_addTraverseListenerLorg_eclipse_swt_events_TraverseListener"); - methodNames.addElement("test_computeSizeII"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_forceFocus"); - methodNames.addElement("test_getBackground"); - methodNames.addElement("test_getBorderWidth"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getDisplay"); - methodNames.addElement("test_getEnabled"); - methodNames.addElement("test_getFont"); - methodNames.addElement("test_getForeground"); - methodNames.addElement("test_getLayoutData"); - methodNames.addElement("test_getLocation"); - methodNames.addElement("test_getMenu"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getShell"); - methodNames.addElement("test_getSize"); - methodNames.addElement("test_getToolTipText"); - methodNames.addElement("test_getVisible"); - methodNames.addElement("test_internal_new_GCLorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_isDisposed"); - methodNames.addElement("test_isEnabled"); - methodNames.addElement("test_isFocusControl"); - methodNames.addElement("test_isReparentable"); - methodNames.addElement("test_isVisible"); - methodNames.addElement("test_moveAboveLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_moveBelowLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_pack"); - methodNames.addElement("test_packZ"); - methodNames.addElement("test_redraw"); - methodNames.addElement("test_redrawIIIIZ"); - methodNames.addElement("test_removeControlListenerLorg_eclipse_swt_events_ControlListener"); - methodNames.addElement("test_removeFocusListenerLorg_eclipse_swt_events_FocusListener"); - methodNames.addElement("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener"); - methodNames.addElement("test_removeKeyListenerLorg_eclipse_swt_events_KeyListener"); - methodNames.addElement("test_removeMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener"); - methodNames.addElement("test_removeMouseListenerLorg_eclipse_swt_events_MouseListener"); - methodNames.addElement("test_removeMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener"); - methodNames.addElement("test_removePaintListenerLorg_eclipse_swt_events_PaintListener"); - methodNames.addElement("test_removeTraverseListenerLorg_eclipse_swt_events_TraverseListener"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setBoundsIIII"); - methodNames.addElement("test_setBoundsLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_setCaptureZ"); - methodNames.addElement("test_setCursorLorg_eclipse_swt_graphics_Cursor"); - methodNames.addElement("test_setEnabledZ"); - methodNames.addElement("test_setFocus"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setForegroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setLayoutDataLjava_lang_Object"); - methodNames.addElement("test_setLocationII"); - methodNames.addElement("test_setLocationLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setMenuLorg_eclipse_swt_widgets_Menu"); - methodNames.addElement("test_setRedrawZ"); - methodNames.addElement("test_setSizeII"); - methodNames.addElement("test_setSizeLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setToolTipTextLjava_lang_String"); - methodNames.addElement("test_setVisibleZ"); - methodNames.addElement("test_toControlLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_toDisplayLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_traverseI"); - methodNames.addElement("test_update"); - methodNames.addElement("test_setParentLorg_eclipse_swt_widgets_Composite"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_addControlListenerLorg_eclipse_swt_events_ControlListener")) test_addControlListenerLorg_eclipse_swt_events_ControlListener(); - else if (getName().equals("test_addFocusListenerLorg_eclipse_swt_events_FocusListener")) test_addFocusListenerLorg_eclipse_swt_events_FocusListener(); - else if (getName().equals("test_addHelpListenerLorg_eclipse_swt_events_HelpListener")) test_addHelpListenerLorg_eclipse_swt_events_HelpListener(); - else if (getName().equals("test_addKeyListenerLorg_eclipse_swt_events_KeyListener")) test_addKeyListenerLorg_eclipse_swt_events_KeyListener(); - else if (getName().equals("test_addMouseListenerLorg_eclipse_swt_events_MouseListener")) test_addMouseListenerLorg_eclipse_swt_events_MouseListener(); - else if (getName().equals("test_addMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener")) test_addMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener(); - else if (getName().equals("test_addMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener")) test_addMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener(); - else if (getName().equals("test_addPaintListenerLorg_eclipse_swt_events_PaintListener")) test_addPaintListenerLorg_eclipse_swt_events_PaintListener(); - else if (getName().equals("test_addTraverseListenerLorg_eclipse_swt_events_TraverseListener")) test_addTraverseListenerLorg_eclipse_swt_events_TraverseListener(); - else if (getName().equals("test_computeSizeII")) test_computeSizeII(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_forceFocus")) test_forceFocus(); - else if (getName().equals("test_getBackground")) test_getBackground(); - else if (getName().equals("test_getBorderWidth")) test_getBorderWidth(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getDisplay")) test_getDisplay(); - else if (getName().equals("test_getEnabled")) test_getEnabled(); - else if (getName().equals("test_getFont")) test_getFont(); - else if (getName().equals("test_getForeground")) test_getForeground(); - else if (getName().equals("test_getLayoutData")) test_getLayoutData(); - else if (getName().equals("test_getLocation")) test_getLocation(); - else if (getName().equals("test_getMenu")) test_getMenu(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getShell")) test_getShell(); - else if (getName().equals("test_getSize")) test_getSize(); - else if (getName().equals("test_getToolTipText")) test_getToolTipText(); - else if (getName().equals("test_getVisible")) test_getVisible(); - else if (getName().equals("test_internal_new_GCLorg_eclipse_swt_graphics_GCData")) test_internal_new_GCLorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData")) test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_isDisposed")) test_isDisposed(); - else if (getName().equals("test_isEnabled")) test_isEnabled(); - else if (getName().equals("test_isFocusControl")) test_isFocusControl(); - else if (getName().equals("test_isReparentable")) test_isReparentable(); - else if (getName().equals("test_isVisible")) test_isVisible(); - else if (getName().equals("test_moveAboveLorg_eclipse_swt_widgets_Control")) test_moveAboveLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_moveBelowLorg_eclipse_swt_widgets_Control")) test_moveBelowLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_pack")) test_pack(); - else if (getName().equals("test_packZ")) test_packZ(); - else if (getName().equals("test_redraw")) test_redraw(); - else if (getName().equals("test_redrawIIIIZ")) test_redrawIIIIZ(); - else if (getName().equals("test_removeControlListenerLorg_eclipse_swt_events_ControlListener")) test_removeControlListenerLorg_eclipse_swt_events_ControlListener(); - else if (getName().equals("test_removeFocusListenerLorg_eclipse_swt_events_FocusListener")) test_removeFocusListenerLorg_eclipse_swt_events_FocusListener(); - else if (getName().equals("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener")) test_removeHelpListenerLorg_eclipse_swt_events_HelpListener(); - else if (getName().equals("test_removeKeyListenerLorg_eclipse_swt_events_KeyListener")) test_removeKeyListenerLorg_eclipse_swt_events_KeyListener(); - else if (getName().equals("test_removeMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener")) test_removeMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener(); - else if (getName().equals("test_removeMouseListenerLorg_eclipse_swt_events_MouseListener")) test_removeMouseListenerLorg_eclipse_swt_events_MouseListener(); - else if (getName().equals("test_removeMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener")) test_removeMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener(); - else if (getName().equals("test_removePaintListenerLorg_eclipse_swt_events_PaintListener")) test_removePaintListenerLorg_eclipse_swt_events_PaintListener(); - else if (getName().equals("test_removeTraverseListenerLorg_eclipse_swt_events_TraverseListener")) test_removeTraverseListenerLorg_eclipse_swt_events_TraverseListener(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setBoundsIIII")) test_setBoundsIIII(); - else if (getName().equals("test_setBoundsLorg_eclipse_swt_graphics_Rectangle")) test_setBoundsLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_setCaptureZ")) test_setCaptureZ(); - else if (getName().equals("test_setCursorLorg_eclipse_swt_graphics_Cursor")) test_setCursorLorg_eclipse_swt_graphics_Cursor(); - else if (getName().equals("test_setEnabledZ")) test_setEnabledZ(); - else if (getName().equals("test_setFocus")) test_setFocus(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setForegroundLorg_eclipse_swt_graphics_Color")) test_setForegroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setLayoutDataLjava_lang_Object")) test_setLayoutDataLjava_lang_Object(); - else if (getName().equals("test_setLocationII")) test_setLocationII(); - else if (getName().equals("test_setLocationLorg_eclipse_swt_graphics_Point")) test_setLocationLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setMenuLorg_eclipse_swt_widgets_Menu")) test_setMenuLorg_eclipse_swt_widgets_Menu(); - else if (getName().equals("test_setRedrawZ")) test_setRedrawZ(); - else if (getName().equals("test_setSizeII")) test_setSizeII(); - else if (getName().equals("test_setSizeLorg_eclipse_swt_graphics_Point")) test_setSizeLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setToolTipTextLjava_lang_String")) test_setToolTipTextLjava_lang_String(); - else if (getName().equals("test_setVisibleZ")) test_setVisibleZ(); - else if (getName().equals("test_toControlLorg_eclipse_swt_graphics_Point")) test_toControlLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_toDisplayLorg_eclipse_swt_graphics_Point")) test_toDisplayLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_traverseI")) test_traverseI(); - else if (getName().equals("test_update")) test_update(); - else if (getName().equals("test_setParentLorg_eclipse_swt_widgets_Composite")) test_setParentLorg_eclipse_swt_widgets_Composite(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolBar.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolBar.java deleted file mode 100644 index c2698e3b4d..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolBar.java +++ /dev/null @@ -1,130 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.CoolBar - * - * @see org.eclipse.swt.widgets.CoolBar - */ -public class Test_org_eclipse_swt_widgets_CoolBar extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_widgets_CoolBar(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- CoolBar coolBar = new CoolBar(shell, 0);
- setWidget(coolBar);
-} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_checkSubclass() { - warnUnimpl("Test test_checkSubclass not written"); -} - -public void test_computeSizeIIZ(){
- warnUnimpl( "Test test_computeSizeIIZ not written");
-} - -public void test_getItemI() { - warnUnimpl("Test test_getItemI not written"); -} - -public void test_getItemCount() { - warnUnimpl("Test test_getItemCount not written"); -} - -public void test_getItems() { - warnUnimpl("Test test_getItems not written"); -} - -public void test_indexOfLorg_eclipse_swt_widgets_CoolItem() { - warnUnimpl("Test test_indexOfLorg_eclipse_swt_widgets_CoolItem not written"); -} - -public void test_getItemOrder() { - warnUnimpl("Test test_getItemOrder not written"); -} - -public void test_getItemSizes() { - warnUnimpl("Test test_getItemSizes not written"); -} - -public void test_getWrapIndices() { - warnUnimpl("Test test_getWrapIndices not written"); -} - -public void test_setWrapIndices$I() { - warnUnimpl("Test test_setWrapIndices$I not written"); -} - -public void test_setItemLayout$I$I$Lorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_setItemLayout$I$I$Lorg_eclipse_swt_graphics_Point not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_CoolBar((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_checkSubclass"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_getItemI"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_indexOfLorg_eclipse_swt_widgets_CoolItem"); - methodNames.addElement("test_getItemOrder"); - methodNames.addElement("test_getItemSizes"); - methodNames.addElement("test_getWrapIndices"); - methodNames.addElement("test_setWrapIndices$I"); - methodNames.addElement("test_setItemLayout$I$I$Lorg_eclipse_swt_graphics_Point"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_checkSubclass")) test_checkSubclass(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_getItemI")) test_getItemI(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_indexOfLorg_eclipse_swt_widgets_CoolItem")) test_indexOfLorg_eclipse_swt_widgets_CoolItem(); - else if (getName().equals("test_getItemOrder")) test_getItemOrder(); - else if (getName().equals("test_getItemSizes")) test_getItemSizes(); - else if (getName().equals("test_getWrapIndices")) test_getWrapIndices(); - else if (getName().equals("test_setWrapIndices$I")) test_setWrapIndices$I(); - else if (getName().equals("test_setItemLayout$I$I$Lorg_eclipse_swt_graphics_Point")) test_setItemLayout$I$I$Lorg_eclipse_swt_graphics_Point(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolItem.java deleted file mode 100644 index 0e0d62a2d3..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolItem.java +++ /dev/null @@ -1,336 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.CoolItem - * - * @see org.eclipse.swt.widgets.CoolItem - */ -public class Test_org_eclipse_swt_widgets_CoolItem extends Test_org_eclipse_swt_widgets_Item { - -static final boolean MINIMAL_CONFORMANCE = false; - -public Test_org_eclipse_swt_widgets_CoolItem(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - setWidget(coolItem); -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CoolBarI() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - - try { - coolItem = new CoolItem(null, 0); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CoolBarII() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0, 0); - try { - coolItem = new CoolItem(coolBar, 0, -1); - fail("No exception thrown for index == -1"); - } - catch (IllegalArgumentException e){ - } - try { - coolItem = new CoolItem(coolBar, 0, 2); - fail("No exception thrown for index == 2"); - } - catch (IllegalArgumentException e){ - } - assertEquals(1, coolBar.getItemCount()); - coolItem = new CoolItem(coolBar, 0, 1); - assertEquals(2, coolBar.getItemCount()); - coolItem = new CoolItem(coolBar, 0, 0); - assertEquals(3, coolBar.getItemCount()); - assertEquals(coolItem, coolBar.getItem(0)); -} - -public void test_checkSubclass() { - warnUnimpl("Test test_checkSubclass not written"); -} - -public void test_computeSizeII() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - Button button = new Button(coolBar, SWT.PUSH); - button.setText("foo"); - - Point size = coolItem.computeSize(SWT.DEFAULT, SWT.DEFAULT); - Point size2 = coolItem.computeSize(0, 0); - assertEquals(size, size2); - - coolItem.setControl(button); - size2 = coolItem.computeSize(SWT.DEFAULT, SWT.DEFAULT); - assertTrue(size2.x > size.x); - - size = coolItem.computeSize(50, 25); - size2 = coolItem.computeSize(100, 25); - assertEquals(size.x + 50, size2.x); - assertEquals(size.y, size2.y); - - size = coolItem.computeSize(1,1); - size2 = coolItem.computeSize(26, 26); - assertEquals(25, size2.x - size.x); -} - -public void test_getBounds() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - Button button = new Button(coolBar, SWT.PUSH); - button.setText("foo"); - coolItem.setControl(button); - - Rectangle rect = coolItem.getBounds(); - Point size = coolItem.getSize(); - assertEquals(size.x, rect.width); - assertEquals(size.y, rect.height); - - coolItem.setSize(25, 25); - rect = coolItem.getBounds(); - coolItem.setSize(100, 25); - Rectangle newRect = coolItem.getBounds(); - assertEquals(rect.width + 75, newRect.width); - assertEquals(rect.x, newRect.x); - assertEquals(rect.y, newRect.y); -} - -public void test_getControl() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - assertNull(coolItem.getControl()); - - Button button = new Button(coolBar, SWT.PUSH); - coolItem.setControl(button); - Control control = coolItem.getControl(); - assertEquals(button, control); - - button = new Button(coolBar, SWT.PUSH); - coolItem.setControl(button); - control = coolItem.getControl(); - assertEquals(button, control); -} - -public void test_getDisplay() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - assertEquals(coolBar.getDisplay(), coolItem.getDisplay()); - - coolBar.dispose(); - try { - coolItem.getDisplay(); - fail("No exception thrown for getDisplay() when parent is disposed"); - } - catch (SWTException e) { - } -} - -public void test_getParent() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - assertEquals(coolBar, coolItem.getParent()); -} - -public void test_setControlLorg_eclipse_swt_widgets_Control() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - coolItem.setControl(null); - - Button button = new Button(coolBar, SWT.PUSH); - button.setText("foobar"); - - Point size = coolItem.getSize(); - coolItem.setControl(button); - Point size2 = coolItem.getSize(); - assertTrue(size2.x > size.x); - - if (!MINIMAL_CONFORMANCE) { - size = button.computeSize(SWT.DEFAULT, SWT.DEFAULT); - size2 = coolItem.computeSize(size.x, size.y); - assertEquals(size2, coolItem.getSize()); - } - - button = new Button(coolBar, SWT.PUSH); - button.dispose(); - try { - coolItem.setControl(button); - fail("No exception when control.isDisposed()"); - } - catch (IllegalArgumentException e) { - } - - button = new Button(shell, SWT.PUSH); - try { - coolItem.setControl(button); - fail("No exception thrown when control has wrong parent"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_getPreferredSize() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - Button button = new Button(coolBar, SWT.PUSH); - button.setText("foobar"); - coolItem.setControl(button); - - Point pref = coolItem.getPreferredSize(); - coolItem.setPreferredSize(pref); - assertEquals(pref, coolItem.getPreferredSize()); -} - -public void test_setPreferredSizeII() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - Button button = new Button(coolBar, SWT.PUSH); - button.setText("foobar"); - coolItem.setControl(button); - - Point size = coolItem.getSize(); - coolItem.setPreferredSize(size); - assertEquals(size.x, coolItem.getSize().x); - coolItem.setSize(coolItem.getPreferredSize()); - assertEquals(size, coolItem.getSize()); -} - -public void test_setPreferredSizeLorg_eclipse_swt_graphics_Point() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - Button button = new Button(coolBar, SWT.PUSH); - button.setText("foobar"); - coolItem.setControl(button); - - Point size = new Point(50, 30); - coolItem.setPreferredSize(size); - Point size2 = coolItem.getPreferredSize(); - coolItem.setPreferredSize(50, 30); - assertEquals(size2, coolItem.getPreferredSize()); -} - -public void test_getSize() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - Button button = new Button(coolBar, SWT.PUSH); - button.setText("foo"); - coolItem.setControl(button); - - Point size = coolItem.getSize(); - Rectangle rect = coolItem.getBounds(); - assertEquals(rect.width, size.x); - assertEquals(rect.height, size.y); -} - -public void test_setSizeII() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - Button button = new Button(coolBar, SWT.PUSH); - button.setText("foo"); - coolItem.setControl(button); - - coolItem.setSize(50, 50); - assertEquals(new Point(50, 50), coolItem.getSize()); - - coolItem.setSize(0, 0); - Point smallest = coolItem.getSize(); - coolItem.setSize(1, 1); - assertEquals(smallest, coolItem.getSize()); - - Rectangle rect = coolItem.getBounds(); - Point size = coolItem.getSize(); - coolItem.setSize(rect.width, rect.height); - assertEquals(size, coolItem.getSize()); -} - -public void test_setSizeLorg_eclipse_swt_graphics_Point() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - Button button = new Button(coolBar, SWT.PUSH); - button.setText("foo"); - coolItem.setControl(button); - - Point size = new Point(50, 50); - coolItem.setSize(size); - Point size2 = coolItem.getSize(); - coolItem.setSize(50, 50); - assertEquals(size2, coolItem.getSize()); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_CoolItem((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CoolBarI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CoolBarII"); - methodNames.addElement("test_checkSubclass"); - methodNames.addElement("test_computeSizeII"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getControl"); - methodNames.addElement("test_getDisplay"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_setControlLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_getPreferredSize"); - methodNames.addElement("test_setPreferredSizeII"); - methodNames.addElement("test_setPreferredSizeLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_getSize"); - methodNames.addElement("test_setSizeII"); - methodNames.addElement("test_setSizeLorg_eclipse_swt_graphics_Point"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CoolBarI")) test_ConstructorLorg_eclipse_swt_widgets_CoolBarI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CoolBarII")) test_ConstructorLorg_eclipse_swt_widgets_CoolBarII(); - else if (getName().equals("test_checkSubclass")) test_checkSubclass(); - else if (getName().equals("test_computeSizeII")) test_computeSizeII(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getControl")) test_getControl(); - else if (getName().equals("test_getDisplay")) test_getDisplay(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_setControlLorg_eclipse_swt_widgets_Control")) test_setControlLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_getPreferredSize")) test_getPreferredSize(); - else if (getName().equals("test_setPreferredSizeII")) test_setPreferredSizeII(); - else if (getName().equals("test_setPreferredSizeLorg_eclipse_swt_graphics_Point")) test_setPreferredSizeLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_getSize")) test_getSize(); - else if (getName().equals("test_setSizeII")) test_setSizeII(); - else if (getName().equals("test_setSizeLorg_eclipse_swt_graphics_Point")) test_setSizeLorg_eclipse_swt_graphics_Point(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Decorations.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Decorations.java deleted file mode 100644 index 631b6aeb65..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Decorations.java +++ /dev/null @@ -1,248 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Decorations - * - * @see org.eclipse.swt.widgets.Decorations - */ -public class Test_org_eclipse_swt_widgets_Decorations extends Test_org_eclipse_swt_widgets_Canvas { - -Decorations decorations; -Image[] images = new Image [3]; - -public Test_org_eclipse_swt_widgets_Decorations(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - decorations = new Decorations(shell, SWT.NULL); - super.setWidget(decorations); -} - -protected void tearDown() { - super.tearDown(); -} - -protected void setWidget(Widget w) { - if (!decorations.isDisposed()) - decorations.dispose(); - decorations = (Decorations)w; - super.setWidget(w); -} - -// this method must be private or protected so the auto-gen tool keeps it
-private void loadImages() {
- images [0] = new Image (shell.getDisplay(), this.getClass().getResourceAsStream("folder.bmp"));
- images [1] = new Image (shell.getDisplay(), this.getClass().getResourceAsStream("folderOpen.bmp"));
- images [2] = new Image (shell.getDisplay(), this.getClass().getResourceAsStream("target.bmp"));
-} - -// this method must be private or protected so the auto-gen tool keeps it
-private void freeImages() {
- for (int i=0; i<images.length; i++) images[i].dispose();
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_computeTrimIIII() { - warnUnimpl("Test test_computeTrimIIII not written"); -} - -public void test_getBounds() { - warnUnimpl("Test test_getBounds not written"); -} - -public void test_getClientArea() { - warnUnimpl("Test test_getClientArea not written"); -} - -public void test_getDefaultButton() { - warnUnimpl("Test test_getDefaultButton not written"); -} - -public void test_getImage() { - warnUnimpl("Test test_getImage not written"); -} - -public void test_getLocation() { - warnUnimpl("Test test_getLocation not written"); -} - -public void test_getMaximized() { - warnUnimpl("Test test_getMaximized not written"); -} - -public void test_getMenuBar() { - warnUnimpl("Test test_getMenuBar not written"); -} - -public void test_getMinimized() { - warnUnimpl("Test test_getMinimized not written"); -} - -public void test_getSize() { - warnUnimpl("Test test_getSize not written"); -} - -public void test_getText() { - warnUnimpl("Test test_getText not written"); -} - -public void test_setDefaultButtonLorg_eclipse_swt_widgets_Button() {
- assertNull(decorations.getDefaultButton());
- Button button = new Button(decorations, SWT.NULL);
- decorations.setDefaultButton(button);
- assertTrue("button not default", decorations.getDefaultButton() == button);
- if (fCheckBogusTestCases) {
- decorations.setDefaultButton(null);
- assertNull(decorations.getDefaultButton());
- }
-} - -public void test_setFocus() {
- decorations.setFocus();
-} - -public void test_setImageLorg_eclipse_swt_graphics_Image() {
- assertNull(":a:", decorations.getImage());
- loadImages();
- decorations.setImage(images[0]);
- assertTrue(":b:", images[0] == decorations.getImage());
- assertTrue(":c:", images[1] != decorations.getImage());
- decorations.setImage(null);
- assertNull(":d:", decorations.getImage());
- freeImages();
-} - -public void test_setMaximizedZ() {
- decorations.setMaximized(false);
- assertTrue(":1:", decorations.getMaximized() == false);
- decorations.setMaximized(true);
- assertTrue(":2:", decorations.getMaximized() == true);
- assertTrue(":3:", decorations.getMinimized() == false);
-} - -public void test_setMenuBarLorg_eclipse_swt_widgets_Menu() {
- assertNull(decorations.getMenu());
- Menu testMenu = new Menu(decorations);
- decorations.setMenu(testMenu);
- assertTrue("Incorrect menu", decorations.getMenu() == testMenu);
- decorations.setMenu(null);
- assertNull(decorations.getMenu());
-} - -public void test_setMinimizedZ() {
- decorations.setMinimized(false);
- assertTrue(":1:", decorations.getMinimized() == false);
- decorations.setMinimized(true);
- assertTrue(":2:", decorations.getMinimized() == true);
- assertTrue(":3:", decorations.getMaximized() == false);
-} - -public void test_setTextLjava_lang_String() {
- try {
- decorations.setText(null);
- fail("No exception thrown for string == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- String testStr = "test string";
- decorations.setText(testStr);
- assertTrue("a", decorations.getText().equals(testStr));
- decorations.setText("");
- assertTrue("b", decorations.getText().equals(""));
- try {
- decorations.setText(null);
- fail("No exception thrown for string == null");
- }
- catch (IllegalArgumentException e) {
- }
-} - -public void test_setVisibleZ() {
- decorations.setVisible(false);
- assertTrue(!decorations.getVisible());
-
- decorations.setVisible(true);
- assertTrue(decorations.getVisible());
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Decorations((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_computeTrimIIII"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getClientArea"); - methodNames.addElement("test_getDefaultButton"); - methodNames.addElement("test_getImage"); - methodNames.addElement("test_getLocation"); - methodNames.addElement("test_getMaximized"); - methodNames.addElement("test_getMenuBar"); - methodNames.addElement("test_getMinimized"); - methodNames.addElement("test_getSize"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_setDefaultButtonLorg_eclipse_swt_widgets_Button"); - methodNames.addElement("test_setFocus"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setMaximizedZ"); - methodNames.addElement("test_setMenuBarLorg_eclipse_swt_widgets_Menu"); - methodNames.addElement("test_setMinimizedZ"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_setVisibleZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Canvas.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getClientArea")) test_getClientArea(); - else if (getName().equals("test_getDefaultButton")) test_getDefaultButton(); - else if (getName().equals("test_getImage")) test_getImage(); - else if (getName().equals("test_getLocation")) test_getLocation(); - else if (getName().equals("test_getMaximized")) test_getMaximized(); - else if (getName().equals("test_getMenuBar")) test_getMenuBar(); - else if (getName().equals("test_getMinimized")) test_getMinimized(); - else if (getName().equals("test_getSize")) test_getSize(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_setDefaultButtonLorg_eclipse_swt_widgets_Button")) test_setDefaultButtonLorg_eclipse_swt_widgets_Button(); - else if (getName().equals("test_setFocus")) test_setFocus(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setMaximizedZ")) test_setMaximizedZ(); - else if (getName().equals("test_setMenuBarLorg_eclipse_swt_widgets_Menu")) test_setMenuBarLorg_eclipse_swt_widgets_Menu(); - else if (getName().equals("test_setMinimizedZ")) test_setMinimizedZ(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_setVisibleZ")) test_setVisibleZ(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Dialog.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Dialog.java deleted file mode 100644 index 1cb27de135..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Dialog.java +++ /dev/null @@ -1,110 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Dialog - * - * @see org.eclipse.swt.widgets.Dialog - */ -public class Test_org_eclipse_swt_widgets_Dialog extends SwtTestCase { - -public Shell shell; -private Dialog dialog; -private int junitStyle; - -public Test_org_eclipse_swt_widgets_Dialog(String name) { - super(name); -} - - -protected void setUp() {
- shell = new Shell();
-} - -protected void tearDown() {
- shell.dispose();
-} - -protected void setDialog(Dialog newDialog) {
- dialog = newDialog;
-} -protected void setStyle(int style) {
- style = junitStyle;
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_Shell() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Shell not written"); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ShellI not written"); -} - -public void test_checkSubclass() { - warnUnimpl("Test test_checkSubclass not written"); -} - -public void test_getParent() {
- assertTrue(":a:", dialog.getParent() == shell);
-} - -public void test_getStyle () {
- // we use this call in a Constructor test so that we can
- // check if the style is the one that was created
- dialog.getStyle();
-} - -public void test_getText() { - warnUnimpl("Test test_getText not written"); -} - -public void test_setTextLjava_lang_String() {
- assertTrue(":1:", dialog.getText() == "");
- String testStr = "test string";
- dialog.setText(testStr);
- assertTrue(":2:", dialog.getText().equals(testStr));
- dialog.setText("");
- assertTrue(":3:", dialog.getText().equals(""));
- if (fCheckSwtNullExceptions) {
- try {
- dialog.setText(null);
- fail("No exception thrown for string = null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI"); - methodNames.addElement("test_checkSubclass"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getStyle"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_setTextLjava_lang_String"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI(); - else if (getName().equals("test_checkSubclass")) test_checkSubclass(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getStyle")) test_getStyle(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DirectoryDialog.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DirectoryDialog.java deleted file mode 100644 index e611b040e2..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DirectoryDialog.java +++ /dev/null @@ -1,137 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.DirectoryDialog - * - * @see org.eclipse.swt.widgets.DirectoryDialog - */ -public class Test_org_eclipse_swt_widgets_DirectoryDialog extends Test_org_eclipse_swt_widgets_Dialog { - -DirectoryDialog dirDialog; - -public Test_org_eclipse_swt_widgets_DirectoryDialog(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- dirDialog = new DirectoryDialog(shell, SWT.NULL);
- setDialog(dirDialog);
-} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Shell() {
- if (fCheckSwtNullExceptions) {
- DirectoryDialog dd = new DirectoryDialog(shell);
- try {
- dd = new DirectoryDialog(null);
- fail("No exception thrown for null parent");
- }
- catch (IllegalArgumentException e) {
- }
- }
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ShellI not written"); -} - -public void test_getFilterPath() {
- // tested in test_setFilterPathLjava_lang_String
-} - -public void test_getMessage() {
- // tested in test_setMessageLjava_lang_String
-} - -public void test_open() {
- if (fTestDialogOpen)
- dirDialog.open();
-} - -public void test_setFilterPathLjava_lang_String() {
- assertTrue(":1:", dirDialog.getFilterPath() == "");
- String testStr = "./*";
- dirDialog.setFilterPath(testStr);
- assertTrue(":2:", dirDialog.getFilterPath().equals(testStr));
- dirDialog.setFilterPath("");
- assertTrue(":3:", dirDialog.getFilterPath().equals(""));
- if (fCheckSwtNullExceptions) {
- try {
- dirDialog.setFilterPath(null);
- fail("No exception thrown for filterPath == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-} - -public void test_setMessageLjava_lang_String() {
- assertTrue(":1:", dirDialog.getMessage() == "");
- String testStr = "test string";
- dirDialog.setMessage(testStr);
- assertTrue(":2:", dirDialog.getMessage().equals(testStr));
- dirDialog.setMessage("");
- assertTrue(":3:", dirDialog.getMessage().equals(""));
- if (fCheckSwtNullExceptions) {
- try {
- dirDialog.setMessage(null);
- fail("No exception thrown for message == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_DirectoryDialog((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI"); - methodNames.addElement("test_getFilterPath"); - methodNames.addElement("test_getMessage"); - methodNames.addElement("test_open"); - methodNames.addElement("test_setFilterPathLjava_lang_String"); - methodNames.addElement("test_setMessageLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Dialog.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI(); - else if (getName().equals("test_getFilterPath")) test_getFilterPath(); - else if (getName().equals("test_getMessage")) test_getMessage(); - else if (getName().equals("test_open")) test_open(); - else if (getName().equals("test_setFilterPathLjava_lang_String")) test_setFilterPathLjava_lang_String(); - else if (getName().equals("test_setMessageLjava_lang_String")) test_setMessageLjava_lang_String(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java deleted file mode 100644 index 20be2be2bd..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java +++ /dev/null @@ -1,365 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Display - * - * @see org.eclipse.swt.widgets.Display - */ -public class Test_org_eclipse_swt_widgets_Display extends Test_org_eclipse_swt_graphics_Device { - -boolean disposeExecRan; - -public Test_org_eclipse_swt_widgets_Display(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- // There can only be one Display object per thread.
- // If a second Display is created on the same thread, an
- // InvalidThreadAccessException is thrown.
- //
- // Each test will create its own Display and must dispose of it
- // before completing.
-} - -protected void tearDown() {
-} - -public void test_Constructor() {
- Display disp = new Display();
- disp.dispose();
-} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceData() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceData not written"); -} - -public void test_asyncExecLjava_lang_Runnable() { - warnUnimpl("Test test_asyncExecLjava_lang_Runnable not written"); -} - -public void test_beep() {
- Display display = new Display();
- try {
- display.beep();
- } finally {
- display.dispose();
- }
-} - -public void test_checkSubclass() { - warnUnimpl("Test test_checkSubclass not written"); -} - -public void test_checkDevice() { - warnUnimpl("Test test_checkDevice not written"); -} - -public void test_createLorg_eclipse_swt_graphics_DeviceData() { - warnUnimpl("Test test_createLorg_eclipse_swt_graphics_DeviceData not written"); -} - -public void test_destroy() { - warnUnimpl("Test test_destroy not written"); -} - -public void test_disposeExecLjava_lang_Runnable() {
- // Also tests dispose and isDisposed
- Display testDisplay = new Display();
- disposeExecRan = false;
- testDisplay.disposeExec(new Runnable() {
- public void run() {
- disposeExecRan = true;
- }
- });
- assertEquals("Display should not be disposed", false, testDisplay.isDisposed());
- testDisplay.dispose();
- assertTrue("Display should be disposed", testDisplay.isDisposed());
- assertTrue("DisposeExec Runnable did not run", disposeExecRan);
-} - -public void test_findWidgetI() { - warnUnimpl("Test test_findWidgetI not written"); -} - -public void test_findDisplayLjava_lang_Thread() { - warnUnimpl("Test test_findDisplayLjava_lang_Thread not written"); -} - -public void test_getActiveShell() { - warnUnimpl("Test test_getActiveShell not written"); -} - -public void test_getBounds() {
- Display display = new Display();
- try {
- Rectangle rect = display.getBounds();
- assertNotNull(rect);
- } finally {
- display.dispose();
- }
-} - -public void test_getCurrent() { - warnUnimpl("Test test_getCurrent not written"); -} - -public void test_getClientArea() { - warnUnimpl("Test test_getClientArea not written"); -} - -public void test_getCursorControl() {
- Display display = new Display();
- try {
- display.getCursorControl();
- } finally {
- display.dispose();
- }
-} - -public void test_getCursorLocation() { - warnUnimpl("Test test_getCursorLocation not written"); -} - -public void test_getDefault() {
- Display display = new Display();
- try {
- assertNotNull(display.getDefault());
- } finally {
- display.dispose();
- }
-} - -public void test_getDataLjava_lang_String() { - warnUnimpl("Test test_getDataLjava_lang_String not written"); -} - -public void test_getData() { - warnUnimpl("Test test_getData not written"); -} - -public void test_getDoubleClickTime() { - warnUnimpl("Test test_getDoubleClickTime not written"); -} - -public void test_getFocusControl() {
- Display display = new Display();
- try {
- display.getFocusControl();
- } finally {
- display.dispose();
- }
-} - -public void test_getIconDepth() { - warnUnimpl("Test test_getIconDepth not written"); -} - -public void test_getShells() { - warnUnimpl("Test test_getShells not written"); -} - -public void test_getSyncThread() { - warnUnimpl("Test test_getSyncThread not written"); -} - -public void test_getSystemColorI() {
- Display display = new Display();
- try {
- int [] colorIds = {
- SWT.COLOR_WIDGET_DARK_SHADOW, SWT.COLOR_WIDGET_NORMAL_SHADOW,
- SWT.COLOR_WIDGET_LIGHT_SHADOW, SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW,
- SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_WIDGET_BORDER,
- SWT.COLOR_WIDGET_FOREGROUND, SWT.COLOR_LIST_FOREGROUND,
- SWT.COLOR_LIST_BACKGROUND, SWT.COLOR_LIST_SELECTION,
- SWT.COLOR_LIST_SELECTION_TEXT,
- };
- for (int i=0; i < colorIds.length; i++) {
- assertNotNull(display.getSystemColor(colorIds[i]));
- }
- } finally {
- display.dispose();
- }
-} - -public void test_getSystemFont() { - warnUnimpl("Test test_getSystemFont not written"); -} - -public void test_getThread() { - warnUnimpl("Test test_getThread not written"); -} - -public void test_internal_new_GCLorg_eclipse_swt_graphics_GCData() { - warnUnimpl("Test test_internal_new_GCLorg_eclipse_swt_graphics_GCData not written"); -} - -public void test_init() { - warnUnimpl("Test test_init not written"); -} - -public void test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData() { - warnUnimpl("Test test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData not written"); -} - -public void test_readAndDispatch() { - warnUnimpl("Test test_readAndDispatch not written"); -} - -public void test_release() { - warnUnimpl("Test test_release not written"); -} - -public void test_setDataLjava_lang_StringLjava_lang_Object() { - warnUnimpl("Test test_setDataLjava_lang_StringLjava_lang_Object not written"); -} - -public void test_setDataLjava_lang_Object() { - warnUnimpl("Test test_setDataLjava_lang_Object not written"); -} - -public void test_setAppNameLjava_lang_String() { - warnUnimpl("Test test_setAppNameLjava_lang_String not written"); -} - -public void test_setSynchronizerLorg_eclipse_swt_widgets_Synchronizer() { - warnUnimpl("Test test_setSynchronizerLorg_eclipse_swt_widgets_Synchronizer not written"); -} - -public void test_sleep() { - warnUnimpl("Test test_sleep not written"); -} - -public void test_syncExecLjava_lang_Runnable() { - warnUnimpl("Test test_syncExecLjava_lang_Runnable not written"); -} - -public void test_timerExecILjava_lang_Runnable() { - warnUnimpl("Test test_timerExecILjava_lang_Runnable not written"); -} - -public void test_update() { - warnUnimpl("Test test_update not written"); -} - -public void test_wake() { - warnUnimpl("Test test_wake not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Display((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceData"); - methodNames.addElement("test_asyncExecLjava_lang_Runnable"); - methodNames.addElement("test_beep"); - methodNames.addElement("test_checkSubclass"); - methodNames.addElement("test_checkDevice"); - methodNames.addElement("test_createLorg_eclipse_swt_graphics_DeviceData"); - methodNames.addElement("test_destroy"); - methodNames.addElement("test_disposeExecLjava_lang_Runnable"); - methodNames.addElement("test_findWidgetI"); - methodNames.addElement("test_findDisplayLjava_lang_Thread"); - methodNames.addElement("test_getActiveShell"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getCurrent"); - methodNames.addElement("test_getClientArea"); - methodNames.addElement("test_getCursorControl"); - methodNames.addElement("test_getCursorLocation"); - methodNames.addElement("test_getDefault"); - methodNames.addElement("test_getDataLjava_lang_String"); - methodNames.addElement("test_getData"); - methodNames.addElement("test_getDoubleClickTime"); - methodNames.addElement("test_getFocusControl"); - methodNames.addElement("test_getIconDepth"); - methodNames.addElement("test_getShells"); - methodNames.addElement("test_getSyncThread"); - methodNames.addElement("test_getSystemColorI"); - methodNames.addElement("test_getSystemFont"); - methodNames.addElement("test_getThread"); - methodNames.addElement("test_internal_new_GCLorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_init"); - methodNames.addElement("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_readAndDispatch"); - methodNames.addElement("test_release"); - methodNames.addElement("test_setDataLjava_lang_StringLjava_lang_Object"); - methodNames.addElement("test_setDataLjava_lang_Object"); - methodNames.addElement("test_setAppNameLjava_lang_String"); - methodNames.addElement("test_setSynchronizerLorg_eclipse_swt_widgets_Synchronizer"); - methodNames.addElement("test_sleep"); - methodNames.addElement("test_syncExecLjava_lang_Runnable"); - methodNames.addElement("test_timerExecILjava_lang_Runnable"); - methodNames.addElement("test_update"); - methodNames.addElement("test_wake"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceData")) test_ConstructorLorg_eclipse_swt_graphics_DeviceData(); - else if (getName().equals("test_asyncExecLjava_lang_Runnable")) test_asyncExecLjava_lang_Runnable(); - else if (getName().equals("test_beep")) test_beep(); - else if (getName().equals("test_checkSubclass")) test_checkSubclass(); - else if (getName().equals("test_checkDevice")) test_checkDevice(); - else if (getName().equals("test_createLorg_eclipse_swt_graphics_DeviceData")) test_createLorg_eclipse_swt_graphics_DeviceData(); - else if (getName().equals("test_destroy")) test_destroy(); - else if (getName().equals("test_disposeExecLjava_lang_Runnable")) test_disposeExecLjava_lang_Runnable(); - else if (getName().equals("test_findWidgetI")) test_findWidgetI(); - else if (getName().equals("test_findDisplayLjava_lang_Thread")) test_findDisplayLjava_lang_Thread(); - else if (getName().equals("test_getActiveShell")) test_getActiveShell(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getCurrent")) test_getCurrent(); - else if (getName().equals("test_getClientArea")) test_getClientArea(); - else if (getName().equals("test_getCursorControl")) test_getCursorControl(); - else if (getName().equals("test_getCursorLocation")) test_getCursorLocation(); - else if (getName().equals("test_getDefault")) test_getDefault(); - else if (getName().equals("test_getDataLjava_lang_String")) test_getDataLjava_lang_String(); - else if (getName().equals("test_getData")) test_getData(); - else if (getName().equals("test_getDoubleClickTime")) test_getDoubleClickTime(); - else if (getName().equals("test_getFocusControl")) test_getFocusControl(); - else if (getName().equals("test_getIconDepth")) test_getIconDepth(); - else if (getName().equals("test_getShells")) test_getShells(); - else if (getName().equals("test_getSyncThread")) test_getSyncThread(); - else if (getName().equals("test_getSystemColorI")) test_getSystemColorI(); - else if (getName().equals("test_getSystemFont")) test_getSystemFont(); - else if (getName().equals("test_getThread")) test_getThread(); - else if (getName().equals("test_internal_new_GCLorg_eclipse_swt_graphics_GCData")) test_internal_new_GCLorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_init")) test_init(); - else if (getName().equals("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData")) test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_readAndDispatch")) test_readAndDispatch(); - else if (getName().equals("test_release")) test_release(); - else if (getName().equals("test_setDataLjava_lang_StringLjava_lang_Object")) test_setDataLjava_lang_StringLjava_lang_Object(); - else if (getName().equals("test_setDataLjava_lang_Object")) test_setDataLjava_lang_Object(); - else if (getName().equals("test_setAppNameLjava_lang_String")) test_setAppNameLjava_lang_String(); - else if (getName().equals("test_setSynchronizerLorg_eclipse_swt_widgets_Synchronizer")) test_setSynchronizerLorg_eclipse_swt_widgets_Synchronizer(); - else if (getName().equals("test_sleep")) test_sleep(); - else if (getName().equals("test_syncExecLjava_lang_Runnable")) test_syncExecLjava_lang_Runnable(); - else if (getName().equals("test_timerExecILjava_lang_Runnable")) test_timerExecILjava_lang_Runnable(); - else if (getName().equals("test_update")) test_update(); - else if (getName().equals("test_wake")) test_wake(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Event.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Event.java deleted file mode 100644 index 19a0a725e4..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Event.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.widgets.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Event - */ -public class Test_org_eclipse_swt_widgets_Event extends SwtTestCase { - -public Test_org_eclipse_swt_widgets_Event(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_getBounds() { - warnUnimpl("Test test_getBounds not written"); -} - -public void test_setBoundsLorg_eclipse_swt_graphics_Rectangle() { - warnUnimpl("Test test_setBoundsLorg_eclipse_swt_graphics_Rectangle not written"); -} - -public void test_toString() { - warnUnimpl("Test test_toString not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Event((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_setBoundsLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_toString"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_setBoundsLorg_eclipse_swt_graphics_Rectangle")) test_setBoundsLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_toString")) test_toString(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FileDialog.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FileDialog.java deleted file mode 100644 index 1513834ff3..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FileDialog.java +++ /dev/null @@ -1,155 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.FileDialog - * - * @see org.eclipse.swt.widgets.FileDialog - */ -public class Test_org_eclipse_swt_widgets_FileDialog extends Test_org_eclipse_swt_widgets_Dialog { - -FileDialog fileDialog; - -public Test_org_eclipse_swt_widgets_FileDialog(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- fileDialog = new FileDialog(shell, SWT.NULL);
- setDialog(fileDialog);
-} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Shell() {
- // Test FileDialog(Shell)
- if (fCheckSwtNullExceptions) {
- FileDialog fd = new FileDialog(shell);
- try {
- fd = new FileDialog(null);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ShellI not written"); -} - -public void test_getFileName() { - warnUnimpl("Test test_getFileName not written"); -} - -public void test_getFileNames() { - warnUnimpl("Test test_getFileNames not written"); -} - -public void test_getFilterExtensions() { - warnUnimpl("Test test_getFilterExtensions not written"); -} - -public void test_getFilterNames() { - warnUnimpl("Test test_getFilterNames not written"); -} - -public void test_getFilterPath() {
- // tested in test_setFilterPathLjava_lang_String
-} - -public void test_open() {
- if (fTestDialogOpen)
- fileDialog.open();
-} - -public void test_setFileNameLjava_lang_String() { - warnUnimpl("Test test_setFileNameLjava_lang_String not written"); -} - -public void test_setFilterExtensions$Ljava_lang_String() { - warnUnimpl("Test test_setFilterExtensions$Ljava_lang_String not written"); -} - -public void test_setFilterNames$Ljava_lang_String() { - warnUnimpl("Test test_setFilterNames$Ljava_lang_String not written"); -} - -public void test_setFilterPathLjava_lang_String() {
- assertTrue(":1:", fileDialog.getFilterPath() == "");
- String testStr = "./*";
- fileDialog.setFilterPath(testStr);
- assertTrue(":2:", fileDialog.getFilterPath().equals(testStr));
- fileDialog.setFilterPath("");
- assertTrue(":3:", fileDialog.getFilterPath().equals(""));
- if (fCheckSwtNullExceptions) {
- try {
- fileDialog.setFilterPath(null);
- fail("No exception thrown for filterPath == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_FileDialog((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI"); - methodNames.addElement("test_getFileName"); - methodNames.addElement("test_getFileNames"); - methodNames.addElement("test_getFilterExtensions"); - methodNames.addElement("test_getFilterNames"); - methodNames.addElement("test_getFilterPath"); - methodNames.addElement("test_open"); - methodNames.addElement("test_setFileNameLjava_lang_String"); - methodNames.addElement("test_setFilterExtensions$Ljava_lang_String"); - methodNames.addElement("test_setFilterNames$Ljava_lang_String"); - methodNames.addElement("test_setFilterPathLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Dialog.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI(); - else if (getName().equals("test_getFileName")) test_getFileName(); - else if (getName().equals("test_getFileNames")) test_getFileNames(); - else if (getName().equals("test_getFilterExtensions")) test_getFilterExtensions(); - else if (getName().equals("test_getFilterNames")) test_getFilterNames(); - else if (getName().equals("test_getFilterPath")) test_getFilterPath(); - else if (getName().equals("test_open")) test_open(); - else if (getName().equals("test_setFileNameLjava_lang_String")) test_setFileNameLjava_lang_String(); - else if (getName().equals("test_setFilterExtensions$Ljava_lang_String")) test_setFilterExtensions$Ljava_lang_String(); - else if (getName().equals("test_setFilterNames$Ljava_lang_String")) test_setFilterNames$Ljava_lang_String(); - else if (getName().equals("test_setFilterPathLjava_lang_String")) test_setFilterPathLjava_lang_String(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FontDialog.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FontDialog.java deleted file mode 100644 index cbe1544404..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FontDialog.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.FontDialog - * - * @see org.eclipse.swt.widgets.FontDialog - */ -public class Test_org_eclipse_swt_widgets_FontDialog extends Test_org_eclipse_swt_widgets_Dialog { - -FontDialog fontDialog; - -public Test_org_eclipse_swt_widgets_FontDialog(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- fontDialog = new FontDialog(shell, SWT.NULL);
- setDialog(fontDialog);
-} - -protected void tearDown() {
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_Shell() {
- FontDialog fd = new FontDialog(shell);
- try {
- new FontDialog(null);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() {
- try {
- new FontDialog(null, SWT.NULL);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-} - -public void test_getFontData() {
- // tested in test_setFontDataLorg_eclipse_swt_graphics_FontData
-} - -public void test_open() { - warnUnimpl("Test test_open not written"); -} - -public void test_setFontDataLorg_eclipse_swt_graphics_FontData() {
- FontData fontData = new FontData();
-
- assertNull(fontDialog.getFontData());
-
- fontDialog.setFontData(fontData);
- assertEquals(fontDialog.getFontData(), fontData);
-
- fontDialog.setFontData(null);
- assertNull(fontDialog.getFontData());
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_FontDialog((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI"); - methodNames.addElement("test_getFontData"); - methodNames.addElement("test_open"); - methodNames.addElement("test_setFontDataLorg_eclipse_swt_graphics_FontData"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Dialog.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI(); - else if (getName().equals("test_getFontData")) test_getFontData(); - else if (getName().equals("test_open")) test_open(); - else if (getName().equals("test_setFontDataLorg_eclipse_swt_graphics_FontData")) test_setFontDataLorg_eclipse_swt_graphics_FontData(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Group.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Group.java deleted file mode 100644 index 7512b84d33..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Group.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Group - * - * @see org.eclipse.swt.widgets.Group - */ -public class Test_org_eclipse_swt_widgets_Group extends Test_org_eclipse_swt_widgets_Composite { - -Group group; - -public Test_org_eclipse_swt_widgets_Group(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- group = new Group(shell, 0);
- setWidget(group);
-} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
- try {
- group = new Group(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {SWT.SHADOW_IN, SWT.SHADOW_OUT, SWT.SHADOW_ETCHED_IN, SWT.SHADOW_ETCHED_OUT};
- for (int i = 0; i < cases.length; i++)
- group = new Group(shell, cases[i]);
-} - -public void test_checkSubclass() { - warnUnimpl("Test test_checkSubclass not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_computeTrimIIII() { - warnUnimpl("Test test_computeTrimIIII not written"); -} - -public void test_getClientArea() { - warnUnimpl("Test test_getClientArea not written"); -} - -public void test_getText() {
- // tested in test_setTextLjava_lang_String
-} - -public void test_setTextLjava_lang_String() {
- String[] cases = {"", "some text", "ldkashdoehufweovcnhslvhregojebckreavbkuhxbiufvcyhbifuyewvbiureyd.,cmnesljliewjfchvbwoifivbeworixuieurvbiuvbohflksjeahfcliureafgyciabelitvyrwtlicuyrtliureybcliuyreuceyvbliureybct"};
- for (int i = 0; i < cases.length; i++) {
- group.setText(cases[i]);
- assertTrue("case: " + String.valueOf(i), group.getText().equals(cases[i]));
- };
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Group((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_checkSubclass"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_computeTrimIIII"); - methodNames.addElement("test_getClientArea"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_checkSubclass")) test_checkSubclass(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII(); - else if (getName().equals("test_getClientArea")) test_getClientArea(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Item.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Item.java deleted file mode 100644 index bd6ecbdc21..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Item.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Item - * - * @see org.eclipse.swt.widgets.Item - */ -public class Test_org_eclipse_swt_widgets_Item extends Test_org_eclipse_swt_widgets_Widget { - -Item item; -protected Image[] images = new Image [3]; - -public Test_org_eclipse_swt_widgets_Item(String name) { - super(name); -} - -protected void setUp() {
- super.setUp();
- loadImages();
-} - -protected void tearDown() {
- super.tearDown();
- freeImages();
-} - -// this method must be private or protected so the auto-gen tool keeps it
-private void loadImages() {
- java.io.InputStream in1 = this.getClass().getResourceAsStream("folder.bmp");
- java.io.InputStream in2 = this.getClass().getResourceAsStream("folderOpen.bmp");
- java.io.InputStream in3 = this.getClass().getResourceAsStream("target.bmp");
- Display display = shell.getDisplay();
-
- images [0] = new Image (display, in1);
- images [1] = new Image (display, in2);
- images [2] = new Image (display, in3);
-
- try {
- in1.close();
- in2.close();
- in3.close();
- } catch (java.io.IOException e) {
- }
-} -protected void setWidget(Widget widget) {
- item = (Item) widget;
- super.setWidget(widget);
-} -// this method must be private or protected so the auto-gen tool keeps it
-private void freeImages() {
- for (int i=0; i<images.length; i++) {
- if (images[i] != null)
- images[i].dispose();
- }
-} - -public void test_getImage() {
- // tested in test_setImageLorg_eclipse_swt_graphics_Image
-} - -public void test_getText() {
- // tested in test_setTextLjava_lang_String
-} - -public void test_setImageLorg_eclipse_swt_graphics_Image() {
- assertNull(item.getImage());
- item.setImage(images[0]);
- assertEquals(images[0], item.getImage());
- assertTrue(item.getImage() != images[1]);
- item.setImage(null);
- assertNull(item.getImage());
-} - -public void test_setTextLjava_lang_String() {
- String testStr = "test string";
- item.setText(testStr);
- assertTrue("a", item.getText().equals(testStr));
- item.setText("");
- assertTrue("b", item.getText().equals(""));
- if (fCheckSwtNullExceptions) {
- try {
- item.setText(null);
- fail("No exception thrown for string == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_getImage"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_getImage")) test_getImage(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Label.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Label.java deleted file mode 100644 index 234eb61e61..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Label.java +++ /dev/null @@ -1,207 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Label - * - * @see org.eclipse.swt.widgets.Label - */ -public class Test_org_eclipse_swt_widgets_Label extends Test_org_eclipse_swt_widgets_Control { - -Label label; - -public Test_org_eclipse_swt_widgets_Label(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- label = new Label(shell, 0);
- setWidget(label);
-} - -protected void tearDown() {
-// super.tearDown();
-
- if (label != null) {
- assertEquals(shell.isDisposed(), false);
- assertEquals(label.isDisposed(), false);
- }
-
- shell.dispose();
- if (label != null) {
- assertTrue(shell.isDisposed());
- assertTrue(label.isDisposed());
- }
-} - -/**
- * Possible exceptions:
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- try {
- label = new Label(null, 0);
- fail("No exception thrown"); //should never get here
- }
- catch (IllegalArgumentException e) {
- }
-
- label = new Label(shell, 0);
-
- int[] cases = {SWT.LEFT, SWT.RIGHT, SWT.CENTER, SWT.SEPARATOR, SWT.HORIZONTAL, SWT.VERTICAL, SWT.SHADOW_IN, SWT.SHADOW_OUT};
- for (int i = 0; i < cases.length; i++)
- label = new Label(shell, cases[i]);
-} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -/**
- * Returns a value which describes the position of the
- * text or image in the receiver. The value will be one of
- * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
- * unless the receiver is a <code>SEPARATOR</code> label, in
- * which case, <code>NONE</code> is returned.
- */
-public void test_getAlignment(){
- int[] cases = {SWT.LEFT, SWT.RIGHT, SWT.CENTER};
- for (int i=0; i<cases.length; i++)
- {
- label = new Label(shell, cases[i]);
- assertEquals(label.getAlignment(), cases[i]);
- }
-} - -/**
- * Returns the receiver's image if it has one, or null
- * if it does not.
- */
-public void test_getImage(){
- Image[] cases = {null, new Image(null, 100, 100)};
- for(int i=0; i<cases.length; i++){
- label.setImage(cases[i]);
- assertEquals(label.getImage(), cases[i]);
- if (cases[i]!=null)
- cases[i].dispose();
- }
-} - -/**
- * Returns the receiver's text, which will be an empty
- * string if it has never been set or if the receiver is
- * a <code>SEPARATOR</code> label.
- */
-public void test_getText(){
- String[] cases = {"", "some name", "sdasdlkjshcdascecoewcwe"};
- for(int i=0; i<cases.length; i++){
- label.setText(cases[i]);
- assertEquals(label.getText(), cases[i]);
- }
-} - -/**
- * Controls how text and images will be displayed in the receiver.
- * The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
- * or <code>CENTER</code>. If the receiver is a <code>SEPARATOR</code>
- * label, the argument is ignored and the alignment is not changed.
- */
-public void test_setAlignmentI(){
- int[] cases = {SWT.LEFT, SWT.RIGHT, SWT.CENTER};
- for (int i=0; i<cases.length; i++)
- {
- label.setAlignment(cases[i]);
- assertEquals(label.getAlignment(), cases[i]);
- }
-} - -public void test_setFocus() { - warnUnimpl("Test test_setFocus not written"); -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written"); -} - -/**
- * Sets the receiver's text.
- * <p>
- * This method sets the widget label. The label may include
- * the mnemonic characters and line delimiters.
- * </p>
- *
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- */
-public void test_setTextLjava_lang_String(){
- try {
- label.setText(null);
- fail("No exception thrown for string == null");
- }
- catch (IllegalArgumentException e) {
- }
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Label((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_getAlignment"); - methodNames.addElement("test_getImage"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_setAlignmentI"); - methodNames.addElement("test_setFocus"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_getAlignment")) test_getAlignment(); - else if (getName().equals("test_getImage")) test_getImage(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_setAlignmentI")) test_setAlignmentI(); - else if (getName().equals("test_setFocus")) test_setFocus(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Layout.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Layout.java deleted file mode 100644 index fc9b598928..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Layout.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.widgets.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Layout - * - * @see org.eclipse.swt.widgets.Layout - */ -public class Test_org_eclipse_swt_widgets_Layout extends SwtTestCase { - -public Test_org_eclipse_swt_widgets_Layout(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ() { - warnUnimpl("Test test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ not written"); -} - -public void test_layoutLorg_eclipse_swt_widgets_CompositeZ() { - warnUnimpl("Test test_layoutLorg_eclipse_swt_widgets_CompositeZ not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ"); - methodNames.addElement("test_layoutLorg_eclipse_swt_widgets_CompositeZ"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ")) test_computeSizeLorg_eclipse_swt_widgets_CompositeIIZ(); - else if (getName().equals("test_layoutLorg_eclipse_swt_widgets_CompositeZ")) test_layoutLorg_eclipse_swt_widgets_CompositeZ(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_List.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_List.java deleted file mode 100644 index cbd4cbdeb9..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_List.java +++ /dev/null @@ -1,2145 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.List - * - * @see org.eclipse.swt.widgets.List - */ -public class Test_org_eclipse_swt_widgets_List extends Test_org_eclipse_swt_widgets_Scrollable { - -List list; - -public Test_org_eclipse_swt_widgets_List(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - list = new List(shell, SWT.MULTI); - - setWidget(list); -} - -protected void tearDown() { - super.tearDown(); -} - -/** - * Test if 'deselect(u, v)' is the same as 'for (i=u; i<=v; ++i) deselect(i);' - */ -protected void deselectII_helper( - String[] items, - int start, - int end, - int[] expectedIndices) { - - list.setItems(items); - list.setSelection(items); - - list.deselect(start, end); - assertEquals( - ":(" + start + ", " + end + "):", - expectedIndices, list.getSelectionIndices()); - - list.setSelection(items); - if ( 0 != (list.getStyle() & SWT.MULTI) ) { - assertEquals("setSelection(items):", items, list.getSelection()); - } - - for (int i = start; i <= end; ++i) { - list.deselect(i); - } - assertEquals( - ":(" + start + ", " + end + "):", - expectedIndices, list.getSelectionIndices()); - - list.deselectAll(); -} -/** - * Dispose of the main list and create a new, single-selection one. - */ -protected List setSingleList() { - list.dispose(); - list = new List(shell, SWT.SINGLE); - setWidget(list); - return list; -} -/** - * Similar to deselectII_helper, checks if select(u, v) is the same as - * for (i=u; i<=v; ++i) select(i) - */ -protected void selectII_helper( - String[] items, - int start, - int end, - int[] expectedIndices) { - list.setItems(items); - list.select(start, end); - assertEquals( - ":(" + start + ", " + end + "):", - expectedIndices, list.getSelectionIndices()); - - list.deselectAll(); - assertEquals("deselectAll:", list.getSelectionIndices(), new int[] {}); - - for (int i = start; i <= end; i++) // <= on purpose - list.select(i); - - assertEquals(":(" + start + ", " + end + "):", - expectedIndices, list.getSelectionIndices()); - - list.deselectAll(); -} -/** - * Similar to deselectII_helper, checks if select(int []arr) gives the same - * result as several individual select(int) calls. The int[] used for selection - * will be filled all integers from start to end inclusive, in order. - */ -protected void select$I_helper( - String[] items, - int start, - int end, - int[] expectedIndices) { - int[] selection = new int[end - start + 1]; - for (int i = 0; i < selection.length; ++i) { - selection[i] = i + start; - } - - list.select(selection); - - assertEquals( - ":(" + start + ", " + end + "):", - expectedIndices, list.getSelectionIndices()); - - list.deselectAll(); - assertEquals("deselectAll:", list.getSelectionIndices(), new int[] {}); - - for (int i = start; i <= end; i++) // <= on purpose - list.select(i); - - assertEquals( - ":(" + start + ", " + end + "):", - expectedIndices, list.getSelectionIndices()); - - list.deselectAll(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - try { - list = new List(null, 0); - fail("No exception thrown"); //should never get here - } catch (IllegalArgumentException e) { - } - - int[] cases = - { - 0, - SWT.SINGLE, - SWT.MULTI, - SWT.MULTI | SWT.V_SCROLL, - SWT.MULTI | SWT.H_SCROLL, - SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL }; - for (int i = 0; i < cases.length; i++) - list = new List(shell, cases[i]); -} - -/** - * Adds the argument to the end of the receiver's list. - * - * @param string the new item - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - * @exception SWTError <ul> - * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li> - * </ul> - * - */ -public void test_addLjava_lang_String() { - try { - list.add(null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - list.add(""); - list.add("some \n text"); - list.add("some text"); - - // test single-selection list - - setSingleList(); - - try { - list.add(null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - list.add(""); - list.add("some \n text"); - list.add("some text"); -} - -/** - * Adds the argument to the receiver's list at the given - * zero-relative index. - * <p> - * Note: To add an item at the end of the list, use the - * result of calling <code>getItemCount()</code> as the - * index or use <code>add(String)</code>. - * </p> - * - * @param string the new item - * @param index the index for the item - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - * @exception SWTError <ul> - * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li> - * </ul> - * - * @see #add(String) - */ -public void test_addLjava_lang_StringI() { - try { - list.add("some text", 2); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(0, list.getItemCount()); - - // test single-selection list - - setSingleList(); - - try { - list.add("some text", 2); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(0, list.getItemCount()); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_deselect$I() { - String[] items = { "item0", "item1", "item2", "item3" }; - String[] empty = { - }; - list.setItems(items); - list.setSelection(items); - assertEquals(":a:", list.getSelection(), items); - try { - list.deselect(null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(list.getSelection(), items); - list.deselect(new int[] { - }); - assertEquals(list.getSelection(), items); - list.deselect(new int[] { 0 }); - assertEquals(list.isSelected(0), false); - assertTrue(list.isSelected(1)); - list.deselect(new int[] { 2, 0, 0 }); - assertEquals(list.getSelectionIndices(), new int[] { 1, 3 }); - /* assert(":d:", !list.isSelected(0)); - assert(":dd:", !list.isSelected(2)); - assert(":ddd:", list.isSelected(1)); - assert(":ddd:", list.isSelected(1));*/ - - - setSingleList(); - list.setItems(items); - list.setSelection(items); - assertEquals(list.getSelection(), new String[] { "item3" }); - try { - list.deselect(null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(list.getSelection(), new String[] { "item3" }); - list.deselect(new int[] { - }); - assertEquals(list.getSelection(), new String[] { "item3" }); - list.deselect(new int[] { 1 }); - assertEquals(list.getSelectionIndices(), new int[] { 3 }); - list.deselect(new int[] { 0 }); - assertEquals(list.getSelectionIndices(), new int[] { 3 }); - list.deselect(new int[] { 3 }); - assertEquals(list.getSelectionIndices(), new int[] {}); - list.deselect(new int[] { 2, 0, 0 }); - assertEquals(list.getSelectionIndices(), new int[] {}); - -} - -public void test_deselectI() { - int number = 5; - String[] items = new String[number]; - for (int i = 0; i < number; i++) - items[i] = "fred" + i; - list.setItems(items); - - String[] items2 = { "item0", "item1", "item2", "item3" }; - String[] empty = { - }; - list.setItems(items2); - list.setSelection(items2); - assertEquals(items2, list.getSelection()); - list.deselect(5); - assertEquals(items2, list.getSelection()); - list.deselect(1); - assertEquals(false, list.isSelected(1)); - list.deselect(1); - assertEquals(false, list.isSelected(1)); - - - setSingleList(); - list.setItems(items2); - list.setSelection(items2); - assertEquals(new String[] { "item3" }, list.getSelection()); - list.deselect(5); - assertEquals(new String[] { "item3" }, list.getSelection()); - list.deselect(2); - assertEquals(false, list.isSelected(2)); - list.deselect(1); - assertEquals(false, list.isSelected(1)); - list.deselect(1); - assertEquals(false, list.isSelected(1)); - // assert(":e:", list.getSe); - -} - -public void test_deselectII() { - int number = 5; - String[] items = new String[number]; - for (int i = 0; i < number; i++) - items[i] = "fred" + i; - list.setItems(items); - list.setSelection(items); - - // tests if deselect(i, j) is the same as for (i=0; i<=j; ++i) deselect(i); - int[][] cases = { { 3, 1 }, { - -3, -2 }, { - -2, -1 }, { - -1, -1 }, { - 10, 1 } - }; - - for (int i = 0; i < cases.length; ++i) { - deselectII_helper(items, cases[i][0], cases[i][1], new int[] { 0, 1, 2, 3, 4 }); - } - if (fCheckSWTPolicy) { - deselectII_helper(items, -1, 3, new int[] { 4 }); - deselectII_helper(items, -1, 30, new int[] { - }); - } - deselectII_helper(items, 1, 3, new int[] { 0, 4 }); - deselectII_helper(items, 1, 1, new int[] { 0, 2, 3, 4 }); - // done - - String[] items2 = { "item0", "item1", "item2", "item3" }; - String[] empty = { - }; - list.setItems(items2); - list.setSelection(items2); - assertEquals(":a:", items2, list.getSelection()); - list.deselect(0, 0); - assertEquals(":b:", list.getSelectionIndices(), new int[] { 1, 2, 3 }); - list.deselect(0, 0); - assertEquals(":bbb:", list.getSelectionIndices(), new int[] { 1, 2, 3 }); - list.deselect(2, 3); - assertEquals(":bb:", list.getSelectionIndices(), new int[] { 1 }); - - list.setSelection(items2); - list.deselect(0, 2); - assertEquals(":dddd:", list.getSelectionIndices(), new int[] { 3 }); - - list.setSelection(items2); - list.deselect(2, 0); - assertEquals( - ":ddddd:", - list.getSelectionIndices(), new int[] { 0, 1, 2, 3 }); - - - setSingleList(); - deselectII_helper(items, 3, 1, new int[]{4}); - deselectII_helper(items, -1, -1, new int[]{4}); - deselectII_helper(items, 1, 3, new int[]{4}); - deselectII_helper(items, -1, 3, new int[]{4}); - deselectII_helper(items, -1, 30, new int[]{}); - deselectII_helper(items, 1, 1, new int[]{4}); - deselectII_helper(items, 10, 1, new int[]{4}); - - - - list.setItems(items2); - list.deselectAll(); - - list.select(0); - - list.deselect(-3, -2); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - list.deselect(-2, -1); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - list.deselect(-1, -1); - assertEquals(":e:", list.getSelectionIndices(), new int[] { 0 }); - - - list.setSelection(items2); - assertEquals(list.getSelection(), new String[] { "item3" }); - - list.deselect(1, 1); - assertEquals(list.getSelection(), new String[] { "item3" }); - - list.deselect(0, 0); - assertEquals(list.getSelection(), new String[] { "item3" }); - - list.deselect(3, 3); - assertEquals(list.getSelection(), new String[] {}); - - list.setSelection(items2); - list.deselect(1, 2); - assertEquals(list.getSelection(), new String[] { "item3" }); - - list.setSelection(items2); - list.deselect(0, 2); - assertEquals(list.getSelectionIndices(), new int[] { 3 }); - - list.setSelection(items2); - list.deselect(1, 3); - assertEquals(list.getSelectionIndices(), new int[] {}); -} - -public void test_deselectAll() { - String[] items = { "item0", "item1", "item2", "item3" }; - String[] empty = { - }; - list.setItems(items); - list.setSelection(items); - assertEquals(items, list.getSelection()); - list.deselectAll(); - assertEquals(empty, list.getSelection()); - - - setSingleList(); - - list.setItems(items); - list.setSelection(items); - assertEquals(new String[] { "item3" }, list.getSelection()); - list.deselectAll(); - assertEquals(empty, list.getSelection()); - -} - -public void test_getFocusIndex() { - warnUnimpl("Test test_getFocusIndex not written"); -} - -/** - * Returns the item at the given, zero-relative index in the - * receiver. Throws an exception if the index is out of range. - * - * @param index the index of the item to return - * @return the item at the given index - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - * @exception SWTError <ul> - * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li> - * </ul> - */ -public void test_getItemI() { - String[] items = { "item0", "item1", "item2", "item3" }; - String[] empty = { - }; - list.setItems(items); - String item = null; - try { - item = list.getItem(5); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(list.getItem(3), "item3"); - - - setSingleList(); - list.setItems(items); - try { - item = list.getItem(5); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - //assert(":a:", list.getItem(5)==null); - assertEquals("item3", list.getItem(3)); - -} - -public void test_getItemCount() { - String[] items = { "item0", "item1", "item2", "item3" }; - - assertEquals(0, list.getItemCount()); - list.setItems(items); - assertEquals(4, list.getItemCount()); - list.remove(2); - assertEquals(3, list.getItemCount()); - list.removeAll(); - assertEquals(0, list.getItemCount()); - - - setSingleList(); - assertEquals(0, list.getItemCount()); - list.setItems(items); - assertEquals(4, list.getItemCount()); - list.remove(2); - assertEquals(3, list.getItemCount()); - list.removeAll(); - assertEquals(0, list.getItemCount()); - -} - -public void test_getItemHeight() { - warnUnimpl("Test test_getItemHeight not written"); -} - -public void test_getItems() { - String[][] cases = { { - }, { - "" }, { - "", "" }, { - "text1", "text2" } - }; - for (int i = 0; i < cases.length; i++) { - list.setItems(cases[i]); - assertEquals("case: " + i, cases[i], list.getItems()); - } -} - -public void test_getSelection() { - String[][] cases = { { - }, { - "" }, { - "", "" }, { - "text1", "text2" } - }; - for (int i = 0; i < cases.length; i++) { - // System.out.println("loop:" + i); - list.setItems(cases[i]); - list.setSelection(cases[i]); - // System.out.println("list:" + list.getSelection()); - // System.out.println("case:" + i + cases[i]); - assertEquals("case: " + i, cases[i], list.getSelection()); - } - - for (int i = 1; i < cases.length; i++) { - list.setItems(cases[i]); - list.setSelection(0); - assertEquals( - "case: " + String.valueOf(i), - list.getSelection(), new String[] { cases[i][0] }); - } - - String[] items = { "text1", "text2", "text3" }; - list.setItems(items); - int[] sel = { 0, 2 }; - list.setSelection(sel); - assertEquals(list.getSelection().length, 2); - assertEquals(list.getSelection()[0], items[0]); - assertEquals(list.getSelection()[1], items[2]); - - list.setSelection(0, 1); - assertEquals(list.getSelection().length, 2); - assertEquals(list.getSelection()[0], items[0]); - assertEquals(list.getSelection()[1], items[1]); - - list.setSelection(1, 1); - assertEquals(list.getSelection().length, 1); - assertEquals(list.getSelection()[0], items[1]); - - list.setSelection(1, 0); - String[] empty = { - }; - assertEquals(empty, list.getSelection()); - - String[] bogus_items = { "bogus_text1", "bogus_text2", "bogus_text3" }; - list.setSelection(bogus_items); - assertEquals(empty, list.getSelection()); - - // test single-selection lists - - setSingleList(); - - list.setItems(items); - sel = new int[] { 0, 2 }; - list.setSelection(sel); - assertEquals(1, list.getSelection().length); - assertEquals(items[0], list.getSelection()[0]); - - list.setSelection(0, 1); - assertEquals(1, list.getSelection().length); - assertEquals(items[1], list.getSelection()[0]); -} - -/** - * Returns the number of selected items contained in the receiver. - * - * @return the number of selected items - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - * @exception SWTError <ul> - * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li> - * </ul> - */ -public void test_getSelectionCount() { - String[] items = { "text1", "text2", "text3" }; - - list.setItems(items); - assertEquals(0, list.getSelectionCount()); - - list.setSelection(items); - assertEquals(3, list.getSelectionCount()); - - list.deselectAll(); - try { - list.setSelection((String[]) null); - fail("No exception thrown for selection == null"); - } catch (IllegalArgumentException e) { - } - assertEquals(list.getSelectionCount(), 0); - - - setSingleList(); - - list.setItems(items); - list.setSelection(items); - assertEquals(1, list.getSelectionCount()); -} - -public void test_getSelectionIndex() { - String[] items = { "text1", "text2", "text3" }; - - setSingleList(); - - list.setItems(items); - list.setSelection(items); - assertEquals(items.length - 1, list.getSelectionIndex()); -} - -public void test_getSelectionIndices() { - String[] items = { "text1", "text2", "text3" }; - - list.setItems(items); - - assertEquals(list.getSelectionIndices(), new int[] {}); - - list.setSelection(items); - int[] sel = { 0, 1, 2 }; - assertEquals(sel, list.getSelectionIndices()); - - - setSingleList(); - - list.setItems(items); - list.setSelection(items); - sel = new int[]{ items.length - 1 }; - assertEquals(sel, list.getSelectionIndices()); - - - list.setItems(items); - assertEquals(new int[] {}, list.getSelectionIndices()); - -} - -public void test_getTopIndex() { - String[] items = { "text1", "text2", "text3" }; - - list.setItems(items); - assertEquals(0, list.getTopIndex()); - - - setSingleList(); - - list.setItems(items); - assertEquals(0, list.getTopIndex()); - -} - -/** - * Gets the index of an item. - * <p> - * The list is searched starting at 0 until an - * item is found that is equal to the search item. - * If no item is found, -1 is returned. Indexing - * is zero based. - * - * @param string the search item - * @return the index of the item - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * </ul> - */ -public void test_indexOfLjava_lang_String() { - String[] items = { "text1", "text2", "text3" }; - - list.setItems(items); - assertEquals(list.indexOf("text3"), 2); - assertEquals(list.indexOf("text4"), -1); - - int ind; - try { - ind = list.indexOf(null); - fail("No exception thrown for item == null"); - } catch (IllegalArgumentException e) { - } - - String[] items2 = { "text1", "text2", "text2" }; //two identical - - list.setItems(items2); - assertEquals(list.indexOf("text2"), 1); - - - setSingleList(); - - list.setItems(items); - assertEquals(-1, list.indexOf("text3", 4)); - - - assertEquals(2, list.indexOf("text3")); - - - assertEquals(-1, list.indexOf("text4")); - - - try { - ind = list.indexOf(null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - - assertEquals(1, list.indexOf("text2")); -} - -public void test_indexOfLjava_lang_StringI() { - String[] items = { "text1", "text2", "text3" }; - - list.setItems(items); - assertEquals(-1, list.indexOf("text3", 4)); - assertEquals(2, list.indexOf("text3", 2)); - assertEquals(1, list.indexOf("text2", 0)); - assertEquals(1, list.indexOf("text2", 1)); - assertEquals(-1, list.indexOf("text2", 2)); - - String[] items2 = { "text1", "text2", "text2" }; //two identical - list.setItems(items2); - assertEquals(list.indexOf("text2", 2), 2); - - - setSingleList(); - - list.setItems(items2); - // assert("list.indexOf(\"text2\", -1)==1", list.indexOf("text2", -1)==1); - assertEquals(1, list.indexOf("text2", 0)); - assertEquals(1, list.indexOf("text2", 1)); - assertEquals(2, list.indexOf("text2", 2)); -} - -public void test_isSelectedI() { - String[] items = { "text1", "text2", "text2" }; //two identical - - list.setItems(items); - list.setSelection(items); - assertTrue(list.isSelected(0)); - assertTrue(list.isSelected(1)); - assertTrue(list.isSelected(2)); - assertEquals(false, list.isSelected(3)); - - - setSingleList(); - - list.setItems(items); - list.setSelection(items); - if (fCheckSWTPolicy) { - assertEquals(false, list.isSelected(0)); - assertTrue(list.isSelected(1)); - assertEquals(false, list.isSelected(2)); - assertEquals(false, list.isSelected(3)); - } - -} - -/** - * Removes the items from the receiver which are - * between the given zero-relative start and end - * indices (inclusive). - * - * @param start the start of the range - * @param end the end of the range - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - * @exception SWTError <ul> - * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li> - * </ul> - */ -public void test_remove$I() { - String[] items = { "text0", "text1", "text2", "text3" }; - - list.setItems(items); - assertEquals(list.getItemCount(), 4); - - list.setItems(items); - list.remove(new int[] { 1, 0, 1 }); - assertEquals(list.getItemCount(), 2); - - list.setItems(items); - - try { - list.remove(new int[] { 3, 1, -1 }); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(":a:", list.getItems(), new String[] { "text0", "text2" }); - - list.setItems(items); - assertEquals(list.getItemCount(), 4); - - try { - list.remove(new int[] { -1, -1 }); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(":b:", list.getItems(), items); - - try { - list.remove(new int[] { -2, -1 }); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(":c:", list.getItems(), items); - - list.setItems(items); - assertEquals(list.getItemCount(), 4); - - list.remove(new int[] { 1, 1, 1 }); - assertEquals( - ":d:", - list.getItems(), new String[] { "text0", "text2", "text3" }); - - list.setItems(items); - assertEquals(list.getItemCount(), 4); - - list.remove(new int[] { 1, 3 }); - assertEquals(":e:", list.getItems(), new String[] { "text0", "text2" }); - - - setSingleList(); - - list.setItems(items); - assertEquals(4, list.getItemCount()); - - list.remove(new int[] { 1, 3 }); - assertEquals(":f:", list.getItems(), new String[] { "text0", "text2" }); - - - list.setItems(items); - assertEquals(4, list.getItemCount()); - - list.remove(new int[] { 3, 1 }); - assertEquals(":g:", list.getItems(), new String[] { "text0", "text2" }); - - - list.setItems(items); - assertEquals(4, list.getItemCount()); - - try { - list.remove(new int[] { 3, 1, -1 }); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(":h:", list.getItems(), new String[] { "text0", "text2" }); - - - list.setItems(items); - assertEquals(4, list.getItemCount()); - - try { - list.remove(new int[] { -1, -1 }); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(":i:", items, list.getItems()); - - - assertEquals(4, list.getItemCount()); - - list.remove(new int[] { 1, 1, 1 }); - assertEquals(":j:", - new String[] { "text0", "text2", "text3" }, list.getItems()); - -} - -/** - * Removes the item from the receiver at the given - * zero-relative index. - * - * @param index the index for the item - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - * @exception SWTError <ul> - * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li> - * </ul> - */ -public void test_removeI() { - String[] items = { "text1", "text2", "text3" }; - - list.setItems(items); - assertEquals(list.getItemCount(), 3); - - try { - list.remove(3); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(list.getItemCount(), 3); - - try { - list.remove(-1); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(list.getItemCount(), 3); - - list.remove(1); - assertEquals(list.getItemCount(), 2); - assertEquals(list.getItem(1), "text3"); - - list.setItems(items); - assertEquals(list.getItemCount(), 3); - - try { - list.remove(3, 4); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(list.getItemCount(), 3); - - try { - list.remove(3, 3); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(list.getItemCount(), 3); - - list.remove(1, 2); - assertEquals(list.getItemCount(), 1); - assertEquals(list.getItem(0), "text1"); - - - setSingleList(); - list.setItems(items); - assertEquals(3, list.getItemCount()); - try { - list.remove(3); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(3, list.getItemCount()); - ///////////////////////////////////////////////// - try { - list.remove(-1); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(3, list.getItemCount()); - //////////////////////////////////////////////// - list.remove(1); - assertEquals(2, list.getItemCount()); - ////////////////////////////////////////////////////// - assertTrue(list.getItem(1).equals("text3")); - -} - -/** - * Removes the items from the receiver which are - * between the given zero-relative start and end - * indices (inclusive). - * - * @param start the start of the range - * @param end the end of the range - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - * @exception SWTError <ul> - * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li> - * </ul> - */ -public void test_removeII() { - String[] items = { "text1", "text2", "text3" }; - - list.setItems(items); - assertEquals(3, list.getItemCount()); - - try { - list.remove(3, 4); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(3, list.getItemCount()); - - try { - list.remove(3, 3); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(3, list.getItemCount()); - - list.remove(0, 0); - assertEquals(2, list.getItemCount()); - assertEquals("text3", list.getItem(1)); - - list.setItems(items); - assertEquals(3, list.getItemCount()); - - try { - list.remove(3, 4); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(3, list.getItemCount()); - - list.remove(0, 2); - assertEquals(0, list.getItemCount()); - - list.setItems(items); - assertEquals(3, list.getItemCount()); - - try { - list.remove(3, 3); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(3, list.getItemCount()); - - list.remove(2, 0); - assertEquals(3, list.getItemCount()); - - - setSingleList(); - - list.setItems(items); - assertEquals(3, list.getItemCount()); - ////////////////////////////////////////////////////////////// - try { - list.remove(3, 4); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(3, list.getItemCount()); - ///////////////////////////////////////////////////////// - try { - list.remove(3, 3); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(3, list.getItemCount()); - ////////////////////////////////////////////////////////////// - list.remove(1, 2); - assertEquals(1, list.getItemCount()); - assertEquals("text1", list.getItem(0)); - - - list.setItems(items); - assertEquals(3, list.getItemCount()); - - try { - list.remove(2, 10); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(2, list.getItemCount()); - assertEquals("text2", list.getItem(1)); - - list.remove(2, 0); - assertEquals(2, list.getItemCount()); -} - -/** - * Searches the receiver's list starting at the first item - * until an item is found that is equal to the argument, - * and removes that item from the list. - * - * @param string the item to remove - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - * @exception SWTError <ul> - * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li> - * </ul> - */ -public void test_removeLjava_lang_String() { - String[] items = { "text1", "text2", "text3", "test2" }; - - list.setItems(items); - assertEquals(list.getItemCount(), 4); - - try { - list.remove((String) null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(list.getItemCount(), 4); - - try { - list.remove("items989"); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(list.getItemCount(), 4); - - list.setItems(items); - assertEquals(list.getItemCount(), 4); - - list.remove("text3"); - assertEquals(list.getItemCount(), 3); - - list.remove("text2"); - assertEquals(list.getItemCount(), 2); - - - setSingleList(); - list.setItems(items); - assertEquals(4, list.getItemCount()); - - try { - list.remove((String) null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(4, list.getItemCount()); - //////////////////////////////////////// - try { - list.remove("items989"); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(4, list.getItemCount()); - - - assertEquals(4, list.getItemCount()); - - list.remove("text3"); - assertEquals(3, list.getItemCount()); - - list.remove("text2"); - assertEquals(2, list.getItemCount()); - -} - -public void test_removeAll() { - String[] items = { "text1", "text2", "text3", "test2" }; - - list.setItems(items); - assertEquals(list.getItemCount(), 4); - - list.removeAll(); - assertEquals(list.getItemCount(), 0); - list.removeAll(); - assertEquals(list.getItemCount(), 0); - - - setSingleList(); - list.setItems(items); - assertEquals(4, list.getItemCount()); - - list.removeAll(); - assertEquals(0, list.getItemCount()); - - - setSingleList(); - assertEquals(0, list.getItemCount()); - list.removeAll(); - assertEquals(0, list.getItemCount()); - -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -/** - * Selects the items at the given zero-relative indices in the receiver. - * If the item at the given zero-relative index in the receiver - * is not selected, it is selected. If the item at the index - * was selected, it remains selected. Indices that are out - * of range and duplicate indices are ignored. - */ -public void test_select$I() { - String[] items = { "item0", "item1", "item2", "item3" }; - list.setItems(items); - - list.select(new int[] { 0, 2 }); - assertEquals(list.getSelectionIndices(), new int[] { 0, 2 }); - - list.select(new int[] { 1, 3 }); - assertEquals(list.getSelectionIndices(), new int[] { 0, 1, 2, 3 }); - - list.select(new int[] { 1, 3 }); - assertEquals(list.getSelectionIndices(), new int[] { 0, 1, 2, 3 }); - - list.select(new int[] { 1 }); - assertEquals(list.getSelectionIndices(), new int[] { 0, 1, 2, 3 }); - - list.add("item4"); - - int[] ind = { -1, 0, 1, 2, 3 }; - list.select(ind); - assertEquals(list.getSelectionIndices(), new int[] { 0, 1, 2, 3 }); - - ind = new int[32]; - for (int i = 0; i < ind.length; i++) - ind[i] = i; - - list.select(ind); - assertEquals(list.getSelectionIndices(), new int[] { 0, 1, 2, 3, 4 }); - - list.setSelection(new int[] { - }); - list.select(new int[] { 1 }); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - - list.setSelection(new int[] { - }); - list.select(new int[] { -1 }); - assertEquals(list.getSelectionIndices(), new int[] {}); - - list.deselectAll(); - items = list.getItems(); - - select$I_helper(items, 0, 3, new int[] { 0, 1, 2, 3 }); - select$I_helper(items, -1, 3, new int[] { 0, 1, 2, 3 }); - select$I_helper(items, -1, 30, new int[] { 0, 1, 2, 3, 4 }); - - - setSingleList(); - list.setItems(items); - - ind = new int[]{ -1, 0, 1, 2, 3 }; - list.select(ind); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - - ind = new int[32]; - for (int i = 0; i < ind.length; i++) - ind[i] = i; - - list.select(ind); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - - ind = new int[]{ 1 }; - list.select(ind); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - list.deselectAll(); - - - ind = new int[]{ -1 }; - list.select(ind); - assertEquals(list.getSelectionIndices(), new int[] {}); - - - setSingleList(); - list.setItems(items); - - list.select(new int[] { 0, 2 }); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - list.select(new int[] { 1, 3 }); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - - list.select(new int[] { 1, 3 }); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - - list.select(new int[] { 2, 3 }); - assertEquals(list.getSelectionIndices(), new int[] { 2 }); - list.select(new int[] { 1, 3 }); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - - - try { - list.select((int[]) null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - - int[] selection = { 0, 1, 2, 3 }; - list.select(selection); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - - selection = new int[]{ -1, 0, 1, 2, 3 }; - list.select(selection); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - - selection = new int[32]; - for (int i = -1; i <= 30; i++) - selection[i + 1] = i; - - list.select(selection); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - - selection = new int[]{1}; - list.select(selection); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); -} - -/** - * Selects the item at the given zero-relative index in the receiver's - * list. If the item at the index was already selected, it remains - * selected. Indices that are out of range are ignored. - */ -public void test_selectI() { - String[] items = { "item0", "item1", "item2", "item3" }; - list.setItems(items); - - list.select(2); - assertEquals("select(2):", list.getSelectionIndices(), new int[] { 2 }); - - list.select(1); - assertEquals("select(1):", list.getSelectionIndices(), new int[] { 1, 2 }); - - list.select(3); - assertEquals( - "select(3):", - list.getSelectionIndices(), new int[] { 1, 2, 3 }); - - list.select(5); - assertEquals( - "select(5):", - list.getSelectionIndices(), new int[] { 1, 2, 3 }); - - - setSingleList(); - list.setItems(items); - - list.select(2); - assertEquals(list.getSelectionIndices(), new int[] { 2 }); - - list.select(1); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - - list.select(3); - assertEquals(list.getSelectionIndices(), new int[] { 3 }); - - list.select(5); - assertEquals(list.getSelectionIndices(), new int[] { 3 }); - -} - -/** - * Selects the items at the given zero-relative indices in the receiver. - * If the item at the index was already selected, it remains - * selected. The range of the indices is inclusive. Indices that are - * out of range are ignored. - */ -public void test_selectII() { - int number = 5; - - String[] items = new String[number]; - int[] empty = { - }; - - for (int i = 0; i < number; i++) - items[i] = "item" + i; - - selectII_helper(items, 10, 1, empty); - selectII_helper(items, 3, 1, empty); - selectII_helper(items, -1, -1, empty); - selectII_helper(items, 2, 4, new int[] { 2, 3, 4 }); - selectII_helper(items, 0, 3, new int[] { 0, 1, 2, 3 }); - selectII_helper(items, 1, 1, new int[] { 1 }); - - if (fCheckSWTPolicy == true) { - selectII_helper(items, -1, 30, new int[] { 0, 1, 2, 3, 4 }); - selectII_helper(items, -1, 3, new int[] { 0, 1, 2, 3 }); - } - - list.select(0); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - list.select(-10, -9); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - list.deselectAll(); - - list.select(1000, 2000); - assertEquals(list.getSelectionCount(), 0); - - list.deselectAll(); - list.select(1, 2); - assertEquals(list.getSelectionIndices(), new int[] { 1, 2 }); - - list.select(1, 3); - assertEquals(list.getSelectionIndices(), new int[] { 1, 2, 3 }); - - list.select(2, 2); - assertEquals(list.getSelectionIndices(), new int[] { 1, 2, 3 }); - - list.select(3, 5); - assertEquals(list.getSelectionIndices(), new int[] { 1, 2, 3, 4 }); - - - setSingleList(); - list.setItems(items); - list.select(0); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - list.select(-10, -9); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - - list.deselectAll(); - assertEquals(0, list.getSelectionCount()); - - list.select(1000, 2000); - if (fCheckOutOfRangeBehaviour) { - assertEquals(0, list.getSelectionCount()); - } - - - list.deselectAll(); - assertEquals(0, list.getSelectionCount()); - - list.select(1, 2); - assertEquals(list.getSelectionIndices(), new int[] { 2 }); - - list.select(1, 3); - assertEquals(list.getSelectionIndices(), new int[] { 3 }); - - list.select(2, 2); - assertEquals(list.getSelectionIndices(), new int[] { 2 }); - - list.select(3, 5); - assertEquals(list.getSelectionIndices(), new int[] { 4 }); - - selectII_helper(items, 1, 1, new int[]{1}); - selectII_helper(items, -1, 30, new int[]{4}); - selectII_helper(items, 10, 1, new int[]{}); - selectII_helper(items, 3, 1, new int[]{}); - selectII_helper(items, -1, -1, new int[]{}); - selectII_helper(items, 2, 4, new int[]{4}); - selectII_helper(items, 0, 3, new int[]{3}); -} - -public void test_selectAll() { - String[] items = { "text1", "text2", "text3", "test2" }; - - list.setItems(items); - assertEquals(list.getSelectionCount(), 0); - list.selectAll(); - assertEquals(list.getSelectionCount(), 4); - - - setSingleList(); - - list.setItems(items); - assertEquals(0, list.getSelectionCount()); - list.selectAll(); - assertEquals(0, list.getSelectionCount()); - -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written"); -} - -/** - * Sets the text of the item in the receiver's list at the given - * zero-relative index to the string argument. This is equivalent - * to <code>remove</code>'ing the old item at the index, and then - * <code>add</code>'ing the new item at that index. - * - * @param index the index for the item - * @param string the new text for the item - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - * @exception SWTError <ul> - * <li>ERROR_ITEM_NOT_REMOVED - if the remove operation fails because of an operating system failure</li> - * <li>ERROR_ITEM_NOT_ADDED - if the add operation fails because of an operating system failure</li> - * </ul> - */ -public void test_setItemILjava_lang_String() { - assertEquals(list.getItemCount(), 0); - int[] cases = { -10, 0, 10 }; - for (int i = 0; i < cases.length; i++) { - try { - list.setItem(cases[i], null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - } - assertEquals(list.getItemCount(), 0); - - for (int i = 0; i < cases.length; i++) { - try { - list.setItem(cases[i], ""); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - } - assertEquals(list.getItemCount(), 0); - - int cases2[] = { 10, 15, 0 }; - for (int i = 0; i < cases2.length; i++) { - try { - list.setItem(cases2[i], "fred"); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(list.getItemCount(), 0); - } - - - setSingleList(); - assertEquals(0, list.getItemCount()); - for (int i = 0; i < cases.length; i++) { - try { - list.setItem(cases[i], null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - } - - - setSingleList(); - for (int i = 0; i < cases.length; i++) { - try { - list.setItem(cases[i], ""); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - } - - assertEquals(0, list.getItemCount()); - - - setSingleList(); - for (int i = 0; i < cases2.length; i++) { - try { - list.setItem(cases2[i], "fred"); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(0, list.getItemCount()); - } - -} - -/** - * Sets the receiver's items to be the given array of items. - * - * @param items the array of items - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - * @exception SWTError <ul> - * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li> - * </ul> - */ -public void test_setItems$Ljava_lang_String() { - try { - list.setItems(null); - fail("No exception thrown for items == null"); - } catch (IllegalArgumentException e) { - } - - String[][] cases = { { null }, { - "dsada", null, "dsdasdasd" } - }; - for (int i = 0; i < cases.length; i++) { - try { - list.setItems(cases[i]); - fail("No exception thrown for items not found"); - } catch (SWTError e) { - } - } - - String[][] itemArr = { { - }, { - "" }, { - "sdasd" }, { - "sdasd", "323434" } - }; - for (int i = 0; i < itemArr.length; i++) { - list.setItems(itemArr[i]); - assertEquals(itemArr[i], list.getItems()); - } - - try { - list.setItems(null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - - setSingleList(); - for (int i = 0; i < itemArr.length; i++) { - list.setItems(itemArr[i]); - assertEquals("case:" + i, itemArr[i], list.getItems()); - } - - - try { - list.setItems(null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } -} - -public void test_setSelection$I() { - int number = 5; - for (int i = 0; i < number; i++) - list.add("fred" + i); - - int[] ind = { 1 }; - list.setSelection(ind); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - - String[][] cases = { { "" }, { - "", "" }, { - "text1", "text2" } - }; - int[] items = { 0 }; - for (int i = 0; i < cases.length; i++) { - list.setItems(cases[i]); - list.setSelection(items); - assertEquals( - "case: " + String.valueOf(i), - list.getSelection(), new String[] { cases[i][0] }); - } - - String[] items2 = { "item0", "item1", "item2", "item3" }; - list.setItems(items2); - - list.setSelection(new int[] { 0, 2 }); - assertEquals("{0, 2}", list.getSelectionIndices(), new int[] { 0, 2 }); - - list.setSelection(new int[] { 1, 3 }); - assertEquals("{1, 3}", list.getSelectionIndices(), new int[] { 1, 3 }); - - list.setSelection(new int[] { 0, 1, 2, 3 }); - assertEquals( - "{0, 1, 2, 3}", - list.getSelectionIndices(), new int[] { 0, 1, 2, 3 }); - - list.setSelection(new int[] { 1 }); - assertEquals("{1}", list.getSelectionIndices(), new int[] { 1 }); - - ind = new int[] { -1, 0, 1, 2, 3 }; - list.setSelection(ind); - assertEquals( - "setSelection(" + ind + "):", - list.getSelectionIndices(), new int[] { 0, 1, 2, 3 }); - - - setSingleList(); - for (int i = 0; i < number; i++) - list.add("fred" + i); - - ind = new int[]{ -1, 0, 1, 2, 3 }; - list.setSelection(ind); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - - ind = new int[32]; - for (int i = 0; i < ind.length; i++) - ind[i] = i; - - list.setSelection(ind); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - - ind = new int[]{ 1 }; - list.setSelection(ind); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - - - list.deselectAll(); - assertEquals(0, list.getSelectionCount()); - - ind = new int[]{ -1 }; - list.setSelection(ind); - assertEquals(list.getSelectionIndices(), new int[] {}); - - - list.setSelection(new int[] { 0, 2 }); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - list.setSelection(new int[] { 1, 3 }); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - - list.setSelection(new int[] { 0, 1, 2, 3 }); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - list.setSelection(new int[] { 1 }); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - - try { - list.setSelection((int[]) null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } -} - -/** - * Sets the receiver's selection to be the given array of items. - * The current selected is first cleared, then the new items are - * selected. - * - * @param items the array of items - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> - * </ul> - */ -public void test_setSelection$Ljava_lang_String() { - String[] items = { "item0", "item1", "item2", "item3" }; - list.setItems(items); - - list.setSelection(new String[] {}); - assertEquals(list.getSelectionIndices(), new int[] {}); - - list.setSelection(new String[] { "" }); - assertEquals(list.getSelectionIndices(), new int[] {}); - - list.setSelection(new String[] { "item2" }); - assertEquals(list.getSelectionIndices(), new int[] { 2 }); - - list.setSelection(new String[] { "item2", "item1" }); - assertEquals(list.getSelectionIndices(), new int[] { 1, 2 }); - - list.setSelection(new String[] { "item5", "item1" }); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - - list.setSelection(new String[] { "item1", "item1" }); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - - list.setItems(items); - try { - list.setSelection((int[]) null); - fail("No exception thrown for selection == null"); - } catch (IllegalArgumentException e) { - } - - - setSingleList(); - list.setItems(items); - - list.setSelection(new String[] {}); - assertEquals(list.getSelectionIndices(), new int[] {}); - - list.setSelection(new String[] { "" }); - assertEquals(list.getSelectionIndices(), new int[] {}); - - list.setSelection(new String[] { "item2" }); - assertEquals(1, list.getSelectionCount()); - assertEquals(list.getSelectionIndices(), new int[] { 2 }); - - list.setSelection(new String[] { "item2", "item1" }); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - - list.setSelection(new String[] { "item5", "item1" }); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - - list.setSelection(new String[] { "item1", "item1" }); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - - - try { - list.setSelection((String[]) null); - fail("No exception thrown for selection == null"); - } catch (IllegalArgumentException e) { - } -} - -/** - * Selects the item at the given zero-relative index in the receiver. - * If the item at the index was already selected, it remains selected. - * The current selected is first cleared, then the new items are selected. - * Indices that are out of range are ignored. - */ -public void test_setSelectionI() { - int number = 5; - for (int i = 0; i < number; i++) - list.add("fred" + i); - - int[] ind = new int[32]; - for (int i = 0, j = 0; i < ind.length; i++, j++) - ind[j] = i; - - list.setSelection(ind); - assertEquals( - "setSelection(" + ind + "):", - list.getSelectionIndices(), new int[] { 0, 1, 2, 3, 4 }); - - list.deselectAll(); - int[] ind2 = { -1 }; - list.setSelection(ind2); - assertEquals( - "setSelection(" + ind2 + "):", - list.getSelectionIndices(), new int[] {}); - - list.deselectAll(); - list.setSelection(2); - assertEquals("2", list.getSelectionIndices(), new int[] { 2 }); - - list.setSelection(3); - assertEquals("3", list.getSelectionIndices(), new int[] { 3 }); - - list.setSelection(5); - assertEquals("5", list.getSelectionIndices(), new int[] {}); - - - setSingleList(); - String[] items = { "item0", "item1", "item2", "item3" }; - list.setItems(items); - - list.setSelection(2); - assertEquals("2", list.getSelectionIndices(), new int[] { 2 }); - - list.setSelection(3); - assertEquals("3", list.getSelectionIndices(), new int[] { 3 }); - - list.setSelection(4); - assertEquals("4", list.getSelectionIndices(), new int[] { 3 }); - -} - -/** - * Selects the items at the given zero-relative indices in the receiver. - * The current selected if first cleared, then the new items are selected. - */ -public void test_setSelectionII() { - int number = 5; - String[] items = new String[number]; - for (int i = 0; i < number; i++) - items[i] = "fred" + i; - - list.setItems(items); - - list.setSelection(1, 1); - assertEquals(list.getSelectionIndices(), new int[] {1}); - - list.setSelection(10, 1); - assertEquals(list.getSelectionIndices(), new int[] {}); - - list.setSelection(3, 1); - assertEquals(list.getSelectionIndices(), new int[] {}); - - list.setSelection(-1, -1); - assertEquals(list.getSelectionIndices(), new int[] {}); - - list.setSelection(1, 3); - assertEquals(list.getSelectionIndices(), new int[] {1, 2, 3}); - - if (fCheckSWTPolicy == true) { - list.setSelection(-1, 3); - assertEquals(list.getSelectionIndices(), new int[] {0, 1, 2, 3}); - - list.setSelection(-1, 30); - assertEquals(list.getSelectionIndices(), new int[] {0, 1, 2, 3, 4}); - } - - items = new String[] { "item0", "item1", "item2", "item3" }; - list.setItems(items); - list.setSelection(1, 2); - assertEquals(list.getSelectionIndices(), new int[] { 1, 2 }); - list.setSelection(3, 3); - assertEquals(list.getSelectionIndices(), new int[] { 3 }); - list.setSelection(3, 2); - assertEquals(list.getSelectionIndices(), new int[] {}); ///IS THAT THE CORRECT ANSWER ?? - - list.setSelection(0, 3); - assertEquals(list.getSelectionIndices(), new int[] { 0, 1, 2, 3 }); - list.setSelection(4, 4); - assertEquals(list.getSelectionIndices(), new int[] {}); ///IS THAT THE CORRECT ANSWER ?? - - list.setSelection(2, 5); - assertEquals(list.getSelectionIndices(), new int[] { 2, 3 }); - list.setSelection(-2, 500); - if (fCheckOutOfRangeBehaviour) - assertEquals(list.getSelectionIndices(), new int[] { 0, 1, 2, 3 }); - - - setSingleList(); - - list.setItems(items); - - list.setSelection(1, 2); - assertEquals(list.getSelectionIndices(), new int[] {2}); - - list.deselectAll(); - list.setSelection(10, 1); - assertEquals(list.getSelectionIndices(), new int[] {}); - - list.setSelection(3, 1); - assertEquals(list.getSelectionIndices(), new int[] {}); - - list.setSelection(-1, -1); - assertEquals(list.getSelectionIndices(), new int[] {}); - - list.setSelection(1, 3); - assertEquals(list.getSelectionIndices(), new int[] {3}); - - list.setSelection(-1, 3); - assertEquals(list.getSelectionIndices(), new int[] {3}); - - list.setSelection(-1, 30); - assertEquals(list.getSelectionIndices(), new int[] {3}); - - list.setSelection(1, 2); - assertEquals(list.getSelectionIndices(), new int[] { 2 }); - - list.setSelection(3, 3); - assertEquals(list.getSelectionIndices(), new int[] { 3 }); - - list.setSelection(3, 2); - assertEquals(list.getSelectionIndices(), new int[] { 3 }); - - list.setSelection(0, 3); - assertEquals(list.getSelectionIndices(), new int[] { 3 }); - - list.deselectAll(); - list.setSelection(4, 4); - assertEquals(list.getSelectionIndices(), new int[] {}); - - list.setSelection(2, 5); - assertEquals(list.getSelectionIndices(), new int[] { 3 }); - - list.setSelection(-2, 500); - assertEquals(list.getSelectionIndices(), new int[] { 3 }); -} - -public void test_setTopIndexI() { - list.setTopIndex(3); - assertEquals(list.getTopIndex(), 0); - String[] items = { "item0", "item1", "item2", "item3" }; - list.setItems(items); - for (int i = 0; i < items.length; i++) { - list.setTopIndex(i); - assertEquals(list.getTopIndex(), i); - } - - - setSingleList(); - list.setTopIndex(3); - assertEquals(0, list.getTopIndex()); - - list.setItems(items); - for (int i = 0; i < items.length; i++) { - list.setTopIndex(i); - assertEquals(i, list.getTopIndex()); - } - -} - -public void test_showSelection() { - String[] items = { "item0", "item1", "item2", "item3" }; - list.setItems(items); - list.setSelection(items); - list.showSelection(); - - - setSingleList(); - - list.setItems(items); - list.setSelection(items); - list.showSelection(); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_List((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addLjava_lang_String"); - methodNames.addElement("test_addLjava_lang_StringI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_deselect$I"); - methodNames.addElement("test_deselectI"); - methodNames.addElement("test_deselectII"); - methodNames.addElement("test_deselectAll"); - methodNames.addElement("test_getFocusIndex"); - methodNames.addElement("test_getItemI"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItemHeight"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionCount"); - methodNames.addElement("test_getSelectionIndex"); - methodNames.addElement("test_getSelectionIndices"); - methodNames.addElement("test_getTopIndex"); - methodNames.addElement("test_indexOfLjava_lang_String"); - methodNames.addElement("test_indexOfLjava_lang_StringI"); - methodNames.addElement("test_isSelectedI"); - methodNames.addElement("test_remove$I"); - methodNames.addElement("test_removeI"); - methodNames.addElement("test_removeII"); - methodNames.addElement("test_removeLjava_lang_String"); - methodNames.addElement("test_removeAll"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_select$I"); - methodNames.addElement("test_selectI"); - methodNames.addElement("test_selectII"); - methodNames.addElement("test_selectAll"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setItemILjava_lang_String"); - methodNames.addElement("test_setItems$Ljava_lang_String"); - methodNames.addElement("test_setSelection$I"); - methodNames.addElement("test_setSelection$Ljava_lang_String"); - methodNames.addElement("test_setSelectionI"); - methodNames.addElement("test_setSelectionII"); - methodNames.addElement("test_setTopIndexI"); - methodNames.addElement("test_showSelection"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Scrollable.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addLjava_lang_String")) test_addLjava_lang_String(); - else if (getName().equals("test_addLjava_lang_StringI")) test_addLjava_lang_StringI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_deselect$I")) test_deselect$I(); - else if (getName().equals("test_deselectI")) test_deselectI(); - else if (getName().equals("test_deselectII")) test_deselectII(); - else if (getName().equals("test_deselectAll")) test_deselectAll(); - else if (getName().equals("test_getFocusIndex")) test_getFocusIndex(); - else if (getName().equals("test_getItemI")) test_getItemI(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItemHeight")) test_getItemHeight(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionCount")) test_getSelectionCount(); - else if (getName().equals("test_getSelectionIndex")) test_getSelectionIndex(); - else if (getName().equals("test_getSelectionIndices")) test_getSelectionIndices(); - else if (getName().equals("test_getTopIndex")) test_getTopIndex(); - else if (getName().equals("test_indexOfLjava_lang_String")) test_indexOfLjava_lang_String(); - else if (getName().equals("test_indexOfLjava_lang_StringI")) test_indexOfLjava_lang_StringI(); - else if (getName().equals("test_isSelectedI")) test_isSelectedI(); - else if (getName().equals("test_remove$I")) test_remove$I(); - else if (getName().equals("test_removeI")) test_removeI(); - else if (getName().equals("test_removeII")) test_removeII(); - else if (getName().equals("test_removeLjava_lang_String")) test_removeLjava_lang_String(); - else if (getName().equals("test_removeAll")) test_removeAll(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_select$I")) test_select$I(); - else if (getName().equals("test_selectI")) test_selectI(); - else if (getName().equals("test_selectII")) test_selectII(); - else if (getName().equals("test_selectAll")) test_selectAll(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setItemILjava_lang_String")) test_setItemILjava_lang_String(); - else if (getName().equals("test_setItems$Ljava_lang_String")) test_setItems$Ljava_lang_String(); - else if (getName().equals("test_setSelection$I")) test_setSelection$I(); - else if (getName().equals("test_setSelection$Ljava_lang_String")) test_setSelection$Ljava_lang_String(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else if (getName().equals("test_setSelectionII")) test_setSelectionII(); - else if (getName().equals("test_setTopIndexI")) test_setTopIndexI(); - else if (getName().equals("test_showSelection")) test_showSelection(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Listener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Listener.java deleted file mode 100644 index a7dbe4848b..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Listener.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.widgets.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Listener - * - * @see org.eclipse.swt.widgets.Listener - */ -public class Test_org_eclipse_swt_widgets_Listener extends SwtTestCase { - -public Test_org_eclipse_swt_widgets_Listener(String name) { - super(name); -} - - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_handleEventLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_handleEventLorg_eclipse_swt_widgets_Event not written"); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_handleEventLorg_eclipse_swt_widgets_Event"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_handleEventLorg_eclipse_swt_widgets_Event")) test_handleEventLorg_eclipse_swt_widgets_Event(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Menu.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Menu.java deleted file mode 100644 index c8603f7988..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Menu.java +++ /dev/null @@ -1,378 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Menu - * - * @see org.eclipse.swt.widgets.Menu - */ -public class Test_org_eclipse_swt_widgets_Menu extends Test_org_eclipse_swt_widgets_Widget { - -Menu menu; - -public Test_org_eclipse_swt_widgets_Menu(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- menu = new Menu(shell);
- setWidget(menu);
-} - -protected void tearDown() { - super.tearDown(); -} - -/* tests Menu(Window) */
-public void test_ConstructorLorg_eclipse_swt_widgets_Control(){
- Composite comp = new Composite(shell, SWT.NULL);
- Menu testMenu = new Menu(comp);
- comp.dispose();
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_DecorationsI(){
- Menu newMenu;
- MenuItem mItem = new MenuItem(menu, SWT.NULL);
- newMenu = new Menu(mItem);
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_Menu(){
- Menu newMenu;
- newMenu = new Menu(menu);
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_MenuItem() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_MenuItem not written"); -} - -public void test_addHelpListenerLorg_eclipse_swt_events_HelpListener() { - warnUnimpl("Test test_addHelpListenerLorg_eclipse_swt_events_HelpListener not written"); -} - -public void test_addMenuListenerLorg_eclipse_swt_events_MenuListener() { - warnUnimpl("Test test_addMenuListenerLorg_eclipse_swt_events_MenuListener not written"); -} - -public void test_getDefaultItem() { - warnUnimpl("Test test_getDefaultItem not written"); -} - -public void test_getDisplay() { - warnUnimpl("Test test_getDisplay not written"); -} - -public void test_getEnabled() { - warnUnimpl("Test test_getEnabled not written"); -} - -/**
- * Returns the item at the given, zero-relative index in the
- * receiver. Throws an exception if the index is out of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- */
-public void test_getItemI(){
- MenuItem mItem0 = new MenuItem(menu, SWT.NULL);
- MenuItem mItem1 = new MenuItem(menu, SWT.NULL);
- assertEquals(menu.getItem(0), mItem0);
- assertEquals(menu.getItem(1), mItem1);
-} - -/**
- * Returns the number of items contained in the receiver.
- */
-public void test_getItemCount(){
- int number = 10;
- MenuItem ti;
- for (int i = 0; i<number ; i++){
- assertEquals(menu.getItemCount(), i);
- ti = new MenuItem(menu, 0);
- }
-} - -/**
- * Returns an array of <code>MenuItem</code>s which are the items
- * in the receiver.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- */
-public void test_getItems(){
- int number = 5;
- MenuItem[] items = new MenuItem[number];
- for (int i = 0; i<number ; i++){
- items[i] = new MenuItem(menu, 0);
- }
- assertEquals(":a:", items, menu.getItems());
-
- menu.getItems()[0].dispose();
- assertEquals(":b:", new MenuItem[]{items[1], items[2], items[3], items[4]}, menu.getItems());
-
- menu.getItems()[3].dispose();
- assertEquals(":c:", new MenuItem[]{items[1], items[2], items[3]}, menu.getItems());
-
- menu.getItems()[1].dispose();
- assertEquals(":d:", new MenuItem[]{items[1], items[3]}, menu.getItems());
-} - -/**
- * Returns the receiver's parent, which must be a <code>Decorations</code>.
- */
-public void test_getParent(){
- assertEquals(menu.getParent(), shell);
-} - -/**
- * Returns the receiver's parent item, which must be a
- * <code>MenuItem</code> or null when the receiver is a
- * root.
- */
-public void test_getParentItem(){
- MenuItem mItem = new MenuItem(menu, SWT.CASCADE);
- Menu newMenu = new Menu(shell, SWT.DROP_DOWN);
- assertNull(newMenu.getParentItem());
- mItem.setMenu(newMenu);
- assertEquals(newMenu.getParentItem(), mItem);
-} - -/**
- * Returns the receiver's parent item, which must be a
- * <code>Menu</code> or null when the receiver is a
- * root.
- */
-public void test_getParentMenu(){
- MenuItem mItem = new MenuItem(menu, SWT.CASCADE);
- Menu newMenu = new Menu(shell, SWT.DROP_DOWN);
- assertNull(newMenu.getParentMenu());
- mItem.setMenu(newMenu);
- assertEquals(newMenu.getParentMenu(), menu);
-} - -/**
- * Returns the receiver's shell. For all controls other than
- * shells, this simply returns the control's nearest ancestor
- * shell. Shells return themselves, even if they are children
- * of other shells.
- */
-public void test_getShell(){
- assertEquals(menu.getShell(), shell);
-} - -public void test_getVisible() { - warnUnimpl("Test test_getVisible not written"); -} - -/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- */
-public void test_indexOfLorg_eclipse_swt_widgets_MenuItem(){
- int number = 10;
- MenuItem[] mis = new MenuItem[number];
- for (int i = 0; i<number ; i++){
- mis[i] = new MenuItem(menu, SWT.NULL);
- }
- for (int i = 0; i<number ; i++){
- assertEquals(menu.indexOf(mis[i]), i);
- if (i>1)
- assertTrue(menu.indexOf(mis[i-1]) != i);
- }
-} - -public void test_isEnabled() { - warnUnimpl("Test test_isEnabled not written"); -} - -/**
- * Returns <code>true</code> if the receiver is visible, and
- * <code>false</code> otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, this method
- * may still indicate that it is considered visible even though
- * it may not actually be showing.
- * </p>
- */
-public void test_isVisible(){ - // This test can not be run as it currently is written. On Windows, if a - // menu has no menu items, it will not become visible. - // If we add menu items to the menu then a second problem is encountered - // because menu.setVisible() enters into a modal loop and execution of - // the JUnit test case will not continue until the menu is selected and closed. - if (true) return;
- menu.setVisible(true);
- assertTrue(menu.isVisible());
-
- // api not implemented yet
- if (fCheckVisibility) {
- menu.setVisible(false);
- assertEquals(menu.isVisible(), false);
- }
-} - -public void test_removeHelpListenerLorg_eclipse_swt_events_HelpListener() { - warnUnimpl("Test test_removeHelpListenerLorg_eclipse_swt_events_HelpListener not written"); -} - -public void test_removeMenuListenerLorg_eclipse_swt_events_MenuListener() { - warnUnimpl("Test test_removeMenuListenerLorg_eclipse_swt_events_MenuListener not written"); -} - -/**
- * Sets the default menu item to the argument or removes
- * the default emphasis when the argument is <code>null</code>.
- *
- * @param item the default menu item or null
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the menu item has been disposed</li>
- * </ul>
- */
-public void test_setDefaultItemLorg_eclipse_swt_widgets_MenuItem(){
- MenuItem mItem0 = new MenuItem(menu, SWT.NULL);
- MenuItem mItem1 = new MenuItem(menu, SWT.NULL);
- menu.setDefaultItem(mItem0);
- assertEquals(menu.getDefaultItem(), mItem0);
- assertTrue("After setDefaultItem(mItem0):", menu.getDefaultItem() != mItem1);
- menu.setDefaultItem(mItem1);
- assertEquals(menu.getDefaultItem(), mItem1);
- assertTrue("After setDefaultItem(mItem1):", menu.getDefaultItem() != mItem0);
-} - -public void test_setEnabledZ() { - warnUnimpl("Test test_setEnabledZ not written"); -} - -public void test_setLocationII() { - warnUnimpl("Test test_setLocationII not written"); -} - -/**
- * Marks the receiver as visible if the argument is <code>true</code>,
- * and marks it invisible otherwise.
- * <p>
- * If one of the receiver's ancestors is not visible or some
- * other condition makes the receiver not visible, marking
- * it visible may not actually cause it to be displayed.
- * </p>
- */
-/* tests both getVisible and setVisble */
-public void test_setVisibleZ(){ - // This test can not be run as it currently is written. On Windows, if a - // menu has no menu items, it will not become visible. - // If we add menu items to the menu then a second problem is encountered - // because menu.setVisible() enters into a modal loop and execution of - // the JUnit test case will not continue until the menu is selected and closed. - if (true) return;
- menu.setVisible(true);
- assertTrue(menu.getVisible());
- // API not implemented yet
- if (fCheckVisibility) {
- menu.setVisible(false);
- assertEquals(menu.getVisible(), false);
- }
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Menu((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_DecorationsI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Menu"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_MenuItem"); - methodNames.addElement("test_addHelpListenerLorg_eclipse_swt_events_HelpListener"); - methodNames.addElement("test_addMenuListenerLorg_eclipse_swt_events_MenuListener"); - methodNames.addElement("test_getDefaultItem"); - methodNames.addElement("test_getDisplay"); - methodNames.addElement("test_getEnabled"); - methodNames.addElement("test_getItemI"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getParentItem"); - methodNames.addElement("test_getParentMenu"); - methodNames.addElement("test_getShell"); - methodNames.addElement("test_getVisible"); - methodNames.addElement("test_indexOfLorg_eclipse_swt_widgets_MenuItem"); - methodNames.addElement("test_isEnabled"); - methodNames.addElement("test_isVisible"); - methodNames.addElement("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener"); - methodNames.addElement("test_removeMenuListenerLorg_eclipse_swt_events_MenuListener"); - methodNames.addElement("test_setDefaultItemLorg_eclipse_swt_widgets_MenuItem"); - methodNames.addElement("test_setEnabledZ"); - methodNames.addElement("test_setLocationII"); - methodNames.addElement("test_setVisibleZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Control")) test_ConstructorLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_DecorationsI")) test_ConstructorLorg_eclipse_swt_widgets_DecorationsI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Menu")) test_ConstructorLorg_eclipse_swt_widgets_Menu(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_MenuItem")) test_ConstructorLorg_eclipse_swt_widgets_MenuItem(); - else if (getName().equals("test_addHelpListenerLorg_eclipse_swt_events_HelpListener")) test_addHelpListenerLorg_eclipse_swt_events_HelpListener(); - else if (getName().equals("test_addMenuListenerLorg_eclipse_swt_events_MenuListener")) test_addMenuListenerLorg_eclipse_swt_events_MenuListener(); - else if (getName().equals("test_getDefaultItem")) test_getDefaultItem(); - else if (getName().equals("test_getDisplay")) test_getDisplay(); - else if (getName().equals("test_getEnabled")) test_getEnabled(); - else if (getName().equals("test_getItemI")) test_getItemI(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getParentItem")) test_getParentItem(); - else if (getName().equals("test_getParentMenu")) test_getParentMenu(); - else if (getName().equals("test_getShell")) test_getShell(); - else if (getName().equals("test_getVisible")) test_getVisible(); - else if (getName().equals("test_indexOfLorg_eclipse_swt_widgets_MenuItem")) test_indexOfLorg_eclipse_swt_widgets_MenuItem(); - else if (getName().equals("test_isEnabled")) test_isEnabled(); - else if (getName().equals("test_isVisible")) test_isVisible(); - else if (getName().equals("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener")) test_removeHelpListenerLorg_eclipse_swt_events_HelpListener(); - else if (getName().equals("test_removeMenuListenerLorg_eclipse_swt_events_MenuListener")) test_removeMenuListenerLorg_eclipse_swt_events_MenuListener(); - else if (getName().equals("test_setDefaultItemLorg_eclipse_swt_widgets_MenuItem")) test_setDefaultItemLorg_eclipse_swt_widgets_MenuItem(); - else if (getName().equals("test_setEnabledZ")) test_setEnabledZ(); - else if (getName().equals("test_setLocationII")) test_setLocationII(); - else if (getName().equals("test_setVisibleZ")) test_setVisibleZ(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MenuItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MenuItem.java deleted file mode 100644 index 403172c3a6..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MenuItem.java +++ /dev/null @@ -1,281 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.MenuItem - * - * @see org.eclipse.swt.widgets.MenuItem - */ -public class Test_org_eclipse_swt_widgets_MenuItem extends Test_org_eclipse_swt_widgets_Item { - -Menu menu; -MenuItem menuItem; - -public Test_org_eclipse_swt_widgets_MenuItem(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- menu = new Menu(shell);
- menuItem = new MenuItem(menu, 0);
- setWidget(menuItem);
-} - -protected void tearDown() { - super.tearDown(); -} - -/**
- * Possible exceptions:
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public void test_ConstructorLorg_eclipse_swt_widgets_MenuI(){
- MenuItem mItem = new MenuItem(menu, SWT.NULL);
- assertNotNull(mItem);
-
- if (fCheckSwtNullExceptions) {
- try {
- mItem = new MenuItem(null, SWT.NULL);
- fail("No exception thrown");
- }
- catch (IllegalArgumentException e) {
- }
- }
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_MenuII(){
- MenuItem mItem = new MenuItem(menu, SWT.NULL, 0); //create a menu item at index 0
- assertNotNull(mItem);
-} - -public void test_addArmListenerLorg_eclipse_swt_events_ArmListener() { - warnUnimpl("Test test_addArmListenerLorg_eclipse_swt_events_ArmListener not written"); -} - -public void test_addHelpListenerLorg_eclipse_swt_events_HelpListener() { - warnUnimpl("Test test_addHelpListenerLorg_eclipse_swt_events_HelpListener not written"); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_checkSubclass() { - warnUnimpl("Test test_checkSubclass not written"); -} - -public void test_getAccelerator() { - warnUnimpl("Test test_getAccelerator not written"); -} - -public void test_getDisplay() { - warnUnimpl("Test test_getDisplay not written"); -} - -public void test_getEnabled() { - warnUnimpl("Test test_getEnabled not written"); -} - -public void test_getMenu() { - warnUnimpl("Test test_getMenu not written"); -} - -/**
- * Returns the receiver's parent, which must be a <code>Menu</code>.
- */
- public void test_getParent(){
- assertEquals(menuItem.getParent(), menu);
-} - -public void test_getSelection() { - warnUnimpl("Test test_getSelection not written"); -} - -/**
- * Returns <code>true</code> if the receiver is enabled, and
- * <code>false</code> otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- */
-public void test_isEnabled(){
- menuItem.setEnabled(true);
- assertTrue(menuItem.isEnabled());
- menuItem.setEnabled(false);
- assertEquals(menuItem.isEnabled(), false);
-} - -public void test_removeArmListenerLorg_eclipse_swt_events_ArmListener() { - warnUnimpl("Test test_removeArmListenerLorg_eclipse_swt_events_ArmListener not written"); -} - -public void test_removeHelpListenerLorg_eclipse_swt_events_HelpListener() { - warnUnimpl("Test test_removeHelpListenerLorg_eclipse_swt_events_HelpListener not written"); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -/**
- * Sets the widget accelerator. An accelerator is the bit-wise
- * OR of zero or more modifier masks and a key. Examples:
- * <code>SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2</code>.
- */
-public void test_setAcceleratorI(){
- menuItem.setAccelerator(SWT.CTRL + 'Z');
- assertEquals(menuItem.getAccelerator(), SWT.CTRL + 'Z');
-
-} - -/**
- * Enables the receiver if the argument is <code>true</code>,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- */
-public void test_setEnabledZ(){
- menuItem.setEnabled(true);
- assertTrue(menuItem.getEnabled());
- menuItem.setEnabled(false);
- assertEquals(menuItem.getEnabled(), false);
-} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written"); -} - -/**
- * Sets the receiver's pull down menu to the argument.
- * Only <code>CASCADE</code> menu items can have a
- * pull down menu. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pull down
- * menu is platform specific.
- *
- * @param menu the new pull down menu
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_MENU_NOT_DROP_DOWN - if the menu is not a drop down menu</li>
- * <li>ERROR_MENUITEM_NOT_CASCADE - if the menu item is not a <code>CASCADE</code></li>
- * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
- * </ul>
- */
-public void test_setMenuLorg_eclipse_swt_widgets_Menu(){
- assertNull(menuItem.getMenu());
- MenuItem mItem = new MenuItem(menu, SWT.CASCADE);
- Menu newMenu = new Menu(shell, SWT.DROP_DOWN);
- mItem.setMenu(newMenu);
- assertEquals(mItem.getMenu(), newMenu);
-} - -/**
- * Sets the selection state of the receiver.
- * <p>
- * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
- * it is selected when it is checked.
- */
-public void test_setSelectionZ(){
-
- int[] itemStyles = {SWT.CHECK, SWT.RADIO};
- for (int i=0; i<itemStyles.length; i++)
- {
- MenuItem mItem = new MenuItem(menu, itemStyles[i]);
- mItem.setSelection(false);
- assertEquals(mItem.getSelection(), false);
- mItem.setSelection(true);
- assertTrue(mItem.getSelection());
- mItem.dispose();
- }
-} - -public void test_setTextLjava_lang_String() { - warnUnimpl("Test test_setTextLjava_lang_String not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_MenuItem((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_MenuI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_MenuII"); - methodNames.addElement("test_addArmListenerLorg_eclipse_swt_events_ArmListener"); - methodNames.addElement("test_addHelpListenerLorg_eclipse_swt_events_HelpListener"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_checkSubclass"); - methodNames.addElement("test_getAccelerator"); - methodNames.addElement("test_getDisplay"); - methodNames.addElement("test_getEnabled"); - methodNames.addElement("test_getMenu"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_isEnabled"); - methodNames.addElement("test_removeArmListenerLorg_eclipse_swt_events_ArmListener"); - methodNames.addElement("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_setAcceleratorI"); - methodNames.addElement("test_setEnabledZ"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setMenuLorg_eclipse_swt_widgets_Menu"); - methodNames.addElement("test_setSelectionZ"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_MenuI")) test_ConstructorLorg_eclipse_swt_widgets_MenuI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_MenuII")) test_ConstructorLorg_eclipse_swt_widgets_MenuII(); - else if (getName().equals("test_addArmListenerLorg_eclipse_swt_events_ArmListener")) test_addArmListenerLorg_eclipse_swt_events_ArmListener(); - else if (getName().equals("test_addHelpListenerLorg_eclipse_swt_events_HelpListener")) test_addHelpListenerLorg_eclipse_swt_events_HelpListener(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_checkSubclass")) test_checkSubclass(); - else if (getName().equals("test_getAccelerator")) test_getAccelerator(); - else if (getName().equals("test_getDisplay")) test_getDisplay(); - else if (getName().equals("test_getEnabled")) test_getEnabled(); - else if (getName().equals("test_getMenu")) test_getMenu(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_isEnabled")) test_isEnabled(); - else if (getName().equals("test_removeArmListenerLorg_eclipse_swt_events_ArmListener")) test_removeArmListenerLorg_eclipse_swt_events_ArmListener(); - else if (getName().equals("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener")) test_removeHelpListenerLorg_eclipse_swt_events_HelpListener(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_setAcceleratorI")) test_setAcceleratorI(); - else if (getName().equals("test_setEnabledZ")) test_setEnabledZ(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setMenuLorg_eclipse_swt_widgets_Menu")) test_setMenuLorg_eclipse_swt_widgets_Menu(); - else if (getName().equals("test_setSelectionZ")) test_setSelectionZ(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MessageBox.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MessageBox.java deleted file mode 100644 index bcf0de293a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MessageBox.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.MessageBox - * - * @see org.eclipse.swt.widgets.MessageBox - */ -public class Test_org_eclipse_swt_widgets_MessageBox extends Test_org_eclipse_swt_widgets_Dialog { - -MessageBox messageBox; - -public Test_org_eclipse_swt_widgets_MessageBox(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- messageBox = new MessageBox(shell, SWT.NULL);
- setDialog(messageBox);
-} - -protected void tearDown() { - super.tearDown(); -} - -/**
- * Possible exceptions:
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public void test_ConstructorLorg_eclipse_swt_widgets_Shell(){
- if (fCheckSwtNullExceptions) {
- MessageBox mb = new MessageBox(shell);
- try {
- mb = new MessageBox(null);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ShellI not written"); -} - -public void test_getMessage() { - warnUnimpl("Test test_getMessage not written"); -} - -/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return the ID of the button that was selected to dismiss the
- * message box (e.g. SWT.OK, SWT.CANCEL, etc...)
- */
-public void test_open(){
- if (fTestDialogOpen)
- messageBox.open();
-} - -/**
- * Sets the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- */
-public void test_setMessageLjava_lang_String(){
- assertEquals(messageBox.getMessage(), "");
- String testStr = "test string";
- messageBox.setMessage(testStr);
- assertEquals(messageBox.getMessage(), testStr);
- messageBox.setMessage("");
- assertEquals(messageBox.getMessage(), "");
- if (fCheckSwtNullExceptions) {
- try {
- messageBox.setMessage(null);
- fail("No exception thrown");
- }
- catch (IllegalArgumentException e) {
- }
- }
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_MessageBox((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI"); - methodNames.addElement("test_getMessage"); - methodNames.addElement("test_open"); - methodNames.addElement("test_setMessageLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Dialog.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI(); - else if (getName().equals("test_getMessage")) test_getMessage(); - else if (getName().equals("test_open")) test_open(); - else if (getName().equals("test_setMessageLjava_lang_String")) test_setMessageLjava_lang_String(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ProgressBar.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ProgressBar.java deleted file mode 100644 index f252d1cefd..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ProgressBar.java +++ /dev/null @@ -1,629 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.ProgressBar - * - * @see org.eclipse.swt.widgets.ProgressBar - */ -public class Test_org_eclipse_swt_widgets_ProgressBar extends Test_org_eclipse_swt_widgets_Control { - -ProgressBar progressBar; - -public Test_org_eclipse_swt_widgets_ProgressBar(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- progressBar = new ProgressBar(shell, 0);
- setWidget(progressBar);
-} - -protected void tearDown() { - super.tearDown(); -} - -// this method must be private or protected so the auto-gen tool keeps it
-private void report(String call, int set, int minExpected, int maxExpected, int selectionExpected) {
- // Uncomment these lines and comment out call to check() if you want the test to report all errors without
- // stopping.
-
- //if (progressBar.getMinimum() != minExpected)
- //System.out.println(call + "(" + set + "): Minimum Expected: " + minExpected + " Actual: " + progressBar.getMinimum());
- //if (progressBar.getMaximum() != maxExpected)
- //System.out.println(call + "(" + set + "): Maximum Expected: " + maxExpected + " Actual: " + progressBar.getMaximum());
- //if (progressBar.getSelection() != selectionExpected)
- //System.out.println(call + "(" + set + "): Selection Expected: " + selectionExpected + " Actual: " + progressBar.getSelection());
-
- check(minExpected, maxExpected, selectionExpected);
-} -// this method must be private or protected so the auto-gen tool keeps it
-private void check(int minExpected, int maxExpected, int selectionExpected) {
- assertEquals(progressBar.getMaximum(), maxExpected);
- assertEquals(progressBar.getMinimum(), minExpected);
- assertEquals(progressBar.getSelection(), selectionExpected);
-} -// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMinimumValues() {
-return new int[][] {
-{-15, 10, 100, 50, },
-{-14, 10, 100, 50, },
-{-13, 10, 100, 50, },
-{-12, 10, 100, 50, },
-{-11, 10, 100, 50, },
-{-10, 10, 100, 50, },
-{-9, 10, 100, 50, },
-{-8, 10, 100, 50, },
-{-7, 10, 100, 50, },
-{-6, 10, 100, 50, },
-{-5, 10, 100, 50, },
-{-4, 10, 100, 50, },
-{-3, 10, 100, 50, },
-{-2, 10, 100, 50, },
-{-1, 10, 100, 50, },
-{0, 0, 100, 50, },
-{1, 1, 100, 50, },
-{2, 2, 100, 50, },
-{3, 3, 100, 50, },
-{4, 4, 100, 50, },
-{5, 5, 100, 50, },
-{6, 6, 100, 50, },
-{7, 7, 100, 50, },
-{8, 8, 100, 50, },
-{9, 9, 100, 50, },
-{10, 10, 100, 50, },
-{11, 11, 100, 50, },
-{12, 12, 100, 50, },
-{13, 13, 100, 50, },
-{14, 14, 100, 50, },
-{15, 15, 100, 50, },
-{16, 16, 100, 50, },
-{17, 17, 100, 50, },
-{18, 18, 100, 50, },
-{19, 19, 100, 50, },
-{20, 20, 100, 50, },
-{21, 21, 100, 50, },
-{22, 22, 100, 50, },
-{23, 23, 100, 50, },
-{24, 24, 100, 50, },
-{25, 25, 100, 50, },
-{26, 26, 100, 50, },
-{27, 27, 100, 50, },
-{28, 28, 100, 50, },
-{29, 29, 100, 50, },
-{30, 30, 100, 50, },
-{31, 31, 100, 50, },
-{32, 32, 100, 50, },
-{33, 33, 100, 50, },
-{34, 34, 100, 50, },
-{35, 35, 100, 50, },
-{36, 36, 100, 50, },
-{37, 37, 100, 50, },
-{38, 38, 100, 50, },
-{39, 39, 100, 50, },
-{40, 40, 100, 50, },
-{41, 41, 100, 50, },
-{42, 42, 100, 50, },
-{43, 43, 100, 50, },
-{44, 44, 100, 50, },
-{45, 45, 100, 50, },
-{46, 46, 100, 50, },
-{47, 47, 100, 50, },
-{48, 48, 100, 50, },
-{49, 49, 100, 50, },
-{50, 50, 100, 50, },
-{51, 51, 100, 51, },
-{52, 52, 100, 52, },
-{53, 53, 100, 53, },
-{54, 54, 100, 54, },
-{55, 55, 100, 55, },
-{56, 56, 100, 56, },
-{57, 57, 100, 57, },
-{58, 58, 100, 58, },
-{59, 59, 100, 59, },
-{60, 60, 100, 60, },
-{61, 61, 100, 61, },
-{62, 62, 100, 62, },
-{63, 63, 100, 63, },
-{64, 64, 100, 64, },
-{65, 65, 100, 65, },
-{66, 66, 100, 66, },
-{67, 67, 100, 67, },
-{68, 68, 100, 68, },
-{69, 69, 100, 69, },
-{70, 70, 100, 70, },
-{71, 71, 100, 71, },
-{72, 72, 100, 72, },
-{73, 73, 100, 73, },
-{74, 74, 100, 74, },
-{75, 75, 100, 75, },
-{76, 76, 100, 76, },
-{77, 77, 100, 77, },
-{78, 78, 100, 78, },
-{79, 79, 100, 79, },
-{80, 80, 100, 80, },
-{81, 81, 100, 81, },
-{82, 82, 100, 82, },
-{83, 83, 100, 83, },
-{84, 84, 100, 84, },
-{85, 85, 100, 85, },
-{86, 86, 100, 86, },
-{87, 87, 100, 87, },
-{88, 88, 100, 88, },
-{89, 89, 100, 89, },
-{90, 90, 100, 90, },
-{91, 91, 100, 91, },
-{92, 92, 100, 92, },
-{93, 93, 100, 93, },
-{94, 94, 100, 94, },
-{95, 95, 100, 95, },
-{96, 96, 100, 96, },
-{97, 97, 100, 97, },
-{98, 98, 100, 98, },
-{99, 99, 100, 99, },
-{100, 10, 100, 50, },
-{101, 10, 100, 50, },
-{102, 10, 100, 50, },
-{103, 10, 100, 50, },
-{104, 10, 100, 50, },
-{105, 10, 100, 50, },
-{106, 10, 100, 50, },
-{107, 10, 100, 50, },
-{108, 10, 100, 50, },
-{109, 10, 100, 50, },
-{110, 10, 100, 50, },
-{111, 10, 100, 50, },
-{112, 10, 100, 50, },
-{113, 10, 100, 50, },
-{114, 10, 100, 50, },
-{115, 10, 100, 50, },
-{116, 10, 100, 50, },
-{117, 10, 100, 50, },
-{118, 10, 100, 50, },
-{119, 10, 100, 50, },
-{120, 10, 100, 50, },
-{121, 10, 100, 50, },
-{122, 10, 100, 50, },
-{123, 10, 100, 50, },
-{124, 10, 100, 50, },
-};
-} -// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMaximumValues() {
-return new int[][] {
-{-15, 10, 100, 50, },
-{-14, 10, 100, 50, },
-{-13, 10, 100, 50, },
-{-12, 10, 100, 50, },
-{-11, 10, 100, 50, },
-{-10, 10, 100, 50, },
-{-9, 10, 100, 50, },
-{-8, 10, 100, 50, },
-{-7, 10, 100, 50, },
-{-6, 10, 100, 50, },
-{-5, 10, 100, 50, },
-{-4, 10, 100, 50, },
-{-3, 10, 100, 50, },
-{-2, 10, 100, 50, },
-{-1, 10, 100, 50, },
-{0, 10, 100, 50, },
-{1, 10, 100, 50, },
-{2, 10, 100, 50, },
-{3, 10, 100, 50, },
-{4, 10, 100, 50, },
-{5, 10, 100, 50, },
-{6, 10, 100, 50, },
-{7, 10, 100, 50, },
-{8, 10, 100, 50, },
-{9, 10, 100, 50, },
-{10, 10, 100, 50, },
-{11, 10, 11, 11, },
-{12, 10, 12, 12, },
-{13, 10, 13, 13, },
-{14, 10, 14, 14, },
-{15, 10, 15, 15, },
-{16, 10, 16, 16, },
-{17, 10, 17, 17, },
-{18, 10, 18, 18, },
-{19, 10, 19, 19, },
-{20, 10, 20, 20, },
-{21, 10, 21, 21, },
-{22, 10, 22, 22, },
-{23, 10, 23, 23, },
-{24, 10, 24, 24, },
-{25, 10, 25, 25, },
-{26, 10, 26, 26, },
-{27, 10, 27, 27, },
-{28, 10, 28, 28, },
-{29, 10, 29, 29, },
-{30, 10, 30, 30, },
-{31, 10, 31, 31, },
-{32, 10, 32, 32, },
-{33, 10, 33, 33, },
-{34, 10, 34, 34, },
-{35, 10, 35, 35, },
-{36, 10, 36, 36, },
-{37, 10, 37, 37, },
-{38, 10, 38, 38, },
-{39, 10, 39, 39, },
-{40, 10, 40, 40, },
-{41, 10, 41, 41, },
-{42, 10, 42, 42, },
-{43, 10, 43, 43, },
-{44, 10, 44, 44, },
-{45, 10, 45, 45, },
-{46, 10, 46, 46, },
-{47, 10, 47, 47, },
-{48, 10, 48, 48, },
-{49, 10, 49, 49, },
-{50, 10, 50, 50, },
-{51, 10, 51, 50, },
-{52, 10, 52, 50, },
-{53, 10, 53, 50, },
-{54, 10, 54, 50, },
-{55, 10, 55, 50, },
-{56, 10, 56, 50, },
-{57, 10, 57, 50, },
-{58, 10, 58, 50, },
-{59, 10, 59, 50, },
-{60, 10, 60, 50, },
-{61, 10, 61, 50, },
-{62, 10, 62, 50, },
-{63, 10, 63, 50, },
-{64, 10, 64, 50, },
-{65, 10, 65, 50, },
-{66, 10, 66, 50, },
-{67, 10, 67, 50, },
-{68, 10, 68, 50, },
-{69, 10, 69, 50, },
-{70, 10, 70, 50, },
-{71, 10, 71, 50, },
-{72, 10, 72, 50, },
-{73, 10, 73, 50, },
-{74, 10, 74, 50, },
-{75, 10, 75, 50, },
-{76, 10, 76, 50, },
-{77, 10, 77, 50, },
-{78, 10, 78, 50, },
-{79, 10, 79, 50, },
-{80, 10, 80, 50, },
-{81, 10, 81, 50, },
-{82, 10, 82, 50, },
-{83, 10, 83, 50, },
-{84, 10, 84, 50, },
-{85, 10, 85, 50, },
-{86, 10, 86, 50, },
-{87, 10, 87, 50, },
-{88, 10, 88, 50, },
-{89, 10, 89, 50, },
-{90, 10, 90, 50, },
-{91, 10, 91, 50, },
-{92, 10, 92, 50, },
-{93, 10, 93, 50, },
-{94, 10, 94, 50, },
-{95, 10, 95, 50, },
-{96, 10, 96, 50, },
-{97, 10, 97, 50, },
-{98, 10, 98, 50, },
-{99, 10, 99, 50, },
-{100, 10, 100, 50, },
-{101, 10, 101, 50, },
-{102, 10, 102, 50, },
-{103, 10, 103, 50, },
-{104, 10, 104, 50, },
-{105, 10, 105, 50, },
-{106, 10, 106, 50, },
-{107, 10, 107, 50, },
-{108, 10, 108, 50, },
-{109, 10, 109, 50, },
-{110, 10, 110, 50, },
-{111, 10, 111, 50, },
-{112, 10, 112, 50, },
-{113, 10, 113, 50, },
-{114, 10, 114, 50, },
-{115, 10, 115, 50, },
-{116, 10, 116, 50, },
-{117, 10, 117, 50, },
-{118, 10, 118, 50, },
-{119, 10, 119, 50, },
-{120, 10, 120, 50, },
-{121, 10, 121, 50, },
-{122, 10, 122, 50, },
-{123, 10, 123, 50, },
-{124, 10, 124, 50, },
-};
-} -// this method must be private or protected so the auto-gen tool keeps it
-private void setDefaults() {
- progressBar.setMaximum(100);
- progressBar.setMinimum(10);
- progressBar.setSelection(50);
-} -// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetSelectionValues() {
-return new int[][] {
-{-15, 10, 100, 50, },
-{-14, 10, 100, 50, },
-{-13, 10, 100, 50, },
-{-12, 10, 100, 50, },
-{-11, 10, 100, 50, },
-{-10, 10, 100, 50, },
-{-9, 10, 100, 50, },
-{-8, 10, 100, 50, },
-{-7, 10, 100, 50, },
-{-6, 10, 100, 50, },
-{-5, 10, 100, 50, },
-{-4, 10, 100, 50, },
-{-3, 10, 100, 50, },
-{-2, 10, 100, 50, },
-{-1, 10, 100, 50, },
-{0, 10, 100, 10, },
-{1, 10, 100, 10, },
-{2, 10, 100, 10, },
-{3, 10, 100, 10, },
-{4, 10, 100, 10, },
-{5, 10, 100, 10, },
-{6, 10, 100, 10, },
-{7, 10, 100, 10, },
-{8, 10, 100, 10, },
-{9, 10, 100, 10, },
-{10, 10, 100, 10, },
-{11, 10, 100, 11, },
-{12, 10, 100, 12, },
-{13, 10, 100, 13, },
-{14, 10, 100, 14, },
-{15, 10, 100, 15, },
-{16, 10, 100, 16, },
-{17, 10, 100, 17, },
-{18, 10, 100, 18, },
-{19, 10, 100, 19, },
-{20, 10, 100, 20, },
-{21, 10, 100, 21, },
-{22, 10, 100, 22, },
-{23, 10, 100, 23, },
-{24, 10, 100, 24, },
-{25, 10, 100, 25, },
-{26, 10, 100, 26, },
-{27, 10, 100, 27, },
-{28, 10, 100, 28, },
-{29, 10, 100, 29, },
-{30, 10, 100, 30, },
-{31, 10, 100, 31, },
-{32, 10, 100, 32, },
-{33, 10, 100, 33, },
-{34, 10, 100, 34, },
-{35, 10, 100, 35, },
-{36, 10, 100, 36, },
-{37, 10, 100, 37, },
-{38, 10, 100, 38, },
-{39, 10, 100, 39, },
-{40, 10, 100, 40, },
-{41, 10, 100, 41, },
-{42, 10, 100, 42, },
-{43, 10, 100, 43, },
-{44, 10, 100, 44, },
-{45, 10, 100, 45, },
-{46, 10, 100, 46, },
-{47, 10, 100, 47, },
-{48, 10, 100, 48, },
-{49, 10, 100, 49, },
-{50, 10, 100, 50, },
-{51, 10, 100, 51, },
-{52, 10, 100, 52, },
-{53, 10, 100, 53, },
-{54, 10, 100, 54, },
-{55, 10, 100, 55, },
-{56, 10, 100, 56, },
-{57, 10, 100, 57, },
-{58, 10, 100, 58, },
-{59, 10, 100, 59, },
-{60, 10, 100, 60, },
-{61, 10, 100, 61, },
-{62, 10, 100, 62, },
-{63, 10, 100, 63, },
-{64, 10, 100, 64, },
-{65, 10, 100, 65, },
-{66, 10, 100, 66, },
-{67, 10, 100, 67, },
-{68, 10, 100, 68, },
-{69, 10, 100, 69, },
-{70, 10, 100, 70, },
-{71, 10, 100, 71, },
-{72, 10, 100, 72, },
-{73, 10, 100, 73, },
-{74, 10, 100, 74, },
-{75, 10, 100, 75, },
-{76, 10, 100, 76, },
-{77, 10, 100, 77, },
-{78, 10, 100, 78, },
-{79, 10, 100, 79, },
-{80, 10, 100, 80, },
-{81, 10, 100, 81, },
-{82, 10, 100, 82, },
-{83, 10, 100, 83, },
-{84, 10, 100, 84, },
-{85, 10, 100, 85, },
-{86, 10, 100, 86, },
-{87, 10, 100, 87, },
-{88, 10, 100, 88, },
-{89, 10, 100, 89, },
-{90, 10, 100, 90, },
-{91, 10, 100, 91, },
-{92, 10, 100, 92, },
-{93, 10, 100, 93, },
-{94, 10, 100, 94, },
-{95, 10, 100, 95, },
-{96, 10, 100, 96, },
-{97, 10, 100, 97, },
-{98, 10, 100, 98, },
-{99, 10, 100, 99, },
-{100, 10, 100, 100, },
-{101, 10, 100, 100, },
-{102, 10, 100, 100, },
-{103, 10, 100, 100, },
-{104, 10, 100, 100, },
-{105, 10, 100, 100, },
-{106, 10, 100, 100, },
-{107, 10, 100, 100, },
-{108, 10, 100, 100, },
-{109, 10, 100, 100, },
-{110, 10, 100, 100, },
-{111, 10, 100, 100, },
-{112, 10, 100, 100, },
-{113, 10, 100, 100, },
-{114, 10, 100, 100, },
-{115, 10, 100, 100, },
-{116, 10, 100, 100, },
-{117, 10, 100, 100, },
-{118, 10, 100, 100, },
-{119, 10, 100, 100, },
-{120, 10, 100, 100, },
-{121, 10, 100, 100, },
-{122, 10, 100, 100, },
-{123, 10, 100, 100, },
-{124, 10, 100, 100, },
-};
-} - -/**
- * Possible exceptions:
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- try {
- progressBar = new ProgressBar(null, 0);
- fail("No exception thrown"); //should never get here
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {0, SWT.HORIZONTAL, SWT.VERTICAL};
- for (int i = 0; i < cases.length; i++)
- progressBar = new ProgressBar(shell, cases[i]);
-} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_getMaximum() { - warnUnimpl("Test test_getMaximum not written"); -} - -public void test_getMinimum() { - warnUnimpl("Test test_getMinimum not written"); -} - -public void test_getSelection() { - warnUnimpl("Test test_getSelection not written"); -} - -/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- */
-public void test_setMaximumI(){
-
- int [][] testValues = getSetMaximumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- progressBar.setMaximum(intArray[0]);
- report("setMaximum", intArray[0], intArray[1], intArray[2], intArray[3]);
- }
-} - -/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- */
-public void test_setMinimumI(){
-
- int [][] testValues = getSetMinimumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- progressBar.setMinimum(intArray[0]);
- report("setMinimum", intArray[0], intArray[1], intArray[2], intArray[3]);
- }
-} - -/**
- * Sets the single <em>selection</em> that is the receiver's
- * position to the argument which must be greater than or equal
- * to zero.
- */
-public void test_setSelectionI(){
-
- int [][] testValues = getSetSelectionValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- progressBar.setSelection(intArray[0]);
- report("setSelection", intArray[0], intArray[1], intArray[2], intArray[3]);
- }
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_ProgressBar((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_getMaximum"); - methodNames.addElement("test_getMinimum"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_setMaximumI"); - methodNames.addElement("test_setMinimumI"); - methodNames.addElement("test_setSelectionI"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_getMaximum")) test_getMaximum(); - else if (getName().equals("test_getMinimum")) test_getMinimum(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_setMaximumI")) test_setMaximumI(); - else if (getName().equals("test_setMinimumI")) test_setMinimumI(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Sash.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Sash.java deleted file mode 100644 index e88bccc9c4..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Sash.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Sash - * - * @see org.eclipse.swt.widgets.Sash - */ -public class Test_org_eclipse_swt_widgets_Sash extends Test_org_eclipse_swt_widgets_Control { - -Sash sash; - -public Test_org_eclipse_swt_widgets_Sash(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- sash = new Sash(shell, 0);
- setWidget(sash);
-} - -protected void tearDown() { - super.tearDown(); -} - -/**
- * Possible exceptions:
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- try {
- sash = new Sash(null, 0);
- fail("No exception thrown"); //should never get here
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {0, SWT.HORIZONTAL, SWT.VERTICAL};
- for (int i = 0; i < cases.length; i++)
- sash = new Sash(shell, cases[i]);
-} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - // overridden from Control because it does not make sense - // to set the font of a Sash. -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Sash((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scale.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scale.java deleted file mode 100644 index f19b299953..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scale.java +++ /dev/null @@ -1,671 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Scale - * - * @see org.eclipse.swt.widgets.Scale - */ -public class Test_org_eclipse_swt_widgets_Scale extends Test_org_eclipse_swt_widgets_Control { - -Scale scale; - -public Test_org_eclipse_swt_widgets_Scale(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- scale = new Scale(shell, 0);
- setWidget(scale);
-} - -protected void tearDown() { - super.tearDown(); -} - -// this method must be private or protected so the auto-gen tool keeps it
-private void report(String call, int set, int minExpected, int maxExpected, int selectionExpected) {
- //Uncomment these lines and comment out call to check() if you want the test to report all errors without
- //stopping.
-
- //if (trackBar.getMinimum() != minExpected)
- //System.out.println(call + "(" + set + "): Minimum Expected: " + minExpected + " Actual: " + trackBar.getMinimum());
- //if (trackBar.getMaximum() != maxExpected)
- //System.out.println(call + "(" + set + "): Maximum Expected: " + maxExpected + " Actual: " + trackBar.getMaximum());
- //if (trackBar.getSelection() != selectionExpected)
- //System.out.println(call + "(" + set + "): Selection Expected: " + selectionExpected + " Actual: " + trackBar.getSelection());
- check(minExpected, maxExpected, selectionExpected);
-} -// this method must be private or protected so the auto-gen tool keeps it
-private void check(int minExpected, int maxExpected, int selectionExpected) {
- assertEquals(scale.getMaximum(), maxExpected);
- assertEquals(scale.getMinimum(), minExpected);
- assertEquals(scale.getSelection(), selectionExpected);
-} -// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMinimumValues() {
-return new int[][] {
-{-15, 10, 100, 50, },
-{-14, 10, 100, 50, },
-{-13, 10, 100, 50, },
-{-12, 10, 100, 50, },
-{-11, 10, 100, 50, },
-{-10, 10, 100, 50, },
-{-9, 10, 100, 50, },
-{-8, 10, 100, 50, },
-{-7, 10, 100, 50, },
-{-6, 10, 100, 50, },
-{-5, 10, 100, 50, },
-{-4, 10, 100, 50, },
-{-3, 10, 100, 50, },
-{-2, 10, 100, 50, },
-{-1, 10, 100, 50, },
-{0, 0, 100, 50, },
-{1, 1, 100, 50, },
-{2, 2, 100, 50, },
-{3, 3, 100, 50, },
-{4, 4, 100, 50, },
-{5, 5, 100, 50, },
-{6, 6, 100, 50, },
-{7, 7, 100, 50, },
-{8, 8, 100, 50, },
-{9, 9, 100, 50, },
-{10, 10, 100, 50, },
-{11, 11, 100, 50, },
-{12, 12, 100, 50, },
-{13, 13, 100, 50, },
-{14, 14, 100, 50, },
-{15, 15, 100, 50, },
-{16, 16, 100, 50, },
-{17, 17, 100, 50, },
-{18, 18, 100, 50, },
-{19, 19, 100, 50, },
-{20, 20, 100, 50, },
-{21, 21, 100, 50, },
-{22, 22, 100, 50, },
-{23, 23, 100, 50, },
-{24, 24, 100, 50, },
-{25, 25, 100, 50, },
-{26, 26, 100, 50, },
-{27, 27, 100, 50, },
-{28, 28, 100, 50, },
-{29, 29, 100, 50, },
-{30, 30, 100, 50, },
-{31, 31, 100, 50, },
-{32, 32, 100, 50, },
-{33, 33, 100, 50, },
-{34, 34, 100, 50, },
-{35, 35, 100, 50, },
-{36, 36, 100, 50, },
-{37, 37, 100, 50, },
-{38, 38, 100, 50, },
-{39, 39, 100, 50, },
-{40, 40, 100, 50, },
-{41, 41, 100, 50, },
-{42, 42, 100, 50, },
-{43, 43, 100, 50, },
-{44, 44, 100, 50, },
-{45, 45, 100, 50, },
-{46, 46, 100, 50, },
-{47, 47, 100, 50, },
-{48, 48, 100, 50, },
-{49, 49, 100, 50, },
-{50, 50, 100, 50, },
-{51, 51, 100, 51, },
-{52, 52, 100, 52, },
-{53, 53, 100, 53, },
-{54, 54, 100, 54, },
-{55, 55, 100, 55, },
-{56, 56, 100, 56, },
-{57, 57, 100, 57, },
-{58, 58, 100, 58, },
-{59, 59, 100, 59, },
-{60, 60, 100, 60, },
-{61, 61, 100, 61, },
-{62, 62, 100, 62, },
-{63, 63, 100, 63, },
-{64, 64, 100, 64, },
-{65, 65, 100, 65, },
-{66, 66, 100, 66, },
-{67, 67, 100, 67, },
-{68, 68, 100, 68, },
-{69, 69, 100, 69, },
-{70, 70, 100, 70, },
-{71, 71, 100, 71, },
-{72, 72, 100, 72, },
-{73, 73, 100, 73, },
-{74, 74, 100, 74, },
-{75, 75, 100, 75, },
-{76, 76, 100, 76, },
-{77, 77, 100, 77, },
-{78, 78, 100, 78, },
-{79, 79, 100, 79, },
-{80, 80, 100, 80, },
-{81, 81, 100, 81, },
-{82, 82, 100, 82, },
-{83, 83, 100, 83, },
-{84, 84, 100, 84, },
-{85, 85, 100, 85, },
-{86, 86, 100, 86, },
-{87, 87, 100, 87, },
-{88, 88, 100, 88, },
-{89, 89, 100, 89, },
-{90, 90, 100, 90, },
-{91, 91, 100, 91, },
-{92, 92, 100, 92, },
-{93, 93, 100, 93, },
-{94, 94, 100, 94, },
-{95, 95, 100, 95, },
-{96, 96, 100, 96, },
-{97, 97, 100, 97, },
-{98, 98, 100, 98, },
-{99, 99, 100, 99, },
-{100, 10, 100, 50, },
-{101, 10, 100, 50, },
-{102, 10, 100, 50, },
-{103, 10, 100, 50, },
-{104, 10, 100, 50, },
-{105, 10, 100, 50, },
-{106, 10, 100, 50, },
-{107, 10, 100, 50, },
-{108, 10, 100, 50, },
-{109, 10, 100, 50, },
-{110, 10, 100, 50, },
-{111, 10, 100, 50, },
-{112, 10, 100, 50, },
-{113, 10, 100, 50, },
-{114, 10, 100, 50, },
-{115, 10, 100, 50, },
-{116, 10, 100, 50, },
-{117, 10, 100, 50, },
-{118, 10, 100, 50, },
-{119, 10, 100, 50, },
-{120, 10, 100, 50, },
-{121, 10, 100, 50, },
-{122, 10, 100, 50, },
-{123, 10, 100, 50, },
-{124, 10, 100, 50, },
-};
-} -// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMaximumValues() {
-return new int[][] {
-{-15, 10, 100, 50, },
-{-14, 10, 100, 50, },
-{-13, 10, 100, 50, },
-{-12, 10, 100, 50, },
-{-11, 10, 100, 50, },
-{-10, 10, 100, 50, },
-{-9, 10, 100, 50, },
-{-8, 10, 100, 50, },
-{-7, 10, 100, 50, },
-{-6, 10, 100, 50, },
-{-5, 10, 100, 50, },
-{-4, 10, 100, 50, },
-{-3, 10, 100, 50, },
-{-2, 10, 100, 50, },
-{-1, 10, 100, 50, },
-{0, 10, 100, 50, },
-{1, 10, 100, 50, },
-{2, 10, 100, 50, },
-{3, 10, 100, 50, },
-{4, 10, 100, 50, },
-{5, 10, 100, 50, },
-{6, 10, 100, 50, },
-{7, 10, 100, 50, },
-{8, 10, 100, 50, },
-{9, 10, 100, 50, },
-{10, 10, 100, 50, },
-{11, 10, 11, 11, },
-{12, 10, 12, 12, },
-{13, 10, 13, 13, },
-{14, 10, 14, 14, },
-{15, 10, 15, 15, },
-{16, 10, 16, 16, },
-{17, 10, 17, 17, },
-{18, 10, 18, 18, },
-{19, 10, 19, 19, },
-{20, 10, 20, 20, },
-{21, 10, 21, 21, },
-{22, 10, 22, 22, },
-{23, 10, 23, 23, },
-{24, 10, 24, 24, },
-{25, 10, 25, 25, },
-{26, 10, 26, 26, },
-{27, 10, 27, 27, },
-{28, 10, 28, 28, },
-{29, 10, 29, 29, },
-{30, 10, 30, 30, },
-{31, 10, 31, 31, },
-{32, 10, 32, 32, },
-{33, 10, 33, 33, },
-{34, 10, 34, 34, },
-{35, 10, 35, 35, },
-{36, 10, 36, 36, },
-{37, 10, 37, 37, },
-{38, 10, 38, 38, },
-{39, 10, 39, 39, },
-{40, 10, 40, 40, },
-{41, 10, 41, 41, },
-{42, 10, 42, 42, },
-{43, 10, 43, 43, },
-{44, 10, 44, 44, },
-{45, 10, 45, 45, },
-{46, 10, 46, 46, },
-{47, 10, 47, 47, },
-{48, 10, 48, 48, },
-{49, 10, 49, 49, },
-{50, 10, 50, 50, },
-{51, 10, 51, 50, },
-{52, 10, 52, 50, },
-{53, 10, 53, 50, },
-{54, 10, 54, 50, },
-{55, 10, 55, 50, },
-{56, 10, 56, 50, },
-{57, 10, 57, 50, },
-{58, 10, 58, 50, },
-{59, 10, 59, 50, },
-{60, 10, 60, 50, },
-{61, 10, 61, 50, },
-{62, 10, 62, 50, },
-{63, 10, 63, 50, },
-{64, 10, 64, 50, },
-{65, 10, 65, 50, },
-{66, 10, 66, 50, },
-{67, 10, 67, 50, },
-{68, 10, 68, 50, },
-{69, 10, 69, 50, },
-{70, 10, 70, 50, },
-{71, 10, 71, 50, },
-{72, 10, 72, 50, },
-{73, 10, 73, 50, },
-{74, 10, 74, 50, },
-{75, 10, 75, 50, },
-{76, 10, 76, 50, },
-{77, 10, 77, 50, },
-{78, 10, 78, 50, },
-{79, 10, 79, 50, },
-{80, 10, 80, 50, },
-{81, 10, 81, 50, },
-{82, 10, 82, 50, },
-{83, 10, 83, 50, },
-{84, 10, 84, 50, },
-{85, 10, 85, 50, },
-{86, 10, 86, 50, },
-{87, 10, 87, 50, },
-{88, 10, 88, 50, },
-{89, 10, 89, 50, },
-{90, 10, 90, 50, },
-{91, 10, 91, 50, },
-{92, 10, 92, 50, },
-{93, 10, 93, 50, },
-{94, 10, 94, 50, },
-{95, 10, 95, 50, },
-{96, 10, 96, 50, },
-{97, 10, 97, 50, },
-{98, 10, 98, 50, },
-{99, 10, 99, 50, },
-{100, 10, 100, 50, },
-{101, 10, 101, 50, },
-{102, 10, 102, 50, },
-{103, 10, 103, 50, },
-{104, 10, 104, 50, },
-{105, 10, 105, 50, },
-{106, 10, 106, 50, },
-{107, 10, 107, 50, },
-{108, 10, 108, 50, },
-{109, 10, 109, 50, },
-{110, 10, 110, 50, },
-{111, 10, 111, 50, },
-{112, 10, 112, 50, },
-{113, 10, 113, 50, },
-{114, 10, 114, 50, },
-{115, 10, 115, 50, },
-{116, 10, 116, 50, },
-{117, 10, 117, 50, },
-{118, 10, 118, 50, },
-{119, 10, 119, 50, },
-{120, 10, 120, 50, },
-{121, 10, 121, 50, },
-{122, 10, 122, 50, },
-{123, 10, 123, 50, },
-{124, 10, 124, 50, },
-};
-} -// this method must be private or protected so the auto-gen tool keeps it
-private void setDefaults() {
- scale.setMaximum(100);
- scale.setMinimum(10);
- scale.setSelection(50);
-} -// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetSelectionValues() {
-return new int[][] {
-{-15, 10, 100, 50, },
-{-14, 10, 100, 50, },
-{-13, 10, 100, 50, },
-{-12, 10, 100, 50, },
-{-11, 10, 100, 50, },
-{-10, 10, 100, 50, },
-{-9, 10, 100, 50, },
-{-8, 10, 100, 50, },
-{-7, 10, 100, 50, },
-{-6, 10, 100, 50, },
-{-5, 10, 100, 50, },
-{-4, 10, 100, 50, },
-{-3, 10, 100, 50, },
-{-2, 10, 100, 50, },
-{-1, 10, 100, 50, },
-{0, 10, 100, 10, },
-{1, 10, 100, 10, },
-{2, 10, 100, 10, },
-{3, 10, 100, 10, },
-{4, 10, 100, 10, },
-{5, 10, 100, 10, },
-{6, 10, 100, 10, },
-{7, 10, 100, 10, },
-{8, 10, 100, 10, },
-{9, 10, 100, 10, },
-{10, 10, 100, 10, },
-{11, 10, 100, 11, },
-{12, 10, 100, 12, },
-{13, 10, 100, 13, },
-{14, 10, 100, 14, },
-{15, 10, 100, 15, },
-{16, 10, 100, 16, },
-{17, 10, 100, 17, },
-{18, 10, 100, 18, },
-{19, 10, 100, 19, },
-{20, 10, 100, 20, },
-{21, 10, 100, 21, },
-{22, 10, 100, 22, },
-{23, 10, 100, 23, },
-{24, 10, 100, 24, },
-{25, 10, 100, 25, },
-{26, 10, 100, 26, },
-{27, 10, 100, 27, },
-{28, 10, 100, 28, },
-{29, 10, 100, 29, },
-{30, 10, 100, 30, },
-{31, 10, 100, 31, },
-{32, 10, 100, 32, },
-{33, 10, 100, 33, },
-{34, 10, 100, 34, },
-{35, 10, 100, 35, },
-{36, 10, 100, 36, },
-{37, 10, 100, 37, },
-{38, 10, 100, 38, },
-{39, 10, 100, 39, },
-{40, 10, 100, 40, },
-{41, 10, 100, 41, },
-{42, 10, 100, 42, },
-{43, 10, 100, 43, },
-{44, 10, 100, 44, },
-{45, 10, 100, 45, },
-{46, 10, 100, 46, },
-{47, 10, 100, 47, },
-{48, 10, 100, 48, },
-{49, 10, 100, 49, },
-{50, 10, 100, 50, },
-{51, 10, 100, 51, },
-{52, 10, 100, 52, },
-{53, 10, 100, 53, },
-{54, 10, 100, 54, },
-{55, 10, 100, 55, },
-{56, 10, 100, 56, },
-{57, 10, 100, 57, },
-{58, 10, 100, 58, },
-{59, 10, 100, 59, },
-{60, 10, 100, 60, },
-{61, 10, 100, 61, },
-{62, 10, 100, 62, },
-{63, 10, 100, 63, },
-{64, 10, 100, 64, },
-{65, 10, 100, 65, },
-{66, 10, 100, 66, },
-{67, 10, 100, 67, },
-{68, 10, 100, 68, },
-{69, 10, 100, 69, },
-{70, 10, 100, 70, },
-{71, 10, 100, 71, },
-{72, 10, 100, 72, },
-{73, 10, 100, 73, },
-{74, 10, 100, 74, },
-{75, 10, 100, 75, },
-{76, 10, 100, 76, },
-{77, 10, 100, 77, },
-{78, 10, 100, 78, },
-{79, 10, 100, 79, },
-{80, 10, 100, 80, },
-{81, 10, 100, 81, },
-{82, 10, 100, 82, },
-{83, 10, 100, 83, },
-{84, 10, 100, 84, },
-{85, 10, 100, 85, },
-{86, 10, 100, 86, },
-{87, 10, 100, 87, },
-{88, 10, 100, 88, },
-{89, 10, 100, 89, },
-{90, 10, 100, 90, },
-{91, 10, 100, 91, },
-{92, 10, 100, 92, },
-{93, 10, 100, 93, },
-{94, 10, 100, 94, },
-{95, 10, 100, 95, },
-{96, 10, 100, 96, },
-{97, 10, 100, 97, },
-{98, 10, 100, 98, },
-{99, 10, 100, 99, },
-{100, 10, 100, 100, },
-{101, 10, 100, 100, },
-{102, 10, 100, 100, },
-{103, 10, 100, 100, },
-{104, 10, 100, 100, },
-{105, 10, 100, 100, },
-{106, 10, 100, 100, },
-{107, 10, 100, 100, },
-{108, 10, 100, 100, },
-{109, 10, 100, 100, },
-{110, 10, 100, 100, },
-{111, 10, 100, 100, },
-{112, 10, 100, 100, },
-{113, 10, 100, 100, },
-{114, 10, 100, 100, },
-{115, 10, 100, 100, },
-{116, 10, 100, 100, },
-{117, 10, 100, 100, },
-{118, 10, 100, 100, },
-{119, 10, 100, 100, },
-{120, 10, 100, 100, },
-{121, 10, 100, 100, },
-{122, 10, 100, 100, },
-{123, 10, 100, 100, },
-{124, 10, 100, 100, },
-};
-} - -/**
- * Possible exceptions:
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- *
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
- * </ul>
- */
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- try {
- scale = new Scale(null, 0);
- fail("No exception occurred"); //should never get here
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {0, SWT.HORIZONTAL, SWT.VERTICAL};
- for (int i = 0; i < cases.length; i++)
- scale = new Scale(shell, cases[i]);
-} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_getIncrement() { - warnUnimpl("Test test_getIncrement not written"); -} - -public void test_getMaximum() { - warnUnimpl("Test test_getMaximum not written"); -} - -public void test_getMinimum() { - warnUnimpl("Test test_getMinimum not written"); -} - -public void test_getPageIncrement() { - warnUnimpl("Test test_getPageIncrement not written"); -} - -public void test_getSelection() { - warnUnimpl("Test test_getSelection not written"); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - // overridden from Control because it does not make sense - // to set the font of a Scale. -} - -public void test_setIncrementI() { - warnUnimpl("Test test_setIncrementI not written"); -} - -/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- */
-public void test_setMaximumI(){
-
- int [][] testValues = getSetMaximumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- scale.setMaximum(intArray[0]);
- report("setMaximum", intArray[0], intArray[1], intArray[2], intArray[3]);
- }
-} - -/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- */
-public void test_setMinimumI(){
-
-
- int [][] testValues = getSetMinimumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- scale.setMinimum(intArray[0]);
- report("setMinimum", intArray[0], intArray[1], intArray[2], intArray[3]);
- }
-} - -public void test_setPageIncrementI() { - warnUnimpl("Test test_setPageIncrementI not written"); -} - -/**
- * Sets the single <em>selection</em> that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- */
-public void test_setSelectionI() {
-
- int [][] testValues = getSetSelectionValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- scale.setSelection(intArray[0]);
- report("setSelection", intArray[0], intArray[1], intArray[2], intArray[3]);
- }
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Scale((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_getIncrement"); - methodNames.addElement("test_getMaximum"); - methodNames.addElement("test_getMinimum"); - methodNames.addElement("test_getPageIncrement"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_setIncrementI"); - methodNames.addElement("test_setMaximumI"); - methodNames.addElement("test_setMinimumI"); - methodNames.addElement("test_setPageIncrementI"); - methodNames.addElement("test_setSelectionI"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_getIncrement")) test_getIncrement(); - else if (getName().equals("test_getMaximum")) test_getMaximum(); - else if (getName().equals("test_getMinimum")) test_getMinimum(); - else if (getName().equals("test_getPageIncrement")) test_getPageIncrement(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_setIncrementI")) test_setIncrementI(); - else if (getName().equals("test_setMaximumI")) test_setMaximumI(); - else if (getName().equals("test_setMinimumI")) test_setMinimumI(); - else if (getName().equals("test_setPageIncrementI")) test_setPageIncrementI(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ScrollBar.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ScrollBar.java deleted file mode 100644 index 0c40d5ad06..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ScrollBar.java +++ /dev/null @@ -1,892 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.ScrollBar - * - * @see org.eclipse.swt.widgets.ScrollBar - */ -public class Test_org_eclipse_swt_widgets_ScrollBar extends Test_org_eclipse_swt_widgets_Widget { - -ScrollBar scrollBar; -Canvas canvas; - -public Test_org_eclipse_swt_widgets_ScrollBar(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- canvas = new Canvas(shell, SWT.H_SCROLL | SWT.V_SCROLL);
- scrollBar = canvas.getHorizontalBar();
- setWidget(scrollBar);
-} - -protected void tearDown() { - super.tearDown(); -} - -// this method must be private or protected so the auto-gen tool keeps it
-private void report(String call, int set, int minExpected, int maxExpected, int selectionExpected, int thumbExpected) {
- // Uncomment these lines and comment out call to check() if you want the test to report all errors without
- // stopping.
-
- //if (scrollBar.getMinimum() != minExpected)
- //System.out.println(call + "(" + set + "): Minimum Expected: " + minExpected + " Actual: " + scrollBar.getMinimum());
- //if (scrollBar.getMaximum() != maxExpected)
- //System.out.println(call + "(" + set + "): Maximum Expected: " + maxExpected + " Actual: " + scrollBar.getMaximum());
- //if (scrollBar.getSelection() != selectionExpected)
- //System.out.println(call + "(" + set + "): Selection Expected: " + selectionExpected + " Actual: " + scrollBar.getSelection());
- //if (scrollBar.getThumb() != thumbExpected)
- //System.out.println(call + "(" + set + "): Thumb Expected: " + thumbExpected + " Actual: " + scrollBar.getThumb());
- check(minExpected, maxExpected, selectionExpected, thumbExpected);
-} -// this method must be private or protected so the auto-gen tool keeps it
-private void check(int minExpected, int maxExpected, int selectionExpected, int thumbExpected) {
- assertEquals(scrollBar.getMaximum(), maxExpected);
- assertEquals(scrollBar.getMinimum(), minExpected);
- assertEquals(scrollBar.getSelection(), selectionExpected);
- assertEquals(scrollBar.getThumb(), thumbExpected);
-} -// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetThumbValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 10, 100, 50, 10},
-{1, 10, 100, 50, 1},
-{2, 10, 100, 50, 2},
-{3, 10, 100, 50, 3},
-{4, 10, 100, 50, 4},
-{5, 10, 100, 50, 5},
-{6, 10, 100, 50, 6},
-{7, 10, 100, 50, 7},
-{8, 10, 100, 50, 8},
-{9, 10, 100, 50, 9},
-{10, 10, 100, 50, 10},
-{11, 10, 100, 50, 11},
-{12, 10, 100, 50, 12},
-{13, 10, 100, 50, 13},
-{14, 10, 100, 50, 14},
-{15, 10, 100, 50, 15},
-{16, 10, 100, 50, 16},
-{17, 10, 100, 50, 17},
-{18, 10, 100, 50, 18},
-{19, 10, 100, 50, 19},
-{20, 10, 100, 50, 20},
-{21, 10, 100, 50, 21},
-{22, 10, 100, 50, 22},
-{23, 10, 100, 50, 23},
-{24, 10, 100, 50, 24},
-{25, 10, 100, 50, 25},
-{26, 10, 100, 50, 26},
-{27, 10, 100, 50, 27},
-{28, 10, 100, 50, 28},
-{29, 10, 100, 50, 29},
-{30, 10, 100, 50, 30},
-{31, 10, 100, 50, 31},
-{32, 10, 100, 50, 32},
-{33, 10, 100, 50, 33},
-{34, 10, 100, 50, 34},
-{35, 10, 100, 50, 35},
-{36, 10, 100, 50, 36},
-{37, 10, 100, 50, 37},
-{38, 10, 100, 50, 38},
-{39, 10, 100, 50, 39},
-{40, 10, 100, 50, 40},
-{41, 10, 100, 50, 41},
-{42, 10, 100, 50, 42},
-{43, 10, 100, 50, 43},
-{44, 10, 100, 50, 44},
-{45, 10, 100, 50, 45},
-{46, 10, 100, 50, 46},
-{47, 10, 100, 50, 47},
-{48, 10, 100, 50, 48},
-{49, 10, 100, 50, 49},
-{50, 10, 100, 50, 50},
-{51, 10, 100, 49, 51},
-{52, 10, 100, 48, 52},
-{53, 10, 100, 47, 53},
-{54, 10, 100, 46, 54},
-{55, 10, 100, 45, 55},
-{56, 10, 100, 44, 56},
-{57, 10, 100, 43, 57},
-{58, 10, 100, 42, 58},
-{59, 10, 100, 41, 59},
-{60, 10, 100, 40, 60},
-{61, 10, 100, 39, 61},
-{62, 10, 100, 38, 62},
-{63, 10, 100, 37, 63},
-{64, 10, 100, 36, 64},
-{65, 10, 100, 35, 65},
-{66, 10, 100, 34, 66},
-{67, 10, 100, 33, 67},
-{68, 10, 100, 32, 68},
-{69, 10, 100, 31, 69},
-{70, 10, 100, 30, 70},
-{71, 10, 100, 29, 71},
-{72, 10, 100, 28, 72},
-{73, 10, 100, 27, 73},
-{74, 10, 100, 26, 74},
-{75, 10, 100, 25, 75},
-{76, 10, 100, 24, 76},
-{77, 10, 100, 23, 77},
-{78, 10, 100, 22, 78},
-{79, 10, 100, 21, 79},
-{80, 10, 100, 20, 80},
-{81, 10, 100, 19, 81},
-{82, 10, 100, 18, 82},
-{83, 10, 100, 17, 83},
-{84, 10, 100, 16, 84},
-{85, 10, 100, 15, 85},
-{86, 10, 100, 14, 86},
-{87, 10, 100, 13, 87},
-{88, 10, 100, 12, 88},
-{89, 10, 100, 11, 89},
-{90, 10, 100, 10, 90},
-{91, 10, 100, 50, 10},
-{92, 10, 100, 50, 10},
-{93, 10, 100, 50, 10},
-{94, 10, 100, 50, 10},
-{95, 10, 100, 50, 10},
-{96, 10, 100, 50, 10},
-{97, 10, 100, 50, 10},
-{98, 10, 100, 50, 10},
-{99, 10, 100, 50, 10},
-{100, 10, 100, 50, 10},
-{101, 10, 100, 50, 10},
-{102, 10, 100, 50, 10},
-{103, 10, 100, 50, 10},
-{104, 10, 100, 50, 10},
-{105, 10, 100, 50, 10},
-{106, 10, 100, 50, 10},
-{107, 10, 100, 50, 10},
-{108, 10, 100, 50, 10},
-{109, 10, 100, 50, 10},
-{110, 10, 100, 50, 10},
-{111, 10, 100, 50, 10},
-{112, 10, 100, 50, 10},
-{113, 10, 100, 50, 10},
-{114, 10, 100, 50, 10},
-{115, 10, 100, 50, 10},
-{116, 10, 100, 50, 10},
-{117, 10, 100, 50, 10},
-{118, 10, 100, 50, 10},
-{119, 10, 100, 50, 10},
-{120, 10, 100, 50, 10},
-{121, 10, 100, 50, 10},
-{122, 10, 100, 50, 10},
-{123, 10, 100, 50, 10},
-{124, 10, 100, 50, 10},
-};
-} -// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMinimumValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 0, 100, 50, 10},
-{1, 1, 100, 50, 10},
-{2, 2, 100, 50, 10},
-{3, 3, 100, 50, 10},
-{4, 4, 100, 50, 10},
-{5, 5, 100, 50, 10},
-{6, 6, 100, 50, 10},
-{7, 7, 100, 50, 10},
-{8, 8, 100, 50, 10},
-{9, 9, 100, 50, 10},
-{10, 10, 100, 50, 10},
-{11, 11, 100, 50, 10},
-{12, 12, 100, 50, 10},
-{13, 13, 100, 50, 10},
-{14, 14, 100, 50, 10},
-{15, 15, 100, 50, 10},
-{16, 16, 100, 50, 10},
-{17, 17, 100, 50, 10},
-{18, 18, 100, 50, 10},
-{19, 19, 100, 50, 10},
-{20, 20, 100, 50, 10},
-{21, 21, 100, 50, 10},
-{22, 22, 100, 50, 10},
-{23, 23, 100, 50, 10},
-{24, 24, 100, 50, 10},
-{25, 25, 100, 50, 10},
-{26, 26, 100, 50, 10},
-{27, 27, 100, 50, 10},
-{28, 28, 100, 50, 10},
-{29, 29, 100, 50, 10},
-{30, 30, 100, 50, 10},
-{31, 31, 100, 50, 10},
-{32, 32, 100, 50, 10},
-{33, 33, 100, 50, 10},
-{34, 34, 100, 50, 10},
-{35, 35, 100, 50, 10},
-{36, 36, 100, 50, 10},
-{37, 37, 100, 50, 10},
-{38, 38, 100, 50, 10},
-{39, 39, 100, 50, 10},
-{40, 40, 100, 50, 10},
-{41, 41, 100, 50, 10},
-{42, 42, 100, 50, 10},
-{43, 43, 100, 50, 10},
-{44, 44, 100, 50, 10},
-{45, 45, 100, 50, 10},
-{46, 46, 100, 50, 10},
-{47, 47, 100, 50, 10},
-{48, 48, 100, 50, 10},
-{49, 49, 100, 50, 10},
-{50, 50, 100, 50, 10},
-{51, 51, 100, 51, 10},
-{52, 52, 100, 52, 10},
-{53, 53, 100, 53, 10},
-{54, 54, 100, 54, 10},
-{55, 55, 100, 55, 10},
-{56, 56, 100, 56, 10},
-{57, 57, 100, 57, 10},
-{58, 58, 100, 58, 10},
-{59, 59, 100, 59, 10},
-{60, 60, 100, 60, 10},
-{61, 61, 100, 61, 10},
-{62, 62, 100, 62, 10},
-{63, 63, 100, 63, 10},
-{64, 64, 100, 64, 10},
-{65, 65, 100, 65, 10},
-{66, 66, 100, 66, 10},
-{67, 67, 100, 67, 10},
-{68, 68, 100, 68, 10},
-{69, 69, 100, 69, 10},
-{70, 70, 100, 70, 10},
-{71, 71, 100, 71, 10},
-{72, 72, 100, 72, 10},
-{73, 73, 100, 73, 10},
-{74, 74, 100, 74, 10},
-{75, 75, 100, 75, 10},
-{76, 76, 100, 76, 10},
-{77, 77, 100, 77, 10},
-{78, 78, 100, 78, 10},
-{79, 79, 100, 79, 10},
-{80, 80, 100, 80, 10},
-{81, 81, 100, 81, 10},
-{82, 82, 100, 82, 10},
-{83, 83, 100, 83, 10},
-{84, 84, 100, 84, 10},
-{85, 85, 100, 85, 10},
-{86, 86, 100, 86, 10},
-{87, 87, 100, 87, 10},
-{88, 88, 100, 88, 10},
-{89, 89, 100, 89, 10},
-{90, 90, 100, 90, 10},
-{91, 91, 100, 91, 9},
-{92, 92, 100, 92, 8},
-{93, 93, 100, 93, 7},
-{94, 94, 100, 94, 6},
-{95, 95, 100, 95, 5},
-{96, 96, 100, 96, 4},
-{97, 97, 100, 97, 3},
-{98, 98, 100, 98, 2},
-{99, 99, 100, 99, 1},
-{100, 10, 100, 50, 10},
-{101, 10, 100, 50, 10},
-{102, 10, 100, 50, 10},
-{103, 10, 100, 50, 10},
-{104, 10, 100, 50, 10},
-{105, 10, 100, 50, 10},
-{106, 10, 100, 50, 10},
-{107, 10, 100, 50, 10},
-{108, 10, 100, 50, 10},
-{109, 10, 100, 50, 10},
-{110, 10, 100, 50, 10},
-{111, 10, 100, 50, 10},
-{112, 10, 100, 50, 10},
-{113, 10, 100, 50, 10},
-{114, 10, 100, 50, 10},
-{115, 10, 100, 50, 10},
-{116, 10, 100, 50, 10},
-{117, 10, 100, 50, 10},
-{118, 10, 100, 50, 10},
-{119, 10, 100, 50, 10},
-{120, 10, 100, 50, 10},
-{121, 10, 100, 50, 10},
-{122, 10, 100, 50, 10},
-{123, 10, 100, 50, 10},
-{124, 10, 100, 50, 10},
-};
-} -// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMaximumValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 10, 100, 50, 10},
-{1, 10, 100, 50, 10},
-{2, 10, 100, 50, 10},
-{3, 10, 100, 50, 10},
-{4, 10, 100, 50, 10},
-{5, 10, 100, 50, 10},
-{6, 10, 100, 50, 10},
-{7, 10, 100, 50, 10},
-{8, 10, 100, 50, 10},
-{9, 10, 100, 50, 10},
-{10, 10, 100, 50, 10},
-{11, 10, 11, 10, 1},
-{12, 10, 12, 10, 2},
-{13, 10, 13, 10, 3},
-{14, 10, 14, 10, 4},
-{15, 10, 15, 10, 5},
-{16, 10, 16, 10, 6},
-{17, 10, 17, 10, 7},
-{18, 10, 18, 10, 8},
-{19, 10, 19, 10, 9},
-{20, 10, 20, 10, 10},
-{21, 10, 21, 11, 10},
-{22, 10, 22, 12, 10},
-{23, 10, 23, 13, 10},
-{24, 10, 24, 14, 10},
-{25, 10, 25, 15, 10},
-{26, 10, 26, 16, 10},
-{27, 10, 27, 17, 10},
-{28, 10, 28, 18, 10},
-{29, 10, 29, 19, 10},
-{30, 10, 30, 20, 10},
-{31, 10, 31, 21, 10},
-{32, 10, 32, 22, 10},
-{33, 10, 33, 23, 10},
-{34, 10, 34, 24, 10},
-{35, 10, 35, 25, 10},
-{36, 10, 36, 26, 10},
-{37, 10, 37, 27, 10},
-{38, 10, 38, 28, 10},
-{39, 10, 39, 29, 10},
-{40, 10, 40, 30, 10},
-{41, 10, 41, 31, 10},
-{42, 10, 42, 32, 10},
-{43, 10, 43, 33, 10},
-{44, 10, 44, 34, 10},
-{45, 10, 45, 35, 10},
-{46, 10, 46, 36, 10},
-{47, 10, 47, 37, 10},
-{48, 10, 48, 38, 10},
-{49, 10, 49, 39, 10},
-{50, 10, 50, 40, 10},
-{51, 10, 51, 41, 10},
-{52, 10, 52, 42, 10},
-{53, 10, 53, 43, 10},
-{54, 10, 54, 44, 10},
-{55, 10, 55, 45, 10},
-{56, 10, 56, 46, 10},
-{57, 10, 57, 47, 10},
-{58, 10, 58, 48, 10},
-{59, 10, 59, 49, 10},
-{60, 10, 60, 50, 10},
-{61, 10, 61, 50, 10},
-{62, 10, 62, 50, 10},
-{63, 10, 63, 50, 10},
-{64, 10, 64, 50, 10},
-{65, 10, 65, 50, 10},
-{66, 10, 66, 50, 10},
-{67, 10, 67, 50, 10},
-{68, 10, 68, 50, 10},
-{69, 10, 69, 50, 10},
-{70, 10, 70, 50, 10},
-{71, 10, 71, 50, 10},
-{72, 10, 72, 50, 10},
-{73, 10, 73, 50, 10},
-{74, 10, 74, 50, 10},
-{75, 10, 75, 50, 10},
-{76, 10, 76, 50, 10},
-{77, 10, 77, 50, 10},
-{78, 10, 78, 50, 10},
-{79, 10, 79, 50, 10},
-{80, 10, 80, 50, 10},
-{81, 10, 81, 50, 10},
-{82, 10, 82, 50, 10},
-{83, 10, 83, 50, 10},
-{84, 10, 84, 50, 10},
-{85, 10, 85, 50, 10},
-{86, 10, 86, 50, 10},
-{87, 10, 87, 50, 10},
-{88, 10, 88, 50, 10},
-{89, 10, 89, 50, 10},
-{90, 10, 90, 50, 10},
-{91, 10, 91, 50, 10},
-{92, 10, 92, 50, 10},
-{93, 10, 93, 50, 10},
-{94, 10, 94, 50, 10},
-{95, 10, 95, 50, 10},
-{96, 10, 96, 50, 10},
-{97, 10, 97, 50, 10},
-{98, 10, 98, 50, 10},
-{99, 10, 99, 50, 10},
-{100, 10, 100, 50, 10},
-{101, 10, 101, 50, 10},
-{102, 10, 102, 50, 10},
-{103, 10, 103, 50, 10},
-{104, 10, 104, 50, 10},
-{105, 10, 105, 50, 10},
-{106, 10, 106, 50, 10},
-{107, 10, 107, 50, 10},
-{108, 10, 108, 50, 10},
-{109, 10, 109, 50, 10},
-{110, 10, 110, 50, 10},
-{111, 10, 111, 50, 10},
-{112, 10, 112, 50, 10},
-{113, 10, 113, 50, 10},
-{114, 10, 114, 50, 10},
-{115, 10, 115, 50, 10},
-{116, 10, 116, 50, 10},
-{117, 10, 117, 50, 10},
-{118, 10, 118, 50, 10},
-{119, 10, 119, 50, 10},
-{120, 10, 120, 50, 10},
-{121, 10, 121, 50, 10},
-{122, 10, 122, 50, 10},
-{123, 10, 123, 50, 10},
-{124, 10, 124, 50, 10},
-};
-} -// this method must be private or protected so the auto-gen tool keeps it
-private void setDefaults() {
- scrollBar.setMaximum(100);
- scrollBar.setMinimum(10);
- scrollBar.setThumb(10);
- scrollBar.setSelection(50);
-} -// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetSelectionValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 10, 100, 10, 10},
-{1, 10, 100, 10, 10},
-{2, 10, 100, 10, 10},
-{3, 10, 100, 10, 10},
-{4, 10, 100, 10, 10},
-{5, 10, 100, 10, 10},
-{6, 10, 100, 10, 10},
-{7, 10, 100, 10, 10},
-{8, 10, 100, 10, 10},
-{9, 10, 100, 10, 10},
-{10, 10, 100, 10, 10},
-{11, 10, 100, 11, 10},
-{12, 10, 100, 12, 10},
-{13, 10, 100, 13, 10},
-{14, 10, 100, 14, 10},
-{15, 10, 100, 15, 10},
-{16, 10, 100, 16, 10},
-{17, 10, 100, 17, 10},
-{18, 10, 100, 18, 10},
-{19, 10, 100, 19, 10},
-{20, 10, 100, 20, 10},
-{21, 10, 100, 21, 10},
-{22, 10, 100, 22, 10},
-{23, 10, 100, 23, 10},
-{24, 10, 100, 24, 10},
-{25, 10, 100, 25, 10},
-{26, 10, 100, 26, 10},
-{27, 10, 100, 27, 10},
-{28, 10, 100, 28, 10},
-{29, 10, 100, 29, 10},
-{30, 10, 100, 30, 10},
-{31, 10, 100, 31, 10},
-{32, 10, 100, 32, 10},
-{33, 10, 100, 33, 10},
-{34, 10, 100, 34, 10},
-{35, 10, 100, 35, 10},
-{36, 10, 100, 36, 10},
-{37, 10, 100, 37, 10},
-{38, 10, 100, 38, 10},
-{39, 10, 100, 39, 10},
-{40, 10, 100, 40, 10},
-{41, 10, 100, 41, 10},
-{42, 10, 100, 42, 10},
-{43, 10, 100, 43, 10},
-{44, 10, 100, 44, 10},
-{45, 10, 100, 45, 10},
-{46, 10, 100, 46, 10},
-{47, 10, 100, 47, 10},
-{48, 10, 100, 48, 10},
-{49, 10, 100, 49, 10},
-{50, 10, 100, 50, 10},
-{51, 10, 100, 51, 10},
-{52, 10, 100, 52, 10},
-{53, 10, 100, 53, 10},
-{54, 10, 100, 54, 10},
-{55, 10, 100, 55, 10},
-{56, 10, 100, 56, 10},
-{57, 10, 100, 57, 10},
-{58, 10, 100, 58, 10},
-{59, 10, 100, 59, 10},
-{60, 10, 100, 60, 10},
-{61, 10, 100, 61, 10},
-{62, 10, 100, 62, 10},
-{63, 10, 100, 63, 10},
-{64, 10, 100, 64, 10},
-{65, 10, 100, 65, 10},
-{66, 10, 100, 66, 10},
-{67, 10, 100, 67, 10},
-{68, 10, 100, 68, 10},
-{69, 10, 100, 69, 10},
-{70, 10, 100, 70, 10},
-{71, 10, 100, 71, 10},
-{72, 10, 100, 72, 10},
-{73, 10, 100, 73, 10},
-{74, 10, 100, 74, 10},
-{75, 10, 100, 75, 10},
-{76, 10, 100, 76, 10},
-{77, 10, 100, 77, 10},
-{78, 10, 100, 78, 10},
-{79, 10, 100, 79, 10},
-{80, 10, 100, 80, 10},
-{81, 10, 100, 81, 10},
-{82, 10, 100, 82, 10},
-{83, 10, 100, 83, 10},
-{84, 10, 100, 84, 10},
-{85, 10, 100, 85, 10},
-{86, 10, 100, 86, 10},
-{87, 10, 100, 87, 10},
-{88, 10, 100, 88, 10},
-{89, 10, 100, 89, 10},
-{90, 10, 100, 90, 10},
-{91, 10, 100, 90, 10},
-{92, 10, 100, 90, 10},
-{93, 10, 100, 90, 10},
-{94, 10, 100, 90, 10},
-{95, 10, 100, 90, 10},
-{96, 10, 100, 90, 10},
-{97, 10, 100, 90, 10},
-{98, 10, 100, 90, 10},
-{99, 10, 100, 90, 10},
-{100, 10, 100, 90, 10},
-{101, 10, 100, 90, 10},
-{102, 10, 100, 90, 10},
-{103, 10, 100, 90, 10},
-{104, 10, 100, 90, 10},
-{105, 10, 100, 90, 10},
-{106, 10, 100, 90, 10},
-{107, 10, 100, 90, 10},
-{108, 10, 100, 90, 10},
-{109, 10, 100, 90, 10},
-{110, 10, 100, 90, 10},
-{111, 10, 100, 90, 10},
-{112, 10, 100, 90, 10},
-{113, 10, 100, 90, 10},
-{114, 10, 100, 90, 10},
-{115, 10, 100, 90, 10},
-{116, 10, 100, 90, 10},
-{117, 10, 100, 90, 10},
-{118, 10, 100, 90, 10},
-{119, 10, 100, 90, 10},
-{120, 10, 100, 90, 10},
-{121, 10, 100, 90, 10},
-{122, 10, 100, 90, 10},
-{123, 10, 100, 90, 10},
-{124, 10, 100, 90, 10},
-};
-} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_getDisplay() { - warnUnimpl("Test test_getDisplay not written"); -} - -public void test_getEnabled() { - warnUnimpl("Test test_getEnabled not written"); -} - -public void test_getIncrement() { - warnUnimpl("Test test_getIncrement not written"); -} - -public void test_getMaximum() { - warnUnimpl("Test test_getMaximum not written"); -} - -public void test_getMinimum() { - warnUnimpl("Test test_getMinimum not written"); -} - -public void test_getPageIncrement() { - warnUnimpl("Test test_getPageIncrement not written"); -} - -public void test_getParent() { - warnUnimpl("Test test_getParent not written"); -} - -public void test_getSelection() { - warnUnimpl("Test test_getSelection not written"); -} - -public void test_getSize() { - warnUnimpl("Test test_getSize not written"); -} - -public void test_getThumb() { - warnUnimpl("Test test_getThumb not written"); -} - -public void test_getVisible() { - warnUnimpl("Test test_getVisible not written"); -} - -public void test_isEnabled() { - warnUnimpl("Test test_isEnabled not written"); -} - -public void test_isVisible() { - warnUnimpl("Test test_isVisible not written"); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_setEnabledZ() { - warnUnimpl("Test test_setEnabledZ not written"); -} - -/**
- * Sets the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed to the argument, which must be at least
- * one.
- */
-public void test_setIncrementI() {
- int[] cases = {1, 10, 10000};
- for (int i=0; i < cases.length; i++)
- {
- scrollBar.setIncrement(cases[i]);
- assertEquals(cases[i], scrollBar.getIncrement());
- }
-
- scrollBar.setIncrement(25); - scrollBar.setIncrement(0); // setting to 0 fails silently
- assertEquals(25, scrollBar.getIncrement()); -} - -/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- */
-public void test_setMaximumI(){
- int [][] testValues = getSetMaximumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- scrollBar.setMaximum(intArray[0]);
- report("setMaximum", intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]);
- }
-} - -/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- */
-public void test_setMinimumI(){
- int [][] testValues = getSetMinimumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- scrollBar.setMinimum(intArray[0]);
- report("setMinimum", intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]);
- }
-} - -/**
- * Sets the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected to the argument, which must be at least
- * one.
- */
-public void test_setPageIncrementI(){
- int[] cases = {1, 10, 10000};
- for (int i=0; i<cases.length; i++)
- {
- scrollBar.setPageIncrement(cases[i]);
- assertEquals(scrollBar.getPageIncrement(), cases[i]);
- }
-
- scrollBar.setPageIncrement(25); - scrollBar.setPageIncrement(0); // setting to 0 fails silently - assertEquals(25, scrollBar.getPageIncrement()); -} - -/**
- * Sets the single <em>selection</em> that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- */
-public void test_setSelectionI(){
- int [][] testValues = getSetSelectionValues();
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- scrollBar.setSelection(intArray[0]);
- report("setSelection", intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]);
- }
-} - -/**
- * Sets the size of the receiver's thumb relative to the
- * difference between its maximum and minimum values to the
- * argument which must be at least one.
- */
-public void test_setThumbI(){
- int [][] testValues = getSetThumbValues();
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- scrollBar.setThumb(intArray[0]);
- report("setThumb", intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]);
- }
-} - -public void test_setValuesIIIIII() { - warnUnimpl("Test test_setValuesIIIIII not written"); -} - -public void test_setVisibleZ() { - warnUnimpl("Test test_setVisibleZ not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_ScrollBar((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_getDisplay"); - methodNames.addElement("test_getEnabled"); - methodNames.addElement("test_getIncrement"); - methodNames.addElement("test_getMaximum"); - methodNames.addElement("test_getMinimum"); - methodNames.addElement("test_getPageIncrement"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSize"); - methodNames.addElement("test_getThumb"); - methodNames.addElement("test_getVisible"); - methodNames.addElement("test_isEnabled"); - methodNames.addElement("test_isVisible"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_setEnabledZ"); - methodNames.addElement("test_setIncrementI"); - methodNames.addElement("test_setMaximumI"); - methodNames.addElement("test_setMinimumI"); - methodNames.addElement("test_setPageIncrementI"); - methodNames.addElement("test_setSelectionI"); - methodNames.addElement("test_setThumbI"); - methodNames.addElement("test_setValuesIIIIII"); - methodNames.addElement("test_setVisibleZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_getDisplay")) test_getDisplay(); - else if (getName().equals("test_getEnabled")) test_getEnabled(); - else if (getName().equals("test_getIncrement")) test_getIncrement(); - else if (getName().equals("test_getMaximum")) test_getMaximum(); - else if (getName().equals("test_getMinimum")) test_getMinimum(); - else if (getName().equals("test_getPageIncrement")) test_getPageIncrement(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSize")) test_getSize(); - else if (getName().equals("test_getThumb")) test_getThumb(); - else if (getName().equals("test_getVisible")) test_getVisible(); - else if (getName().equals("test_isEnabled")) test_isEnabled(); - else if (getName().equals("test_isVisible")) test_isVisible(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_setEnabledZ")) test_setEnabledZ(); - else if (getName().equals("test_setIncrementI")) test_setIncrementI(); - else if (getName().equals("test_setMaximumI")) test_setMaximumI(); - else if (getName().equals("test_setMinimumI")) test_setMinimumI(); - else if (getName().equals("test_setPageIncrementI")) test_setPageIncrementI(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else if (getName().equals("test_setThumbI")) test_setThumbI(); - else if (getName().equals("test_setValuesIIIIII")) test_setValuesIIIIII(); - else if (getName().equals("test_setVisibleZ")) test_setVisibleZ(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scrollable.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scrollable.java deleted file mode 100644 index ae6dce3400..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scrollable.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.widgets.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Scrollable - * - * @see org.eclipse.swt.widgets.Scrollable - */ -public class Test_org_eclipse_swt_widgets_Scrollable extends Test_org_eclipse_swt_widgets_Control { - - Scrollable scrollable; - -public Test_org_eclipse_swt_widgets_Scrollable(String name) { - super(name); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -protected void setWidget(Widget w) { - scrollable = (Scrollable)w; - super.setWidget(w); -} - -public void test_computeTrimIIII() { - scrollable.computeTrim(0, 0, 0, 0); -} - -public void test_getClientArea() { - scrollable.getClientArea(); -} - -public void test_getHorizontalBar() { - ScrollBar hbar = scrollable.getHorizontalBar(); -} - -public void test_getVerticalBar() { - ScrollBar vbar = scrollable.getVerticalBar(); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_computeTrimIIII"); - methodNames.addElement("test_getClientArea"); - methodNames.addElement("test_getHorizontalBar"); - methodNames.addElement("test_getVerticalBar"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII(); - else if (getName().equals("test_getClientArea")) test_getClientArea(); - else if (getName().equals("test_getHorizontalBar")) test_getHorizontalBar(); - else if (getName().equals("test_getVerticalBar")) test_getVerticalBar(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Shell.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Shell.java deleted file mode 100644 index 4ffdb24881..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Shell.java +++ /dev/null @@ -1,426 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Shell - * - * @see org.eclipse.swt.widgets.Shell - */ -public class Test_org_eclipse_swt_widgets_Shell extends Test_org_eclipse_swt_widgets_Decorations { - -Shell testShell; - -public Test_org_eclipse_swt_widgets_Shell(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- testShell = new Shell(shell, SWT.NULL);
- setWidget(shell);
- assertTrue(testShell.getParent() == shell);
-} - -protected void tearDown() { - super.tearDown(); -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_ConstructorI(){
- /* this should test various combinations of STYLE bits, for now just test individual bits */
- int[] cases = {SWT.NO_TRIM, SWT.RESIZE, SWT.TITLE, SWT.CLOSE, SWT.MENU, SWT.MIN, SWT.BORDER,
- SWT.CLIP_CHILDREN, SWT.CLIP_SIBLINGS, SWT.ON_TOP, SWT.FLAT, SWT.SMOOTH};
- Shell newShell;
- for (int i = 0; i < cases.length; i++) {
- newShell = new Shell(cases[i]);
- assertTrue("a " +i, newShell.getDisplay() == shell.getDisplay());
- newShell.dispose();
- }
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_Display(){
- Display display = shell.getDisplay();
- Shell newShell = new Shell(display);
- assertTrue("a: ", newShell.getDisplay() == display);
- newShell.dispose();
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_DisplayI(){
- int[] cases = {SWT.NO_TRIM, SWT.RESIZE, SWT.TITLE, SWT.CLOSE, SWT.MENU, SWT.MIN, SWT.BORDER,
- SWT.CLIP_CHILDREN, SWT.CLIP_SIBLINGS, SWT.ON_TOP, SWT.FLAT, SWT.SMOOTH};
- Shell newShell;
- Display display = shell.getDisplay();
- for (int i = 0; i < cases.length; i++) {
- newShell = new Shell(display, cases[i]);
- assertTrue("a " +i, newShell.getDisplay() == shell.getDisplay());
- newShell.dispose();
- }
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_Shell(){
- Shell newShell = new Shell(shell);
- assertTrue("a: ", newShell.getParent() == shell);
- newShell.dispose();
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_ShellI(){
- /* this should test various combinations of STYLE bits, for now just test individual bits */
- int[] cases = {SWT.NO_TRIM, SWT.RESIZE, SWT.TITLE, SWT.CLOSE, SWT.MENU, SWT.MIN, SWT.BORDER,
- SWT.CLIP_CHILDREN, SWT.CLIP_SIBLINGS, SWT.ON_TOP, SWT.FLAT, SWT.SMOOTH};
- Shell newShell;
- for (int i = 0; i < cases.length; i++) {
- newShell = new Shell(shell, cases[i]);
- assertTrue("a " +i, newShell.getParent() == shell);
- newShell.dispose();
- }
-} - -public void test_win32_newLorg_eclipse_swt_widgets_DisplayI() { - // do not test - Windows only -} - -public void test_addShellListenerLorg_eclipse_swt_events_ShellListener() { - warnUnimpl("Test test_addShellListenerLorg_eclipse_swt_events_ShellListener not written"); -} - -public void test_close(){
-
- // bogus line that 'enabled' gpfs
- // Shell newShell = new Shell();
- testShell.setBounds(20,30,200, 200);
- testShell.open();
- testShell.close();
- shell.setBounds(20,30,200, 200);
- shell.open();
-} - -public void test_dispose(){
- Shell newShell = new Shell();
- newShell.dispose();
-} - -public void test_getBounds() { - // tested in test_setBoundsIIII and test_setBoundsLorg_eclipse_swt_graphics_Rectangle -} - -public void test_getDisplay(){
- assertTrue( shell.getDisplay() == testShell.getDisplay());
-} - -public void test_getEnabled(){
- assertTrue(":a0:", shell.getEnabled());
- shell.setEnabled(false);
- assertTrue(":a:", !shell.getEnabled());
- shell.setEnabled(true);
- assertTrue(":b:", shell.getEnabled());
-} - -public void test_getImeInputMode() { - warnUnimpl("Test test_getImeInputMode not written"); -} - -public void test_getLocation() { - warnUnimpl("Test test_getLocation not written"); -} - -public void test_getParent () { - // overriding Control.test_getParent - assertTrue(shell.getParent()==null); - assertTrue(testShell.getParent() == shell); -} - -public void test_getShell () {
- assertTrue(":a:", shell.getShell()==shell);
- Shell shell_1 = new Shell(shell);
- assertTrue(":b:", shell_1.getShell()== shell_1);
- shell_1.dispose();
-} - -public void test_getShells() { - warnUnimpl("Test test_getShells not written"); -} - -public void test_getStyle() { - // overriding Widget.test_getStyle - assertTrue("testShell not modeless", (testShell.getStyle () & SWT.MODELESS) == SWT.MODELESS); - int[] cases = {SWT.MODELESS, SWT.PRIMARY_MODAL, SWT.APPLICATION_MODAL, SWT.SYSTEM_MODAL}; - for (int i = 0; i < cases.length; i++) { - Shell testShell2 = new Shell(shell, cases[i]); - assertTrue("shell " + i, (testShell2.getStyle () & cases[i]) == cases[i]); - testShell2.dispose(); - } -} - -public void test_isEnabled(){
- assertTrue(":a:", shell.isEnabled());
- shell.setEnabled(false);
- assertTrue(":b:", !shell.isEnabled());
- if (fCheckBogusTestCases)
- assertTrue(":b1:", !testShell.isEnabled());
- shell.setEnabled(true);
- assertTrue(":c:", shell.isEnabled());
- assertTrue(":a:", testShell.isEnabled());
- testShell.setEnabled(false);
- assertTrue(":b:", !testShell.isEnabled());
- testShell.setEnabled(true);
- assertTrue(":c:", testShell.isEnabled());
-} - -public void test_isVisible() { - // overriding Control.test_isVisible - testShell.setVisible(true); - assertTrue(testShell.isVisible()); - shell.setVisible(true); - assertTrue(shell.isVisible()); - - testShell.setVisible(true); - shell.setVisible(true); - assertTrue("shell.isVisible() a:", shell.isVisible()); - shell.setVisible(false); - assertTrue("shell.isVisible() b:", !shell.isVisible()); - if (fCheckBogusTestCases) - assertTrue("testShell.isVisible() c:", !testShell.isVisible()); -} - -public void test_open(){
- shell.open();
-} - -public void test_removeShellListenerLorg_eclipse_swt_events_ShellListener() { - warnUnimpl("Test test_removeShellListenerLorg_eclipse_swt_events_ShellListener not written"); -} - -public void test_setBoundsIIII() { - // overridden from Control because Shells have a minimum size -} - -public void test_setBoundsLorg_eclipse_swt_graphics_Rectangle() { - // overridden from Control because Shells have a minimum size -// /* windows */ -// /* note that there is a minimum size for a shell, this test will fail if p1.x < 112 or p1.y < 27 */ -// /* note that there is a maximum size for a shell, this test will fail if p1.x > 1292 or p1.y > 1036 */ -// if (SwtJunit.isWindows) { -// Point p1 = new Point(112, 27); -// Rectangle r1 = new Rectangle(20, 30, p1.x, p1.y); -// Rectangle r2; -// for (int i = 0; i < 11; i++) { -// testShell.setBounds(r1); -// r2 = testShell.getBounds(); -// assert("child shell iteration " + i + " set=" + r1 + " get=" + r2, r1.equals(r2)); -// r1.width += 100; -// r1.height += 100; -// } -// r1 = new Rectangle(20, 30, p1.x, p1.y); -// for (int i = 0; i < 11; i++) { -// shell.setBounds(r1); -// r2 = shell.getBounds(); -// assert("parent shell iteration " + i + " set=" + r1 + " get=" + r2, r1.equals(r2)); -// r1.width += 100; -// r1.height += 100; -// } -// } -// /* motif */ -// /* note that there is a minimum size for a shell, this test will fail if p1.x < 112 or p1.y < 27 */ -// /* note that there is a maximum size for a shell, this test will fail if p1.x > 1292 or p1.y > 1036 */ -// if (SwtJunit.isMotif) { -// Point p1 = new Point(15,35); -// Rectangle r1 = new Rectangle(20, 30, p1.x, p1.y); -// Rectangle r2; -// -// for (int i = 0; i < 15; i++) { -// testShell.setBounds(r1); -// r2 = testShell.getBounds(); -// assert("child shell iteration " + i + " set=" + r1 + " get=" + r2, r1.equals(r2)); -// r1.width += 100; -// r1.height += 100; -// } -// r1 = new Rectangle(50, 50, p1.x, p1.y); -// for (int i = 0; i < 11; i++) { -// shell.setBounds(r1); -// r2 = shell.getBounds(); -// assert("parent shell iteration " + i + " set=" + r1 + " get=" + r2, r1.equals(r2)); -// r1.width += 100; -// r1.height += 100; -// } -// } -} - -public void test_setEnabledZ() { - warnUnimpl("Test test_setEnabledZ not written"); -} - -public void test_setImeInputModeI() { - warnUnimpl("Test test_setImeInputModeI not written"); -} - -public void test_setSizeII() { - /* windows */ - /* note that there is a minimum size for a shell, this test will fail if p1.x < 112 or p1.y < 27 */ - /* note that there is a maximum size for a shell, this test will fail if p1.x > 1292 or p1.y > 1036 */ - if (SwtJunit.isWindows) { - Point newSize = new Point(112, 27); - for (int i = 0; i < 10; i++) { - testShell.setSize(newSize.x, newSize.y); - assertEquals(newSize, testShell.getSize()); - newSize.x += 100; - newSize.y += 100; - } - newSize = new Point(1292, 1036); - for (int i = 0; i < 10; i++) { - testShell.setSize(newSize.x, newSize.y); - assertEquals(newSize, testShell.getSize()); - newSize.x -= 100; - newSize.y -= 100; - } - } - - /* motif */ - /* note that there is a minimum size for a shell, this test will fail if p1.x < ?? or p1.y < ?? */ - /* note that there is a maximum size for a shell, this test will fail if p1.x > ?? or p1.y > ?? */ - if (SwtJunit.isMotif) { - Point newSize = new Point(2, 2); - for (int i = 0; i < 10; i++) { - testShell.setSize(newSize.x, newSize.y); - assertEquals(newSize, testShell.getSize()); - newSize.x += 100; - newSize.y += 100; - } - newSize = new Point(1600, 1600); - for (int i = 0; i < 10; i++) { - testShell.setSize(newSize.x, newSize.y); - assertEquals(newSize, testShell.getSize()); - newSize.x -= 100; - newSize.y -= 100; - } - } -} - -public void test_setSizeLorg_eclipse_swt_graphics_Point() { - /* windows */ - /* note that there is a minimum size for a shell, this test will fail if p1.x < 112 or p1.y < 27 */ - /* note that there is a maximum size for a shell, this test will fail if p1.x > 1292 or p1.y > 1036 */ - if (SwtJunit.isWindows) { - Point newSize = new Point(112, 27); - for (int i = 0; i < 10; i++) { - testShell.setSize(newSize); - assertEquals(newSize, testShell.getSize()); - newSize.x += 100; - newSize.y += 100; - } - newSize = new Point(1292, 1036); - for (int i = 0; i < 10; i++) { - testShell.setSize(newSize); - assertEquals(newSize, testShell.getSize()); - newSize.x -= 100; - newSize.y -= 100; - } - } - - /* motif */ - /* note that there is a minimum size for a shell, this test will fail if p1.x < ?? or p1.y < ?? */ - /* note that there is a maximum size for a shell, this test will fail if p1.x > ?? or p1.y > ?? */ - if (SwtJunit.isMotif) { - Point newSize = new Point(2, 2); - for (int i = 0; i < 10; i++) { - testShell.setSize(newSize); - assertEquals(newSize, testShell.getSize()); - newSize.x += 100; - newSize.y += 100; - } - newSize = new Point(1600, 1600); - for (int i = 0; i < 10; i++) { - testShell.setSize(newSize); - assertEquals(newSize, testShell.getSize()); - newSize.x -= 100; - newSize.y -= 100; - } - } -} - -public void test_setVisibleZ() { - warnUnimpl("Test test_setVisibleZ not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Shell((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Display"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_DisplayI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI"); - methodNames.addElement("test_win32_newLorg_eclipse_swt_widgets_DisplayI"); - methodNames.addElement("test_addShellListenerLorg_eclipse_swt_events_ShellListener"); - methodNames.addElement("test_close"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getDisplay"); - methodNames.addElement("test_getEnabled"); - methodNames.addElement("test_getImeInputMode"); - methodNames.addElement("test_getLocation"); - methodNames.addElement("test_getShell"); - methodNames.addElement("test_getShells"); - methodNames.addElement("test_isEnabled"); - methodNames.addElement("test_open"); - methodNames.addElement("test_removeShellListenerLorg_eclipse_swt_events_ShellListener"); - methodNames.addElement("test_setEnabledZ"); - methodNames.addElement("test_setImeInputModeI"); - methodNames.addElement("test_setVisibleZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Decorations.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorI")) test_ConstructorI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Display")) test_ConstructorLorg_eclipse_swt_widgets_Display(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_DisplayI")) test_ConstructorLorg_eclipse_swt_widgets_DisplayI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI(); - else if (getName().equals("test_win32_newLorg_eclipse_swt_widgets_DisplayI")) test_win32_newLorg_eclipse_swt_widgets_DisplayI(); - else if (getName().equals("test_addShellListenerLorg_eclipse_swt_events_ShellListener")) test_addShellListenerLorg_eclipse_swt_events_ShellListener(); - else if (getName().equals("test_close")) test_close(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getDisplay")) test_getDisplay(); - else if (getName().equals("test_getEnabled")) test_getEnabled(); - else if (getName().equals("test_getImeInputMode")) test_getImeInputMode(); - else if (getName().equals("test_getLocation")) test_getLocation(); - else if (getName().equals("test_getShell")) test_getShell(); - else if (getName().equals("test_getShells")) test_getShells(); - else if (getName().equals("test_isEnabled")) test_isEnabled(); - else if (getName().equals("test_open")) test_open(); - else if (getName().equals("test_removeShellListenerLorg_eclipse_swt_events_ShellListener")) test_removeShellListenerLorg_eclipse_swt_events_ShellListener(); - else if (getName().equals("test_setEnabledZ")) test_setEnabledZ(); - else if (getName().equals("test_setImeInputModeI")) test_setImeInputModeI(); - else if (getName().equals("test_setVisibleZ")) test_setVisibleZ(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Slider.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Slider.java deleted file mode 100644 index b8a42105bf..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Slider.java +++ /dev/null @@ -1,843 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Slider - * - * @see org.eclipse.swt.widgets.Slider - */ -public class Test_org_eclipse_swt_widgets_Slider extends Test_org_eclipse_swt_widgets_Control { - -Slider slider; - -public Test_org_eclipse_swt_widgets_Slider(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- slider = new Slider(shell, 0);
- setWidget(slider);
-} - -protected void tearDown() { - super.tearDown(); -} - -// this method must be private or protected so the auto-gen tool keeps it
-private void report(String call, int set, int minExpected, int maxExpected, int selectionExpected, int thumbExpected) {
- // Uncomment these lines and comment out call to check() if you want the test to report all errors without
- // stopping.
-
- //if (slider.getMinimum() != minExpected)
- //System.out.println(call + "(" + set + "): Minimum Expected: " + minExpected + " Actual: " + slider.getMinimum());
- //if (slider.getMaximum() != maxExpected)
- //System.out.println(call + "(" + set + "): Maximum Expected: " + maxExpected + " Actual: " + slider.getMaximum());
- //if (slider.getSelection() != selectionExpected)
- //System.out.println(call + "(" + set + "): Selection Expected: " + selectionExpected + " Actual: " + slider.getSelection());
- //if (slider.getThumb() != thumbExpected)
- //System.out.println(call + "(" + set + "): Thumb Expected: " + thumbExpected + " Actual: " + slider.getThumb());
-
- check(call, set, minExpected, maxExpected, selectionExpected, thumbExpected);
-} -// this method must be private or protected so the auto-gen tool keeps it
-private void check(String call, int set, int minExpected, int maxExpected, int selectionExpected, int thumbExpected) {
- assertTrue(call + "(" + set + "): Maximum Expected: " + maxExpected + " Actual: " + slider.getMaximum(), slider.getMaximum() == maxExpected);
- assertTrue(call + "(" + set + "): Minimum Expected: " + minExpected + " Actual: " + slider.getMinimum(), slider.getMinimum() == minExpected);
- assertTrue(call + "(" + set + "): Selection Expected: " + selectionExpected + " Actual: " + slider.getSelection(), slider.getSelection() == selectionExpected);
- assertTrue(call + "(" + set + "): Thumb Expected: " + thumbExpected + " Actual: " + slider.getThumb(), slider.getThumb() == thumbExpected);
-} -// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetThumbValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 10, 100, 50, 10},
-{1, 10, 100, 50, 1},
-{2, 10, 100, 50, 2},
-{3, 10, 100, 50, 3},
-{4, 10, 100, 50, 4},
-{5, 10, 100, 50, 5},
-{6, 10, 100, 50, 6},
-{7, 10, 100, 50, 7},
-{8, 10, 100, 50, 8},
-{9, 10, 100, 50, 9},
-{10, 10, 100, 50, 10},
-{11, 10, 100, 50, 11},
-{12, 10, 100, 50, 12},
-{13, 10, 100, 50, 13},
-{14, 10, 100, 50, 14},
-{15, 10, 100, 50, 15},
-{16, 10, 100, 50, 16},
-{17, 10, 100, 50, 17},
-{18, 10, 100, 50, 18},
-{19, 10, 100, 50, 19},
-{20, 10, 100, 50, 20},
-{21, 10, 100, 50, 21},
-{22, 10, 100, 50, 22},
-{23, 10, 100, 50, 23},
-{24, 10, 100, 50, 24},
-{25, 10, 100, 50, 25},
-{26, 10, 100, 50, 26},
-{27, 10, 100, 50, 27},
-{28, 10, 100, 50, 28},
-{29, 10, 100, 50, 29},
-{30, 10, 100, 50, 30},
-{31, 10, 100, 50, 31},
-{32, 10, 100, 50, 32},
-{33, 10, 100, 50, 33},
-{34, 10, 100, 50, 34},
-{35, 10, 100, 50, 35},
-{36, 10, 100, 50, 36},
-{37, 10, 100, 50, 37},
-{38, 10, 100, 50, 38},
-{39, 10, 100, 50, 39},
-{40, 10, 100, 50, 40},
-{41, 10, 100, 50, 41},
-{42, 10, 100, 50, 42},
-{43, 10, 100, 50, 43},
-{44, 10, 100, 50, 44},
-{45, 10, 100, 50, 45},
-{46, 10, 100, 50, 46},
-{47, 10, 100, 50, 47},
-{48, 10, 100, 50, 48},
-{49, 10, 100, 50, 49},
-{50, 10, 100, 50, 50},
-{51, 10, 100, 49, 51},
-{52, 10, 100, 48, 52},
-{53, 10, 100, 47, 53},
-{54, 10, 100, 46, 54},
-{55, 10, 100, 45, 55},
-{56, 10, 100, 44, 56},
-{57, 10, 100, 43, 57},
-{58, 10, 100, 42, 58},
-{59, 10, 100, 41, 59},
-{60, 10, 100, 40, 60},
-{61, 10, 100, 39, 61},
-{62, 10, 100, 38, 62},
-{63, 10, 100, 37, 63},
-{64, 10, 100, 36, 64},
-{65, 10, 100, 35, 65},
-{66, 10, 100, 34, 66},
-{67, 10, 100, 33, 67},
-{68, 10, 100, 32, 68},
-{69, 10, 100, 31, 69},
-{70, 10, 100, 30, 70},
-{71, 10, 100, 29, 71},
-{72, 10, 100, 28, 72},
-{73, 10, 100, 27, 73},
-{74, 10, 100, 26, 74},
-{75, 10, 100, 25, 75},
-{76, 10, 100, 24, 76},
-{77, 10, 100, 23, 77},
-{78, 10, 100, 22, 78},
-{79, 10, 100, 21, 79},
-{80, 10, 100, 20, 80},
-{81, 10, 100, 19, 81},
-{82, 10, 100, 18, 82},
-{83, 10, 100, 17, 83},
-{84, 10, 100, 16, 84},
-{85, 10, 100, 15, 85},
-{86, 10, 100, 14, 86},
-{87, 10, 100, 13, 87},
-{88, 10, 100, 12, 88},
-{89, 10, 100, 11, 89},
-{90, 10, 100, 10, 90},
-{91, 10, 100, 50, 10},
-{92, 10, 100, 50, 10},
-{93, 10, 100, 50, 10},
-{94, 10, 100, 50, 10},
-{95, 10, 100, 50, 10},
-{96, 10, 100, 50, 10},
-{97, 10, 100, 50, 10},
-{98, 10, 100, 50, 10},
-{99, 10, 100, 50, 10},
-{100, 10, 100, 50, 10},
-{101, 10, 100, 50, 10},
-{102, 10, 100, 50, 10},
-{103, 10, 100, 50, 10},
-{104, 10, 100, 50, 10},
-{105, 10, 100, 50, 10},
-{106, 10, 100, 50, 10},
-{107, 10, 100, 50, 10},
-{108, 10, 100, 50, 10},
-{109, 10, 100, 50, 10},
-{110, 10, 100, 50, 10},
-{111, 10, 100, 50, 10},
-{112, 10, 100, 50, 10},
-{113, 10, 100, 50, 10},
-{114, 10, 100, 50, 10},
-{115, 10, 100, 50, 10},
-{116, 10, 100, 50, 10},
-{117, 10, 100, 50, 10},
-{118, 10, 100, 50, 10},
-{119, 10, 100, 50, 10},
-{120, 10, 100, 50, 10},
-{121, 10, 100, 50, 10},
-{122, 10, 100, 50, 10},
-{123, 10, 100, 50, 10},
-{124, 10, 100, 50, 10},
-};
-} -// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMinimumValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 0, 100, 50, 10},
-{1, 1, 100, 50, 10},
-{2, 2, 100, 50, 10},
-{3, 3, 100, 50, 10},
-{4, 4, 100, 50, 10},
-{5, 5, 100, 50, 10},
-{6, 6, 100, 50, 10},
-{7, 7, 100, 50, 10},
-{8, 8, 100, 50, 10},
-{9, 9, 100, 50, 10},
-{10, 10, 100, 50, 10},
-{11, 11, 100, 50, 10},
-{12, 12, 100, 50, 10},
-{13, 13, 100, 50, 10},
-{14, 14, 100, 50, 10},
-{15, 15, 100, 50, 10},
-{16, 16, 100, 50, 10},
-{17, 17, 100, 50, 10},
-{18, 18, 100, 50, 10},
-{19, 19, 100, 50, 10},
-{20, 20, 100, 50, 10},
-{21, 21, 100, 50, 10},
-{22, 22, 100, 50, 10},
-{23, 23, 100, 50, 10},
-{24, 24, 100, 50, 10},
-{25, 25, 100, 50, 10},
-{26, 26, 100, 50, 10},
-{27, 27, 100, 50, 10},
-{28, 28, 100, 50, 10},
-{29, 29, 100, 50, 10},
-{30, 30, 100, 50, 10},
-{31, 31, 100, 50, 10},
-{32, 32, 100, 50, 10},
-{33, 33, 100, 50, 10},
-{34, 34, 100, 50, 10},
-{35, 35, 100, 50, 10},
-{36, 36, 100, 50, 10},
-{37, 37, 100, 50, 10},
-{38, 38, 100, 50, 10},
-{39, 39, 100, 50, 10},
-{40, 40, 100, 50, 10},
-{41, 41, 100, 50, 10},
-{42, 42, 100, 50, 10},
-{43, 43, 100, 50, 10},
-{44, 44, 100, 50, 10},
-{45, 45, 100, 50, 10},
-{46, 46, 100, 50, 10},
-{47, 47, 100, 50, 10},
-{48, 48, 100, 50, 10},
-{49, 49, 100, 50, 10},
-{50, 50, 100, 50, 10},
-{51, 51, 100, 51, 10},
-{52, 52, 100, 52, 10},
-{53, 53, 100, 53, 10},
-{54, 54, 100, 54, 10},
-{55, 55, 100, 55, 10},
-{56, 56, 100, 56, 10},
-{57, 57, 100, 57, 10},
-{58, 58, 100, 58, 10},
-{59, 59, 100, 59, 10},
-{60, 60, 100, 60, 10},
-{61, 61, 100, 61, 10},
-{62, 62, 100, 62, 10},
-{63, 63, 100, 63, 10},
-{64, 64, 100, 64, 10},
-{65, 65, 100, 65, 10},
-{66, 66, 100, 66, 10},
-{67, 67, 100, 67, 10},
-{68, 68, 100, 68, 10},
-{69, 69, 100, 69, 10},
-{70, 70, 100, 70, 10},
-{71, 71, 100, 71, 10},
-{72, 72, 100, 72, 10},
-{73, 73, 100, 73, 10},
-{74, 74, 100, 74, 10},
-{75, 75, 100, 75, 10},
-{76, 76, 100, 76, 10},
-{77, 77, 100, 77, 10},
-{78, 78, 100, 78, 10},
-{79, 79, 100, 79, 10},
-{80, 80, 100, 80, 10},
-{81, 81, 100, 81, 10},
-{82, 82, 100, 82, 10},
-{83, 83, 100, 83, 10},
-{84, 84, 100, 84, 10},
-{85, 85, 100, 85, 10},
-{86, 86, 100, 86, 10},
-{87, 87, 100, 87, 10},
-{88, 88, 100, 88, 10},
-{89, 89, 100, 89, 10},
-{90, 90, 100, 90, 10},
-{91, 91, 100, 91, 9},
-{92, 92, 100, 92, 8},
-{93, 93, 100, 93, 7},
-{94, 94, 100, 94, 6},
-{95, 95, 100, 95, 5},
-{96, 96, 100, 96, 4},
-{97, 97, 100, 97, 3},
-{98, 98, 100, 98, 2},
-{99, 99, 100, 99, 1},
-{100, 10, 100, 50, 10},
-{101, 10, 100, 50, 10},
-{102, 10, 100, 50, 10},
-{103, 10, 100, 50, 10},
-{104, 10, 100, 50, 10},
-{105, 10, 100, 50, 10},
-{106, 10, 100, 50, 10},
-{107, 10, 100, 50, 10},
-{108, 10, 100, 50, 10},
-{109, 10, 100, 50, 10},
-{110, 10, 100, 50, 10},
-{111, 10, 100, 50, 10},
-{112, 10, 100, 50, 10},
-{113, 10, 100, 50, 10},
-{114, 10, 100, 50, 10},
-{115, 10, 100, 50, 10},
-{116, 10, 100, 50, 10},
-{117, 10, 100, 50, 10},
-{118, 10, 100, 50, 10},
-{119, 10, 100, 50, 10},
-{120, 10, 100, 50, 10},
-{121, 10, 100, 50, 10},
-{122, 10, 100, 50, 10},
-{123, 10, 100, 50, 10},
-{124, 10, 100, 50, 10},
-};
-} -// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMaximumValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 10, 100, 50, 10},
-{1, 10, 100, 50, 10},
-{2, 10, 100, 50, 10},
-{3, 10, 100, 50, 10},
-{4, 10, 100, 50, 10},
-{5, 10, 100, 50, 10},
-{6, 10, 100, 50, 10},
-{7, 10, 100, 50, 10},
-{8, 10, 100, 50, 10},
-{9, 10, 100, 50, 10},
-{10, 10, 100, 50, 10},
-{11, 10, 11, 10, 1},
-{12, 10, 12, 10, 2},
-{13, 10, 13, 10, 3},
-{14, 10, 14, 10, 4},
-{15, 10, 15, 10, 5},
-{16, 10, 16, 10, 6},
-{17, 10, 17, 10, 7},
-{18, 10, 18, 10, 8},
-{19, 10, 19, 10, 9},
-{20, 10, 20, 10, 10},
-{21, 10, 21, 11, 10},
-{22, 10, 22, 12, 10},
-{23, 10, 23, 13, 10},
-{24, 10, 24, 14, 10},
-{25, 10, 25, 15, 10},
-{26, 10, 26, 16, 10},
-{27, 10, 27, 17, 10},
-{28, 10, 28, 18, 10},
-{29, 10, 29, 19, 10},
-{30, 10, 30, 20, 10},
-{31, 10, 31, 21, 10},
-{32, 10, 32, 22, 10},
-{33, 10, 33, 23, 10},
-{34, 10, 34, 24, 10},
-{35, 10, 35, 25, 10},
-{36, 10, 36, 26, 10},
-{37, 10, 37, 27, 10},
-{38, 10, 38, 28, 10},
-{39, 10, 39, 29, 10},
-{40, 10, 40, 30, 10},
-{41, 10, 41, 31, 10},
-{42, 10, 42, 32, 10},
-{43, 10, 43, 33, 10},
-{44, 10, 44, 34, 10},
-{45, 10, 45, 35, 10},
-{46, 10, 46, 36, 10},
-{47, 10, 47, 37, 10},
-{48, 10, 48, 38, 10},
-{49, 10, 49, 39, 10},
-{50, 10, 50, 40, 10},
-{51, 10, 51, 41, 10},
-{52, 10, 52, 42, 10},
-{53, 10, 53, 43, 10},
-{54, 10, 54, 44, 10},
-{55, 10, 55, 45, 10},
-{56, 10, 56, 46, 10},
-{57, 10, 57, 47, 10},
-{58, 10, 58, 48, 10},
-{59, 10, 59, 49, 10},
-{60, 10, 60, 50, 10},
-{61, 10, 61, 50, 10},
-{62, 10, 62, 50, 10},
-{63, 10, 63, 50, 10},
-{64, 10, 64, 50, 10},
-{65, 10, 65, 50, 10},
-{66, 10, 66, 50, 10},
-{67, 10, 67, 50, 10},
-{68, 10, 68, 50, 10},
-{69, 10, 69, 50, 10},
-{70, 10, 70, 50, 10},
-{71, 10, 71, 50, 10},
-{72, 10, 72, 50, 10},
-{73, 10, 73, 50, 10},
-{74, 10, 74, 50, 10},
-{75, 10, 75, 50, 10},
-{76, 10, 76, 50, 10},
-{77, 10, 77, 50, 10},
-{78, 10, 78, 50, 10},
-{79, 10, 79, 50, 10},
-{80, 10, 80, 50, 10},
-{81, 10, 81, 50, 10},
-{82, 10, 82, 50, 10},
-{83, 10, 83, 50, 10},
-{84, 10, 84, 50, 10},
-{85, 10, 85, 50, 10},
-{86, 10, 86, 50, 10},
-{87, 10, 87, 50, 10},
-{88, 10, 88, 50, 10},
-{89, 10, 89, 50, 10},
-{90, 10, 90, 50, 10},
-{91, 10, 91, 50, 10},
-{92, 10, 92, 50, 10},
-{93, 10, 93, 50, 10},
-{94, 10, 94, 50, 10},
-{95, 10, 95, 50, 10},
-{96, 10, 96, 50, 10},
-{97, 10, 97, 50, 10},
-{98, 10, 98, 50, 10},
-{99, 10, 99, 50, 10},
-{100, 10, 100, 50, 10},
-{101, 10, 101, 50, 10},
-{102, 10, 102, 50, 10},
-{103, 10, 103, 50, 10},
-{104, 10, 104, 50, 10},
-{105, 10, 105, 50, 10},
-{106, 10, 106, 50, 10},
-{107, 10, 107, 50, 10},
-{108, 10, 108, 50, 10},
-{109, 10, 109, 50, 10},
-{110, 10, 110, 50, 10},
-{111, 10, 111, 50, 10},
-{112, 10, 112, 50, 10},
-{113, 10, 113, 50, 10},
-{114, 10, 114, 50, 10},
-{115, 10, 115, 50, 10},
-{116, 10, 116, 50, 10},
-{117, 10, 117, 50, 10},
-{118, 10, 118, 50, 10},
-{119, 10, 119, 50, 10},
-{120, 10, 120, 50, 10},
-{121, 10, 121, 50, 10},
-{122, 10, 122, 50, 10},
-{123, 10, 123, 50, 10},
-{124, 10, 124, 50, 10},
-};
-} -// this method must be private or protected so the auto-gen tool keeps it
-private void setDefaults() {
-
- slider.setMaximum(100);
- slider.setMinimum(10);
- slider.setThumb(10);
- slider.setSelection(50);
-
-} -// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetSelectionValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 10, 100, 10, 10},
-{1, 10, 100, 10, 10},
-{2, 10, 100, 10, 10},
-{3, 10, 100, 10, 10},
-{4, 10, 100, 10, 10},
-{5, 10, 100, 10, 10},
-{6, 10, 100, 10, 10},
-{7, 10, 100, 10, 10},
-{8, 10, 100, 10, 10},
-{9, 10, 100, 10, 10},
-{10, 10, 100, 10, 10},
-{11, 10, 100, 11, 10},
-{12, 10, 100, 12, 10},
-{13, 10, 100, 13, 10},
-{14, 10, 100, 14, 10},
-{15, 10, 100, 15, 10},
-{16, 10, 100, 16, 10},
-{17, 10, 100, 17, 10},
-{18, 10, 100, 18, 10},
-{19, 10, 100, 19, 10},
-{20, 10, 100, 20, 10},
-{21, 10, 100, 21, 10},
-{22, 10, 100, 22, 10},
-{23, 10, 100, 23, 10},
-{24, 10, 100, 24, 10},
-{25, 10, 100, 25, 10},
-{26, 10, 100, 26, 10},
-{27, 10, 100, 27, 10},
-{28, 10, 100, 28, 10},
-{29, 10, 100, 29, 10},
-{30, 10, 100, 30, 10},
-{31, 10, 100, 31, 10},
-{32, 10, 100, 32, 10},
-{33, 10, 100, 33, 10},
-{34, 10, 100, 34, 10},
-{35, 10, 100, 35, 10},
-{36, 10, 100, 36, 10},
-{37, 10, 100, 37, 10},
-{38, 10, 100, 38, 10},
-{39, 10, 100, 39, 10},
-{40, 10, 100, 40, 10},
-{41, 10, 100, 41, 10},
-{42, 10, 100, 42, 10},
-{43, 10, 100, 43, 10},
-{44, 10, 100, 44, 10},
-{45, 10, 100, 45, 10},
-{46, 10, 100, 46, 10},
-{47, 10, 100, 47, 10},
-{48, 10, 100, 48, 10},
-{49, 10, 100, 49, 10},
-{50, 10, 100, 50, 10},
-{51, 10, 100, 51, 10},
-{52, 10, 100, 52, 10},
-{53, 10, 100, 53, 10},
-{54, 10, 100, 54, 10},
-{55, 10, 100, 55, 10},
-{56, 10, 100, 56, 10},
-{57, 10, 100, 57, 10},
-{58, 10, 100, 58, 10},
-{59, 10, 100, 59, 10},
-{60, 10, 100, 60, 10},
-{61, 10, 100, 61, 10},
-{62, 10, 100, 62, 10},
-{63, 10, 100, 63, 10},
-{64, 10, 100, 64, 10},
-{65, 10, 100, 65, 10},
-{66, 10, 100, 66, 10},
-{67, 10, 100, 67, 10},
-{68, 10, 100, 68, 10},
-{69, 10, 100, 69, 10},
-{70, 10, 100, 70, 10},
-{71, 10, 100, 71, 10},
-{72, 10, 100, 72, 10},
-{73, 10, 100, 73, 10},
-{74, 10, 100, 74, 10},
-{75, 10, 100, 75, 10},
-{76, 10, 100, 76, 10},
-{77, 10, 100, 77, 10},
-{78, 10, 100, 78, 10},
-{79, 10, 100, 79, 10},
-{80, 10, 100, 80, 10},
-{81, 10, 100, 81, 10},
-{82, 10, 100, 82, 10},
-{83, 10, 100, 83, 10},
-{84, 10, 100, 84, 10},
-{85, 10, 100, 85, 10},
-{86, 10, 100, 86, 10},
-{87, 10, 100, 87, 10},
-{88, 10, 100, 88, 10},
-{89, 10, 100, 89, 10},
-{90, 10, 100, 90, 10},
-{91, 10, 100, 90, 10},
-{92, 10, 100, 90, 10},
-{93, 10, 100, 90, 10},
-{94, 10, 100, 90, 10},
-{95, 10, 100, 90, 10},
-{96, 10, 100, 90, 10},
-{97, 10, 100, 90, 10},
-{98, 10, 100, 90, 10},
-{99, 10, 100, 90, 10},
-{100, 10, 100, 90, 10},
-{101, 10, 100, 90, 10},
-{102, 10, 100, 90, 10},
-{103, 10, 100, 90, 10},
-{104, 10, 100, 90, 10},
-{105, 10, 100, 90, 10},
-{106, 10, 100, 90, 10},
-{107, 10, 100, 90, 10},
-{108, 10, 100, 90, 10},
-{109, 10, 100, 90, 10},
-{110, 10, 100, 90, 10},
-{111, 10, 100, 90, 10},
-{112, 10, 100, 90, 10},
-{113, 10, 100, 90, 10},
-{114, 10, 100, 90, 10},
-{115, 10, 100, 90, 10},
-{116, 10, 100, 90, 10},
-{117, 10, 100, 90, 10},
-{118, 10, 100, 90, 10},
-{119, 10, 100, 90, 10},
-{120, 10, 100, 90, 10},
-{121, 10, 100, 90, 10},
-{122, 10, 100, 90, 10},
-{123, 10, 100, 90, 10},
-{124, 10, 100, 90, 10},
-};
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- try {
- slider = new Slider(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {0, SWT.HORIZONTAL, SWT.VERTICAL};
- for (int i = 0; i < cases.length; i++)
- slider = new Slider(shell, cases[i]);
-} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_getEnabled() { - warnUnimpl("Test test_getEnabled not written"); -} - -public void test_getIncrement(){
- int[] cases = {1, 10, 10000};
- for (int i=0; i<cases.length; i++)
- {
- slider.setIncrement(cases[i]);
- assertTrue("case: " + String.valueOf(i), slider.getIncrement()==cases[i]);
- }
-} - -public void test_getMaximum() { - warnUnimpl("Test test_getMaximum not written"); -} - -public void test_getMinimum() { - warnUnimpl("Test test_getMinimum not written"); -} - -public void test_getPageIncrement(){
- int[] cases = {1, 10, 10000};
- for (int i=0; i<cases.length; i++)
- {
- slider.setPageIncrement(cases[i]);
- assertTrue("case: " + String.valueOf(i), slider.getPageIncrement()==cases[i]);
- }
-} - -public void test_getSelection() { - warnUnimpl("Test test_getSelection not written"); -} - -public void test_getThumb() { - warnUnimpl("Test test_getThumb not written"); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_setEnabledZ() { - warnUnimpl("Test test_setEnabledZ not written"); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - // overridden from Control because it does not make sense - // to set the font of a Slider. -} - -public void test_setIncrementI() { - warnUnimpl("Test test_setIncrementI not written"); -} - -public void test_setMaximumI(){
-
- int [][] testValues = getSetMaximumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- slider.setMaximum(intArray[0]);
- report("setMaximum", intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]);
- }
-} - -public void test_setMinimumI(){
-
- int [][] testValues = getSetMinimumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- slider.setMinimum(intArray[0]);
- report("setMinimum", intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]);
- }
-} - -public void test_setPageIncrementI() { - warnUnimpl("Test test_setPageIncrementI not written"); -} - -public void test_setSelectionI(){
-
- int [][] testValues = getSetSelectionValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- slider.setSelection(intArray[0]);
- report("setSelection", intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]);
- }
-} - -public void test_setThumbI(){
-
- int [][] testValues = getSetThumbValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- slider.setThumb(intArray[0]);
- report("setThumb", intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]);
- }
-} - -public void test_setValuesIIIIII() { - warnUnimpl("Test test_setValuesIIIIII not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Slider((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_getEnabled"); - methodNames.addElement("test_getIncrement"); - methodNames.addElement("test_getMaximum"); - methodNames.addElement("test_getMinimum"); - methodNames.addElement("test_getPageIncrement"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getThumb"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_setEnabledZ"); - methodNames.addElement("test_setIncrementI"); - methodNames.addElement("test_setMaximumI"); - methodNames.addElement("test_setMinimumI"); - methodNames.addElement("test_setPageIncrementI"); - methodNames.addElement("test_setSelectionI"); - methodNames.addElement("test_setThumbI"); - methodNames.addElement("test_setValuesIIIIII"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_getEnabled")) test_getEnabled(); - else if (getName().equals("test_getIncrement")) test_getIncrement(); - else if (getName().equals("test_getMaximum")) test_getMaximum(); - else if (getName().equals("test_getMinimum")) test_getMinimum(); - else if (getName().equals("test_getPageIncrement")) test_getPageIncrement(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getThumb")) test_getThumb(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_setEnabledZ")) test_setEnabledZ(); - else if (getName().equals("test_setIncrementI")) test_setIncrementI(); - else if (getName().equals("test_setMaximumI")) test_setMaximumI(); - else if (getName().equals("test_setMinimumI")) test_setMinimumI(); - else if (getName().equals("test_setPageIncrementI")) test_setPageIncrementI(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else if (getName().equals("test_setThumbI")) test_setThumbI(); - else if (getName().equals("test_setValuesIIIIII")) test_setValuesIIIIII(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Synchronizer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Synchronizer.java deleted file mode 100644 index 4d71ba88e7..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Synchronizer.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.widgets.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Synchronizer - * - * @see org.eclipse.swt.widgets.Synchronizer - */ -public class Test_org_eclipse_swt_widgets_Synchronizer extends SwtTestCase { - -public Test_org_eclipse_swt_widgets_Synchronizer(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Display() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Display not written"); -} - -public void test_asyncExecLjava_lang_Runnable() { - warnUnimpl("Test test_asyncExecLjava_lang_Runnable not written"); -} - -public void test_syncExecLjava_lang_Runnable() { - warnUnimpl("Test test_syncExecLjava_lang_Runnable not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Synchronizer((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Display"); - methodNames.addElement("test_asyncExecLjava_lang_Runnable"); - methodNames.addElement("test_syncExecLjava_lang_Runnable"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Display")) test_ConstructorLorg_eclipse_swt_widgets_Display(); - else if (getName().equals("test_asyncExecLjava_lang_Runnable")) test_asyncExecLjava_lang_Runnable(); - else if (getName().equals("test_syncExecLjava_lang_Runnable")) test_syncExecLjava_lang_Runnable(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabFolder.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabFolder.java deleted file mode 100644 index 1de80e1a33..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabFolder.java +++ /dev/null @@ -1,406 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.TabFolder - * - * @see org.eclipse.swt.widgets.TabFolder - */ -public class Test_org_eclipse_swt_widgets_TabFolder extends Test_org_eclipse_swt_widgets_Composite { - -protected TabFolder tabFolder; - -public Test_org_eclipse_swt_widgets_TabFolder(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- makeCleanEnvironment();
-} - -protected void tearDown() { - super.tearDown(); -} - -/**
- * (Re)initializes tabFolder. This is called from setUp before each test
- * method is invoked, but also inside the test methods themselves to
- * re-initialize the environment for a fresh test.
- *
- * Basically a shim for coalescing the old test methods (several test
- * methods testing the same target method) into a single test method for
- * every target method. This way the original tests should work with little
- * modification, as long as this method is called before each test.
- *
- * Caveat: the Widget TestCase defines the tearDown method, which asserts that
- * the main widget (defined by the last call to setWidget) has been disposed.
- * So using this inside test methods means that only the widget created by
- * the last call to this method will be tested for this.
- */
-private void makeCleanEnvironment() {
-// this method must be private or protected so the auto-gen tool keeps it
- tabFolder = new TabFolder(shell, 0);
- setWidget(tabFolder);
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- TabFolder newTabFolder;
- try {
- newTabFolder = new TabFolder(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_checkSubclass() { - warnUnimpl("Test test_checkSubclass not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_computeTrimIIII() { - warnUnimpl("Test test_computeTrimIIII not written"); -} - -public void test_getClientArea() { - warnUnimpl("Test test_getClientArea not written"); -} - -public void test_getItemI(){
- int number = 15;
- TabItem[] items = new TabItem[number];
- for (int i = 0; i < number; i++) {
- items[i] = new TabItem(tabFolder, 0);
- }
-
- for (int i = 0; i < number; i++) {
- assertTrue(":a:" +String.valueOf(i), tabFolder.getItem(i).equals(items[i]));
- }
- try {
- tabFolder.getItem(number);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- tabFolder.getItem(number+1);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- tabFolder.getItem(-1);
- fail("No exception thrown for index == -1");
- }
- catch (IllegalArgumentException e) {
- }
-} - -public void test_getItemCount() {
- int number = 10;
- TabItem ti;
- for (int i = 0; i<number ; i++){
- assertTrue(":a:" + i, tabFolder.getItemCount()==i);
- ti = new TabItem(tabFolder, 0);
- }
-} - -public void test_getItems() {
- int number = 5;
- TabItem[] items = new TabItem[number];
-
- assertEquals(0, tabFolder.getItems().length);
-
- for (int i = 0; i<number ; i++){
- items[i] = new TabItem(tabFolder, 0);
- }
- assertEquals(items, tabFolder.getItems());
-
- tabFolder.getItems()[0].dispose();
- assertEquals(new TabItem[]{items[1], items[2], items[3], items[4]}, tabFolder.getItems());
-
- tabFolder.getItems()[3].dispose();
- assertEquals(new TabItem[]{items[1], items[2], items[3]}, tabFolder.getItems());
-
- tabFolder.getItems()[1].dispose();
- assertEquals(new TabItem[]{items[1], items[3]}, tabFolder.getItems());
-} - -public void test_getSelection() {
- int number = 10;
- TabItem[] tis = new TabItem[number];
- for (int i = 0; i<number ; i++){
- tis[i] = new TabItem(tabFolder, 0);
- }
- assertTrue(":a:", tabFolder.getSelection()[0] == tis[0]);
- for (int i = 0; i<number ; i++){
- tabFolder.setSelection(i);
- assertTrue(":b:" + i, tabFolder.getSelection()[0]==tis[i]);
- }
-} - -public void test_getSelectionIndex() {
- int number = 15;
- TabItem[] items = new TabItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TabItem(tabFolder, 0);
-
- assertTrue(":a:", tabFolder.getSelectionIndex()==0);
-
- tabFolder.setSelection(new TabItem[]{items[2], items[number-1], items[10]});
- assertTrue(":b:", tabFolder.getSelectionIndex()==2);
-
- tabFolder.setSelection(items);
- assertTrue(":c:", tabFolder.getSelectionIndex()==0);
-} - -public void test_indexOfLorg_eclipse_swt_widgets_TabItem(){
- int number = 10;
- TabItem[] tis = new TabItem[number];
- for (int i = 0; i<number ; i++){
- tis[i] = new TabItem(tabFolder, 0);
- }
- for (int i = 0; i<number ; i++){
- assertTrue(":a:" + i, tabFolder.indexOf(tis[i])==i);
- }
-
- //
- makeCleanEnvironment();
-
- for (int i = 0; i<number ; i++){
- tis[i] = new TabItem(tabFolder, 0);
- }
- for (int i = 0; i<number ; i++){
- try {
- tabFolder.indexOf(null);
- fail("No exception thrown for tabItem == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-
- //
- makeCleanEnvironment();
- number = 20;
- TabItem[] items = new TabItem[number];
-
- for (int i = 0; i < number; i++) {
- items[i] = new TabItem(tabFolder, 0);
- items[i].setText(String.valueOf(i));
- }
-
- //another tabFolder
- TabFolder tabFolder_2 = new TabFolder(shell, 0);
- TabItem[] items_2 = new TabItem[number];
- for (int i = 0; i < number; i++) {
- items_2[i] = new TabItem(tabFolder_2, 0);
- items_2[i].setText(String.valueOf(i));
- }
-
- for (int i = 0; i < number; i++) {
- assertTrue(":a:" + String.valueOf(i), tabFolder.indexOf(items_2[i])==-1);
- }
-
- //
- TabFolder tabFolder2 = new TabFolder(shell, SWT.NULL);
- TabItem tabItem = new TabItem(tabFolder2, SWT.NULL);
-
- assertTrue(":a:", tabFolder.indexOf(tabItem) == -1);
-} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_setSelection$Lorg_eclipse_swt_widgets_TabItem() { - warnUnimpl("Test test_setSelection$Lorg_eclipse_swt_widgets_TabItem not written"); -} - -public void test_setSelectionI(){
- int number = 10;
- TabItem ti;
- for (int i = 0; i<number ; i++){
- ti = new TabItem(tabFolder, 0);
- }
- for (int i = 0; i<number ; i++){
- tabFolder.setSelection(i);
- assertEquals(i, tabFolder.getSelectionIndex());
- }
-
- //
- makeCleanEnvironment();
-
- for (int i = 0; i<number ; i++){
- ti = new TabItem(tabFolder, 0);
- assertEquals("i=" + i, 0, tabFolder.getSelectionIndex());
- }
-
- //
- makeCleanEnvironment();
-
- number = 5;
- TabItem[] items = new TabItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TabItem(tabFolder, 0);
- try {
- tabFolder.setSelection((TabItem[]) null);
- fail("No exception thrown for selection == null");
- }
- catch (IllegalArgumentException e) {
- }
- finally {
- assertEquals(new TabItem[]{items[0]}, tabFolder.getSelection());
- }
-
- //
- makeCleanEnvironment();
-
- items = new TabItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TabItem(tabFolder, 0);
-
- tabFolder.setSelection(0);
- assertEquals(new TabItem[]{items[0]}, tabFolder.getSelection());
-
- tabFolder.setSelection(4);
- assertEquals(new TabItem[]{items[4]}, tabFolder.getSelection());
-
- tabFolder.setSelection(2);
- assertEquals(new TabItem[]{items[2]}, tabFolder.getSelection());
-
- tabFolder.setSelection(1);
- assertEquals(new TabItem[]{items[1]}, tabFolder.getSelection());
-
- tabFolder.setSelection(number + 1);
- assertEquals(new TabItem[]{items[1]}, tabFolder.getSelection());
-
- tabFolder.setSelection(-1);
- assertEquals(0, tabFolder.getSelection().length);
-
- tabFolder.setSelection(3);
- assertEquals(new TabItem[]{items[3]}, tabFolder.getSelection());
-
- tabFolder.setSelection(-2);
- assertEquals(0, tabFolder.getSelection().length);
-
- //
- makeCleanEnvironment();
-
- for (int i = 0; i < number; i++)
- items[i] = new TabItem(tabFolder, 0);
-
- tabFolder.setSelection(new TabItem[]{});
- assertEquals(new TabItem[]{}, tabFolder.getSelection());
-
- tabFolder.setSelection(new TabItem[] {items[0]});
- assertEquals(new TabItem[] {items[0]}, tabFolder.getSelection());
-
- tabFolder.setSelection(new TabItem[] {items[3]});
- assertEquals(new TabItem[] {items[3]}, tabFolder.getSelection());
-
- tabFolder.setSelection(new TabItem[] {items[4]});
- assertEquals(new TabItem[] {items[4]}, tabFolder.getSelection());
-
- tabFolder.setSelection(new TabItem[] {items[2]});
- assertEquals(new TabItem[] {items[2]}, tabFolder.getSelection());
-
- tabFolder.setSelection(new TabItem[] {items[1]});
- assertEquals(new TabItem[] {items[1]}, tabFolder.getSelection());
-
- //
- makeCleanEnvironment();
-
- for (int i = 0; i < number; i++)
- items[i] = new TabItem(tabFolder, 0);
- try {
- tabFolder.setSelection( new TabItem[]{items[0], null});
- tabFolder.setSelection( new TabItem[]{null});
- fail("No exception thrown for selection == null");
- }
- catch (IllegalArgumentException e) {
- }
- finally {
- assertEquals(new TabItem[]{items[0]}, tabFolder.getSelection());
- }
-} - -public void test_setSelectionIZ() { - warnUnimpl("Test test_setSelectionIZ not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_TabFolder((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_checkSubclass"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_computeTrimIIII"); - methodNames.addElement("test_getClientArea"); - methodNames.addElement("test_getItemI"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionIndex"); - methodNames.addElement("test_indexOfLorg_eclipse_swt_widgets_TabItem"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_setSelection$Lorg_eclipse_swt_widgets_TabItem"); - methodNames.addElement("test_setSelectionI"); - methodNames.addElement("test_setSelectionIZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_checkSubclass")) test_checkSubclass(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII(); - else if (getName().equals("test_getClientArea")) test_getClientArea(); - else if (getName().equals("test_getItemI")) test_getItemI(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionIndex")) test_getSelectionIndex(); - else if (getName().equals("test_indexOfLorg_eclipse_swt_widgets_TabItem")) test_indexOfLorg_eclipse_swt_widgets_TabItem(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_setSelection$Lorg_eclipse_swt_widgets_TabItem")) test_setSelection$Lorg_eclipse_swt_widgets_TabItem(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else if (getName().equals("test_setSelectionIZ")) test_setSelectionIZ(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabItem.java deleted file mode 100644 index 7cfa0f6b9f..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabItem.java +++ /dev/null @@ -1,187 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.TabItem - * - * @see org.eclipse.swt.widgets.TabItem - */ -public class Test_org_eclipse_swt_widgets_TabItem extends Test_org_eclipse_swt_widgets_Item { - -TabFolder tabFolder; -TabItem tabItem; - -public Test_org_eclipse_swt_widgets_TabItem(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- tabFolder = new TabFolder(shell, 0);
- tabItem = new TabItem(tabFolder, 0);
- setWidget(tabItem);
-} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_TabFolderI(){
- if (fCheckSwtNullExceptions) {
- try {
- TabItem tItem = new TabItem(null, SWT.NULL);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_TabFolderII(){
- TabItem tItem = new TabItem(tabFolder, SWT.NULL, 0);
-
- assertTrue(":a:", tabFolder.getItems()[0] == tItem);
-
- tItem = new TabItem(tabFolder, SWT.NULL, 1);
- assertTrue(":b:", tabFolder.getItems()[1] == tItem);
-
- tItem = new TabItem(tabFolder, SWT.NULL, 1);
- assertTrue(":c:", tabFolder.getItems()[1] == tItem);
-
- if (fCheckOutOfRangeBehaviour) {
- try {
- new TabItem(tabFolder, SWT.NULL, -1);
- fail("No exception thrown");
- }
- catch (IllegalArgumentException e) {
- }
- finally {
- assertTrue(":d:", tabFolder.getItems()[1] == tItem);
- }
- }
- if (fCheckOutOfRangeBehaviour) {
- try {
- new TabItem(tabFolder, SWT.NULL, tabFolder.getItemCount() + 1);
- fail("No exception thrown");
- }
- catch (IllegalArgumentException e) {
- }
- finally {
- assertTrue(":e:", tabFolder.getItems()[1] == tItem);
- }
- }
- if (fCheckSwtNullExceptions) {
- try {
- new TabItem(null, SWT.NULL, 0);
- fail("No exception thrown");
- }
- catch (IllegalArgumentException e) {
- }
- }
-} - -public void test_checkSubclass() { - warnUnimpl("Test test_checkSubclass not written"); -} - -public void test_getControl() { - warnUnimpl("Test test_getControl not written"); -} - -public void test_getDisplay() {
- assertTrue(tabItem.getDisplay() == tabFolder.getDisplay());
-} - -public void test_getParent() {
- assertTrue(":a: ", tabItem.getParent() == tabFolder);
-} - -public void test_getToolTipText() { - warnUnimpl("Test test_getToolTipText not written"); -} - -public void test_setControlLorg_eclipse_swt_widgets_Control(){
- Control control = new Table(tabFolder, SWT.NULL);
-
- assertTrue(":a: ", tabItem.getControl() == null);
-
- tabItem.setControl(control);
- assertTrue(":b: ", tabItem.getControl() == control);
-
- tabItem.setControl(null);
- assertTrue(":c: ", tabItem.getControl() == null);
-} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setTextLjava_lang_String() { - warnUnimpl("Test test_setTextLjava_lang_String not written"); -} - -public void test_setToolTipTextLjava_lang_String(){
- tabItem.setToolTipText("fred");
- assertTrue(":a: ", tabItem.getToolTipText().equals("fred"));
- tabItem.setToolTipText("fredttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt");
- assertTrue(":b: ", tabItem.getToolTipText().equals("fredttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt"));
- tabItem.setToolTipText(null);
- assertTrue(":c: ", tabItem.getToolTipText() == null);
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_TabItem((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TabFolderI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TabFolderII"); - methodNames.addElement("test_checkSubclass"); - methodNames.addElement("test_getControl"); - methodNames.addElement("test_getDisplay"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getToolTipText"); - methodNames.addElement("test_setControlLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_setToolTipTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TabFolderI")) test_ConstructorLorg_eclipse_swt_widgets_TabFolderI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TabFolderII")) test_ConstructorLorg_eclipse_swt_widgets_TabFolderII(); - else if (getName().equals("test_checkSubclass")) test_checkSubclass(); - else if (getName().equals("test_getControl")) test_getControl(); - else if (getName().equals("test_getDisplay")) test_getDisplay(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getToolTipText")) test_getToolTipText(); - else if (getName().equals("test_setControlLorg_eclipse_swt_widgets_Control")) test_setControlLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_setToolTipTextLjava_lang_String")) test_setToolTipTextLjava_lang_String(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Table.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Table.java deleted file mode 100644 index 9e4c926262..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Table.java +++ /dev/null @@ -1,1637 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Table - * - * @see org.eclipse.swt.widgets.Table - */ -public class Test_org_eclipse_swt_widgets_Table extends Test_org_eclipse_swt_widgets_Composite { - -protected Table table; - -public Test_org_eclipse_swt_widgets_Table(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- makeCleanEnvironment(false); // by default, use multi-select table.
-} - -protected void tearDown() { - super.tearDown(); -} - -/**
- * (Re)initializes table. This is called from setUp before each test
- * method is invoked, but also inside the test methods themselves to
- * re-initialize the environment for a fresh test.
- *
- * Basically a shim for coalescing the old test methods (several test
- * methods testing the same target method) into a single test method for
- * every target method. This way the original tests should work with little
- * modification, as long as this method is called before each test.
- *
- * Caveat: the Widget TestCase defines the tearDown method, will assert that
- * the main widget (defined by the last call to setWidget) has been disposed.
- * So using this inside test methods means that only the widget created by
- * the last call to this method will be tested for this.
- *
- * @param int Value to pass as the second parameter to the Table constructor
- */
-private void makeCleanEnvironment(boolean singleMode) {
-// this method must be private or protected so the auto-gen tool keeps it
- if ( singleMode == false )
- table = new Table(shell, SWT.MULTI);
- else
- table = new Table(shell, SWT.SINGLE);
- setWidget(table);
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- if (fCheckSwtNullExceptions) {
- Table newTable;
- try {
- newTable = new Table(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_checkSubclass() { - warnUnimpl("Test test_checkSubclass not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_deselect$I(){
int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.select(new int[] {0, 3});
- assertEquals(2, table.getSelectionCount());
-
- table.deselect(new int[] {1, 2});
- assertEquals(2, table.getSelectionCount());
-
- table.deselect(new int[] {1, 3, 5});
- assertEquals(1, table.getSelectionCount());
-
- table.deselect(new int[] {9, 3, 0});
- assertEquals(0, table.getSelectionCount());
-
- makeCleanEnvironment(false);
-
- items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.selectAll();
- assertEquals(number, table.getSelectionCount());
-
- try{
- table.deselect(null);
- fail("No exception thrown for selection == null");
- }
- catch (IllegalArgumentException e) {
- }
- assertEquals(number, table.getSelectionCount());
- table.selectAll();
-
- table.deselect(new int[] {});
- assertEquals(number, table.getSelectionCount());
- table.selectAll();
-
- table.deselect(new int[] {-1, 100, -1000});
- assertEquals(number, table.getSelectionCount());
- table.selectAll();
-
- table.deselect(new int[] {2, -1, 1, 100, 2});
- assertEquals(number-2, table.getSelectionCount());
-
- table.deselect(new int[] {2, -1, 1, 100, 2});
- assertEquals(number-2, table.getSelectionCount());
-
- table.deselect(new int[] {2, -1, 3, 100, 2});
- assertEquals(number-3, table.getSelectionCount());
-} - -public void test_deselectI(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++) {
- items[i] = new TableItem(table, 0);
- }
- assertEquals(0, table.getSelectionCount());
-
- table.deselect(0);
- assertEquals(0, table.getSelectionCount());
-
- table.select(new int[] {0, 3, 6});
- assertEquals(3, table.getSelectionCount());
-
- table.deselect(0);
- assertEquals(2, table.getSelectionCount());
-
- table.deselect(0);
- assertEquals(2, table.getSelectionCount());
-
- table.deselect(5);
- assertEquals(2, table.getSelectionCount());
-
- table.deselect(3);
- assertEquals(1, table.getSelectionCount());
-
- table.deselect(100);
- assertEquals(1, table.getSelectionCount());
-} - -public void test_deselectII(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.select(new int[] {0, 3, 6});
- assertEquals(3, table.getSelectionCount());
-
- table.deselect(7, 10);
- assertEquals(3, table.getSelectionCount());
-
- table.deselect(6, 10);
- assertEquals(2, table.getSelectionCount());
-
- table.deselect(1, 10);
- assertEquals(1, table.getSelectionCount());
-
- table.deselect(0, 10);
- assertEquals(0, table.getSelectionCount());
-
- table.deselect(0, 100);
- assertEquals(0, table.getSelectionCount());
-
- makeCleanEnvironment(false);
-
- items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.selectAll();
- assertEquals(number, table.getSelectionCount());
-
- table.deselect(-10, 2);
- assertEquals(number-3, table.getSelectionCount());
- table.selectAll();
-
- table.deselect(-10, 2000);
- assertEquals(0, table.getSelectionCount());
- table.selectAll();
-
- table.deselect(2000, -10);
- assertEquals(number, table.getSelectionCount());
- table.selectAll();
-
- table.deselect(0, number-1);
- assertEquals(0, table.getSelectionCount());
- table.selectAll();
-
- table.deselect(0, 0);
- assertEquals(number-1, table.getSelectionCount());
- table.selectAll();
-
- table.deselect(number-1, number-1);
- assertEquals(number-1, table.getSelectionCount());
- table.selectAll();
- table.deselect(-1, -1);
- assertEquals(number, table.getSelectionCount());
- table.selectAll();
-
- table.deselect(number, number);
- assertEquals(number, table.getSelectionCount());
- table.selectAll();
-} - -public void test_deselectAll() {
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(0, table.getSelectionCount());
- table.select(new int[] {2, 4, 5, 10});
-
- assertEquals(4, table.getSelectionCount());
-
- table.deselectAll();
- assertEquals(0, table.getSelectionCount());
-
- table.selectAll();
- assertEquals(number, table.getSelectionCount());
-
- table.deselectAll();
- assertEquals(0, table.getSelectionCount());
-} - -public void test_getColumnI() { - warnUnimpl("Test test_getColumnI not written"); -} - -public void test_getColumnCount() { - warnUnimpl("Test test_getColumnCount not written"); -} - -public void test_getColumns() { - warnUnimpl("Test test_getColumns not written"); -} - -public void test_getGridLineWidth() {
- table.getGridLineWidth();
-} - -public void test_getHeaderVisible() { - warnUnimpl("Test test_getHeaderVisible not written"); -} - -public void test_getItemI(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- for (int i = 0; i < number; i++)
- assertEquals("i=" + i, items[i], table.getItem(i));
- try {
- table.getItem(number);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- table.getItem(number+1);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- for (int i = 0; i < number; i++) {
- assertEquals("i=" + i, items[i], table.getItem(i));
- }
- try {
- table.getItem(number);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- table.getItem(number+1);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-} - -public void test_getItemLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_getItemLorg_eclipse_swt_graphics_Point not written"); -} - -public void test_getItemCount(){
- int[] cases = {0, 10, 100};
- for (int j = 0; j < cases.length; j++) {
- for (int i = 0; i < cases[j]; i++) {
- TableItem ti = new TableItem(table, 0);
- }
- assertEquals("j="+ j, cases[j], table.getItemCount());
- table.removeAll();
- }
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
- for (int j = 0; j < cases.length; j++) {
- for (int i = 0; i < cases[j]; i++) {
- TableItem ti = new TableItem(table, 0);
- }
- assertEquals("j="+ j, cases[j], table.getItemCount());
- table.removeAll();
- }
-} - -public void test_getItemHeight() {
- assertTrue(":a: Item height <= 0", table.getItemHeight() > 0);
- new TableItem(table, 0);
- assertTrue(":b: Item height <= 0", table.getItemHeight() > 0);
-} - -public void test_getItems(){
- int[] cases = {0, 10, 100};
- for (int j = 0; j < cases.length; j++) {
- for (int i = 0; i < cases[j]; i++) {
- TableItem ti = new TableItem(table, 0);
- }
- assertEquals("j=" + j, cases[j], table.getItems().length);
- table.removeAll();
- }
-
- for (int j = 0; j < cases.length; j++) {
- for (int i = 0; i < cases[j]; i++) {
- TableItem ti = new TableItem(table, 0);
- ti.setText(String.valueOf(i));
- }
- TableItem[] items = table.getItems();
- for (int i = 0; i < items.length; i++) {
- assertEquals("j=" + j + ", i=" + i, String.valueOf(i), items[i].getText());
- }
- table.removeAll();
- }
-
- // note SWT.SINGLE
- makeCleanEnvironment(true);
-
- for (int j = 0; j < cases.length; j++) {
- for (int i = 0; i < cases[j]; i++) {
- TableItem ti = new TableItem(table, 0);
- }
- assertEquals("j=" + j, cases[j], table.getItems().length);
- table.removeAll();
- }
-
- makeCleanEnvironment(true);
-
- for (int j = 0; j < cases.length; j++) {
- for (int i = 0; i < cases[j]; i++) {
- TableItem ti = new TableItem(table, 0);
- ti.setText(String.valueOf(i));
- }
- TableItem[] items = table.getItems();
- for (int i = 0; i < items.length; i++) {
- assertEquals("j=" + j + ", i=" + i, String.valueOf(i), items[i].getText());
- }
- table.removeAll();
- }
-} - -public void test_getLinesVisible() { - warnUnimpl("Test test_getLinesVisible not written"); -} - -public void test_getSelection(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(new TableItem[] {}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[2], items[number-1], items[10]});
- assertEquals(new TableItem[] {items[2], items[10], items[number-1]}, table.getSelection());
-
- table.setSelection(items);
- assertEquals(items, table.getSelection());
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(new TableItem[] {}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[10], items[number-1], items[2]});
- assertEquals(new TableItem[] {items[10]}, table.getSelection());
-
- table.setSelection(items);
- assertEquals(new TableItem[] {items[0]}, table.getSelection());
-} - -public void test_getSelectionCount(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(0, table.getSelectionCount());
-
- table.setSelection(new TableItem[]{items[2], items[number-1], items[10]});
- assertEquals(3, table.getSelectionCount());
-
- table.setSelection(items);
- assertEquals(number, table.getSelectionCount());
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(0, table.getSelectionCount());
-
- table.setSelection(new TableItem[]{items[2], items[number-1], items[10]});
- assertEquals(1, table.getSelectionCount());
-
- table.setSelection(items);
- assertEquals(1, table.getSelectionCount());
-} - -public void test_getSelectionIndex(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(-1, table.getSelectionIndex());
-
- table.setSelection(new TableItem[]{items[2], items[number-1], items[10]});
- assertEquals(2, table.getSelectionIndex());
-
- table.setSelection(items);
- assertEquals(0, table.getSelectionIndex());
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(-1, table.getSelectionIndex());
-
- table.setSelection(new TableItem[]{items[2], items[number-1], items[10]});
- assertEquals(2, table.getSelectionIndex());
-
- table.setSelection(items);
- assertEquals(0, table.getSelectionIndex());
-} - -public void test_getSelectionIndices(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(new int[]{}, table.getSelectionIndices());
- table.setSelection(new TableItem[]{items[2], items[number-1], items[10]});
- assertEquals(new int[]{2, 10, number-1}, table.getSelectionIndices()); // 10 < number
-
- int[] all = new int[number];
- for (int i = 0; i<number; i++)
- all[i]=i;
- table.setSelection(items);
- assertEquals(all, table.getSelectionIndices());
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(new int[]{}, table.getSelectionIndices());
-
- table.setSelection(new TableItem[]{items[2], items[number-1], items[10]});
- assertEquals(new int[]{2}, table.getSelectionIndices());
-
- table.setSelection(items);
- assertEquals(new int[]{0}, table.getSelectionIndices());
-} - -public void test_getTopIndex() { - warnUnimpl("Test test_getTopIndex not written"); -} - -public void test_indexOfLorg_eclipse_swt_widgets_TableColumn() { - warnUnimpl("Test test_indexOfLorg_eclipse_swt_widgets_TableColumn not written"); -} - -public void test_indexOfLorg_eclipse_swt_widgets_TableItem(){
- int number = 20;
- TableItem[] items = new TableItem[number];
-
- for (int i = 0; i < number; i++) {
- items[i] = new TableItem(table, 0);
- items[i].setText(String.valueOf(i));
- }
-
- for (int i = 0; i < number; i++) {
- assertEquals(i, table.indexOf(items[i]));
- }
-
- for (int i = 0; i < number; i++) {
- try {
- table.indexOf((TableItem)null);
- fail("No exception thrown for tableItem == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-
- // another table
- Table table_2 = new Table(shell, 0);
- TableItem[] items_2 = new TableItem[number];
- for (int i = 0; i < number; i++) {
- items_2[i] = new TableItem(table_2, 0);
- items_2[i].setText(String.valueOf(i));
- }
-
- for (int i = 0; i < number; i++) {
- assertEquals("i=" + i, -1, table.indexOf(items_2[i]));
- }
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- number = 20;
- items = new TableItem[number];
-
- for (int i = 0; i < number; i++) {
- items[i] = new TableItem(table, 0);
- items[i].setText(String.valueOf(i));
- }
-
- for (int i = 0; i < number; i++) {
- assertEquals(i, table.indexOf(items[i]));
- }
-
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++) {
- items[i] = new TableItem(table, 0);
- items[i].setText(String.valueOf(i));
- }
-
- for (int i = 0; i < number; i++) {
- try {
- table.indexOf((TableItem)null);
- fail("No exception thrown for tableItem == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++) {
- items[i] = new TableItem(table, 0);
- items[i].setText(String.valueOf(i));
- }
-
- // another table
- table_2 = new Table(shell, 0);
- items_2 = new TableItem[number];
- for (int i = 0; i < number; i++) {
- items_2[i] = new TableItem(table_2, 0);
- items_2[i].setText(String.valueOf(i));
- }
-
- for (int i = 0; i < number; i++) {
- assertEquals("i=" + i, -1, table.indexOf(items_2[i]));
- }
-} - -public void test_isSelectedI(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- for (int i = 0; i < number; i++)
- assertTrue(":a:" + i, !table.isSelected(i));
- table.setSelection(new TableItem[] {items[2], items[number-1], items[10]});
- for (int i = 0; i < number; i++) {
- if (i == 2 || i == number-1 || i == 10)
- assertTrue(":b:" + i, table.isSelected(i));
- else
- assertTrue(":b:" + i, !table.isSelected(i));
- }
-
- table.setSelection(items);
- for (int i = 0; i < number; i++)
- assertTrue(":c:" + i, table.isSelected(i));
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- for (int i = 0; i < number; i++)
- assertTrue(":d:" + i, !table.isSelected(i));
- table.setSelection(new TableItem[] {items[10], items[number-1], items[2]});
- for (int i = 0; i < number; i++) {
- if (i == 10)
- assertTrue(":e:" + i, table.isSelected(i));
- else
- assertTrue(":e:" + i, !table.isSelected(i));
- }
-
- table.setSelection(items);
- for (int i = 0; i < number; i++){
- if (i == 0)
- assertTrue(":f:" + i, table.isSelected(i));
- else
- assertTrue(":f:" + i, !table.isSelected(i));
- }
-} - -public void test_remove$I(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- try {
- table.remove(null);
- fail("No exception thrown for tableItems == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- table.remove(new int[] {2, 1, 0, -100, 5, 5, 2, 1, 0, 0, 0});
- fail("No exception thrown for illegal index arguments");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- table.remove(new int[] {2, 1, 0, number, 5, 5, 2, 1, 0, 0, 0});
- fail("No exception thrown for illegal index arguments");
- }
- catch (IllegalArgumentException e) {
- }
-
- table.remove(new int[] {});
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertTrue(":a:", !items[2].isDisposed());
- table.remove(new int[] {2});
- assertTrue(":b:", items[2].isDisposed());
- assertEquals(number-1, table.getItemCount());
-
- assertTrue(":c:", !items[number-1].isDisposed());
- table.remove(new int[] {number-2});
- assertTrue(":d:", items[number-1].isDisposed());
- assertEquals(number-2, table.getItemCount());
-
- assertTrue(":e:", !items[3].isDisposed());
- table.remove(new int[] {2});
- assertTrue(":f:", items[3].isDisposed());
- assertEquals(number-3, table.getItemCount());
-
- assertTrue(":g:", !items[0].isDisposed());
- table.remove(new int[] {0});
- assertTrue(":h:", items[0].isDisposed());
- assertEquals(number-4, table.getItemCount());
-} - -public void test_removeI() { - warnUnimpl("Test test_removeI not written"); -} - -public void test_removeII(){
- int number = 5;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- // should not cause a null pointer exception, bounds checks for table not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- try {
- table.remove(-number, number + 100);
- fail("No exception thrown for illegal index range");
- }
- catch (IllegalArgumentException e) {
- }
- }
-
- makeCleanEnvironment(false);
-
- items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.remove(2, 3);
- assertEquals(new TableItem[]{items[0], items[1], items[4]}, table.getItems());
-
- makeCleanEnvironment(false);
-
- items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- //should not cause a null pointer exception, bounds checks for table not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- try {
- table.remove(2, 100);
- fail("No exception thrown for illegal index range");
- }
- catch (IllegalArgumentException e) {
- }
- assertEquals(new TableItem[] {items[0], items[1]}, table.getItems());
- }
-
- makeCleanEnvironment(false);
-
- items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- // should not cause a null pointer exception, bounds checks for table not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- try {
- table.remove(2, number);
- fail("No exception thrown for illegal index range");
- }
- catch (IllegalArgumentException e) {
- }
- assertEquals(new TableItem[] {items[0], items[1]}, table.getItems());
- }
-
- makeCleanEnvironment(false);
-
- items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.remove(2, number-1);
- assertEquals(new TableItem[] {items[0], items[1]}, table.getItems());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.remove(0, 3);
- assertEquals(new TableItem[] {items[4]}, table.getItems());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.remove(0, number-1);
- assertEquals(new TableItem[] {}, table.getItems());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.remove(new int[] {});
- assertEquals(number, table.getItemCount());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- // should not cause a null pointer exception, bounds checks for table not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- try {
- table.remove(-20, -10);
- fail("No exception thrown for illegal index range");
- }
- catch (IllegalArgumentException e) {
- }
- assertEquals(items, table.getItems());
- }
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- // should not cause a null pointer exception, bounds checks for table not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- try {
- table.remove(20, 40);
- fail("No exception thrown for illegal index range");
- }
- catch (IllegalArgumentException e) {
- }
- assertEquals(items, table.getItems());
- }
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- // should not cause a null pointer exception, bounds checks for table not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- table.remove(200, 40);
- assertEquals(items, table.getItems());
- }
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.remove(2, 2);
- assertEquals(new TableItem[]{items[0], items[1], items[3], items[4]}, table.getItems());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.remove(0, 0);
- assertEquals(new TableItem[]{items[1], items[2], items[3], items[4]}, table.getItems());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.remove(4, 4);
- assertEquals(new TableItem[]{items[0], items[1], items[2], items[3]}, table.getItems());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- assertEquals(number, table.getItemCount());
- // should not cause a null pointer exception, bounds checks for table not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- try {
- table.remove(-10, 2);
- fail("No exception thrown for illegal index range");
- }
- catch (IllegalArgumentException e) {
- }
- }
- assertEquals(number, table.getItemCount());
- if (fCheckSWTPolicy) {
- table.remove(10, 2);
- assertEquals(number, table.getItemCount());
- }
- table.remove(0, 2);
- assertEquals(number - 3, table.getItemCount());
- assertEquals(new TableItem[] {items[3], items[4]}, table.getItems());
- if (fCheckOutOfRangeBehaviour) {
- try {
- table.remove(1, 200);
- fail("No exception thrown for illegal index range");
- }
- catch (IllegalArgumentException e) {
- }
- assertEquals(1, table.getItemCount());
- assertEquals(new TableItem[] {items[3]}, table.getItems());
- }
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.remove(0, number-1);
- assertEquals(0, table.getItemCount());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- // should not cause a null pointer exception, bounds checks for table not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- try {
- table.remove(number, number);
- fail("No exception thrown for illegal index range");
- }
- catch (IllegalArgumentException e) {
- }
- }
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- // should not cause a null pointer exception, bounds checks for table not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- try {
- table.remove(number, number + 100);
- fail("No exception thrown for illegal index range");
- }
- catch (IllegalArgumentException e) {
- }
- }
-
- makeCleanEnvironment(false);
-
- number = 15;
- items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
-
- table.remove(new int[] {2, 1, 0, 5, 5});
- assertEquals(number-4, table.getItemCount());
-} - -public void test_removeAll(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.removeAll();
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.removeAll();
- table.removeAll();
-} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_select$I(){
- try {
- table.select(null);
- fail("No exception thrown for selection == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.select(new int[] {10, 2, 14});
- assertEquals(new int[] {2, 10, 14}, table.getSelectionIndices());
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- try {
- table.select(null);
- fail("No exception thrown for selection == null");
- }
- catch (IllegalArgumentException e) {
- }
-} - -public void test_selectI(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.select(new int[] {10, 2, 14});
- assertEquals(new int[] {2, 10, 14}, table.getSelectionIndices());
-
- table.select(7);
- assertEquals(new int[]{2, 7, 10, 14}, table.getSelectionIndices());
-
- table.select(0);
- assertEquals(new int[]{0, 2, 7, 10, 14}, table.getSelectionIndices());
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.select(new int[] {number - 1, 10, 2 });
- assertEquals(number - 1, table.getSelectionIndex());
- table.setSelection(new int[] {number - 1,10, 2});
- assertEquals(number - 1, table.getSelectionIndex()); // for SINGLE setSelection and select are the same
-
- table.select(7);
- assertEquals(new int[] {7}, table.getSelectionIndices());
- table.setSelection(7);
- assertEquals(new int[] {7}, table.getSelectionIndices()); // for SINGLE setSelection and select are the same
-
- table.select(0);
- assertEquals(new int[] {0}, table.getSelectionIndices());
- table.setSelection(0);
- assertEquals(new int[] {0}, table.getSelectionIndices()); // for SINGLE setSelection and select are the same
-} - -public void test_selectII(){
- int number = 15;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.select(new int[] {10, 2, 14});
- assertEquals(new int[] {2, 10, 14}, table.getSelectionIndices());
-
- table.select(7);
- assertEquals(new int[]{2, 7, 10, 14}, table.getSelectionIndices());
-
- table.select(0);
- assertEquals(new int[]{0, 2, 7, 10, 14}, table.getSelectionIndices());
-
- table.select(4, 10);
- assertEquals(new int[]{0, 2, 4, 5, 6, 7, 8, 9, 10, 14}, table.getSelectionIndices());
-
- table.select(4, 14);
- assertEquals(new int[]{0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, table.getSelectionIndices());
-
- table.select(0, 7);
- assertEquals(new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, table.getSelectionIndices());
-
- table.select(9, 5);
- assertEquals(new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, table.getSelectionIndices());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.select(-100, 1000);
- assertEquals(number, table.getSelectionCount());
- table.deselectAll();
- assertEquals(0, table.getSelectionCount());
- table.select(0, 1000);
- assertEquals(number, table.getSelectionCount());
- table.deselectAll();
-
- table.select(0, number-1);
- assertEquals(number, table.getSelectionCount());
- table.deselectAll();
-
- table.select(0, 0);
- assertEquals(1, table.getSelectionCount());
- table.deselectAll();
-
- table.select(number-1, number);
- assertEquals(1, table.getSelectionCount());
- table.deselectAll();
-
- table.select(number, number);
- assertEquals(0, table.getSelectionCount());
- table.deselectAll();
-
- // note: SWT.SINGLE
- makeCleanEnvironment(true);
-
- table.setSelection(0);
-
- if (fCheckSWTPolicy) {
- table.select(4, 10);
- assertEquals(new int[] {4}, table.getSelectionIndices());
- table.setSelection(4, 10);
- assertEquals(new int[] {4}, table.getSelectionIndices()); //for SINGLE setSelection and select are the same
-
- table.select(5, number - 1);
- assertEquals(new int[] {5}, table.getSelectionIndices());
- table.setSelection(5, number - 1);
- assertEquals(new int[] {5}, table.getSelectionIndices()); //for SINGLE setSelection and select are the same
-
- table.select(0, 7);
- assertEquals(new int[] {0}, table.getSelectionIndices());
- table.setSelection(0, 7);
- assertEquals(new int[] {0}, table.getSelectionIndices()); //for SINGLE setSelection and select are the same
-
- table.select(9, 5);
- assertEquals(new int[] {7}, table.getSelectionIndices());
- table.setSelection(9, 5);
- assertEquals(new int[] {}, table.getSelectionIndices()); //for SINGLE setSelection and select are the same
- } // ?? in this case maybe the sel. should be cleared
-
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- if (fCheckSWTPolicy) {
- table.select(-100, 1000);
- assertEquals(1, table.getSelectionCount());
- assertEquals(new int[] {number - 1}, table.getSelectionIndices());
- }
- table.deselectAll();
- assertEquals(0, table.getSelectionCount());
- table.select(0, 1000);
- assertEquals(1, table.getSelectionCount());
- if (fCheckSWTPolicy)
- assertEquals(new int[] {number - 1}, table.getSelectionIndices());
- table.deselectAll();
- table.select(0, number - 1);
- assertEquals(1, table.getSelectionCount());
- if (fCheckSWTPolicy)
- assertEquals(new int[] {number - 1}, table.getSelectionIndices());
- table.deselectAll();
- table.select(0, 0);
- assertEquals(1, table.getSelectionCount());
- assertEquals(new int[] {0}, table.getSelectionIndices());
- table.deselectAll();
- table.select(number - 1, number);
- assertEquals(1, table.getSelectionCount());
- assertEquals(new int[] {number - 1}, table.getSelectionIndices());
- table.deselectAll();
- table.select(number, number);
- assertEquals(0, table.getSelectionCount());
- assertEquals(new int[] {}, table.getSelectionIndices());
- table.deselectAll();
-
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.select(-100, 1000);
- if (fCheckSWTPolicy) {
- assertEquals(1, table.getSelectionCount());
- assertEquals(new int[] {number - 1}, table.getSelectionIndices());
- }
- table.deselectAll();
- assertEquals(0, table.getSelectionCount());
- table.select(1000, 0);
- assertEquals(0, table.getSelectionCount());
- assertEquals(new int[] {}, table.getSelectionIndices());
- table.deselectAll();
- table.select(number - 1, 0);
- if (fCheckSWTPolicy)
- assertEquals(0, table.getSelectionCount());
- table.deselectAll();
- table.select(0, 0);
- assertEquals(1, table.getSelectionCount());
- assertEquals(new int[] {0}, table.getSelectionIndices());
- table.deselectAll();
- table.select(-1, -1);
- if (fCheckSWTPolicy) {
- assertEquals(0, table.getSelectionCount());
- assertEquals(new int[] {}, table.getSelectionIndices());
- }
- table.deselectAll();
- table.select(number, number);
- if (fCheckSWTPolicy) {
- assertEquals(0, table.getSelectionCount());
- assertEquals(new int[] {}, table.getSelectionIndices());
- }
- table.deselectAll();
-} - -public void test_selectAll(){
- int number = 5;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(new int[]{}, table.getSelectionIndices());
- table.selectAll();
- assertEquals(new int[]{0, 1, 2, 3, 4}, table.getSelectionIndices());
-
- // test single-selection table
- makeCleanEnvironment(true);
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- assertEquals(new int[]{}, table.getSelectionIndices());
- table.selectAll();
- assertEquals(new int[]{}, table.getSelectionIndices());
-} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written"); -} - -public void test_setHeaderVisibleZ(){
- table.setHeaderVisible(true);
- assertTrue(table.getHeaderVisible());
-
- table.setHeaderVisible(false);
- assertTrue(!table.getHeaderVisible());
-} - -public void test_setLinesVisibleZ(){
- table.setLinesVisible(true);
- assertTrue(table.getLinesVisible());
-
- table.setLinesVisible(false);
- assertTrue(!table.getLinesVisible());
-} - -public void test_setRedrawZ() { - warnUnimpl("Test test_setRedrawZ not written"); -} - -public void test_setSelection$I(){
- int number = 5;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- try {
- table.setSelection((int[]) null);
- fail("No exception thrown for selection == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- table.setSelection(new int[]{});
- assertEquals(new int[]{}, table.getSelectionIndices());
-
- table.setSelection(new int[]{0, 3, 2});
- assertEquals(new int[]{0, 2, 3}, table.getSelectionIndices());
-
- table.setSelection(new int[]{3, 2, 1});
- assertEquals(new int[]{1, 2, 3}, table.getSelectionIndices());
-
- table.setSelection(new int[]{1, 4, 0});
- assertEquals(new int[]{0, 1, 4}, table.getSelectionIndices());
- table.setSelection(new int[]{0, 4, 0});
- assertEquals(new int[]{0, 4}, table.getSelectionIndices());
-
- table.setSelection(new int[]{2, 3, 4});
- assertEquals(new int[]{2, 3, 4}, table.getSelectionIndices());
-
- table.setSelection(new int[]{4, 4, 4, 4, 4, 4, 4});
- assertEquals(new int[]{4}, table.getSelectionIndices());
-
- table.setSelection(new int[]{4});
- assertEquals(new int[]{4}, table.getSelectionIndices());
-
- // test single-selection table
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- try {
- table.setSelection((int[]) null);
- fail("No exception thrown for selection range == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.setSelection(new int[] {});
- assertEquals(new int[] {}, table.getSelectionIndices());
- table.setSelection(new int[] {0, 3, 2});
- if (fCheckSWTPolicy)
- assertEquals(new int[] {2}, table.getSelectionIndices());
- table.setSelection(new int[] {3, 2, 1});
- if (fCheckSWTPolicy)
- assertEquals(new int[] {1}, table.getSelectionIndices());
- table.setSelection(new int[] {1, 4, 0});
- if (fCheckSWTPolicy)
- assertEquals(new int[] {0}, table.getSelectionIndices());
- table.setSelection(new int[] {0, 4, 1});
- if (fCheckSWTPolicy)
- assertEquals(new int[] {0}, table.getSelectionIndices());
- table.setSelection(new int[] {2, 3, 4});
- if (fCheckSWTPolicy)
- assertEquals(new int[] {4}, table.getSelectionIndices());
- table.setSelection(new int[] {4, 4, 4, 4, 4, 4, 4});
- assertEquals(new int[] {4}, table.getSelectionIndices());
- table.setSelection(new int[] {4});
- assertEquals(new int[] {4}, table.getSelectionIndices());
-
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- try {
- table.setSelection((TableItem[]) null);
- fail("No exception thrown for selection range == null");
- }
- catch (IllegalArgumentException e) {
- }
- finally {
- assertEquals(0, table.getSelectionCount());
- }
-} - -public void test_setSelection$Lorg_eclipse_swt_widgets_TableItem(){
- int number = 5;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- try {
- table.setSelection((TableItem[]) null);
- fail("No exception thrown for selection range == null");
- }
- catch (IllegalArgumentException e) {
- }
- finally {
- assertEquals(0, table.getSelectionCount());
- }
-
- table.setSelection(new TableItem[]{});
- assertEquals(0, table.getSelectionCount());
-
- table.setSelection(new TableItem[]{items[0], items[3], items[2]});
- assertEquals(new TableItem[]{items[0], items[2], items[3]}, table.getSelection());
- table.setSelection(new TableItem[]{items[3], items[2], items[1]});
- assertEquals(new TableItem[]{items[1], items[2], items[3]}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[1], items[4], items[0]});
- assertEquals(new TableItem[]{items[0], items[1], items[4]}, table.getSelection());
- table.setSelection(new TableItem[]{items[0], items[4], items[0]});
- assertEquals(new TableItem[]{items[0], items[4]}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[2], items[3], items[4]});
- assertEquals(new TableItem[]{items[2], items[3], items[4]}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[4], items[4], items[4], items[4], items[4], items[4]});
- assertEquals(new TableItem[]{items[4]}, table.getSelection());
- table.setSelection(new TableItem[]{items[4]});
- assertEquals(new TableItem[]{items[4]}, table.getSelection());
-
- makeCleanEnvironment(false);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.setSelection(new TableItem[] {items[0]});
- assertEquals(new TableItem[] {items[0]}, table.getSelection());
-
- table.setSelection(new TableItem[] {items[3]});
- assertEquals(new TableItem[] {items[3]}, table.getSelection());
-
- table.setSelection(new TableItem[] {items[4]});
- assertEquals(new TableItem[] {items[4]}, table.getSelection());
- table.setSelection(new TableItem[] {items[2]});
- assertEquals(new TableItem[] {items[2]}, table.getSelection());
- table.setSelection(new TableItem[] {items[1]});
- assertEquals(new TableItem[] {items[1]}, table.getSelection());
-
- // test single-selection table
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.setSelection(new TableItem[]{});
- assertEquals(0, table.getSelectionCount());
-
- table.setSelection(new TableItem[]{items[0], items[3], items[2]});
- assertEquals(new TableItem[]{items[0]}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[3], items[2], items[1]});
- assertEquals(new TableItem[]{items[3]}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[1], items[4], items[0]});
- assertEquals(new TableItem[]{items[1]}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[0], items[4], items[0]});
- assertEquals(new TableItem[]{items[0]}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[2], items[3], items[4]});
- assertEquals(new TableItem[]{items[2]}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[4], items[4], items[4], items[4], items[4], items[4]});
- assertEquals(new TableItem[]{items[4]}, table.getSelection());
-
- table.setSelection(new TableItem[]{items[4]});
- assertEquals(new TableItem[]{items[4]}, table.getSelection());
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.setSelection(new TableItem[] {items[0]});
- assertEquals(new TableItem[] {items[0]}, table.getSelection());
-
- table.setSelection(new TableItem[] {items[3]});
- assertEquals(new TableItem[] {items[3]}, table.getSelection());
-
- table.setSelection(new TableItem[] {items[4]});
- assertEquals(new TableItem[] {items[4]}, table.getSelection());
-
- table.setSelection(new TableItem[] {items[2]});
- assertEquals(new TableItem[] {items[2]}, table.getSelection());
-
- table.setSelection(new TableItem[] {items[1]});
- assertEquals(new TableItem[] {items[1]}, table.getSelection());
-} - -public void test_setSelectionI(){
- int number = 5;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.setSelection(0);
- assertEquals(new int[]{0}, table.getSelectionIndices());
- table.setSelection(3);
- assertEquals(new int[]{3}, table.getSelectionIndices());
- table.setSelection(4);
- assertEquals(new int[]{4}, table.getSelectionIndices());
-
- table.setSelection(2);
- assertEquals(new int[]{2}, table.getSelectionIndices());
-
- table.setSelection(1);
- assertEquals(new int[]{1}, table.getSelectionIndices());
-
- // test single-selection table
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.setSelection(0);
- assertEquals(new int[]{0}, table.getSelectionIndices());
-
- table.setSelection(3);
- assertEquals(new int[]{3}, table.getSelectionIndices());
-
- table.setSelection(4);
- assertEquals(new int[]{4}, table.getSelectionIndices());
-
- table.setSelection(2);
- assertEquals(new int[]{2}, table.getSelectionIndices());
-
- table.setSelection(1);
- assertEquals(new int[]{1}, table.getSelectionIndices());
-
-} - -public void test_setSelectionII(){
- int number = 5;
- TableItem[] items = new TableItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
-
- table.setSelection(0, 1);
- assertEquals(new int[]{0, 1}, table.getSelectionIndices());
-
- table.setSelection(2, 4);
- assertEquals(new int[]{2, 3, 4}, table.getSelectionIndices());
-
- table.setSelection(3, 4);
- assertEquals(new int[]{3, 4}, table.getSelectionIndices());
-
- table.setSelection(5, 4);
- assertEquals(new int[]{}, table.getSelectionIndices());
-
- table.setSelection(2, 2);
- assertEquals(new int[]{2}, table.getSelectionIndices());
-
- table.setSelection(1, 4);
- assertEquals(new int[]{1, 2, 3, 4}, table.getSelectionIndices());
-
- table.setSelection(0, 4);
- assertEquals(new int[]{0, 1, 2, 3, 4}, table.getSelectionIndices());
-
- // test single-selection table
- makeCleanEnvironment(true);
-
- for (int i = 0; i < number; i++)
- items[i] = new TableItem(table, 0);
- table.setSelection(0, 1);
- if (fCheckSWTPolicy)
- assertEquals(new int[] {1}, table.getSelectionIndices());
- table.setSelection(2, 4);
- if (fCheckSWTPolicy)
- assertEquals(new int[] {4}, table.getSelectionIndices());
- table.setSelection(5, 4);
- if (fCheckSWTPolicy)
- assertEquals(new int[] {}, table.getSelectionIndices());
- table.setSelection(2, 2);
- assertEquals(new int[] {2}, table.getSelectionIndices());
- table.setSelection(1, 4);
- if (fCheckSWTPolicy)
- assertEquals(new int[] {4}, table.getSelectionIndices());
- table.setSelection(0, 4);
- if (fCheckSWTPolicy)
- assertEquals(new int[] {4}, table.getSelectionIndices());
-} - -public void test_setTopIndexI() { - warnUnimpl("Test test_setTopIndexI not written"); -} - -public void test_showItemLorg_eclipse_swt_widgets_TableItem() { - warnUnimpl("Test test_showItemLorg_eclipse_swt_widgets_TableItem not written"); -} - -public void test_showSelection() {
- table.showSelection();
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Table((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_checkSubclass"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_deselect$I"); - methodNames.addElement("test_deselectI"); - methodNames.addElement("test_deselectII"); - methodNames.addElement("test_deselectAll"); - methodNames.addElement("test_getColumnI"); - methodNames.addElement("test_getColumnCount"); - methodNames.addElement("test_getColumns"); - methodNames.addElement("test_getGridLineWidth"); - methodNames.addElement("test_getHeaderVisible"); - methodNames.addElement("test_getItemI"); - methodNames.addElement("test_getItemLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItemHeight"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getLinesVisible"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionCount"); - methodNames.addElement("test_getSelectionIndex"); - methodNames.addElement("test_getSelectionIndices"); - methodNames.addElement("test_getTopIndex"); - methodNames.addElement("test_indexOfLorg_eclipse_swt_widgets_TableColumn"); - methodNames.addElement("test_indexOfLorg_eclipse_swt_widgets_TableItem"); - methodNames.addElement("test_isSelectedI"); - methodNames.addElement("test_remove$I"); - methodNames.addElement("test_removeI"); - methodNames.addElement("test_removeII"); - methodNames.addElement("test_removeAll"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_select$I"); - methodNames.addElement("test_selectI"); - methodNames.addElement("test_selectII"); - methodNames.addElement("test_selectAll"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setHeaderVisibleZ"); - methodNames.addElement("test_setLinesVisibleZ"); - methodNames.addElement("test_setRedrawZ"); - methodNames.addElement("test_setSelection$I"); - methodNames.addElement("test_setSelection$Lorg_eclipse_swt_widgets_TableItem"); - methodNames.addElement("test_setSelectionI"); - methodNames.addElement("test_setSelectionII"); - methodNames.addElement("test_setTopIndexI"); - methodNames.addElement("test_showItemLorg_eclipse_swt_widgets_TableItem"); - methodNames.addElement("test_showSelection"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_checkSubclass")) test_checkSubclass(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_deselect$I")) test_deselect$I(); - else if (getName().equals("test_deselectI")) test_deselectI(); - else if (getName().equals("test_deselectII")) test_deselectII(); - else if (getName().equals("test_deselectAll")) test_deselectAll(); - else if (getName().equals("test_getColumnI")) test_getColumnI(); - else if (getName().equals("test_getColumnCount")) test_getColumnCount(); - else if (getName().equals("test_getColumns")) test_getColumns(); - else if (getName().equals("test_getGridLineWidth")) test_getGridLineWidth(); - else if (getName().equals("test_getHeaderVisible")) test_getHeaderVisible(); - else if (getName().equals("test_getItemI")) test_getItemI(); - else if (getName().equals("test_getItemLorg_eclipse_swt_graphics_Point")) test_getItemLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItemHeight")) test_getItemHeight(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getLinesVisible")) test_getLinesVisible(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionCount")) test_getSelectionCount(); - else if (getName().equals("test_getSelectionIndex")) test_getSelectionIndex(); - else if (getName().equals("test_getSelectionIndices")) test_getSelectionIndices(); - else if (getName().equals("test_getTopIndex")) test_getTopIndex(); - else if (getName().equals("test_indexOfLorg_eclipse_swt_widgets_TableColumn")) test_indexOfLorg_eclipse_swt_widgets_TableColumn(); - else if (getName().equals("test_indexOfLorg_eclipse_swt_widgets_TableItem")) test_indexOfLorg_eclipse_swt_widgets_TableItem(); - else if (getName().equals("test_isSelectedI")) test_isSelectedI(); - else if (getName().equals("test_remove$I")) test_remove$I(); - else if (getName().equals("test_removeI")) test_removeI(); - else if (getName().equals("test_removeII")) test_removeII(); - else if (getName().equals("test_removeAll")) test_removeAll(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_select$I")) test_select$I(); - else if (getName().equals("test_selectI")) test_selectI(); - else if (getName().equals("test_selectII")) test_selectII(); - else if (getName().equals("test_selectAll")) test_selectAll(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setHeaderVisibleZ")) test_setHeaderVisibleZ(); - else if (getName().equals("test_setLinesVisibleZ")) test_setLinesVisibleZ(); - else if (getName().equals("test_setRedrawZ")) test_setRedrawZ(); - else if (getName().equals("test_setSelection$I")) test_setSelection$I(); - else if (getName().equals("test_setSelection$Lorg_eclipse_swt_widgets_TableItem")) test_setSelection$Lorg_eclipse_swt_widgets_TableItem(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else if (getName().equals("test_setSelectionII")) test_setSelectionII(); - else if (getName().equals("test_setTopIndexI")) test_setTopIndexI(); - else if (getName().equals("test_showItemLorg_eclipse_swt_widgets_TableItem")) test_showItemLorg_eclipse_swt_widgets_TableItem(); - else if (getName().equals("test_showSelection")) test_showSelection(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableColumn.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableColumn.java deleted file mode 100644 index eabc7ed3ff..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableColumn.java +++ /dev/null @@ -1,270 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.TableColumn - * - * @see org.eclipse.swt.widgets.TableColumn - */ -public class Test_org_eclipse_swt_widgets_TableColumn extends Test_org_eclipse_swt_widgets_Item { - -protected TableColumn tableColumn; -protected Table table; - -public Test_org_eclipse_swt_widgets_TableColumn(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- table = new Table(shell, SWT.SINGLE);
- tableColumn = new TableColumn(table, SWT.NULL);
- setWidget(tableColumn);
-} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_TableI(){
- if (fCheckSwtNullExceptions) {
- try {
- new TableColumn(null, SWT.NULL);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_TableII(){
- if (fCheckSwtNullExceptions) {
- try {
- new TableColumn(null, SWT.NULL, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- new TableColumn(table, SWT.NULL, -1);
- fail("No exception thrown for index == -1");
- }
- catch (IllegalArgumentException e) {
- }
-
- try {
- new TableColumn(table, SWT.NULL, 2);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
- }
-} - -public void test_addControlListenerLorg_eclipse_swt_events_ControlListener() { - warnUnimpl("Test test_addControlListenerLorg_eclipse_swt_events_ControlListener not written"); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(){
- try {
- tableColumn.addSelectionListener(null);
- fail("No exception thrown for selectionListener == null");
- }
- catch (IllegalArgumentException e) {
- }
-} - -public void test_checkSubclass() { - warnUnimpl("Test test_checkSubclass not written"); -} - -public void test_getAlignment() { - warnUnimpl("Test test_getAlignment not written"); -} - -public void test_getDisplay() {
- assertTrue(":a:", tableColumn.getDisplay() == table.getDisplay());
-} - -public void test_getParent() { - warnUnimpl("Test test_getParent not written"); -} - -public void test_getResizable() { - warnUnimpl("Test test_getResizable not written"); -} - -public void test_getWidth(){
- final int DEFAULT_WIDTH = 10;
- int testWidth = 42;
-
- assertTrue(":a: width=" + tableColumn.getWidth() + " should be=" + DEFAULT_WIDTH, tableColumn.getWidth() == DEFAULT_WIDTH);
-
// try {
-// tableColumn.setWidth(-1);
-// assertTrue("No exception thrown", false);
-// }
-// catch (IllegalArgumentException e) {
-// assertTrue("Wrong error thrown: " + e, e.getMessage().equals("Argument not valid"));
-// }
-// catch (SWTException e) {
-// assertTrue("Wrong error thrown: " + e, e.getMessage().equals("Argument not valid"));
-// }
-
- tableColumn.setWidth(0);
- assertTrue(":c: width=" + tableColumn.getWidth() + " should be=" + 0, tableColumn.getWidth() == 0);
-
- tableColumn.setWidth(testWidth);
- assertTrue(":d: width=" + tableColumn.getWidth() + " should be=" + testWidth, tableColumn.getWidth() == testWidth);
-
- tableColumn.setWidth(testWidth);
- assertTrue(":e: width=" + tableColumn.getWidth() + " should be=" + testWidth, tableColumn.getWidth() == testWidth);
-} - -public void test_pack() { - warnUnimpl("Test test_pack not written"); -} - -public void test_removeControlListenerLorg_eclipse_swt_events_ControlListener() { - warnUnimpl("Test test_removeControlListenerLorg_eclipse_swt_events_ControlListener not written"); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(){
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {}};
-
- tableColumn.removeSelectionListener(listener);
- tableColumn.addSelectionListener(listener);
- tableColumn.removeSelectionListener(listener);
- try {
- tableColumn.removeSelectionListener(null);
- fail("No exception thrown for selectionListener == null");
- }
- catch (IllegalArgumentException e) {
- }
-} - -public void test_setAlignmentI(){
- TableColumn column2;
-
- assertTrue(":a:", tableColumn.getAlignment() == SWT.LEFT);
-
- tableColumn.setAlignment(-1);
- assertTrue(":b:", tableColumn.getAlignment() == SWT.LEFT);
-
- tableColumn.setAlignment(SWT.RIGHT);
- assertTrue(
- ":c: Should not be allowed to set alignment of the first column",
- tableColumn.getAlignment() == SWT.LEFT);
-
- column2 = new TableColumn(table, SWT.NULL);
- column2.setAlignment(SWT.RIGHT);
- assertTrue(":d:", column2.getAlignment() == SWT.RIGHT);
-
- column2.setAlignment(SWT.CENTER);
- assertTrue(":e:", column2.getAlignment() == SWT.CENTER);
-
- column2.setAlignment(SWT.LEFT);
- assertTrue(":f:", column2.getAlignment() == SWT.LEFT);
-} - -public void test_setResizableZ(){
- assertTrue(":a:", tableColumn.getResizable() == true);
-
- tableColumn.setResizable(false);
- assertTrue(":b:", tableColumn.getResizable() == false);
-
- tableColumn.setResizable(false);
- assertTrue(":c:", tableColumn.getResizable() == false);
-
- tableColumn.setResizable(true);
- assertTrue(":d:", tableColumn.getResizable() == true);
-} - -public void test_setTextLjava_lang_String(){
- assertTrue(":a:", tableColumn.getText() == "");
-
- tableColumn.setText("text");
- assertTrue(":b:", tableColumn.getText() == "text");
-
- try {
- tableColumn.setText(null);
- fail("No exception thrown for column header == null");
- }
- catch (IllegalArgumentException e) {
- }
-} - -public void test_setWidthI() { - warnUnimpl("Test test_setWidthI not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_TableColumn((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TableI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TableII"); - methodNames.addElement("test_addControlListenerLorg_eclipse_swt_events_ControlListener"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_checkSubclass"); - methodNames.addElement("test_getAlignment"); - methodNames.addElement("test_getDisplay"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getResizable"); - methodNames.addElement("test_getWidth"); - methodNames.addElement("test_pack"); - methodNames.addElement("test_removeControlListenerLorg_eclipse_swt_events_ControlListener"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_setAlignmentI"); - methodNames.addElement("test_setResizableZ"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_setWidthI"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TableI")) test_ConstructorLorg_eclipse_swt_widgets_TableI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TableII")) test_ConstructorLorg_eclipse_swt_widgets_TableII(); - else if (getName().equals("test_addControlListenerLorg_eclipse_swt_events_ControlListener")) test_addControlListenerLorg_eclipse_swt_events_ControlListener(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_checkSubclass")) test_checkSubclass(); - else if (getName().equals("test_getAlignment")) test_getAlignment(); - else if (getName().equals("test_getDisplay")) test_getDisplay(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getResizable")) test_getResizable(); - else if (getName().equals("test_getWidth")) test_getWidth(); - else if (getName().equals("test_pack")) test_pack(); - else if (getName().equals("test_removeControlListenerLorg_eclipse_swt_events_ControlListener")) test_removeControlListenerLorg_eclipse_swt_events_ControlListener(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_setAlignmentI")) test_setAlignmentI(); - else if (getName().equals("test_setResizableZ")) test_setResizableZ(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_setWidthI")) test_setWidthI(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java deleted file mode 100644 index 759fff59c5..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java +++ /dev/null @@ -1,519 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.TableItem - * - * @see org.eclipse.swt.widgets.TableItem - */ -public class Test_org_eclipse_swt_widgets_TableItem extends Test_org_eclipse_swt_widgets_Item { - -Table table; -TableItem tableItem; - -public Test_org_eclipse_swt_widgets_TableItem(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - makeCleanEnvironment(); -} - -protected void tearDown() { - super.tearDown(); -} - -// this method must be private or protected so the auto-gen tool keeps it -private void makeCleanEnvironment() { - if ( tableItem != null ) tableItem.dispose(); - if ( table != null ) table.dispose(); - table = new Table(shell, 0); - tableItem = new TableItem(table, 0); - setWidget(tableItem); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_TableI(){ - if (fCheckSwtNullExceptions) { - try { - TableItem tItem = new TableItem(null, SWT.NULL); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } - } -} - -public void test_ConstructorLorg_eclipse_swt_widgets_TableII() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_TableII not written"); -} - -public void test_checkSubclass() { - warnUnimpl("Test test_checkSubclass not written"); -} - -public void test_getBackground() { - // tested in test_setBackgroundLorg_eclipse_swt_graphics_Color -} - -public void test_getBoundsI(){ - int boundsX; - Rectangle bounds; - Table table2 = new Table(shell, SWT.CHECK); - TableItem tableItem2 = new TableItem(table2, SWT.NULL); - bounds = tableItem.getBounds(0); - assertTrue(":a:", bounds.x > 0 && bounds.width > 0); - boundsX = bounds.x; - bounds = tableItem.getBounds(-1); - assertTrue(":b:", bounds.equals(new Rectangle(0, 0, 0, 0))); - bounds = tableItem.getBounds(1); - assertTrue(":c:", bounds.equals(new Rectangle(0, 0, 0, 0))); - //table2.setWidths(new int[] {30}); - TableColumn column = new TableColumn(table2, SWT.NONE, 0); - column.setWidth(30); - bounds = tableItem2.getBounds(0); - assertTrue(":d:", bounds.x > boundsX && bounds.width > 0); - bounds = tableItem2.getBounds(-1); - assertEquals(new Rectangle(0, 0, 0, 0), bounds); - bounds = tableItem2.getBounds(1); - assertEquals(new Rectangle(0, 0, 0, 0), bounds); - - - // - makeCleanEnvironment(); - - Image image = images[0]; - table2.dispose(); - table2 = new Table(shell, SWT.CHECK); - tableItem2.dispose(); - tableItem2 = new TableItem(table2, SWT.NULL); - column.dispose(); - - new TableColumn(table, SWT.NULL); - new TableColumn(table, SWT.NULL); - tableItem.setImage(1, image); - bounds = tableItem.getBounds(0); - assertTrue(":a:", bounds.x > 0 && bounds.width > 0); - boundsX = bounds.x; - bounds = tableItem.getBounds(-1); - assertEquals(new Rectangle(0, 0, 0, 0), bounds); - bounds = tableItem.getBounds(1); - //assert(":c:", bounds.x > 0 && bounds.width > 0); // ?? setting the image in one column does not affect width of other columns - assertTrue(":c:", bounds.x > 0 && bounds.height > 0); - - column = new TableColumn(table2, SWT.NULL); - column.setWidth(30); - new TableColumn(table2, SWT.NULL); - tableItem2.setImage(1, image); - bounds = tableItem2.getBounds(0); - assertTrue(":d:", bounds.x > boundsX && bounds.width > 0); - bounds = tableItem2.getBounds(-1); - assertEquals(new Rectangle(0, 0, 0, 0), bounds); - bounds = tableItem2.getBounds(1); - //assert(":f:", bounds.x > 0 && bounds.width > 0); // ?? setting the image in one column does not affect width of other columns - assertTrue(":f:", bounds.x > 0 && bounds.height > 0); -} - -public void test_getChecked() { - warnUnimpl("Test test_getChecked not written"); -} - -public void test_getDisplay() { - assertEquals(table.getDisplay(), tableItem.getDisplay()); -} - -public void test_getForeground() { - // tested in test_setForegroundLorg_eclipse_swt_graphics_Color -} - -public void test_getGrayed() { - warnUnimpl("Test test_getGrayed not written"); -} - -public void test_getImageI() { - warnUnimpl("Test test_getImageI not written"); -} - -/** - * Test without item image - */ -public void test_getImageBoundsI(){ - Rectangle bounds; - Table table2 = new Table(shell, SWT.CHECK); - TableItem tableItem2 = new TableItem(table2, SWT.NULL); - int imageX; - - assertEquals(new Rectangle(0, 0, 0, 0), tableItem.getImageBounds(-1)); - - bounds = tableItem.getImageBounds(0); - assertTrue(":b:", bounds.x > 0 && bounds.width == 0); - imageX = bounds.x; - - assertEquals(new Rectangle(0, 0, 0, 0), tableItem.getImageBounds(1)); - - assertEquals(new Rectangle(0, 0, 0, 0), tableItem2.getImageBounds(-1)); - - bounds = tableItem2.getImageBounds(0); - assertTrue(":e:", bounds.x > imageX && bounds.width == 0); - - assertEquals(new Rectangle(0, 0, 0, 0), tableItem2.getImageBounds(1)); - // - makeCleanEnvironment(); - - Image image = images[0]; - int imageWidth = image.getBounds().width; - int imageHeight; - - tableItem.setImage(0, image); - imageHeight = table.getItemHeight() - table.getGridLineWidth(); - assertEquals(new Rectangle(0, 0, 0, 0), tableItem.getImageBounds(-1)); - - bounds = tableItem.getImageBounds(0); - assertTrue(":b:", bounds.x > 0 && bounds.width == imageWidth && bounds.height == imageHeight); - assertEquals(new Rectangle(0, 0, 0, 0), tableItem.getImageBounds(1)); - - - // - makeCleanEnvironment(); - - table2.dispose(); - table2 = new Table(shell, SWT.CHECK); - tableItem2.dispose(); - tableItem2 = new TableItem(table2, SWT.NULL); - Rectangle imageBounds = image.getBounds(); - imageWidth = imageBounds.width; tableItem2.setImage(0, image); - imageHeight = table2.getItemHeight() - table2.getGridLineWidth(); - assertEquals(new Rectangle(0, 0, 0, 0), tableItem2.getImageBounds(-1)); - - bounds = tableItem2.getImageBounds(0); // bounds.width should be check box width if they are wider than image - assertTrue(":b:", bounds.x > 0 && bounds.width > 0 && bounds.height == imageHeight); - assertEquals(new Rectangle(0, 0, 0, 0), tableItem2.getImageBounds(1)); - - - // - makeCleanEnvironment(); - - table2.dispose(); - table2 = new Table(shell, SWT.CHECK); - tableItem2.dispose(); - tableItem2 = new TableItem(table2, SWT.NULL); - image = images[1]; - imageBounds = image.getBounds(); - imageWidth = imageBounds.width; - tableItem2.setImage(0, image); - imageHeight = table2.getItemHeight() - table2.getGridLineWidth(); - assertEquals(new Rectangle(0, 0, 0, 0), tableItem2.getImageBounds(-1)); - bounds = tableItem2.getImageBounds(0); // bounds.width should be check box width if check box is wider than image - assertTrue(":b:", bounds.x > 0 && bounds.width > 0 && bounds.height == imageHeight); - assertEquals(new Rectangle(0, 0, 0, 0), tableItem2.getImageBounds(1)); -} - -public void test_getImageIndent() { - warnUnimpl("Test test_getImageIndent not written"); -} - -public void test_getParent() { - assertEquals(table, tableItem.getParent()); -} - -public void test_getTextI() { - warnUnimpl("Test test_getTextI not written"); -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(tableItem.getDisplay(), 255, 0, 0); - tableItem.setBackground(color); - assertEquals(color, tableItem.getBackground()); - tableItem.setBackground(null); - assertEquals(table.getBackground(),tableItem.getBackground()); - color.dispose(); - try { - tableItem.setBackground(color); - fail("No exception thrown for color disposed"); - } catch (IllegalArgumentException e) { - } -} - -public void test_setCheckedZ(){ - assertEquals(false, tableItem.getChecked()); - - tableItem.setChecked(true); - assertEquals(false, tableItem.getChecked()); - Table t = new Table(shell, SWT.CHECK); - TableItem ti = new TableItem(t, SWT.NULL); - ti.setChecked(true); - assertTrue(ti.getChecked()); - - ti.setChecked(false); - assertEquals(false, ti.getChecked()); - t.dispose(); -} - -public void test_setForegroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(tableItem.getDisplay(), 255, 0, 0); - tableItem.setForeground(color); - assertEquals(color, tableItem.getForeground()); - tableItem.setForeground(null); - assertEquals(table.getForeground(),tableItem.getForeground()); - color.dispose(); - try { - tableItem.setForeground(color); - fail("No exception thrown for color disposed"); - } catch (IllegalArgumentException e) { - } -} - -public void test_setGrayedZ() { - warnUnimpl("Test test_setGrayedZ not written"); -} - -public void test_setImage$Lorg_eclipse_swt_graphics_Image(){ - assertNull(tableItem.getImage(1)); - tableItem.setImage(-1, null); - assertNull(tableItem.getImage(-1)); - - tableItem.setImage(0, images[0]); - assertEquals(images[0], tableItem.getImage(0)); - String texts[] = new String[images.length]; - for (int i = 0; i < texts.length; i++) { - texts[i] = String.valueOf(i); - } - - //table.setText(texts); // create enough columns for TableItem.setImage(Image[]) to work - int columnCount = table.getColumnCount(); - if (columnCount < texts.length) { - for (int i = columnCount; i < texts.length; i++){ - TableColumn column = new TableColumn(table, SWT.NONE); - } - } - TableColumn[] columns = table.getColumns(); - for (int i = 0; i < texts.length; i++) { - columns[i].setText(texts[i]); - } - tableItem.setImage(1, images[1]); - assertEquals(images[1], tableItem.getImage(1)); - tableItem.setImage(images); - for (int i = 0; i < images.length; i++) { - assertEquals(images[i], tableItem.getImage(i)); - } - try { - tableItem.setImage((Image []) null); - fail("No exception thrown for images == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_setImageILorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageILorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setImageIndentI(){ - assertEquals(0, tableItem.getImageIndent()); - tableItem.setImageIndent(1); - assertEquals(1, tableItem.getImageIndent()); - tableItem.setImageIndent(-1); - assertEquals(1, tableItem.getImageIndent()); -} - -public void test_setText$Ljava_lang_String(){ - final String TestString = "test"; - final String TestStrings[] = new String[] {TestString, TestString + "1", TestString + "2"}; - - try { - tableItem.setText((String []) null); - fail("No exception thrown for strings == null"); - } - catch (IllegalArgumentException e) { - } - - /* - * Test the getText/setText API with a Table that has only - * the default column. - */ - - assertEquals(0, tableItem.getText(1).length()); - - tableItem.setText(TestStrings); - assertEquals(TestStrings[0], tableItem.getText(0)); - for (int i = 1; i < TestStrings.length; i++) { - assertEquals(0, tableItem.getText(i).length()); - } - - - /* - * Test the getText/setText API with a Table that enough - * columns to fit all test item texts. - */ - - int columnCount = table.getColumnCount(); - if (columnCount < images.length) { - for (int i = columnCount; i < images.length; i++){ - TableColumn column = new TableColumn(table, SWT.NONE); - } - } - TableColumn[] columns = table.getColumns(); - for (int i = 0; i < TestStrings.length; i++) { - columns[i].setText(TestStrings[i]); - } - assertEquals(0, tableItem.getText(1).length()); - -} - -public void test_setTextILjava_lang_String(){ - final String TestString = "test"; - final String TestStrings[] = new String[] {TestString, TestString + "1", TestString + "2"}; - - /* - * Test the getText/setText API with a Table that has only - * the default column. - */ - - assertEquals(0, tableItem.getText(1).length()); - tableItem.setText(1, TestString); - assertEquals(0, tableItem.getText(1).length()); - assertEquals(0, tableItem.getText(0).length()); - - tableItem.setText(0, TestString); - assertEquals(TestString, tableItem.getText(0)); - tableItem.setText(-1, TestStrings[1]); - assertEquals(0, tableItem.getText(-1).length()); - - /* - * Test the getText/setText API with a Table that enough - * columns to fit all test item texts. - */ - - makeCleanEnvironment(); - - //table.setText(TestStrings); // create anough columns for TableItem.setText(String[]) to work - int columnCount = table.getColumnCount(); - if (columnCount < images.length) { - for (int i = columnCount; i < images.length; i++){ - TableColumn column = new TableColumn(table, SWT.NONE); - } - } - TableColumn[] columns = table.getColumns(); - for (int i = 0; i < TestStrings.length; i++) { - columns[i].setText(TestStrings[i]); - } - assertEquals(0, tableItem.getText(1).length()); - - - tableItem.setText(1, TestString); - assertEquals(TestString, tableItem.getText(1)); - assertEquals(0, tableItem.getText(0).length()); - - tableItem.setText(0, TestString); - assertEquals(TestString, tableItem.getText(0)); - - - tableItem.setText(-1, TestStrings[1]); - assertEquals(0, tableItem.getText(-1).length()); - - - try { - tableItem.setText(-1, null); - fail("No exception thrown for string == null"); - } - catch (IllegalArgumentException e) { - } - - try { - tableItem.setText(0, null); - fail("No exception thrown for string == null"); - } - catch (IllegalArgumentException e) { - } - - -} - -public void test_setTextLjava_lang_String() { - warnUnimpl("Test test_setTextLjava_lang_String not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_TableItem((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TableI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TableII"); - methodNames.addElement("test_checkSubclass"); - methodNames.addElement("test_getBoundsI"); - methodNames.addElement("test_getChecked"); - methodNames.addElement("test_getDisplay"); - methodNames.addElement("test_getGrayed"); - methodNames.addElement("test_getImageI"); - methodNames.addElement("test_getImageBoundsI"); - methodNames.addElement("test_getImageIndent"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getTextI"); - methodNames.addElement("test_setCheckedZ"); - methodNames.addElement("test_setGrayedZ"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setForegroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setImage$Lorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setImageILorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setImageIndentI"); - methodNames.addElement("test_setText$Ljava_lang_String"); - methodNames.addElement("test_setTextILjava_lang_String"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TableI")) test_ConstructorLorg_eclipse_swt_widgets_TableI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TableII")) test_ConstructorLorg_eclipse_swt_widgets_TableII(); - else if (getName().equals("test_checkSubclass")) test_checkSubclass(); - else if (getName().equals("test_getBoundsI")) test_getBoundsI(); - else if (getName().equals("test_getChecked")) test_getChecked(); - else if (getName().equals("test_getDisplay")) test_getDisplay(); - else if (getName().equals("test_getGrayed")) test_getGrayed(); - else if (getName().equals("test_getImageI")) test_getImageI(); - else if (getName().equals("test_getImageBoundsI")) test_getImageBoundsI(); - else if (getName().equals("test_getImageIndent")) test_getImageIndent(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getTextI")) test_getTextI(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setCheckedZ")) test_setCheckedZ(); - else if (getName().equals("test_setForegroundLorg_eclipse_swt_graphics_Color")) test_setForegroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setGrayedZ")) test_setGrayedZ(); - else if (getName().equals("test_setImage$Lorg_eclipse_swt_graphics_Image")) test_setImage$Lorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setImageILorg_eclipse_swt_graphics_Image")) test_setImageILorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setImageIndentI")) test_setImageIndentI(); - else if (getName().equals("test_setText$Ljava_lang_String")) test_setText$Ljava_lang_String(); - else if (getName().equals("test_setTextILjava_lang_String")) test_setTextILjava_lang_String(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Text.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Text.java deleted file mode 100644 index 4f0ad444ad..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Text.java +++ /dev/null @@ -1,978 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Text - * - * @see org.eclipse.swt.widgets.Text - */ -public class Test_org_eclipse_swt_widgets_Text extends Test_org_eclipse_swt_widgets_Scrollable { - -Text text; -String delimiterString; - -public Test_org_eclipse_swt_widgets_Text(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- makeCleanEnvironment(false); // use multi-line by default
-} - -protected void tearDown() { - super.tearDown(); -} - -/**
- * Clean up the environment for a new test.
- *
- * @param single true if the new text widget should be single-line.
- */
-private void makeCleanEnvironment(boolean single) {
-// this method must be private or protected so the auto-gen tool keeps it
- if ( text != null ) text.dispose();
-
- if ( single == true )
- text = new Text(shell, SWT.SINGLE);
- else
- text = new Text(shell, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
- setWidget(text);
- delimiterString = Text.DELIMITER;
-} -protected void setWidget(Widget w) {
- text = (Text)w;
- super.setWidget(w);
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- try {
- text = new Text(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {0, SWT.SINGLE, SWT.MULTI, SWT.MULTI | SWT.V_SCROLL, SWT.MULTI | SWT.H_SCROLL, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL,
- SWT.WRAP};
- for (int i = 0; i < cases.length; i++)
- text = new Text(shell, cases[i]);
-} - -public void test_addModifyListenerLorg_eclipse_swt_events_ModifyListener() { - warnUnimpl("Test test_addModifyListenerLorg_eclipse_swt_events_ModifyListener not written"); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener() { - warnUnimpl("Test test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener not written"); -} - -public void test_appendLjava_lang_String(){
- try {
- text.append(null);
- fail("No exception thrown for string == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- text.setText("01");
- text.append("23");
- assertEquals("0123", text.getText());
- text.append("45");
- assertEquals("012345", text.getText());
- text.setSelection(0);
- text.append("67");
- assertEquals("01234567", text.getText());
-
- text.setText("01");
- text.append("23");
- assertEquals("0123", text.getText());
- text.append("4" + delimiterString+ "5");
- assertEquals("01234" + delimiterString +"5", text.getText());
- text.setSelection(0);
- text.append("67");
- assertEquals("01234" + delimiterString+"567", text.getText());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- try {
- text.append(null);
- fail("No exception thrown on string == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("01");
- text.append("23");
- assertEquals("0123", text.getText());
- text.append("45");
- assertEquals("012345", text.getText());
- text.setSelection(0);
- text.append("67");
- assertEquals("01234567", text.getText());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("01");
- text.append("23");
- assertEquals("0123", text.getText());
- text.append("4" + delimiterString+"5");
- assertEquals("01234" + delimiterString+"5", text.getText());
- text.setSelection(0);
- text.append("67");
- assertEquals("01234" + delimiterString+"567", text.getText());
-} - -public void test_clearSelection(){
- text.setText("01234567890");
- assertEquals("", text.getSelectionText());
- text.selectAll();
- assertEquals("01234567890", text.getSelectionText());
- text.clearSelection();
- assertEquals("", text.getSelectionText());
-
- text.setText("01234567890");
- assertEquals("", text.getSelectionText());
- text.selectAll();
- assertEquals("01234567890", text.getSelectionText());
- text.clearSelection();
- assertEquals("", text.getSelectionText());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("01234567890");
- assertEquals("", text.getSelectionText());
- text.selectAll();
- assertEquals("01234567890", text.getSelectionText());
- text.clearSelection();
- assertEquals("", text.getSelectionText());
-} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_copy(){
- text.copy();
-
- text.selectAll();
- text.copy();
- assertEquals("", text.getSelectionText());
-
- text.setText("00000");
- text.selectAll();
- text.copy();
- text.setSelection(2);
- assertEquals("", text.getSelectionText());
-
- text.setText("");
- text.paste();
- assertEquals("00000", text.getText());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.copy();
-
- text.selectAll();
- text.copy();
- assertEquals("", text.getSelectionText());
-
- text.setText("00000");
- text.selectAll();
- text.copy();
- text.setSelection(2);
- assertEquals("", text.getSelectionText());
-
- text.setText("");
- text.paste();
- assertEquals("00000", text.getText());
-} - -public void test_cut(){
- text.cut();
- text.setText("01234567890");
- text.setSelection(2, 5);
- text.cut();
- assertEquals("01567890", text.getText());
-
- text.selectAll();
- text.cut();
- assertEquals("", text.getText());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.cut();
-
- text.setText("01234567890");
- text.setSelection(2, 5);
- text.cut();
- assertEquals("01567890", text.getText());
-
- text.selectAll();
- text.cut();
- assertEquals("", text.getText());
-} - -public void test_getCaretLineNumber() { - warnUnimpl("Test test_getCaretLineNumber not written"); -} - -public void test_getCaretLocation() { - warnUnimpl("Test test_getCaretLocation not written"); -} - -public void test_getCaretPosition() { - warnUnimpl("Test test_getCaretPosition not written"); -} - -public void test_getCharCount(){
- assertEquals(0, text.getCharCount());
- text.setText("");
- assertEquals(0, text.getCharCount());
- text.setText("01234567890");
- assertEquals(11, text.getCharCount());
-
- text.setText("012345" + delimiterString+"67890");
- assertEquals(11 + delimiterString.length(), text.getCharCount()); //might be bogus on UNIX
-
- text.setText("");
- assertEquals(0, text.getCharCount());
-
- text.setText("01234\t567890");
- assertEquals(12, text.getCharCount());
-
- //
- text.setText("");
- assertEquals(0, text.getCharCount());
- text.setText("01234567890");
- assertEquals(11, text.getCharCount());
-
- text.setText("012345" + delimiterString+"67890");
- assertEquals(11 + delimiterString.length(), text.getCharCount()); //might be bogus on UNIX
-
- text.setText("");
- assertEquals(0, text.getCharCount());
-
- text.setText("01234\t567890");
- assertEquals(12, text.getCharCount());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- assertEquals(0, text.getCharCount());
- text.setText("");
- assertEquals(0, text.getCharCount());
- text.setText("01234567890");
- assertEquals(11, text.getCharCount());
- if (fCheckBogusTestCases) {
- text.setText("012345"+ delimiterString + "67890");
- assertEquals(11 + delimiterString.length(), text.getCharCount()); //might be bogus on UNIX
- }
- text.setText("");
- assertEquals(0, text.getCharCount());
- if (!SwtJunit.isAIX) {
- text.setText("01234\t567890");
- assertEquals(12, text.getCharCount());
- }
-} - -public void test_getDoubleClickEnabled(){
- text.setDoubleClickEnabled(true);
- assertTrue(text.getDoubleClickEnabled());
-
- text.setDoubleClickEnabled(false);
- assertEquals(false, text.getDoubleClickEnabled());
-
- // this method tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setDoubleClickEnabled(true);
- assertTrue(text.getDoubleClickEnabled());
-
- text.setDoubleClickEnabled(false);
- assertEquals(false, text.getDoubleClickEnabled());
-} - -public void test_getEchoChar(){
- text.setEchoChar('a');
- assertEquals('a', text.getEchoChar());
-} - -public void test_getEditable() { - warnUnimpl("Test test_getEditable not written"); -} - -public void test_getLineCount(){
- assertEquals(1, text.getLineCount());
- text.append("dddasd" + delimiterString);
- assertEquals(2, text.getLineCount());
- text.append("ddasdasdasdasd" + delimiterString);
- assertEquals(3, text.getLineCount());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- assertEquals(1, text.getLineCount());
- text.append("dddasd" + delimiterString);
- assertEquals(1, text.getLineCount());
- text.append("ddasdasdasdasd" + delimiterString);
- assertEquals(1, text.getLineCount());
-} - -public void test_getLineDelimiter() { - warnUnimpl("Test test_getLineDelimiter not written"); -} - -public void test_getLineHeight() { - warnUnimpl("Test test_getLineHeight not written"); -} - -public void test_getSelection() { - warnUnimpl("Test test_getSelection not written"); -} - -public void test_getSelectionCount() { - warnUnimpl("Test test_getSelectionCount not written"); -} - -public void test_getSelectionText(){
- text.setText("01234567890");
- assertEquals("", text.getSelectionText());
- text.setSelection(3, 7);
- assertEquals("3456", text.getSelectionText());
-
- text.selectAll();
- assertEquals("01234567890", text.getSelectionText());
-} - -public void test_getTabs() { - warnUnimpl("Test test_getTabs not written"); -} - -public void test_getText(){
- assertEquals("", text.getText());
- text.setText("01234567890");
- assertEquals("01234567890", text.getText());
- text.setText("");
- assertEquals("", text.getText());
- String string = "012345" + delimiterString + "67890";
- text.setText(string);
- assertEquals(string, text.getText());
-} - -public void test_getTextII(){
- assertEquals("", text.getText());
- text.setText("01234567890");
- assertEquals("345", text.getText(3, 5));
- // these tests should not cause a null pointer exception, checks not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- text.setText("");
- assertEquals("", text.getText(3, 5));
- text.setText("01234567890");
- assertEquals(":d:", text.getText(3, 100));
- text.setText("01234567890");
- assertEquals("34", text.getText(5, 3));
- }
-} - -public void test_getTextLimit() { - warnUnimpl("Test test_getTextLimit not written"); -} - -public void test_getTopIndex(){
- assertEquals(0, text.getTopIndex());
- text.setText("01234567890");
- assertEquals(0, text.getTopIndex());
- text.append(delimiterString +"01234567890");
- assertEquals(0, text.getTopIndex());
- text.setTopIndex(1);
- assertEquals(1, text.getTopIndex());
- text.setTopIndex(17);
- assertEquals(1, text.getTopIndex());
-} - -public void test_getTopPixel() { - warnUnimpl("Test test_getTopPixel not written"); -} - -public void test_insertLjava_lang_String(){
- try {
- text.insert(null);
- fail("No exception thrown for string == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- assertEquals("", text.getText());
- text.insert("");
- assertEquals("", text.getText());
- text.insert("fred");
- assertEquals("fred", text.getText());
- text.setSelection(2);
- text.insert("helmut");
- assertEquals("frhelmuted", text.getText());
-
- text.setText("01234567890");
- text.setSelection(4);
- assertEquals(1, text.getLineCount());
- text.insert(delimiterString);
- assertEquals(2, text.getLineCount());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- try {
- text.insert(null);
- fail("No exception thrown on string == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- assertEquals("", text.getText());
- text.insert("");
- assertEquals("", text.getText());
- text.insert("fred");
- assertEquals("fred", text.getText());
- text.setSelection(2);
- text.insert("helmut");
- assertEquals("frhelmuted", text.getText());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("01234567890");
- text.setSelection(4);
- assertEquals(1, text.getLineCount());
- text.insert(Text.DELIMITER);
- assertEquals(1, text.getLineCount());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- try {
- text.insert(null);
- fail("No exception thrown on string == null");
- }
- catch (IllegalArgumentException e) {
- }
-} - -public void test_paste(){
- text.setText("01234567890");
- text.setSelection(2, 4);
- assertEquals("01234567890", text.getText());
- text.copy();
- text.setSelection(0);
- text.paste();
- assertEquals("2301234567890", text.getText());
- text.copy();
- text.setSelection(3);
- text.paste();
- assertEquals("230231234567890", text.getText());
-
- text.setText("0" + delimiterString + "1");
- text.selectAll();
- text.copy();
- text.setSelection(0);
- text.paste();
- assertEquals("0" + delimiterString + "1" + "0" + delimiterString + "1", text.getText());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("01234567890");
- text.setSelection(2, 4);
- assertEquals("01234567890", text.getText());
- text.copy();
- text.setSelection(0);
- text.paste();
- assertEquals("2301234567890", text.getText());
- text.copy();
- text.setSelection(3);
- text.paste();
- assertEquals("230231234567890", text.getText());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("0" + delimiterString + "1");
- text.selectAll();
- text.copy();
- text.setSelection(0);
- text.paste();
-
- if (fCheckSWTPolicy)
- assertEquals("0" + delimiterString + "1" + "0" + delimiterString + "1", text.getText());
-} - -public void test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener() { - warnUnimpl("Test test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener not written"); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener() { - warnUnimpl("Test test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener not written"); -} - -public void test_selectAll(){
- text.setText("01234567890");
- assertEquals("01234567890", text.getText());
- text.selectAll();
- assertEquals("01234567890", text.getSelectionText());
- text.cut();
- assertEquals("", text.getText());
-
- text.setText("01234" + delimiterString+"567890");
- assertEquals("01234" + delimiterString+"567890", text.getText());
- text.selectAll();
- assertEquals("01234" + delimiterString+"567890", text.getSelectionText());
- text.cut();
- assertEquals("", text.getText());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("01234567890");
- assertEquals("01234567890", text.getText());
- text.selectAll();
- assertEquals("01234567890", text.getSelectionText());
- text.cut();
- assertEquals("", text.getText());
-
- // tests a SINGLE line text editor
- if (fCheckBogusTestCases) {
- text.setText("01234" + delimiterString+"567890");
- assertEquals("01234" + delimiterString+"567890", text.getText());
- text.selectAll();
- assertEquals("01234" + delimiterString+"567890", text.getSelectionText());
- text.cut();
- assertEquals("", text.getText());
- }
-} - -public void test_setDoubleClickEnabledZ(){
- text.setDoubleClickEnabled(true);
- assertTrue(text.getDoubleClickEnabled());
-
- text.setDoubleClickEnabled(false);
- assertEquals(false, text.getDoubleClickEnabled());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setDoubleClickEnabled(true);
- assertTrue(text.getDoubleClickEnabled());
-
- text.setDoubleClickEnabled(false);
- assertEquals(false, text.getDoubleClickEnabled());
-} - -public void test_setEchoCharC(){
- for (int i=0; i<128; i++){
- text.setEchoChar((char) i);
- assertEquals((char)i, text.getEchoChar());
- }
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setEchoChar('a');
- assertEquals('a', text.getEchoChar());
-
- text.setEchoChar((char) 0);
- assertEquals((char)0, text.getEchoChar());
-
- text.setEchoChar('\n');
- assertEquals('\n', text.getEchoChar());
-
- for (int i=0; i<128; i++){
- text.setEchoChar((char) i);
- assertEquals((char)i, text.getEchoChar());
- }
-} - -public void test_setEditableZ() { - warnUnimpl("Test test_setEditableZ not written"); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written"); -} - -public void test_setSelectionI() { - warnUnimpl("Test test_setSelectionI not written"); -} - -public void test_setSelectionII(){
- text.setText("01234567890");
- assertEquals(0, text.getSelectionCount());
- text.setSelection(2, 4);
- assertEquals(2, text.getSelectionCount());
- text.setSelection(2, 100);
- assertEquals(9, text.getSelectionCount());
-
- text.setText("0123" + delimiterString +"4567890");
- assertEquals(0, text.getSelectionCount());
- text.setSelection(2, 4);
- assertEquals(2, text.getSelectionCount());
- text.setSelection(2, 100);
- assertEquals(9 + delimiterString.length(), text.getSelectionCount());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("01234567890");
- assertEquals(0, text.getSelectionCount());
- text.setSelection(2, 4);
- assertEquals(2, text.getSelectionCount());
- text.setSelection(2, 100);
- assertEquals(9, text.getSelectionCount());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("0123"+ delimiterString+"4567890");
- assertEquals(0, text.getSelectionCount());
- text.setSelection(2, 4);
- assertEquals(2, text.getSelectionCount());
- if (fCheckBogusTestCases) {
- text.setSelection(2, 100);
- assertEquals(9 +delimiterString.length(), text.getSelectionCount());
- }
-} - -public void test_setRedrawZ(){
- text.setRedraw(false);
- text.setRedraw(true);
-} - -public void test_setSelectionLorg_eclipse_swt_graphics_Point(){
- text.setText("dsdsdasdslaasdas");
- try {
- text.setSelection((Point) null);
- fail("No exception thrown for selection == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- text.setText("01234567890");
- text.setSelection(new Point(2, 2));
- assertEquals(new Point(2, 2), text.getSelection());
-
- text.setSelection(new Point(3, 2));
- assertEquals(new Point(2, 3), text.getSelection());
-
- text.setSelection(new Point(3, 100));
- assertEquals(new Point(3, 11), text.getSelection());
-
text.setText("01234567890");
- text.setSelection(4);
- assertEquals(new Point(4, 4), text.getSelection());
-
- text.setSelection(100);
- assertEquals(new Point(11, 11), text.getSelection());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("dsdsdasdslaasdas");
- try {
- text.setSelection((Point) null);
- fail("No exception thrown for selection == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("01234567890");
-
- text.setSelection(new Point(2, 2));
- assertEquals(new Point(2, 2), text.getSelection());
-
- text.setSelection(new Point(3, 2));
- assertEquals(new Point(2, 3), text.getSelection());
-
- text.setSelection(new Point(3, 100));
- assertEquals(new Point(3, 11), text.getSelection());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.setText("01234567890");
- text.setSelection(4);
- assertEquals(new Point(4, 4), text.getSelection());
-
- text.setSelection(100);
- assertEquals(new Point(11, 11), text.getSelection());
-} - -public void test_setTabsI(){
- if (SwtJunit.isMotif) {
- for (int i = 0; i < 200; i++) {
- text.setTabs(i);
- assertEquals(8, text.getTabs());
- }
- } else {
- for (int i = 0; i < 200; i++) {
- text.setTabs(i);
- assertEquals(i, text.getTabs());
- }
- }
-} - -public void test_setTextLjava_lang_String(){
- try {
- text.setText(null);
- fail("No exception thrown for string == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- text.setText("");
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- assertEquals("", text.getText());
- text.setText("01234567890");
- assertEquals("01234567890", text.getText());
- text.setText("");
- assertEquals("", text.getText());
- if (fCheckBogusTestCases) {
- text.setText("012345" + delimiterString+ "67890");
- assertEquals("012345" + delimiterString +"67890", text.getText());
- }
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- assertEquals("", text.getText());
- text.setText("01234567890");
- assertEquals("345", text.getText(3, 5));
- // these tests should not cause a null pointer exception, checks not implemented yet
- if (fCheckOutOfRangeBehaviour) {
- text.setText("");
- assertEquals("", text.getText(3, 5));
- text.setText("01234567890");
- assertEquals("34567890", text.getText(3, 100));
- text.setText("01234567890");
- assertEquals("34", text.getText(5, 3));
- }
-} - -public void test_setTextLimitI() { - warnUnimpl("Test test_setTextLimitI not written"); -} - -public void test_setTopIndexI(){
- int number = 100;
- for (int i = 0; i < number; i++) {
- text.append("01234\n");
- }
- for (int i = 1; i <= number; i++) {
- text.setTopIndex(i);
- assertEquals(i, text.getTopIndex());
- }
-
- text.setTopIndex(number+5);
- assertEquals(number, text.getTopIndex());
-
- // tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- assertEquals(0, text.getTopIndex());
- text.setText("01234567890");
- assertEquals(0, text.getTopIndex());
- text.append(Text.DELIMITER +"01234567890");
- assertEquals(0, text.getTopIndex());
- text.setTopIndex(1);
- assertEquals(0, text.getTopIndex());
- text.setTopIndex(17);
- assertEquals(0, text.getTopIndex());
-
- text.setText("");
- for (int i = 0; i < number; i++) {
- text.append("01234" + Text.DELIMITER);
- }
- for (int i = 0; i < number; i++) {
- text.setTopIndex(i);
- assertEquals(0, text.getTopIndex());
- }
-} - -public void test_showSelection(){
- text.showSelection();
-
- text.selectAll();
- text.showSelection();
-
- text.setText("00000");
- text.selectAll();
- text.showSelection();
- text.clearSelection();
- text.showSelection();
-
- // this method tests a SINGLE line text editor
- makeCleanEnvironment(true);
-
- text.showSelection();
-
- text.selectAll();
- text.showSelection();
-
-
- text.setText("00000");
- text.selectAll();
- text.showSelection();
-
- text.clearSelection();
- text.showSelection();
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Text((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener"); - methodNames.addElement("test_appendLjava_lang_String"); - methodNames.addElement("test_clearSelection"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_copy"); - methodNames.addElement("test_cut"); - methodNames.addElement("test_getCaretLineNumber"); - methodNames.addElement("test_getCaretLocation"); - methodNames.addElement("test_getCaretPosition"); - methodNames.addElement("test_getCharCount"); - methodNames.addElement("test_getDoubleClickEnabled"); - methodNames.addElement("test_getEchoChar"); - methodNames.addElement("test_getEditable"); - methodNames.addElement("test_getLineCount"); - methodNames.addElement("test_getLineDelimiter"); - methodNames.addElement("test_getLineHeight"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionCount"); - methodNames.addElement("test_getSelectionText"); - methodNames.addElement("test_getTabs"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_getTextII"); - methodNames.addElement("test_getTextLimit"); - methodNames.addElement("test_getTopIndex"); - methodNames.addElement("test_getTopPixel"); - methodNames.addElement("test_insertLjava_lang_String"); - methodNames.addElement("test_paste"); - methodNames.addElement("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener"); - methodNames.addElement("test_selectAll"); - methodNames.addElement("test_setDoubleClickEnabledZ"); - methodNames.addElement("test_setEchoCharC"); - methodNames.addElement("test_setEditableZ"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setSelectionI"); - methodNames.addElement("test_setSelectionII"); - methodNames.addElement("test_setRedrawZ"); - methodNames.addElement("test_setSelectionLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setTabsI"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_setTextLimitI"); - methodNames.addElement("test_setTopIndexI"); - methodNames.addElement("test_showSelection"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Scrollable.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_addModifyListenerLorg_eclipse_swt_events_ModifyListener(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener")) test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener(); - else if (getName().equals("test_appendLjava_lang_String")) test_appendLjava_lang_String(); - else if (getName().equals("test_clearSelection")) test_clearSelection(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_copy")) test_copy(); - else if (getName().equals("test_cut")) test_cut(); - else if (getName().equals("test_getCaretLineNumber")) test_getCaretLineNumber(); - else if (getName().equals("test_getCaretLocation")) test_getCaretLocation(); - else if (getName().equals("test_getCaretPosition")) test_getCaretPosition(); - else if (getName().equals("test_getCharCount")) test_getCharCount(); - else if (getName().equals("test_getDoubleClickEnabled")) test_getDoubleClickEnabled(); - else if (getName().equals("test_getEchoChar")) test_getEchoChar(); - else if (getName().equals("test_getEditable")) test_getEditable(); - else if (getName().equals("test_getLineCount")) test_getLineCount(); - else if (getName().equals("test_getLineDelimiter")) test_getLineDelimiter(); - else if (getName().equals("test_getLineHeight")) test_getLineHeight(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionCount")) test_getSelectionCount(); - else if (getName().equals("test_getSelectionText")) test_getSelectionText(); - else if (getName().equals("test_getTabs")) test_getTabs(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_getTextII")) test_getTextII(); - else if (getName().equals("test_getTextLimit")) test_getTextLimit(); - else if (getName().equals("test_getTopIndex")) test_getTopIndex(); - else if (getName().equals("test_getTopPixel")) test_getTopPixel(); - else if (getName().equals("test_insertLjava_lang_String")) test_insertLjava_lang_String(); - else if (getName().equals("test_paste")) test_paste(); - else if (getName().equals("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener")) test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener(); - else if (getName().equals("test_selectAll")) test_selectAll(); - else if (getName().equals("test_setDoubleClickEnabledZ")) test_setDoubleClickEnabledZ(); - else if (getName().equals("test_setEchoCharC")) test_setEchoCharC(); - else if (getName().equals("test_setEditableZ")) test_setEditableZ(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else if (getName().equals("test_setSelectionII")) test_setSelectionII(); - else if (getName().equals("test_setRedrawZ")) test_setRedrawZ(); - else if (getName().equals("test_setSelectionLorg_eclipse_swt_graphics_Point")) test_setSelectionLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setTabsI")) test_setTabsI(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_setTextLimitI")) test_setTextLimitI(); - else if (getName().equals("test_setTopIndexI")) test_setTopIndexI(); - else if (getName().equals("test_showSelection")) test_showSelection(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolBar.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolBar.java deleted file mode 100644 index 1e371d0567..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolBar.java +++ /dev/null @@ -1,208 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.ToolBar - * - * @see org.eclipse.swt.widgets.ToolBar - */ -public class Test_org_eclipse_swt_widgets_ToolBar extends Test_org_eclipse_swt_widgets_Composite { - -protected ToolBar toolBar; - -public Test_org_eclipse_swt_widgets_ToolBar(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- toolBar = new ToolBar(shell, 0);
- setWidget(toolBar);
-} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- if (fCheckSwtNullExceptions) {
- ToolBar newToolBar;
- try {
- newToolBar = new ToolBar(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-} - -public void test_checkSubclass() { - warnUnimpl("Test test_checkSubclass not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_computeTrimIIII() { - warnUnimpl("Test test_computeTrimIIII not written"); -} - -public void test_getItemI(){
- int number = 5;
- ToolItem[] items = new ToolItem[number];
- for (int i = 0; i<number ; i++){
- items[i] = new ToolItem(toolBar, 0);
- }
- for (int i = 0; i<number ; i++){
- assertTrue(":a:", toolBar.getItem(i)==items[i]);
- }
-
- toolBar = new ToolBar(shell, 0);
- number = 5;
- items = new ToolItem[number];
- for (int i = 0; i<number ; i++){
- items[i] = new ToolItem(toolBar, 0);
- }
- try {
- toolBar.getItem(number);
- fail("No exception thrown for illegal index argument");
- }
- catch (IllegalArgumentException e) {
- }
-} - -public void test_getItemLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_getItemLorg_eclipse_swt_graphics_Point not written"); -} - -public void test_getItemCount(){
- int number = 10;
- ToolItem ti;
- for (int i = 0; i<number ; i++){
- assertTrue(":a:" + i, toolBar.getItemCount()==i);
- ti = new ToolItem(toolBar, 0);
- }
-} - -public void test_getItems(){
- int number = 5;
- ToolItem[] items = new ToolItem[number];
- for (int i = 0; i<number ; i++){
- items[i] = new ToolItem(toolBar, 0);
- }
- assertEquals(items, toolBar.getItems());
-
- toolBar.getItems()[0].dispose();
- assertEquals(new ToolItem[]{items[1], items[2], items[3], items[4]}, toolBar.getItems());
-
- toolBar.getItems()[3].dispose();
- assertEquals(new ToolItem[]{items[1], items[2], items[3]}, toolBar.getItems());
-
- toolBar.getItems()[1].dispose();
- assertEquals(new ToolItem[]{items[1], items[3]}, toolBar.getItems());
-} - -public void test_getRowCount(){
- toolBar = new ToolBar(shell, SWT.WRAP);
- int number = 5;
- ToolItem[] items = new ToolItem[number];
- for (int i = 0; i<number ; i++){
- items[i] = new ToolItem(toolBar, 0);
- }
- assertTrue(":a:" + toolBar.getRowCount(), toolBar.getRowCount()==number); //???? because of Size(0, 0)
-
- toolBar = new ToolBar(shell, 0);
- number = 5;
- items = new ToolItem[number];
- for (int i = 0; i<number ; i++){
- items[i] = new ToolItem(toolBar, 0);
- }
- assertTrue(":a:", toolBar.getRowCount()==1);
-} - -public void test_indexOfLorg_eclipse_swt_widgets_ToolItem(){
- int number = 10;
- ToolItem[] tis = new ToolItem[number];
- for (int i = 0; i<number ; i++){
- tis[i] = new ToolItem(toolBar, 0);
- }
- for (int i = 0; i<number ; i++){
- assertTrue(":a:" + i, toolBar.indexOf(tis[i])==i);
- }
-
- number = 10;
- tis = new ToolItem[number];
- for (int i = 0; i<number ; i++){
- tis[i] = new ToolItem(toolBar, 0);
- }
- for (int i = 0; i<number ; i++){
- try {
- toolBar.indexOf(null);
- fail("No exception thrown for toolItem == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-} - -public void test_setFocus() { - warnUnimpl("Test test_setFocus not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_ToolBar((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_checkSubclass"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_computeTrimIIII"); - methodNames.addElement("test_getItemI"); - methodNames.addElement("test_getItemLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getRowCount"); - methodNames.addElement("test_indexOfLorg_eclipse_swt_widgets_ToolItem"); - methodNames.addElement("test_setFocus"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_checkSubclass")) test_checkSubclass(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII(); - else if (getName().equals("test_getItemI")) test_getItemI(); - else if (getName().equals("test_getItemLorg_eclipse_swt_graphics_Point")) test_getItemLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getRowCount")) test_getRowCount(); - else if (getName().equals("test_indexOfLorg_eclipse_swt_widgets_ToolItem")) test_indexOfLorg_eclipse_swt_widgets_ToolItem(); - else if (getName().equals("test_setFocus")) test_setFocus(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolItem.java deleted file mode 100644 index 9b09dd0b8b..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolItem.java +++ /dev/null @@ -1,225 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.ToolItem - * - * @see org.eclipse.swt.widgets.ToolItem - */ -public class Test_org_eclipse_swt_widgets_ToolItem extends Test_org_eclipse_swt_widgets_Item { - -ToolBar toolBar; -ToolItem toolItem; - -public Test_org_eclipse_swt_widgets_ToolItem(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- toolBar = new ToolBar(shell, 0);
- toolItem = new ToolItem(toolBar, 0);
- setWidget(toolItem);
-} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ToolBarI(){
- if (fCheckSwtNullExceptions) {
- try {
- ToolItem tItem = new ToolItem(null, SWT.NULL);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_ToolBarII() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ToolBarII not written"); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_checkSubclass() { - warnUnimpl("Test test_checkSubclass not written"); -} - -public void test_getBounds() { - warnUnimpl("Test test_getBounds not written"); -} - -public void test_getControl() { - warnUnimpl("Test test_getControl not written"); -} - -public void test_getDisabledImage() { - warnUnimpl("Test test_getDisabledImage not written"); -} - -public void test_getDisplay() { - warnUnimpl("Test test_getDisplay not written"); -} - -public void test_getEnabled() { - warnUnimpl("Test test_getEnabled not written"); -} - -public void test_getHotImage() { - warnUnimpl("Test test_getHotImage not written"); -} - -public void test_getParent() { - warnUnimpl("Test test_getParent not written"); -} - -public void test_getSelection(){
- // Test for method boolean org.eclipse.swt.widgets.ToolItem.getSelection()
- warnUnimpl( "Test Test_org_eclipse_swt_widgets_ToolItem.test_5_getSelection not written");
-} - -public void test_getToolTipText(){
- toolItem.setToolTipText("fred");
- assertTrue(":a: ", toolItem.getToolTipText().equals("fred"));
- toolItem.setToolTipText("fredttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt");
- assertTrue(":a: ", toolItem.getToolTipText().equals("fredttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt"));
-} - -public void test_getWidth() { - warnUnimpl("Test test_getWidth not written"); -} - -public void test_isEnabled(){
- // Test for method boolean org.eclipse.swt.widgets.ToolItem.isEnabled()
- warnUnimpl( "Test Test_org_eclipse_swt_widgets_ToolItem.test_7_isEnabled not written");
-} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_setControlLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setControlLorg_eclipse_swt_widgets_Control not written"); -} - -public void test_setEnabledZ(){
- // Test for method void org.eclipse.swt.widgets.ToolItem.setEnabled(boolean)
- warnUnimpl( "Test Test_org_eclipse_swt_widgets_ToolItem.test_8_setEnabled not written");
-} - -public void test_setDisabledImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setDisabledImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setHotImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setHotImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setSelectionZ() { - warnUnimpl("Test test_setSelectionZ not written"); -} - -public void test_setTextLjava_lang_String() { - warnUnimpl("Test test_setTextLjava_lang_String not written"); -} - -public void test_setToolTipTextLjava_lang_String() { - warnUnimpl("Test test_setToolTipTextLjava_lang_String not written"); -} - -public void test_setWidthI() { - warnUnimpl("Test test_setWidthI not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_ToolItem((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ToolBarI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ToolBarII"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_checkSubclass"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getControl"); - methodNames.addElement("test_getDisabledImage"); - methodNames.addElement("test_getDisplay"); - methodNames.addElement("test_getEnabled"); - methodNames.addElement("test_getHotImage"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getToolTipText"); - methodNames.addElement("test_getWidth"); - methodNames.addElement("test_isEnabled"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_setControlLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setEnabledZ"); - methodNames.addElement("test_setDisabledImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setHotImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setSelectionZ"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_setToolTipTextLjava_lang_String"); - methodNames.addElement("test_setWidthI"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ToolBarI")) test_ConstructorLorg_eclipse_swt_widgets_ToolBarI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ToolBarII")) test_ConstructorLorg_eclipse_swt_widgets_ToolBarII(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_checkSubclass")) test_checkSubclass(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getControl")) test_getControl(); - else if (getName().equals("test_getDisabledImage")) test_getDisabledImage(); - else if (getName().equals("test_getDisplay")) test_getDisplay(); - else if (getName().equals("test_getEnabled")) test_getEnabled(); - else if (getName().equals("test_getHotImage")) test_getHotImage(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getToolTipText")) test_getToolTipText(); - else if (getName().equals("test_getWidth")) test_getWidth(); - else if (getName().equals("test_isEnabled")) test_isEnabled(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_setControlLorg_eclipse_swt_widgets_Control")) test_setControlLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setEnabledZ")) test_setEnabledZ(); - else if (getName().equals("test_setDisabledImageLorg_eclipse_swt_graphics_Image")) test_setDisabledImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setHotImageLorg_eclipse_swt_graphics_Image")) test_setHotImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setSelectionZ")) test_setSelectionZ(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_setToolTipTextLjava_lang_String")) test_setToolTipTextLjava_lang_String(); - else if (getName().equals("test_setWidthI")) test_setWidthI(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tracker.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tracker.java deleted file mode 100644 index 6f65a2dddf..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tracker.java +++ /dev/null @@ -1,124 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.widgets.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Tracker - * - * @see org.eclipse.swt.widgets.Tracker - */ -public class Test_org_eclipse_swt_widgets_Tracker extends Test_org_eclipse_swt_widgets_Widget { - - Tracker tracker; - -public Test_org_eclipse_swt_widgets_Tracker(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - tracker = new Tracker(shell, 0); - setWidget(tracker); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_DisplayI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_DisplayI not written"); -} - -public void test_addControlListenerLorg_eclipse_swt_events_ControlListener() { - warnUnimpl("Test test_addControlListenerLorg_eclipse_swt_events_ControlListener not written"); -} - -public void test_close() { - warnUnimpl("Test test_close not written"); -} - -public void test_getDisplay() { - warnUnimpl("Test test_getDisplay not written"); -} - -public void test_getRectangles() { - warnUnimpl("Test test_getRectangles not written"); -} - -public void test_getStippled() { - warnUnimpl("Test test_getStippled not written"); -} - -public void test_open() { - warnUnimpl("Test test_open not written"); -} - -public void test_removeControlListenerLorg_eclipse_swt_events_ControlListener() { - warnUnimpl("Test test_removeControlListenerLorg_eclipse_swt_events_ControlListener not written"); -} - -public void test_setRectangles$Lorg_eclipse_swt_graphics_Rectangle() { - warnUnimpl("Test test_setRectangles$Lorg_eclipse_swt_graphics_Rectangle not written"); -} - -public void test_setStippledZ() { - warnUnimpl("Test test_setStippledZ not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Tracker((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_DisplayI"); - methodNames.addElement("test_addControlListenerLorg_eclipse_swt_events_ControlListener"); - methodNames.addElement("test_close"); - methodNames.addElement("test_getDisplay"); - methodNames.addElement("test_getRectangles"); - methodNames.addElement("test_getStippled"); - methodNames.addElement("test_open"); - methodNames.addElement("test_removeControlListenerLorg_eclipse_swt_events_ControlListener"); - methodNames.addElement("test_setRectangles$Lorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_setStippledZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_DisplayI")) test_ConstructorLorg_eclipse_swt_widgets_DisplayI(); - else if (getName().equals("test_addControlListenerLorg_eclipse_swt_events_ControlListener")) test_addControlListenerLorg_eclipse_swt_events_ControlListener(); - else if (getName().equals("test_close")) test_close(); - else if (getName().equals("test_getDisplay")) test_getDisplay(); - else if (getName().equals("test_getRectangles")) test_getRectangles(); - else if (getName().equals("test_getStippled")) test_getStippled(); - else if (getName().equals("test_open")) test_open(); - else if (getName().equals("test_removeControlListenerLorg_eclipse_swt_events_ControlListener")) test_removeControlListenerLorg_eclipse_swt_events_ControlListener(); - else if (getName().equals("test_setRectangles$Lorg_eclipse_swt_graphics_Rectangle")) test_setRectangles$Lorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_setStippledZ")) test_setStippledZ(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java deleted file mode 100644 index 551dd8dda4..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java +++ /dev/null @@ -1,509 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Tree - * - * @see org.eclipse.swt.widgets.Tree - */ -public class Test_org_eclipse_swt_widgets_Tree extends Test_org_eclipse_swt_widgets_Composite { - -public Tree tree; - -public Test_org_eclipse_swt_widgets_Tree(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() {
- super.setUp();
- tree = new Tree(shell, SWT.MULTI);
- setWidget(tree);
-} - -protected void tearDown() { - super.tearDown(); -} - -/**
- * Clean up the environment for a new test.
- *
- * @param single true if the new tree should be a single-selection one,
- * otherwise use multi-selection.
- */
-private void makeCleanEnvironment(boolean single) {
-// this method must be private or protected so the auto-gen tool keeps it
- tree.dispose();
- tree = new Tree(shell, single?SWT.SINGLE:SWT.MULTI);
- setWidget(tree);
-} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- try {
- tree = new Tree(null, 0);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {0, SWT.BORDER};
- for (int i = 0; i < cases.length; i++)
- tree = new Tree(shell, cases[i]);
-
- cases = new int[]{0, 10, 100};
- for (int j = 0; j < cases.length; j++) {
- for (int i = 0; i < cases[j]; i++) {
- TreeItem ti = new TreeItem(tree, 0);
- }
- assertEquals(cases[j], tree.getItemCount());
- tree.removeAll();
- }
-} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_addTreeListenerLorg_eclipse_swt_events_TreeListener() { - warnUnimpl("Test test_addTreeListenerLorg_eclipse_swt_events_TreeListener not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_deselectAll() {
- int number = 15;
- TreeItem[] items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
-
- assertEquals(0, tree.getSelectionCount());
- tree.setSelection(new TreeItem[] {items[2], items[4], items[5], items[10]});
-
- assertEquals(4, tree.getSelectionCount());
-
- tree.deselectAll();
- assertEquals(0, tree.getSelectionCount());
-
- tree.selectAll();
- assertEquals(number, tree.getSelectionCount());
-
- tree.deselectAll();
- assertEquals(0, tree.getSelectionCount());
-} - -public void test_getItemLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_getItemLorg_eclipse_swt_graphics_Point not written"); -} - -public void test_getItemCount() { - warnUnimpl("Test test_getItemCount not written"); -} - -public void test_getItemHeight() {
- assertTrue(":a: Item height is 0", tree.getItemHeight() > 0);
- new TreeItem(tree, 0);
- assertTrue(":b: Item height is 0", tree.getItemHeight() > 0);
-} - -public void test_getItems(){
- int[] cases = {0, 10, 100};
- for (int j = 0; j < cases.length; j++) {
- for (int i = 0; i < cases[j]; i++) {
- TreeItem ti = new TreeItem(tree, 0);
- }
- assertEquals(cases[j], tree.getItems().length);
- tree.removeAll();
- assertEquals(0, tree.getItemCount());
- }
-
- makeCleanEnvironment(false);
-
- for (int j = 0; j < cases.length; j++) {
- for (int i = 0; i < cases[j]; i++) {
- TreeItem ti = new TreeItem(tree, 0);
- ti.setText(String.valueOf(i));
- }
- TreeItem[] items = tree.getItems();
- for (int i = 0; i < items.length; i++) {
- assertEquals(String.valueOf(i), items[i].getText());
- }
- tree.removeAll();
- assertEquals(0, tree.getItemCount());
- }
-} - -public void test_getParentItem() {
- assertNull(tree.getParentItem());
-} - -public void test_getSelection() { - warnUnimpl("Test test_getSelection not written"); -} - -public void test_getSelectionCount(){
- makeCleanEnvironment(true); // use single-selection tree.
-
- int number = 15;
- TreeItem[] items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
-
- assertEquals(0, tree.getSelectionCount());
-
- tree.setSelection(new TreeItem[]{items[2], items[number-1], items[10]});
- assertEquals(1, tree.getSelectionCount());
-
- tree.setSelection(items);
- assertEquals(1, tree.getSelectionCount());
-} - -public void test_removeAll() {
- tree.removeAll();
-
- int number = 20;
- TreeItem[] items = new TreeItem[number];
- for (int i = 0; i < number; i++) {
- items[i] = new TreeItem(tree, 0);
- }
- tree.removeAll();
- assertEquals(0, tree.getItemCount());
-} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_removeTreeListenerLorg_eclipse_swt_events_TreeListener() { - warnUnimpl("Test test_removeTreeListenerLorg_eclipse_swt_events_TreeListener not written"); -} - -public void test_setInsertMarkLorg_eclipse_swt_widgets_TreeItemZ() { - warnUnimpl("Test test_setInsertMarkLorg_eclipse_swt_widgets_TreeItemZ not written"); -} - -public void test_selectAll(){
- int number = 5;
- TreeItem[] items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
-
- assertEquals(0, tree.getSelectionCount());
- tree.selectAll();
- assertEquals(number, tree.getSelectionCount());
-
- makeCleanEnvironment(true); // single-selection tree
-
- items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
-
- assertEquals(0, tree.getSelectionCount());
- tree.selectAll();
- assertEquals(0, tree.getSelectionCount());
-} - -public void test_setRedrawZ() { - warnUnimpl("Test test_setRedrawZ not written"); -} - -public void test_setSelection$Lorg_eclipse_swt_widgets_TreeItem(){
- int number = 20;
- TreeItem[] items = new TreeItem[number];
- for (int i = 0; i < number; i++) {
- items[i] = new TreeItem(tree, 0);
- }
- TreeItem[] itemsToBeSelected = {items[5], items[16], items[19]};
- tree.setSelection(itemsToBeSelected);
- TreeItem[] selItems = tree.getSelection();
- int selLength = selItems.length;
- if (fCheckMultiSelectTree) {
- assertTrue(":len:" + String.valueOf(selLength), selLength != itemsToBeSelected.length);
- for (int i = 0; i < selLength; i++)
- if (selItems[i] == itemsToBeSelected[i])
- fail();
- }
- tree.setSelection(tree.getItems());
- assertEquals(":b:", items, tree.getItems());
- tree.setSelection(new TreeItem[] {});
- if (fCheckMultiSelectTree)
- assertEquals(":c:", new TreeItem[] {}, tree.getItems());
- try {
- tree.setSelection((TreeItem[]) null);
- fail("No exception thrown for items == null");
- }
- catch (IllegalArgumentException e) {
- }
- tree.removeAll();
-
- makeCleanEnvironment(false);
-
- number = 5;
- items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
- try {
- tree.setSelection((TreeItem[]) null);
- fail("No exception thrown for items == null");
- }
- catch (IllegalArgumentException e) {
- }
- assertEquals(0, tree.getSelectionCount());
-
- makeCleanEnvironment(false);
-
- items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
-
- tree.setSelection(new TreeItem[]{});
- assertEquals(0, tree.getSelectionCount());
-
- tree.setSelection(new TreeItem[]{items[0], items[3], items[2]});
- assertEquals(":b:", new TreeItem[]{items[0], items[2], items[3]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[3], items[2], items[1]});
- assertEquals(":c:", new TreeItem[]{items[1], items[2], items[3]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[1], items[4], items[0]});
- assertEquals(":d:", new TreeItem[]{items[0], items[1], items[4]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[0], items[4], items[0]});
- assertEquals(":e:", new TreeItem[]{items[0], items[4]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[2], items[3], items[4]});
- assertEquals(":f:", new TreeItem[]{items[2], items[3], items[4]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[4], items[4], items[4], items[4], items[4], items[4]});
- assertEquals(":g:", new TreeItem[]{items[4]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[4]});
- assertEquals(":h:", new TreeItem[]{items[4]}, tree.getSelection());
-
- makeCleanEnvironment(false);
-
- items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
-
- tree.setSelection(new TreeItem[] {items[0]});
- assertEquals(":a:", new TreeItem[] {items[0]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[] {items[3]});
- assertEquals(":b:", new TreeItem[] {items[3]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[] {items[4]});
- assertEquals(":c:", new TreeItem[] {items[4]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[] {items[2]});
- assertEquals(":d:", new TreeItem[] {items[2]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[] {items[1]});
- assertEquals(":e:", new TreeItem[] {items[1]}, tree.getSelection());
-
- makeCleanEnvironment(true); // single-selection tree
-
- number = 15;
- items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
-
- assertEquals(":a:", new TreeItem[] {}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[10], items[number-1], items[2]});
- assertEquals(":b:", new TreeItem[] {items[10]}, tree.getSelection());
-
- tree.setSelection(items);
- assertEquals(":c:", new TreeItem[] {items[0]}, tree.getSelection());
-
- makeCleanEnvironment(true); //single-selection tree
-
- number = 5;
- items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
- try {
- tree.setSelection((TreeItem[]) null);
- fail("No exception thrown for items == null");
- }
- catch (IllegalArgumentException e) {
- }
- assertEquals(0, tree.getSelectionCount());
-
- makeCleanEnvironment(true); // single-selection tree
-
- number = 5;
- items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
-
- tree.setSelection(new TreeItem[]{});
- assertEquals(0, tree.getSelectionCount());
-
- tree.setSelection(new TreeItem[]{items[0], items[3], items[2]});
- assertEquals(":b:", new TreeItem[]{items[0]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[3], items[2], items[1]});
- assertEquals(":c:", new TreeItem[]{items[3]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[1], items[4], items[0]});
- assertEquals(":d:", new TreeItem[]{items[1]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[0], items[4], items[0]});
- assertEquals(":e:", new TreeItem[]{items[0]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[2], items[3], items[4]});
- assertEquals(":f:", new TreeItem[]{items[2]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[4], items[4], items[4], items[4], items[4], items[4]});
- assertEquals(":g:", new TreeItem[]{items[4]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[]{items[4]});
- assertEquals(":h:", new TreeItem[]{items[4]}, tree.getSelection());
-
- makeCleanEnvironment(true); //single-selection tree
-
- number = 5;
- items = new TreeItem[number];
- for (int i = 0; i < number; i++)
- items[i] = new TreeItem(tree, 0);
-
- tree.setSelection(new TreeItem[] {items[0]});
- assertEquals(":a:", new TreeItem[] {items[0]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[] {items[3]});
- assertEquals(":b:", new TreeItem[] {items[3]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[] {items[4]});
- assertEquals(":c:", new TreeItem[] {items[4]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[] {items[2]});
- assertEquals(":d:", new TreeItem[] {items[2]}, tree.getSelection());
-
- tree.setSelection(new TreeItem[] {items[1]});
- assertEquals(":e:", new TreeItem[] {items[1]}, tree.getSelection());
-} - -public void test_showItemLorg_eclipse_swt_widgets_TreeItem(){
- try {
- tree.showItem(null);
- fail("No exception thrown for item == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- int number = 20;
- TreeItem[] items = new TreeItem[number];
- for (int i = 0; i < number; i++) {
- items[i] = new TreeItem(tree, 0);
- }
- for(int i=0; i<number; i++)
- tree.showItem(items[i]);
-
- tree.removeAll();
-
- makeCleanEnvironment(false);
- //showing somebody else's items
-
- items = new TreeItem[number];
- for (int i = 0; i < number; i++) {
- items[i] = new TreeItem(tree, 0);
- }
-
- Tree tree2 = new Tree(shell, 0);
- TreeItem[] items2 = new TreeItem[number];
- for (int i = 0; i < number; i++) {
- items2[i] = new TreeItem(tree2, 0);
- };
-
- for(int i=0; i<number; i++)
- tree.showItem(items2[i]);
-
- tree.removeAll();
-} - -public void test_showSelection() {
- TreeItem item;
-
- tree.showSelection();
- item = new TreeItem(tree, 0);
- tree.setSelection(new TreeItem[]{item});
- tree.showSelection();
-} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Tree((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_addTreeListenerLorg_eclipse_swt_events_TreeListener"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_deselectAll"); - methodNames.addElement("test_getItemLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItemHeight"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getParentItem"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionCount"); - methodNames.addElement("test_removeAll"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_removeTreeListenerLorg_eclipse_swt_events_TreeListener"); - methodNames.addElement("test_setInsertMarkLorg_eclipse_swt_widgets_TreeItemZ"); - methodNames.addElement("test_selectAll"); - methodNames.addElement("test_setRedrawZ"); - methodNames.addElement("test_setSelection$Lorg_eclipse_swt_widgets_TreeItem"); - methodNames.addElement("test_showItemLorg_eclipse_swt_widgets_TreeItem"); - methodNames.addElement("test_showSelection"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_addTreeListenerLorg_eclipse_swt_events_TreeListener")) test_addTreeListenerLorg_eclipse_swt_events_TreeListener(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_deselectAll")) test_deselectAll(); - else if (getName().equals("test_getItemLorg_eclipse_swt_graphics_Point")) test_getItemLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItemHeight")) test_getItemHeight(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getParentItem")) test_getParentItem(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionCount")) test_getSelectionCount(); - else if (getName().equals("test_removeAll")) test_removeAll(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_removeTreeListenerLorg_eclipse_swt_events_TreeListener")) test_removeTreeListenerLorg_eclipse_swt_events_TreeListener(); - else if (getName().equals("test_setInsertMarkLorg_eclipse_swt_widgets_TreeItemZ")) test_setInsertMarkLorg_eclipse_swt_widgets_TreeItemZ(); - else if (getName().equals("test_selectAll")) test_selectAll(); - else if (getName().equals("test_setRedrawZ")) test_setRedrawZ(); - else if (getName().equals("test_setSelection$Lorg_eclipse_swt_widgets_TreeItem")) test_setSelection$Lorg_eclipse_swt_widgets_TreeItem(); - else if (getName().equals("test_showItemLorg_eclipse_swt_widgets_TreeItem")) test_showItemLorg_eclipse_swt_widgets_TreeItem(); - else if (getName().equals("test_showSelection")) test_showSelection(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java deleted file mode 100644 index 1e336e1ec8..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java +++ /dev/null @@ -1,309 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.TreeItem - * - * @see org.eclipse.swt.widgets.TreeItem - */ -public class Test_org_eclipse_swt_widgets_TreeItem extends Test_org_eclipse_swt_widgets_Item { - -TreeItem treeItem; -Tree tree; - -public Test_org_eclipse_swt_widgets_TreeItem(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - tree = new Tree(shell, 0); - treeItem = new TreeItem(tree, 0); - setWidget(treeItem); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_TreeI(){ - if (fCheckSwtNullExceptions) { - try { - TreeItem tItem = new TreeItem((TreeItem)null, SWT.NULL); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } - } - - for (int i=0; i<10; i++) { - new TreeItem(tree, 0); - } - assertEquals(11, tree.getItemCount()); - new TreeItem(tree, 0, 5); - assertEquals(12, tree.getItemCount()); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_TreeII(){ - try { - new TreeItem(tree, 0, 5); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_ConstructorLorg_eclipse_swt_widgets_TreeItemI(){ - for (int i = 0; i < 10; i++) { - new TreeItem(treeItem, 0); - } - assertEquals(10, treeItem.getItemCount()); - new TreeItem(treeItem, 0, 5); - assertEquals(1, tree.getItemCount()); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_TreeItemII(){ - if (fCheckOutOfRangeBehaviour) { - try { - new TreeItem(treeItem, 0, 5); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) { - } - assertEquals(1, tree.getItemCount()); - } -} - -public void test_checkSubclass() { - warnUnimpl("Test test_checkSubclass not written"); -} - -public void test_getBackground() { - // tested in test_setBackgroundLorg_eclipse_swt_graphics_Color -} - -public void test_getBounds() { - warnUnimpl("Test test_getBounds not written"); -} - -public void test_getChecked(){ - Tree newTree = new Tree(shell, SWT.CHECK); - TreeItem tItem = new TreeItem(newTree,0); - assertEquals(false, tItem.getChecked()); - tItem.setChecked(true); - assertTrue(tItem.getChecked()); - tItem.setChecked(false); - assertEquals(false, tItem.getChecked()); -} - -public void test_getDisplay() { - assertEquals(tree.getDisplay(), treeItem.getDisplay()); -} - -public void test_getExpanded(){ - assertEquals(false, treeItem.getExpanded()); - // there must be at least one subitem before you can set the treeitem expanded - new TreeItem(treeItem, 0); - treeItem.setExpanded(true); - assertTrue(treeItem.getExpanded()); - treeItem.setExpanded(false); - assertEquals(false, treeItem.getExpanded()); -} - -public void test_getForeground() { - // tested in test_setForegroundLorg_eclipse_swt_graphics_Color -} - -public void test_getGrayed() { - warnUnimpl("Test test_getGrayed not written"); -} - -public void test_getItemCount(){ - for (int i = 0; i < 10; i++) { - assertEquals(i, treeItem.getItemCount()); - new TreeItem(treeItem, 0); - } - assertTrue("b: ", treeItem.getItemCount() == 10); -} - -public void test_getItems(){ - if (fCheckBogusTestCases) { - int[] cases = {2, 10, 100}; - for (int j = 0; j < cases.length; j++) { - for (int i = 0; i < cases[j]; i++) { - TreeItem ti = new TreeItem(tree, 0); - } - assertEquals(cases[j], tree.getItems().length); - tree.removeAll(); - assertEquals(0, tree.getItemCount()); - } - } -} - -public void test_getParent(){ - assertEquals(tree, treeItem.getParent()); -} - -public void test_getParentItem(){ - TreeItem tItem = new TreeItem(treeItem, SWT.NULL); - assertEquals(treeItem, tItem.getParentItem()); -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(treeItem.getDisplay(), 255, 0, 0); - treeItem.setBackground(color); - assertEquals(color, treeItem.getBackground()); - treeItem.setBackground(null); - assertEquals(tree.getBackground(),treeItem.getBackground()); - color.dispose(); - try { - treeItem.setBackground(color); - fail("No exception thrown for color disposed"); - } catch (IllegalArgumentException e) { - } -} - - -public void test_setCheckedZ(){ - assertEquals(false, treeItem.getChecked()); - - treeItem.setChecked(true); - assertEquals(false, treeItem.getChecked()); - - Tree t = new Tree(shell, SWT.CHECK); - TreeItem ti = new TreeItem(t, SWT.NULL); - ti.setChecked(true); - assertTrue(ti.getChecked()); - - ti.setChecked(false); - assertEquals(false, ti.getChecked()); - t.dispose(); -} - -public void test_setExpandedZ(){ - assertEquals(false, treeItem.getExpanded()); - - // there must be at least one subitem before you can set the treeitem expanded - treeItem.setExpanded(true); - assertEquals(false, treeItem.getExpanded()); - - - new TreeItem(treeItem, SWT.NULL); - treeItem.setExpanded(true); - assertTrue(treeItem.getExpanded()); - treeItem.setExpanded(false); - assertEquals(false, treeItem.getExpanded()); - - TreeItem ti = new TreeItem(treeItem, SWT.NULL); - ti.setExpanded(true); - treeItem.setExpanded(false); - assertEquals(false, ti.getExpanded()); -} - -public void test_setForegroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(treeItem.getDisplay(), 255, 0, 0); - treeItem.setForeground(color); - assertEquals(color, treeItem.getForeground()); - treeItem.setForeground(null); - assertEquals(tree.getForeground(),treeItem.getForeground()); - color.dispose(); - try { - treeItem.setForeground(color); - fail("No exception thrown for color disposed"); - } catch (IllegalArgumentException e) { - } -} - -public void test_setGrayedZ() { - warnUnimpl("Test test_setGrayedZ not written"); -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setTextLjava_lang_String(){ - try { - treeItem.setText(null); - fail("No exception thrown for string == null"); - } - catch (IllegalArgumentException e) { - } -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_TreeItem((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TreeI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TreeII"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TreeItemI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TreeItemII"); - methodNames.addElement("test_checkSubclass"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getChecked"); - methodNames.addElement("test_getDisplay"); - methodNames.addElement("test_getExpanded"); - methodNames.addElement("test_getGrayed"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getParentItem"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setCheckedZ"); - methodNames.addElement("test_setExpandedZ"); - methodNames.addElement("test_setForegroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setGrayedZ"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TreeI")) test_ConstructorLorg_eclipse_swt_widgets_TreeI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TreeII")) test_ConstructorLorg_eclipse_swt_widgets_TreeII(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TreeItemI")) test_ConstructorLorg_eclipse_swt_widgets_TreeItemI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TreeItemII")) test_ConstructorLorg_eclipse_swt_widgets_TreeItemII(); - else if (getName().equals("test_checkSubclass")) test_checkSubclass(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getChecked")) test_getChecked(); - else if (getName().equals("test_getDisplay")) test_getDisplay(); - else if (getName().equals("test_getExpanded")) test_getExpanded(); - else if (getName().equals("test_getGrayed")) test_getGrayed(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getParentItem")) test_getParentItem(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setCheckedZ")) test_setCheckedZ(); - else if (getName().equals("test_setExpandedZ")) test_setExpandedZ(); - else if (getName().equals("test_setForegroundLorg_eclipse_swt_graphics_Color")) test_setForegroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setGrayedZ")) test_setGrayedZ(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TypedListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TypedListener.java deleted file mode 100644 index 0d7b8d196b..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TypedListener.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.widgets.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.TypedListener - * - * @see org.eclipse.swt.widgets.TypedListener - */ -public class Test_org_eclipse_swt_widgets_TypedListener extends SwtTestCase { - -public Test_org_eclipse_swt_widgets_TypedListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_internal_SWTEventListener() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_internal_SWTEventListener not written"); -} - -public void test_getEventListener() { - warnUnimpl("Test test_getEventListener not written"); -} - -public void test_handleEventLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_handleEventLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_TypedListener((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_internal_SWTEventListener"); - methodNames.addElement("test_getEventListener"); - methodNames.addElement("test_handleEventLorg_eclipse_swt_widgets_Event"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_internal_SWTEventListener")) test_ConstructorLorg_eclipse_swt_internal_SWTEventListener(); - else if (getName().equals("test_getEventListener")) test_getEventListener(); - else if (getName().equals("test_handleEventLorg_eclipse_swt_widgets_Event")) test_handleEventLorg_eclipse_swt_widgets_Event(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Widget.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Widget.java deleted file mode 100644 index 8d9d546568..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Widget.java +++ /dev/null @@ -1,193 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Widget - * - * @see org.eclipse.swt.widgets.Widget - */ -public class Test_org_eclipse_swt_widgets_Widget extends SwtTestCase { - -public Shell shell; -private Widget widget; - -public Test_org_eclipse_swt_widgets_Widget(String name) { - super(name); -} - -protected void setUp() {
- shell = new Shell();
-} - -protected void tearDown() {
- if (widget != null) {
- assertEquals(false, widget.isDisposed());
- }
- assertEquals(false, shell.isDisposed());
- shell.dispose();
- if (widget != null) {
- assertTrue(widget.isDisposed());
- }
- assertTrue(shell.isDisposed());
-} - -protected void setWidget(Widget w) {
- widget = w;
-} - -public void test_addListenerILorg_eclipse_swt_widgets_Listener() {
- try {
- widget.addListener(SWT.Dispose, null);
- fail("No exception thrown for listener == null");
- }
- catch (IllegalArgumentException e) {
- }
- - Listener listener = new Listener() { - public void handleEvent(Event e) { - } - };
- widget.addListener(SWT.Dispose, listener); - widget.removeListener(SWT.Dispose, listener);
-} - -public void test_addDisposeListenerLorg_eclipse_swt_events_DisposeListener() { - DisposeListener listener = new DisposeListener() { - public void widgetDisposed(DisposeEvent e) { - } - }; - widget.addDisposeListener(listener); - widget.removeDisposeListener(listener); -} - -public void test_dispose() { - // tested in tearDown -} - -public void test_getData() { - // tested in test_setDataLjava_lang_Object
-} - -public void test_getDataLjava_lang_String() { - // tested in test_setDataLjava_lang_StringLjava_lang_Object -} - -public void test_getDisplay() { - assertEquals(widget.getDisplay(), widget.getDisplay()); -} - -public void test_getStyle() { - // this test should be overridden by leaf subclasses -} - -public void test_isDisposed() {
- assertEquals(false, widget.isDisposed());
-} - -public void test_notifyListenersILorg_eclipse_swt_widgets_Event() { - // this method is further tested in many of the addTypedListener tests
- try {
- widget.notifyListeners(0, null);
- fail("No exception thrown for event == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- widget.notifyListeners(SWT.Paint, new Event());
-} - -public void test_removeListenerILorg_eclipse_swt_widgets_Listener() { - // this method is further tested by all of the removeTypedListener tests
- try {
- widget.removeListener(SWT.Paint, null);
- fail("No exception thrown for listener == null");
- }
- catch (IllegalArgumentException e) {
- }
-
- widget.removeListener(SWT.Paint, new Listener() { - public void handleEvent(Event e) { - } - }); - - Listener listener = new Listener() { - public void handleEvent(Event e) { - } - }; - widget.addListener(SWT.Paint, listener); - widget.removeListener(SWT.Paint, listener); -} - -public void test_removeDisposeListenerLorg_eclipse_swt_events_DisposeListener() { - // tested in test_addDisposeListenerLorg_eclipse_swt_events_DisposeListener -} - -public void test_setDataLjava_lang_Object(){
- widget.setData(widget); - assertEquals(widget, widget.getData()); - - widget.setData(null);
- assertNull(widget.getData());
-} - -public void test_setDataLjava_lang_StringLjava_lang_Object() { - widget.setData("the widget", widget); - assertEquals(widget, widget.getData("the widget")); - - widget.setData("the widget", null); - assertNull(widget.getData("the widget")); -} - -public void test_toString() {
- assertNotNull(widget.toString());
- assertEquals(false, widget.toString().equals(""));
-} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_addListenerILorg_eclipse_swt_widgets_Listener"); - methodNames.addElement("test_addDisposeListenerLorg_eclipse_swt_events_DisposeListener"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getData"); - methodNames.addElement("test_getDataLjava_lang_String"); - methodNames.addElement("test_getDisplay"); - methodNames.addElement("test_getStyle"); - methodNames.addElement("test_isDisposed"); - methodNames.addElement("test_notifyListenersILorg_eclipse_swt_widgets_Event"); - methodNames.addElement("test_removeListenerILorg_eclipse_swt_widgets_Listener"); - methodNames.addElement("test_removeDisposeListenerLorg_eclipse_swt_events_DisposeListener"); - methodNames.addElement("test_setDataLjava_lang_Object"); - methodNames.addElement("test_setDataLjava_lang_StringLjava_lang_Object"); - methodNames.addElement("test_toString"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_addListenerILorg_eclipse_swt_widgets_Listener")) test_addListenerILorg_eclipse_swt_widgets_Listener(); - else if (getName().equals("test_addDisposeListenerLorg_eclipse_swt_events_DisposeListener")) test_addDisposeListenerLorg_eclipse_swt_events_DisposeListener(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getData")) test_getData(); - else if (getName().equals("test_getDataLjava_lang_String")) test_getDataLjava_lang_String(); - else if (getName().equals("test_getDisplay")) test_getDisplay(); - else if (getName().equals("test_getStyle")) test_getStyle(); - else if (getName().equals("test_isDisposed")) test_isDisposed(); - else if (getName().equals("test_notifyListenersILorg_eclipse_swt_widgets_Event")) test_notifyListenersILorg_eclipse_swt_widgets_Event(); - else if (getName().equals("test_removeListenerILorg_eclipse_swt_widgets_Listener")) test_removeListenerILorg_eclipse_swt_widgets_Listener(); - else if (getName().equals("test_removeDisposeListenerLorg_eclipse_swt_events_DisposeListener")) test_removeDisposeListenerLorg_eclipse_swt_events_DisposeListener(); - else if (getName().equals("test_setDataLjava_lang_Object")) test_setDataLjava_lang_Object(); - else if (getName().equals("test_setDataLjava_lang_StringLjava_lang_Object")) test_setDataLjava_lang_StringLjava_lang_Object(); - else if (getName().equals("test_toString")) test_toString(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/check.bmp b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/check.bmp Binary files differdeleted file mode 100644 index 72f236079c..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/check.bmp +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/dot.gif b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/dot.gif Binary files differdeleted file mode 100644 index b9ad0367f8..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/dot.gif +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.bmp b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.bmp Binary files differdeleted file mode 100644 index 574351fbd4..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.bmp +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.bmp b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.bmp Binary files differdeleted file mode 100644 index 6ba1214663..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.bmp +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/push.bmp b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/push.bmp Binary files differdeleted file mode 100644 index d61c9f4ce1..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/push.bmp +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/radio.bmp b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/radio.bmp Binary files differdeleted file mode 100644 index 89e0cc31c4..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/radio.bmp +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.bmp b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.bmp Binary files differdeleted file mode 100644 index ec7d509e74..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.bmp +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/about.html b/tests/org.eclipse.swt.tests/about.html deleted file mode 100644 index 9db411aab9..0000000000 --- a/tests/org.eclipse.swt.tests/about.html +++ /dev/null @@ -1,30 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<html> -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>20th June, 2002</p> -<h3>License</h3> -<p>Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>. -For purposes of the CPL, "Program" will mean the Content.</p> - -<h3>Contributions</h3> - -<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise -made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such -Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p> - -<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the -host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available -to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also -providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of -the CPL.</p> - -</body> -</html>
\ No newline at end of file diff --git a/tests/org.eclipse.swt.tests/build.properties b/tests/org.eclipse.swt.tests/build.properties deleted file mode 100644 index 2374e5ab05..0000000000 --- a/tests/org.eclipse.swt.tests/build.properties +++ /dev/null @@ -1,3 +0,0 @@ -source.swttests.jar=JUnit Tests/
-
-bin.includes=*.jar,plugin.xml,test.xml,about.html
\ No newline at end of file diff --git a/tests/org.eclipse.swt.tests/plugin.properties b/tests/org.eclipse.swt.tests/plugin.properties deleted file mode 100644 index 4cc0f3ca7d..0000000000 --- a/tests/org.eclipse.swt.tests/plugin.properties +++ /dev/null @@ -1 +0,0 @@ -providerName = Eclipse.org
\ No newline at end of file diff --git a/tests/org.eclipse.swt.tests/plugin.xml b/tests/org.eclipse.swt.tests/plugin.xml deleted file mode 100644 index 1da4949ca1..0000000000 --- a/tests/org.eclipse.swt.tests/plugin.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!-- File written by PDE 1.0 -->
-<plugin
- id="org.eclipse.swt.tests"
- name="Tests"
- provider-name="%providerName"
- version="2.0.0">
-
-<requires>
- <import plugin="org.junit"/>
- <import plugin="org.eclipse.swt"/>
-</requires>
-
-<runtime>
- <library name="swttests.jar">
- <export name="*"/>
- </library>
- </runtime>
-</plugin>
diff --git a/tests/org.eclipse.swt.tests/test.xml b/tests/org.eclipse.swt.tests/test.xml deleted file mode 100644 index 137b447ad0..0000000000 --- a/tests/org.eclipse.swt.tests/test.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0"?>
-
-<project name="testsuite" default="run" basedir=".">
- <!-- This file is intended to be more tightly coupled with the -->
- <!-- org.eclipse.ui plugin, for testing. -->
-
- <!-- The property ${eclipse-home} should be passed into this script -->
-
- <!-- sets the properties eclipse-home, and library-file -->
- <property name="eclipse-home" value="${basedir}/../.."/>
- <property name="plugin-name" value="org.eclipse.swt.tests"/>
- <property name="library-file" value="${eclipse-home}/plugins/org.eclipse.test/library.xml"/>
-
- <!-- This target holds all initialization code that needs to be done for -->
- <!-- all tests that are to be run. Initialization for individual tests -->
- <!-- should be done within the body of the suite target. -->
- <target name="init">
- <tstamp/>
- <delete>
- <fileset dir="${eclipse-home}" includes="org*.xml"/>
- </delete>
- </target>
-
- <!-- This target defines the tests that need to be run. -->
- <target name="suite">
- <property name="data" value="${eclipse-home}/swt_sniff_folder"/>
- <delete dir="${location1}" quiet="true"/>
- <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="data-dir" value="${data}"/>
- <property name="plugin-name" value="${plugin-name}"/>
- <property name="classname" value="org.eclipse.swt.tests.junit.AllTests"/>
- </ant>
- </target>
-
- <!-- This target holds code to cleanup the testing environment after the tests -->
- <!-- have been run. You can use this to delete temporary files that are created. -->
- <target name="cleanup">
- </target>
-
- <!-- This target runs the test suite. Any actions that need to happen after all -->
- <!-- the tests have been run should go here. -->
- <target name="run" depends="init,suite,cleanup">
- <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
- <property name="includes" value="org*.xml"/>
- <property name="output-file" value="${plugin-name}.xml"/>
- </ant>
- </target>
-
-</project>
|