Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcvs2svn2001-07-19 21:34:52 +0000
committercvs2svn2001-07-19 21:34:52 +0000
commite596143603bd2116aafdb2a4d819f5d2c0b3fbaf (patch)
tree19044aeb2ddcd8b3622903fff5a6113305bc76a4
parent7f4b3c8c903a375da9643be16ca896191929ce1e (diff)
downloadeclipse.platform.swt-vi_hack_for_1GGZAZ6.tar.gz
eclipse.platform.swt-vi_hack_for_1GGZAZ6.tar.xz
eclipse.platform.swt-vi_hack_for_1GGZAZ6.zip
This commit was manufactured by cvs2svn to create tag 'vi_hack_for_1GGZAZ6'.vi_hack_for_1GGZAZ6
Sprout from R1_0NL 2001-07-17 20:38:35 UTC Veronika Irvine <torres> '*** empty log message ***' Cherrypick from versioning 2001-07-19 21:34:51 UTC Veronika Irvine <torres> 'vi hack for Activate': bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java bundles/org.eclipse.swt/ws/motif/libswt-gnome1126.so bundles/org.eclipse.swt/ws/motif/libswt1126.so bundles/org.eclipse.swt/ws/photon/libswt1126.so bundles/org.eclipse.swt/ws/win32/swt1126.dll Delete: bundles/org.eclipse.swt/Eclipse SWT/motif/library/cde.c bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgDisplaySettings_t.java bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgVideoModeInfo_t.java examples/org.eclipse.swt.examples.controls/.classpath examples/org.eclipse.swt.examples.controls/.cvsignore examples/org.eclipse.swt.examples.controls/.vcm_meta examples/org.eclipse.swt.examples.controls/build.properties examples/org.eclipse.swt.examples.controls/doc-html/hglegal.htm examples/org.eclipse.swt.examples.controls/doc-html/ngibmcpy.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/import.properties examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/AlignableTab.java examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ButtonTab.java examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ComboTab.java examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ControlPlugin.java examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ControlView.java examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/DialogTab.java examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/LabelTab.java examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ListTab.java examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ProgressBarTab.java examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/RangeTab.java examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/SashTab.java examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ScrollableTab.java examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ShellTab.java examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/SliderTab.java examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/Tab.java examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/TableTab.java examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/TextTab.java examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ToolBarTab.java examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/TreeTab.java examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/closedFolder.gif examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/openFolder.gif examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/target.gif examples/org.eclipse.swt.examples.controls/plugin.jars examples/org.eclipse.swt.examples.controls/plugin.properties examples/org.eclipse.swt.examples.controls/plugin.xml 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/.vcm_meta examples/org.eclipse.swt.examples.launcher/build.properties examples/org.eclipse.swt.examples.launcher/doc-html/hglegal.htm examples/org.eclipse.swt.examples.launcher/doc-html/ngibmcpy.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/import.properties examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ApplicationRunner.java examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ImportProjectTask.java examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ItemDescriptor.java examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ItemTreeNode.java examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LaunchDelegate.java examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherApplication.java examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherPlugin.java examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherView.java examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ProgramLaunchDelegate.java examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/SplitLayout.java examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ViewLaunchDelegate.java examples/org.eclipse.swt.examples.launcher/plugin.jars 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.xsd 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.ole.win32/.classpath examples/org.eclipse.swt.examples.ole.win32/.cvsignore examples/org.eclipse.swt.examples.ole.win32/.vcm_meta examples/org.eclipse.swt.examples.ole.win32/build.properties examples/org.eclipse.swt.examples.ole.win32/doc-html/hglegal.htm examples/org.eclipse.swt.examples.ole.win32/doc-html/ngibmcpy.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/import.properties examples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OleBrowserView.java examples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OlePlugin.java examples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java examples/org.eclipse.swt.examples.ole.win32/plugin.jars 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/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/.vcm_meta examples/org.eclipse.swt.examples.paint/build.properties examples/org.eclipse.swt.examples.paint/doc-html/hglegal.htm examples/org.eclipse.swt.examples.paint/doc-html/ngibmcpy.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/import.properties examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/AirbrushTool.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/BasicPaintSession.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ContainerFigure.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ContinuousPaintSession.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/DragPaintSession.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseFigure.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseTool.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/Figure.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/FigureDrawContext.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineFigure.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineTool.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintPlugin.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintSession.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintStatus.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintSurface.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintTool.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintView.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PencilTool.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PointFigure.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PolyLineTool.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleFigure.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleTool.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleTool.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SegmentedPaintSession.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidEllipseFigure.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidPolygonFigure.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidRectangleFigure.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/StatelessXORFigureHelper.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/TextFigure.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/TextTool.java examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ToolSettings.java examples/org.eclipse.swt.examples.paint/plugin.jars examples/org.eclipse.swt.examples.paint/plugin.properties examples/org.eclipse.swt.examples.paint/plugin.xml 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/.vcm_meta examples/org.eclipse.swt.examples/build.properties examples/org.eclipse.swt.examples/doc-html/hglegal.htm examples/org.eclipse.swt.examples/doc-html/ngibmcpy.gif examples/org.eclipse.swt.examples/doc-html/swt_addressbook_ex.html examples/org.eclipse.swt.examples/doc-html/swt_control_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_manual_setup.html examples/org.eclipse.swt.examples/doc-html/swt_texteditor_ex.html examples/org.eclipse.swt.examples/examples_addressbook.properties examples/org.eclipse.swt.examples/examples_control.properties examples/org.eclipse.swt.examples/examples_fileviewer.properties examples/org.eclipse.swt.examples/examples_helloworld.properties examples/org.eclipse.swt.examples/examples_hoverhelp.properties examples/org.eclipse.swt.examples/examples_images.properties examples/org.eclipse.swt.examples/examples_javaviewer.properties examples/org.eclipse.swt.examples/examples_texteditor.properties examples/org.eclipse.swt.examples/import.properties examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/AddressBook.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/DataEntryDialog.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/FindListener.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/SearchDialog.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/AlignableTab.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ButtonTab.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ComboTab.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ControlExample.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/DialogTab.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/Images.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/LabelTab.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ListTab.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ProgressBarTab.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/RangeTab.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SashTab.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ScrollableTab.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ShellTab.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SliderTab.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/Tab.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TableTab.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TextTab.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ToolBarTab.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TreeTab.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/folder.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/folderOpen.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/stop.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/ComboView.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/FileDisplayInfo.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/FileViewer.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/IconCache.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TableView.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TreeExpandDropListener.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TreeScrollDropListener.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TreeView.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/UpdateWorker.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Copy.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Cut.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Delete.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Parent.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Paste.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Print.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Rename.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Search.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/generic_example.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_File.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld1.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld2.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld3.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld4.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld5.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/HoverHelp.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/information.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/warning.gif examples/org.eclipse.swt.examples/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/javaviewer/JavaViewer.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/Images.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/TextEditor.java examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/blue.bmp examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/blue_mask.bmp examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/bold.bmp examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/bold_mask.bmp examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/erase.bmp examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/erase_mask.bmp examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/green.bmp examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/green_mask.bmp examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/red.bmp examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/red_mask.bmp examples/org.eclipse.swt.examples/plugin.jars examples/org.eclipse.swt.examples/plugin.properties examples/org.eclipse.swt.examples/plugin.xml 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/DialogTab.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Images.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/folder.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/folderOpen.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/stop.gif examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/ComboView.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileDisplayInfo.java 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/TableView.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/TreeExpandDropListener.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/TreeScrollDropListener.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/TreeView.java examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/UpdateWorker.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/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
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/motif/library/cde.c263
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgDisplaySettings_t.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgVideoModeInfo_t.java22
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java55
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java16
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/.classpath12
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/.cvsignore1
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/.vcm_meta13
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/build.properties11
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/doc-html/hglegal.htm14
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/doc-html/ngibmcpy.gifbin814 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/doc-html/swt_controls_ex.html33
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/icons/controls_example.gifbin111 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/import.properties4
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/AlignableTab.java76
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ButtonTab.java181
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ComboTab.java107
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ControlPlugin.java128
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ControlView.java94
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/DialogTab.java424
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/LabelTab.java158
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ListTab.java74
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ProgressBarTab.java107
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/RangeTab.java161
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/SashTab.java158
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ScrollableTab.java48
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ShellTab.java217
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/SliderTab.java226
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/Tab.java364
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/TableTab.java172
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/TextTab.java100
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ToolBarTab.java271
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/TreeTab.java113
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/closedFolder.gifbin906 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/openFolder.gifbin184 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/target.gifbin917 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/plugin.jars3
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/plugin.properties187
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/plugin.xml53
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlPlugin.java128
-rwxr-xr-xexamples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlView.java94
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/.classpath23
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/.cvsignore1
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/.vcm_meta13
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/build.properties13
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/doc-html/hglegal.htm14
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/doc-html/ngibmcpy.gifbin814 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/doc-html/swt_launcher_ex.html59
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/doc/org.eclipse.swt.examples.launcher.launchItems.html61
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/icons/closedFolder.gifbin160 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/icons/generic_example.gifbin158 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/icons/launcher_example.gifbin168 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/icons/openFolder.gifbin152 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/import.properties4
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ApplicationRunner.java183
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ImportProjectTask.java290
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ItemDescriptor.java85
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ItemTreeNode.java73
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LaunchDelegate.java9
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherApplication.java81
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherPlugin.java413
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherView.java222
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ProgramLaunchDelegate.java79
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/SplitLayout.java12
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ViewLaunchDelegate.java23
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/plugin.jars1
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/plugin.properties96
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/plugin.xml77
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/schema/org.eclipse.swt.examples.launcher.launchItems.xsd217
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemDescriptor.java85
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemTreeNode.java73
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherPlugin.java413
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherView.java222
-rwxr-xr-xexamples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/SplitLayout.java12
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/.classpath12
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/.cvsignore1
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/.vcm_meta13
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/build.properties11
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/doc-html/hglegal.htm14
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/doc-html/ngibmcpy.gifbin814 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/doc-html/swt_ole_ex.html40
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/icons/backward_nav.gifbin881 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/icons/forward_nav.gifbin883 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/icons/home_nav.gifbin928 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/icons/refresh_nav.gifbin160 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/icons/search_nav.gifbin245 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/icons/stop_nav.gifbin174 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/icons/webbrowser_example.gifbin380 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/import.properties4
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OleBrowserView.java363
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OlePlugin.java170
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java251
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/plugin.jars1
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/plugin.properties52
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/plugin.xml53
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleBrowserView.java363
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java170
-rwxr-xr-xexamples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java251
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/.classpath12
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/.cvsignore1
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/.vcm_meta13
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/build.properties11
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/doc-html/hglegal.htm14
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/doc-html/ngibmcpy.gifbin814 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/doc-html/swt_paint_ex.html37
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/fill_none.gifbin865 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/fill_outline.gifbin872 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/fill_solid.gifbin861 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.paint/icons/linestyle_dash.gifbin880 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.paint/icons/linestyle_dashdot.gifbin880 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.paint/icons/linestyle_dot.gifbin879 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.paint/icons/linestyle_solid.gifbin871 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/options_font.gifbin868 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/paint_example.gifbin932 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/tool_airbrush.gifbin890 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/tool_ellipse.gifbin872 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/tool_line.gifbin860 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/tool_pencil.gifbin874 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/tool_polyline.gifbin879 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/tool_rectangle.gifbin865 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/tool_roundedrectangle.gifbin871 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/icons/tool_text.gifbin875 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/import.properties4
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/AirbrushTool.java81
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/BasicPaintSession.java10
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ContainerFigure.java94
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ContinuousPaintSession.java236
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/DragPaintSession.java129
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseFigure.java38
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseTool.java60
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/Figure.java63
-rw-r--r--examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/FigureDrawContext.java34
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineFigure.java36
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineTool.java53
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintPlugin.java78
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintSession.java52
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintStatus.java91
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintSurface.java38
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintTool.java13
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintView.java462
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PencilTool.java59
-rw-r--r--examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PointFigure.java34
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PolyLineTool.java71
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleFigure.java37
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleTool.java69
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java39
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleTool.java62
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SegmentedPaintSession.java152
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidEllipseFigure.java38
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidPolygonFigure.java39
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidRectangleFigure.java37
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java39
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/StatelessXORFigureHelper.java24
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/TextFigure.java57
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/TextTool.java122
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ToolSettings.java27
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/plugin.jars1
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/plugin.properties103
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/plugin.xml53
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/AirbrushTool.java81
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/BasicPaintSession.java10
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContainerFigure.java94
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java236
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/DragPaintSession.java129
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseFigure.java38
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseTool.java60
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/Figure.java63
-rw-r--r--examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/FigureDrawContext.java34
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineFigure.java36
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineTool.java53
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintPlugin.java78
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSession.java52
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSurface.java38
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintTool.java13
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintView.java462
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PencilTool.java59
-rw-r--r--examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PointFigure.java34
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PolyLineTool.java71
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleFigure.java37
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleTool.java69
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java39
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleTool.java62
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SegmentedPaintSession.java152
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidEllipseFigure.java38
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidPolygonFigure.java39
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRectangleFigure.java37
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java39
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextFigure.java57
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextTool.java122
-rwxr-xr-xexamples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ToolSettings.java27
-rwxr-xr-xexamples/org.eclipse.swt.examples/.classpath8
-rwxr-xr-xexamples/org.eclipse.swt.examples/.cvsignore1
-rwxr-xr-xexamples/org.eclipse.swt.examples/.vcm_meta13
-rwxr-xr-xexamples/org.eclipse.swt.examples/build.properties10
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/hglegal.htm14
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/ngibmcpy.gifbin814 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/swt_addressbook_ex.html33
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/swt_control_ex.html34
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/swt_fileviewer_ex.html31
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/swt_helloworld_ex.html52
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/swt_hoverhelp_ex.html38
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/swt_imageanalyzer_ex.html56
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/swt_javaviewer_ex.html31
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/swt_manual_setup.html98
-rwxr-xr-xexamples/org.eclipse.swt.examples/doc-html/swt_texteditor_ex.html31
-rwxr-xr-xexamples/org.eclipse.swt.examples/examples_addressbook.properties59
-rwxr-xr-xexamples/org.eclipse.swt.examples/examples_control.properties169
-rwxr-xr-xexamples/org.eclipse.swt.examples/examples_fileviewer.properties47
-rwxr-xr-xexamples/org.eclipse.swt.examples/examples_helloworld.properties1
-rwxr-xr-xexamples/org.eclipse.swt.examples/examples_hoverhelp.properties16
-rwxr-xr-xexamples/org.eclipse.swt.examples/examples_images.properties92
-rwxr-xr-xexamples/org.eclipse.swt.examples/examples_javaviewer.properties7
-rwxr-xr-xexamples/org.eclipse.swt.examples/examples_texteditor.properties6
-rwxr-xr-xexamples/org.eclipse.swt.examples/import.properties16
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/AddressBook.java908
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/DataEntryDialog.java157
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/FindListener.java12
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/SearchDialog.java196
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/AlignableTab.java73
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ButtonTab.java175
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ComboTab.java102
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ControlExample.java94
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/DialogTab.java417
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/Images.java50
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/LabelTab.java152
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ListTab.java71
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ProgressBarTab.java99
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/RangeTab.java154
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SashTab.java155
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ScrollableTab.java47
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ShellTab.java212
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SliderTab.java212
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/Tab.java354
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TableTab.java172
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TextTab.java96
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ToolBarTab.java261
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TreeTab.java111
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/folder.gifbin906 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/folderOpen.gifbin184 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/stop.gifbin917 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/ComboView.java88
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/FileDisplayInfo.java1
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/FileViewer.java694
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/IconCache.java149
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TableView.java1
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TreeExpandDropListener.java84
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TreeScrollDropListener.java1
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TreeView.java1
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/UpdateWorker.java1
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Copy.gifbin167 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Cut.gifbin152 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Delete.gifbin143 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Parent.gifbin132 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Paste.gifbin245 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Print.gifbin227 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gifbin182 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Rename.gifbin163 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Search.gifbin153 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/generic_example.gifbin158 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gifbin217 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gifbin160 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_File.gifbin152 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gifbin231 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gifbin152 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld1.java26
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld2.java33
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld3.java40
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld4.java35
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld5.java43
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/HoverHelp.java336
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/information.gifbin92 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/warning.gifbin152 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java1858
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java367
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/javaviewer/JavaViewer.java180
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/Images.java52
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/TextEditor.java355
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/blue.bmpbin334 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/blue_mask.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/bold.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/bold_mask.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/erase.bmpbin334 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/erase_mask.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/green.bmpbin334 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/green_mask.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/red.bmpbin334 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/red_mask.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/plugin.jars2
-rwxr-xr-xexamples/org.eclipse.swt.examples/plugin.properties101
-rwxr-xr-xexamples/org.eclipse.swt.examples/plugin.xml150
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/AddressBook.java908
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/DataEntryDialog.java157
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/FindListener.java12
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/SearchDialog.java196
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/AlignableTab.java73
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ButtonTab.java175
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ComboTab.java102
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java94
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/DialogTab.java417
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Images.java50
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LabelTab.java152
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ListTab.java71
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ProgressBarTab.java99
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/RangeTab.java154
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SashTab.java155
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ScrollableTab.java47
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ShellTab.java212
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SliderTab.java212
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java354
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java172
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TextTab.java96
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ToolBarTab.java261
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java111
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/folder.gifbin906 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/folderOpen.gifbin184 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/stop.gifbin917 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/ComboView.java88
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileDisplayInfo.java1
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java694
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/IconCache.java149
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/TableView.java1
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/TreeExpandDropListener.java84
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/TreeScrollDropListener.java1
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/TreeView.java1
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/UpdateWorker.java1
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Copy.gifbin167 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Cut.gifbin152 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Delete.gifbin143 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Parent.gifbin132 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Paste.gifbin245 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Print.gifbin227 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gifbin182 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Rename.gifbin163 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Search.gifbin153 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/generic_example.gifbin158 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gifbin217 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gifbin160 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_File.gifbin152 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gifbin231 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gifbin152 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld1.java26
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld2.java33
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld3.java40
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld4.java35
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld5.java43
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java336
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/information.gifbin92 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/warning.gifbin152 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java1858
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java367
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaViewer.java180
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/Images.java52
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java355
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue.bmpbin334 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue_mask.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold_mask.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase.bmpbin334 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase_mask.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green.bmpbin334 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green_mask.bmpbin134 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red.bmpbin334 -> 0 bytes
-rwxr-xr-xexamples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red_mask.bmpbin134 -> 0 bytes
367 files changed, 51 insertions, 32158 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java
index a9542bd917..4e62476aa0 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java
@@ -1325,15 +1325,6 @@ private SIZE xFormPixelsToHimetric(SIZE aSize) {
void onClientMouseDown(int message, int lParam, int wParam) {
Event event = new Event();
event.item = this;
- event.time = OS.GetMessageTime ();
- event.x = (short) (lParam & 0xFFFF);
- event.y = (short) (lParam >> 16);
- if (message == OS.WM_LBUTTONDOWN) event.button = 1;
- if (message == OS.WM_MBUTTONDOWN) event.button = 2;
- if (message == OS.WM_RBUTTONDOWN) event.button = 3;
- if (OS.GetKeyState (OS.VK_MENU) < 0) event.stateMask |= SWT.ALT;
- if ((wParam & OS.MK_SHIFT) != 0) event.stateMask |= SWT.SHIFT;
- if ((wParam & OS.MK_CONTROL) != 0) event.stateMask |= SWT.CONTROL;
- notifyParentListeners(SWT.ChildMouseDown, event);
+ notifyParentListeners(SWT.Activate, event);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/library/cde.c b/bundles/org.eclipse.swt/Eclipse SWT/motif/library/cde.c
deleted file mode 100644
index f0bb3fedb5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/library/cde.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * (c) Copyright IBM Corp., 2000, 2001
- * All Rights Reserved.
- */
-
-/**
- * SWT CDE natives implementation.
- */
-
-#include <jni.h>
-
-#include <stdio.h>
-#include <assert.h>
-#include <Dt/Dts.h>
-#include <Dt/Action.h>
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtAppInitialize
- * Signature: (III[B[B)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtAppInitialize
- (JNIEnv *env, jclass that, jint appContext, jint display, jint topWidget,
- jbyteArray appName, jbyteArray appClass)
-{
- jbyte* appName1 = NULL;
- jbyte* appClass1 = NULL;
- jboolean status;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtAppInitialize\n");
-#endif
-
- if (appName) appName1 = (*env)->GetByteArrayElements(env, appName, NULL);
- if (appClass) appClass1 = (*env)->GetByteArrayElements(env, appClass, NULL);
-
- status = (jint) DtAppInitialize( (XtAppContext) appContext,
- (Display*) display, (Widget) topWidget, appName1, appClass1 );
-
- if (appClass) (*env)->ReleaseByteArrayElements(env, appClass, appClass1, 0);
- if (appName) (*env)->ReleaseByteArrayElements(env, appName, appName1, 0);
- return status;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtDbLoad
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtDbLoad
- (JNIEnv *env, jclass that )
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtDbLoad\n");
-#endif
-
- DtDbLoad();
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtDtsDataTypeNames
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtDtsDataTypeNames
- (JNIEnv *env, jclass that)
-{
- jint dataTypeList;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtDtsDataTypeNames\n");
-#endif
-
- dataTypeList = (jint) DtDtsDataTypeNames();
- return dataTypeList;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtDtsFileToDataType
- * Signature: ([B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtDtsFileToDataType
- (JNIEnv *env, jclass that, jbyteArray fileName)
-{
- jbyte* fileName1 = NULL;
- jint dataType;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtDtsFileToDataType\n");
-#endif
-
- if (fileName) fileName1 = (*env)->GetByteArrayElements(env, fileName, NULL);
- dataType = (jint) DtDtsFileToDataType( (char*) fileName1 );
- if (fileName) (*env)->ReleaseByteArrayElements(env, fileName, fileName1, 0);
- return dataType;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtDtsDataTypeIsAction
- * Signature: ([B)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtDtsDataTypeIsAction
- (JNIEnv *env, jclass that, jbyteArray dataType)
-{
- jbyte* dataType1 = NULL;
- jboolean isAction;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtDtsDataTypeIsAction\n");
-#endif
-
- if (dataType) dataType1 = (*env)->GetByteArrayElements(env, dataType, NULL);
- isAction = (jboolean) DtDtsDataTypeIsAction( (char*) dataType1 );
- if (dataType) (*env)->ReleaseByteArrayElements(env, dataType, dataType1, 0);
- return isAction;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtDtsDataTypeToAttributeValue
- * Signature: ([B[B[B)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtDtsDataTypeToAttributeValue
- (JNIEnv *env, jclass that, jbyteArray dataType, jbyteArray attrName, jbyteArray optName)
-{
- jbyte* dataType1 = NULL;
- jbyte* attrName1 = NULL;
- jbyte* optName1 = NULL;
- jint attrValue;
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtDtsDataTypeToAttributeValue\n");
-#endif
-
- if (dataType) dataType1 = (*env)->GetByteArrayElements(env, dataType, NULL);
- if (attrName) attrName1 = (*env)->GetByteArrayElements(env, attrName, NULL);
- if (optName) optName1 = (*env)->GetByteArrayElements(env, optName, NULL);
-
- attrValue = (jint) DtDtsDataTypeToAttributeValue( (char*) dataType1,
- (char*) attrName1, (char*) optName1 );
-
- if (optName) (*env)->ReleaseByteArrayElements(env, optName, optName1, 0);
- if (attrName) (*env)->ReleaseByteArrayElements(env, attrName, attrName1, 0);
- if (dataType) (*env)->ReleaseByteArrayElements(env, dataType, dataType1, 0);
- return attrValue;
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtDtsFreeDataType
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtDtsFreeDataType
- (JNIEnv *env, jclass that, jint dataType)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtDtsFreeDataType\n");
-#endif
-
- DtDtsFreeDataType( (char*) dataType );
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtDtsFreeDataTypeNames
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtDtsFreeDataTypeNames
- (JNIEnv *env, jclass that, jint dataTypeList)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtDtsFreeDataTypeNames\n");
-#endif
-
- DtDtsFreeDataTypeNames( (char**) dataTypeList );
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtDtsFreeAttributeValue
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtDtsFreeAttributeValue
- (JNIEnv *env, jclass that, jint attrValue)
-{
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtDtsFreeAttributeValue\n");
-#endif
-
- DtDtsFreeAttributeValue( (char*) attrValue );
-}
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: DtActionInvoke
- * Signature: (I[B[BI[B[B[BIII)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_CDE_DtActionInvoke
- (JNIEnv *env, jclass that, jint topWidget, jbyteArray action,
- jbyteArray fileName, jint argCount, jbyteArray termOpts, jbyteArray execHost,
- jbyteArray contextDir, jint useIndicator, jint callback, jint clientData)
-{
- jbyte* action1 = NULL;
- jbyte* fileName1 = NULL;
- jbyte* termOpts1 = NULL;
- jbyte* execHost1 = NULL;
- jbyte* contextDir1 = NULL;
- jint actionID;
- DtActionArg arg; /* Action arguments should really be Java objects. */
-
-#ifdef DEBUG_CALL_PRINTS
- fprintf(stderr, "DtActionInvoke\n");
-#endif
-
- if (action) action1 = (*env)->GetByteArrayElements(env, action, NULL);
- if (fileName) fileName1 = (*env)->GetByteArrayElements(env, fileName, NULL);
- if (termOpts) termOpts1 = (*env)->GetByteArrayElements(env, termOpts, NULL);
- if (execHost) execHost1 = (*env)->GetByteArrayElements(env, execHost, NULL);
- if (contextDir) contextDir1 = (*env)->GetByteArrayElements(env, contextDir, NULL);
-
- /* TBD: DtActionArg should be a Java class and the third argument
- * (fileName) should really be an array of DtActionArg.
- *
- * Create the action argument given the file name. This is the only type
- * of action supported by the Program module of SWT. The argCount is
- * ignored because only one file can be passed this way.
- */
- arg.argClass = DtACTION_FILE;
- arg.u.file.name = (char*) fileName1;
-
-/*
- printf("Invoking action: %d %s %s 1 %X %X %X %X %X %X\n", topWidget, action1, fileName1,
- termOpts1, execHost1, contextDir1, useIndicator, callback, clientData );
-*/
- actionID = (jint) DtActionInvoke( (Widget) topWidget, (char*) action1,
- &arg, 1, (char*) termOpts1,(char*) execHost1, (char*) contextDir1,
- useIndicator, (DtActionCallbackProc) callback, (XtPointer) clientData );
-
- if (contextDir) (*env)->ReleaseByteArrayElements(env, contextDir, contextDir1, 0);
- if (execHost) (*env)->ReleaseByteArrayElements(env, execHost, execHost1, 0);
- if (termOpts) (*env)->ReleaseByteArrayElements(env, termOpts, termOpts1, 0);
- if (fileName) (*env)->ReleaseByteArrayElements(env, fileName, fileName1, 0);
- if (action) (*env)->ReleaseByteArrayElements(env, action, action1, 0);
-
- return actionID;
-}
-
-/* Utility methods */
-
-
-/*
- * Class: org_eclipse_swt_internal_motif_CDE
- * Method: listElementAt
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_CDE_listElementAt
- (JNIEnv *env, jclass that, jint nameList, jint index)
-{
- char** nameList1 = (char**) nameList;
- return (jint) nameList1[ index ];
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgDisplaySettings_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgDisplaySettings_t.java
deleted file mode 100644
index 89c384775e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgDisplaySettings_t.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PgDisplaySettings_t {
- public int mode;
- public int xres;
- public int yres;
- public int refresh;
- public int flags;
- public int [] reserved = new int [22];
- public static final int sizeof = 108;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgVideoModeInfo_t.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgVideoModeInfo_t.java
deleted file mode 100644
index 61494500ac..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/PgVideoModeInfo_t.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.swt.internal.photon;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class PgVideoModeInfo_t {
- public short width;
- public short height;
- public short bits_per_pixel;
- public short bytes_per_scanline;
- public int type;
- public int mode_capabilities1;
- public int mode_capabilities2;
- public int mode_capabilities3;
- public int mode_capabilities4;
- public int mode_capabilities5;
- public int mode_capabilities6;
- public byte [] refresh_rates = new byte [20];
- public static final int sizeof = 56;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
index 6fa0c93470..d8ced46dbd 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
@@ -2989,9 +2989,9 @@ LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) {
LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
- Event e = createMouseEvent(SWT.MouseDown, 1, wParam, lParam);
- e.item = this;
- notifyParentListeners(SWT.ChildMouseDown, e);
+ Event event = new Event();
+ event.item = this;
+ notifyParentListeners(SWT.Activate, event);
sendMouseEvent (SWT.MouseDown, 1, OS.WM_LBUTTONDOWN, wParam, lParam);
int result = callWindowProc (OS.WM_LBUTTONDOWN, wParam, lParam);
@@ -3038,9 +3038,9 @@ LRESULT WM_MBUTTONDBLCLK (int wParam, int lParam) {
}
LRESULT WM_MBUTTONDOWN (int wParam, int lParam) {
- Event e = createMouseEvent(SWT.MouseDown, 2, wParam, lParam);
- e.item = this;
- notifyParentListeners(SWT.ChildMouseDown, e);
+ Event event = new Event();
+ event.item = this;
+ notifyParentListeners(SWT.Activate, event);
sendMouseEvent (SWT.MouseDown, 2, OS.WM_MBUTTONDOWN, wParam, lParam);
int result = callWindowProc (OS.WM_MBUTTONDOWN, wParam, lParam);
@@ -3350,9 +3350,9 @@ LRESULT WM_RBUTTONDBLCLK (int wParam, int lParam) {
}
LRESULT WM_RBUTTONDOWN (int wParam, int lParam) {
- Event e = createMouseEvent(SWT.MouseDown, 3, wParam, lParam);
- e.item = this;
- notifyParentListeners(SWT.ChildMouseDown, e);
+ Event event = new Event();
+ event.item = this;
+ notifyParentListeners(SWT.Activate, event);
sendMouseEvent (SWT.MouseDown, 3, OS.WM_RBUTTONDOWN, wParam, lParam);
int result = callWindowProc (OS.WM_RBUTTONDOWN, wParam, lParam);
@@ -3385,18 +3385,18 @@ LRESULT WM_SETCURSOR (int wParam, int lParam) {
LRESULT WM_SETFOCUS (int wParam, int lParam) {
/* Build the focus in list */
- int index = 0;
- Control [] focusIn = getPath ();
- Display display = getDisplay ();
- Control control = display.findControl (wParam);
- if (control != null) {
- Control [] focusOut = control.getPath ();
- int length = Math.min (focusIn.length, focusOut.length);
- while (index < length) {
- if (focusIn [index] != focusOut [index]) break;
- index++;
- }
- }
+// int index = 0;
+// Control [] focusIn = getPath ();
+// Display display = getDisplay ();
+// Control control = display.findControl (wParam);
+// if (control != null) {
+// Control [] focusOut = control.getPath ();
+// int length = Math.min (focusIn.length, focusOut.length);
+// while (index < length) {
+// if (focusIn [index] != focusOut [index]) break;
+// index++;
+// }
+// }
/*
* It is possible (but unlikely), that application
@@ -3414,11 +3414,14 @@ LRESULT WM_SETFOCUS (int wParam, int lParam) {
* this happens, keep processing those widgets that
* are not disposed.
*/
- for (int i=focusIn.length-1; i>=index; --i) {
- if (!focusIn [i].isDisposed ()) {
- focusIn [i].sendEvent (SWT.Activate);
- }
- }
+// for (int i=focusIn.length-1; i>=index; --i) {
+// if (!focusIn [i].isDisposed ()) {
+// focusIn [i].sendEvent (SWT.Activate);
+// }
+// }
+ Event event = new Event();
+ event.item = this;
+ notifyParentListeners(SWT.Activate, event);
/*
* It is possible (but unlikely), that application
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
index 2ec2522cd6..971916163b 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
@@ -940,7 +940,10 @@ LRESULT WM_ACTIVATE (int wParam, int lParam) {
* Windows message by returning zero as the result of
* the window proc.
*/
- sendEvent (SWT.Activate);
+// Event e = new Event();
+// e.item = this;
+// notifyParentListeners(SWT.Activate, e);
+ sendEvent(SWT.Activate);
if (isDisposed ()) return LRESULT.ZERO;
if (restoreFocus ()) return LRESULT.ZERO;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java
index ba20d01f8b..1995ac0dab 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java
@@ -240,9 +240,9 @@ LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) {
}
LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
- Event e = createMouseEvent(SWT.MouseDown, 1, wParam, lParam);
- e.item = this;
- notifyParentListeners(SWT.ChildMouseDown, e);
+ Event event = new Event();
+ event.item = this;
+ notifyParentListeners(SWT.Activate, event);
/*
* Feature in Windows. When the user clicks on the group
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
index e467b2a1a3..d05ea3bc94 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
@@ -1944,9 +1944,9 @@ LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) {
}
LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
- Event e = createMouseEvent(SWT.MouseDown, 1, wParam, lParam);
- e.item = this;
- notifyParentListeners(SWT.ChildMouseDown, e);
+ Event event = new Event();
+ event.item = this;
+ notifyParentListeners(SWT.Activate, event);
/*
* Feature in Windows. For some reason, capturing
@@ -2104,9 +2104,9 @@ LRESULT WM_RBUTTONDBLCLK (int wParam, int lParam) {
LRESULT WM_RBUTTONDOWN (int wParam, int lParam) {
- Event e = createMouseEvent(SWT.MouseDown, 3, wParam, lParam);
- e.item = this;
- notifyParentListeners(SWT.ChildMouseDown, e);
+ Event event = new Event();
+ event.item = this;
+ notifyParentListeners(SWT.Activate, event);
/*
* Feature in Windows. For some reason, capturing
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
index 3d47d53241..b875a1a7e7 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
@@ -1069,9 +1069,9 @@ LRESULT WM_KILLFOCUS (int wParam, int lParam) {
}
LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
- Event e = createMouseEvent(SWT.MouseDown, 1, wParam, lParam);
- e.item = this;
- notifyParentListeners(SWT.ChildMouseDown, e);
+ Event event = new Event();
+ event.item = this;
+ notifyParentListeners(SWT.Activate, event);
/*
* Feature in Windows. When a tree item is
@@ -1108,7 +1108,7 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
}
tvItem.state = state << 12;
OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- Event event = new Event ();
+ event = new Event ();
event.item = items [tvItem.lParam];
event.detail = SWT.CHECK;
postEvent (SWT.Selection, event);
@@ -1244,7 +1244,7 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
tvItem.hItem = hNewItem;
tvItem.mask = OS.TVIF_STATE | OS.TVIF_PARAM;
OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- Event event = new Event ();
+ event = new Event ();
if ((tvItem.state & OS.TVIS_SELECTED) != 0) {
event.item = items [tvItem.lParam];
}
@@ -1269,9 +1269,9 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
}
LRESULT WM_RBUTTONDOWN (int wParam, int lParam) {
- Event e = createMouseEvent(SWT.MouseDown, 3, wParam, lParam);
- e.item = this;
- notifyParentListeners(SWT.ChildMouseDown, e);
+ Event event = new Event();
+ event.item = this;
+ notifyParentListeners(SWT.Activate, event);
/*
* Feature in Windows. The receiver uses WM_RBUTTONDOWN
diff --git a/examples/org.eclipse.swt.examples.controls/.classpath b/examples/org.eclipse.swt.examples.controls/.classpath
deleted file mode 100755
index ff43f54984..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=""/>
- <classpathentry kind="var" path="JRE_LIB"/>
- <classpathentry kind="var"
- path="ECLIPSE_PLUGINS/org.eclipse.swt/swt.jar" sourcepath="ECLIPSE_PLUGINS/org.eclipse.swt/swtsrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_PLUGINS/org.eclipse.core.runtime/runtime.jar" sourcepath="ECLIPSE_PLUGINS/org.eclipse.core.runtime/runtimesrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_PLUGINS/org.eclipse.ui/workbench.jar" sourcepath="ECLIPSE_PLUGINS/org.eclipse.ui/workbenchsrc.zip"/>
- <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/.vcm_meta b/examples/org.eclipse.swt.examples.controls/.vcm_meta
deleted file mode 100755
index d64b057431..0000000000
--- a/examples/org.eclipse.swt.examples.controls/.vcm_meta
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project-description>
- <comment></comment>
- <nature id="org.eclipse.jdt.core.javanature"/>
- <nature id="org.eclipse.pde.PluginNature"/>
- <reference project-name="org.eclipse.swt"/>
- <builder name="org.eclipse.jdt.core.javabuilder">
- </builder>
- <builder name="org.eclipse.pde.ManifestBuilder">
- </builder>
- <builder name="org.eclipse.pde.SchemaBuilder">
- </builder>
-</project-description>
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 d778b564ae..0000000000
--- a/examples/org.eclipse.swt.examples.controls/build.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-build.includes = doc-html/,\
- icons/,\
- plugin.properties,\
- plugin.xml
-
-build.vaj.Eclipse\ SWT\ Examples\ Controls = /
-
-build.excludes = bin/,\
- .cvsignore,\
- .vcm_meta,\
- build.properties \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.controls/doc-html/hglegal.htm b/examples/org.eclipse.swt.examples.controls/doc-html/hglegal.htm
deleted file mode 100755
index b071dbdf45..0000000000
--- a/examples/org.eclipse.swt.examples.controls/doc-html/hglegal.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="Mozilla/4.73 [en] (Win98; U) [Netscape]">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2001. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.controls/doc-html/ngibmcpy.gif b/examples/org.eclipse.swt.examples.controls/doc-html/ngibmcpy.gif
deleted file mode 100755
index 360f8e9989..0000000000
--- a/examples/org.eclipse.swt.examples.controls/doc-html/ngibmcpy.gif
+++ /dev/null
Binary files differ
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 c99f6af5b2..0000000000
--- a/examples/org.eclipse.swt.examples.controls/doc-html/swt_controls_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 - Controls Example</title>
-</head>
-<body>
-
-<h2>Example - SWT Controls</h2>
-
-<h3>Introduction</h3>
-<p>This example is a simple demonstration of common Standard Widget Toolkit
-(SWT) UI controls.&nbsp; It consists of a shell and tab folder where each
-tab in the folder allows the user to interact with a control.
-</p>
-
-<h3>Running the example</h3>
-<p>To run the Controls Example, pull down the Perspective menu, select the
-Show View menu item, then select Other from the submenu.&nbsp; A dialog
-will come up with a list of views.&nbsp; Expand SWT Examples and select
-the view named Controls.&nbsp; A view containing a number of tabbed pages
-will appear.
-</p>
-
-<h3>Details</h3>
-<p>Each page (tab) of the controls example allows the user to interact with
-a different SWT control.&nbsp; The name of the control being demonstrated
-on each page is on the tab.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000" 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
deleted file mode 100755
index cbdee97066..0000000000
--- a/examples/org.eclipse.swt.examples.controls/icons/controls_example.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.controls/import.properties b/examples/org.eclipse.swt.examples.controls/import.properties
deleted file mode 100755
index 9185f56fc8..0000000000
--- a/examples/org.eclipse.swt.examples.controls/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/org/eclipse/swt/examples/controls/AlignableTab.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/AlignableTab.java
deleted file mode 100755
index 82f7df5948..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/AlignableTab.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 "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 (ControlPlugin.getResourceString("Alignment"));
-
- /* Create the controls */
- leftButton = new Button (allignmentGroup, SWT.RADIO);
- leftButton.setText (ControlPlugin.getResourceString("Left"));
- centerButton = new Button (allignmentGroup, SWT.RADIO);
- centerButton.setText(ControlPlugin.getResourceString("Center"));
- rightButton = new Button (allignmentGroup, SWT.RADIO);
- rightButton.setText (ControlPlugin.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.controls/org/eclipse/swt/examples/controls/ButtonTab.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ButtonTab.java
deleted file mode 100755
index 036842b1b3..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ButtonTab.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-
- /**
- * Creates the "Control" group.
- */
- void createControlGroup () {
- super.createControlGroup ();
-
- /* Create the controls */
- upButton = new Button (allignmentGroup, SWT.RADIO);
- upButton.setText (ControlPlugin.getResourceString("Up"));
- downButton = new Button (allignmentGroup, SWT.RADIO);
- downButton.setText (ControlPlugin.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 (ControlPlugin.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 (ControlPlugin.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 (borderButton.getSelection()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- button1 = new Button(textButtonGroup, style);
- button1.setText(ControlPlugin.getResourceString("One"));
- button2 = new Button(textButtonGroup, style);
- button2.setText(ControlPlugin.getResourceString("Two"));
- button3 = new Button(textButtonGroup, style);
- button3.setText(ControlPlugin.getResourceString("Three"));
- button4 = new Button(imageButtonGroup, style);
- button4.setImage(ControlPlugin.images[ControlPlugin.ciClosedFolder]);
- button5 = new Button(imageButtonGroup, style);
- button5.setImage(ControlPlugin.images[ControlPlugin.ciOpenFolder]);
- button6 = new Button(imageButtonGroup, style);
- button6.setImage(ControlPlugin.images[ControlPlugin.ciTarget]);
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- pushButton = new Button (styleGroup, SWT.RADIO);
- pushButton.setText(ControlPlugin.getResourceString("SWT_PUSH"));
- checkButton = new Button (styleGroup, SWT.RADIO);
- checkButton.setText (ControlPlugin.getResourceString("SWT_CHECK"));
- radioButton = new Button (styleGroup, SWT.RADIO);
- radioButton.setText (ControlPlugin.getResourceString("SWT_RADIO"));
- toggleButton = new Button (styleGroup, SWT.RADIO);
- toggleButton.setText (ControlPlugin.getResourceString("SWT_TOGGLE"));
- arrowButton = new Button (styleGroup, SWT.RADIO);
- arrowButton.setText (ControlPlugin.getResourceString("SWT_ARROW"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (ControlPlugin.getResourceString("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 ControlPlugin.getResourceString("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);
- borderButton.setSelection ((button1.getStyle () & SWT.BORDER) != 0);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ComboTab.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ComboTab.java
deleted file mode 100755
index 37ef288ece..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ComboTab.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 = {ControlPlugin.getResourceString("ListData0_0"),
- ControlPlugin.getResourceString("ListData0_1"),
- ControlPlugin.getResourceString("ListData0_2"),
- ControlPlugin.getResourceString("ListData0_3"),
- ControlPlugin.getResourceString("ListData0_4"),
- ControlPlugin.getResourceString("ListData0_5"),
- ControlPlugin.getResourceString("ListData0_6"),
- ControlPlugin.getResourceString("ListData0_7"),
- ControlPlugin.getResourceString("ListData0_8")};
-
- /**
- * 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 (ControlPlugin.getResourceString("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 (ControlPlugin.getResourceString("SWT_DROP_DOWN"));
- simpleButton = new Button (styleGroup, SWT.RADIO);
- simpleButton.setText(ControlPlugin.getResourceString("SWT_SIMPLE"));
- readOnlyButton = new Button (styleGroup, SWT.CHECK);
- readOnlyButton.setText (ControlPlugin.getResourceString("SWT_READ_ONLY"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (ControlPlugin.getResourceString("SWT_BORDER"));
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {combo1};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlPlugin.getResourceString("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.controls/org/eclipse/swt/examples/controls/ControlPlugin.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ControlPlugin.java
deleted file mode 100755
index 945efaadc5..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ControlPlugin.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 ControlPlugin extends AbstractUIPlugin {
- //The shared instance.
- private static ControlPlugin plugin;
- private static ResourceBundle resourceBundle;
-
- static final int
- ciClosedFolder = 0,
- ciOpenFolder = 1,
- ciTarget = 2;
- static final String[] imageLocations = {
- "closedFolder.gif",
- "openFolder.gif",
- "target.gif" };
- static Image images[];
-
- /**
- * The constructor.
- */
- public ControlPlugin(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 ControlPlugin getDefault() {
- return plugin;
- }
-
- /**
- * 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 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.
- */
- 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() {
- Class clazz = ControlPlugin.class;
- 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);
- }
- }
- } catch (Throwable ex) {
- freeResources();
- logError(getResourceString("error.CouldNotLoadResources"), ex);
- 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;
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ControlView.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ControlView.java
deleted file mode 100755
index 9b996280d8..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ControlView.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.part.ViewPart;
-import java.util.ResourceBundle;
-
-/**
- * <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 {
- private ShellTab shellTab;
- private TabFolder tabFolder;
- private Composite mainFrame;
-
- /**
- * The constructor.
- */
- public ControlView() {
- ControlPlugin.initResources();
- }
-
- /**
- * Create the example
- *
- * @see ViewPart#createPartControl
- */
- public void createPartControl(Composite frame) {
- this.mainFrame = frame;
-
- /* Create the tab folder */
- tabFolder = new TabFolder (frame, SWT.NULL);
- Tab [] tabs = new Tab [] {
- new ButtonTab (),
- new ComboTab (),
- new DialogTab (),
- new LabelTab (),
- new ListTab (),
- new ProgressBarTab (),
- new SashTab (),
- shellTab = new ShellTab(),
- new SliderTab (),
- new TableTab (),
- new TextTab (),
- new ToolBarTab (),
- new TreeTab (),
- };
- 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));
- }
-
- }
-
- /**
- * Called when we must grab focus.
- *
- * @see org.eclipse.ui.part.ViewPart#setFocus
- */
- public void setFocus() {
- //tabFolder.setFocus();
- mainFrame.setFocus();
- }
-
- /**
- * Called when the View is to be disposed
- */
-
- 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;
- super.dispose();
- }
-}
diff --git a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/DialogTab.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/DialogTab.java
deleted file mode 100755
index 14a9f7e301..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/DialogTab.java
+++ /dev/null
@@ -1,424 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 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 = {ControlPlugin.getResourceString("FilterName_0"),
- ControlPlugin.getResourceString("FilterName_1"),
- ControlPlugin.getResourceString("FilterName_2")};
-
- /**
- * 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 (ControlPlugin.getResourceString("ColorDialog"))) {
- ColorDialog dialog = new ColorDialog (shell ,style);
- dialog.setRGB (new RGB (100, 100, 100));
- dialog.setText (ControlPlugin.getResourceString("Title"));
- RGB result = dialog.open ();
- textWidget.append (ControlPlugin.getResourceString("ColorDialog") + Text.DELIMITER);
- textWidget.append (ControlPlugin.getResourceString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals (ControlPlugin.getResourceString("DirectoryDialog"))) {
- DirectoryDialog dialog = new DirectoryDialog (shell, style);
- dialog.setMessage (ControlPlugin.getResourceString("Example_string"));
- dialog.setText (ControlPlugin.getResourceString("Title"));
- String result = dialog.open ();
- textWidget.append (ControlPlugin.getResourceString("DirectoryDialog") + Text.DELIMITER);
- textWidget.append (ControlPlugin.getResourceString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals (ControlPlugin.getResourceString("FileDialog"))) {
- FileDialog dialog = new FileDialog (shell, style);
- dialog.setFileName (ControlPlugin.getResourceString("readme_txt"));
- dialog.setFilterNames (FilterNames);
- dialog.setFilterExtensions (FilterExtensions);
- dialog.setText (ControlPlugin.getResourceString("Title"));
- String result = dialog.open();
- textWidget.append (ControlPlugin.getResourceString("FileDialog") + Text.DELIMITER);
- textWidget.append (ControlPlugin.getResourceString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals (ControlPlugin.getResourceString("FontDialog"))) {
- FontDialog dialog = new FontDialog (shell, style);
- dialog.setText (ControlPlugin.getResourceString("Title"));
- FontData result = dialog.open ();
- textWidget.append (ControlPlugin.getResourceString("FontDialog") + Text.DELIMITER);
- textWidget.append (ControlPlugin.getResourceString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals(ControlPlugin.getResourceString("MessageBox"))) {
- MessageBox dialog = new MessageBox (shell, style);
- dialog.setMessage (ControlPlugin.getResourceString("Example_string"));
- dialog.setText (ControlPlugin.getResourceString("Title"));
- int result = dialog.open ();
- textWidget.append (ControlPlugin.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 (ControlPlugin.getResourceString("Result") + ControlPlugin.getResourceString("SWT_OK"));
- break;
- case SWT.YES:
- textWidget.append (ControlPlugin.getResourceString("Result") + ControlPlugin.getResourceString("SWT_YES"));
- break;
- case SWT.NO:
- textWidget.append (ControlPlugin.getResourceString("Result") + ControlPlugin.getResourceString("SWT_NO"));
- break;
- case SWT.CANCEL:
- textWidget.append (ControlPlugin.getResourceString("Result") + ControlPlugin.getResourceString("SWT_CANCEL"));
- break;
- case SWT.ABORT:
- textWidget.append (ControlPlugin.getResourceString("Result") + ControlPlugin.getResourceString("SWT_ABORT"));
- break;
- case SWT.RETRY:
- textWidget.append (ControlPlugin.getResourceString("Result") + ControlPlugin.getResourceString("SWT_RETRY"));
- break;
- case SWT.IGNORE:
- textWidget.append (ControlPlugin.getResourceString("Result") + ControlPlugin.getResourceString("SWT_IGNORE"));
- break;
- default:
- textWidget.append(ControlPlugin.getResourceString("Result") + 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 (ControlPlugin.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 (ControlPlugin.getResourceString("Dialog_Type"));
- }
-
- /**
- * Creates the "Control" widget children.
- */
- void createControlWidgets () {
-
- /* Create the combo */
- String [] strings = {
- ControlPlugin.getResourceString("ColorDialog"),
- ControlPlugin.getResourceString("DirectoryDialog"),
- ControlPlugin.getResourceString("FileDialog"),
- ControlPlugin.getResourceString("FontDialog"),
- ControlPlugin.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 (ControlPlugin.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 (ControlPlugin.getResourceString("Button_Styles"));
-
- /* Create the button style buttons */
- okButton = new Button (buttonStyleGroup, SWT.CHECK);
- okButton.setText (ControlPlugin.getResourceString("SWT_OK"));
- cancelButton = new Button (buttonStyleGroup, SWT.CHECK);
- cancelButton.setText (ControlPlugin.getResourceString("SWT_CANCEL"));
- yesButton = new Button (buttonStyleGroup, SWT.CHECK);
- yesButton.setText (ControlPlugin.getResourceString("SWT_YES"));
- noButton = new Button (buttonStyleGroup, SWT.CHECK);
- noButton.setText (ControlPlugin.getResourceString("SWT_NO"));
- retryButton = new Button (buttonStyleGroup, SWT.CHECK);
- retryButton.setText (ControlPlugin.getResourceString("SWT_RETRY"));
- abortButton = new Button (buttonStyleGroup, SWT.CHECK);
- abortButton.setText (ControlPlugin.getResourceString("SWT_ABORT"));
- ignoreButton = new Button (buttonStyleGroup, SWT.CHECK);
- ignoreButton.setText (ControlPlugin.getResourceString("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 (ControlPlugin.getResourceString("Icon_Styles"));
-
- /* Create the icon style buttons */
- iconErrorButton = new Button (iconStyleGroup, SWT.RADIO);
- iconErrorButton.setText (ControlPlugin.getResourceString("SWT_ICON_ERROR"));
- iconInformationButton = new Button (iconStyleGroup, SWT.RADIO);
- iconInformationButton.setText (ControlPlugin.getResourceString("SWT_ICON_INFORMATION"));
- iconQuestionButton = new Button (iconStyleGroup, SWT.RADIO);
- iconQuestionButton.setText (ControlPlugin.getResourceString("SWT_ICON_QUESTION"));
- iconWarningButton = new Button (iconStyleGroup, SWT.RADIO);
- iconWarningButton.setText (ControlPlugin.getResourceString("SWT_ICON_WARNING"));
- iconWorkingButton = new Button (iconStyleGroup, SWT.RADIO);
- iconWorkingButton.setText (ControlPlugin.getResourceString("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 (ControlPlugin.getResourceString("Modal_Styles"));
-
- /* Create the modal style buttons */
- modelessButton = new Button (modalStyleGroup, SWT.RADIO);
- modelessButton.setText (ControlPlugin.getResourceString("SWT_MODELESS"));
- primaryModalButton = new Button (modalStyleGroup, SWT.RADIO);
- primaryModalButton.setText (ControlPlugin.getResourceString("SWT_PRIMARY_MODAL"));
- applicationModalButton = new Button (modalStyleGroup, SWT.RADIO);
- applicationModalButton.setText (ControlPlugin.getResourceString("SWT_APPLICATION_MODAL"));
- systemModalButton = new Button (modalStyleGroup, SWT.RADIO);
- systemModalButton.setText (ControlPlugin.getResourceString("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 (ControlPlugin.getResourceString("File_Dialog_Styles"));
-
- /* Create the file dialog style buttons */
- saveButton = new Button (fileDialogStyleGroup, SWT.RADIO);
- saveButton.setText (ControlPlugin.getResourceString("SWT_SAVE"));
- openButton = new Button(fileDialogStyleGroup, SWT.RADIO);
- openButton.setText(ControlPlugin.getResourceString("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.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- resultGroup.setText (ControlPlugin.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.widthHint = 300;
- gridData.heightHint = 400;
- 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 (ControlPlugin.getResourceString("MessageBox"));
- boolean isFileDialog = name.equals (ControlPlugin.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 ControlPlugin.getResourceString("Dialog");
- }
-}
diff --git a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/LabelTab.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/LabelTab.java
deleted file mode 100755
index 3df4a386dd..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/LabelTab.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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, horizontalButton, verticalButton, shadowInButton, shadowOutButton;
-
- /**
- * 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 (ControlPlugin.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 (ControlPlugin.getResourceString("Image_Labels"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (separatorButton.getSelection ()) style |= SWT.SEPARATOR;
- 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(ControlPlugin.getResourceString("One"));
- label2 = new Label (textLabelGroup, style);
- label2.setText(ControlPlugin.getResourceString("Two"));
- label3 = new Label (textLabelGroup, style);
- label3.setText (ControlPlugin.getResourceString("Three"));
- label4 = new Label (imageLabelGroup, style);
- label4.setImage (ControlPlugin.images[ControlPlugin.ciClosedFolder]);
- label5 = new Label (imageLabelGroup, style);
- label5.setImage (ControlPlugin.images[ControlPlugin.ciOpenFolder]);
- label6 = new Label(imageLabelGroup, style);
- label6.setImage (ControlPlugin.images[ControlPlugin.ciTarget]);
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- separatorButton = new Button (styleGroup, SWT.CHECK);
- separatorButton.setText (ControlPlugin.getResourceString("SWT_SEPARATOR"));
- horizontalButton = new Button (styleGroup, SWT.RADIO);
- horizontalButton.setText (ControlPlugin.getResourceString("SWT_HORIZONTAL"));
- verticalButton = new Button (styleGroup, SWT.RADIO);
- verticalButton.setText (ControlPlugin.getResourceString("SWT_VERTICAL"));
- Group styleSubGroup = new Group (styleGroup, SWT.NULL);
- styleSubGroup.setLayout (new GridLayout ());
- shadowInButton = new Button (styleSubGroup, SWT.RADIO);
- shadowInButton.setText (ControlPlugin.getResourceString("SWT_SHADOW_IN"));
- shadowOutButton = new Button (styleSubGroup, SWT.RADIO);
- shadowOutButton.setText (ControlPlugin.getResourceString("SWT_SHADOW_OUT"));
- borderButton = new Button(styleGroup, SWT.CHECK);
- borderButton.setText(ControlPlugin.getResourceString("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 ControlPlugin.getResourceString("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;
- 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 (isSeparator && (label1.getStyle () & SWT.SHADOW_OUT) != 0);
- 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.controls/org/eclipse/swt/examples/controls/ListTab.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ListTab.java
deleted file mode 100755
index d55f05b839..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ListTab.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 = {ControlPlugin.getResourceString("ListData1_0"),
- ControlPlugin.getResourceString("ListData1_1"),
- ControlPlugin.getResourceString("ListData1_2"),
- ControlPlugin.getResourceString("ListData1_3"),
- ControlPlugin.getResourceString("ListData1_4"),
- ControlPlugin.getResourceString("ListData1_5"),
- ControlPlugin.getResourceString("ListData1_6"),
- ControlPlugin.getResourceString("ListData1_7"),
- ControlPlugin.getResourceString("ListData1_8")};
-
- /**
- * 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 (ControlPlugin.getResourceString("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 ControlPlugin.getResourceString("List");
- }
-}
diff --git a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ProgressBarTab.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ProgressBarTab.java
deleted file mode 100755
index 6c98778d26..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ProgressBarTab.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 "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 (ControlPlugin.getResourceString("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 (ControlPlugin.getResourceString("SWT_SMOOTH"));
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {progressBar1};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlPlugin.getResourceString("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 ());
- }
-
- /**
- * Sets the minimim of the "Example" widgets.
- */
- void setWidgetMinimum () {
- progressBar1.setMinimum (minimumScale.getSelection ());
- }
-
- /**
- * Sets the selection of the "Example" widgets.
- */
- void setWidgetSelection () {
- progressBar1.setSelection (selectionScale.getSelection ());
- }
-}
diff --git a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/RangeTab.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/RangeTab.java
deleted file mode 100755
index 3e39268a0b..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/RangeTab.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 "Control" widget children.
- */
- void createControlWidgets () {
-
- /* Leave an empty cell */
- new Composite (controlGroup, SWT.NULL);
-
- /* 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 (ControlPlugin.getResourceString("Maximum"));
-
- /* Create a scale widget */
- maximumScale = new Scale (maximumGroup, SWT.NULL);
- maximumScale.setMaximum (100);
- maximumScale.setSelection (100);
- maximumScale.setPageIncrement (10);
- maximumScale.setIncrement (5);
-
- /* 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 (ControlPlugin.getResourceString("Minimum"));
-
- /* Create a scale widget */
- minimumScale = new Scale (minimumGroup, SWT.NULL);
- minimumScale.setMaximum (100);
- minimumScale.setPageIncrement (10);
- minimumScale.setIncrement (5);
-
- /* 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.HORIZONTAL_ALIGN_CENTER);
- gridData.horizontalSpan = 2;
- selectionGroup.setLayoutData(gridData);
- selectionGroup.setText(ControlPlugin.getResourceString("Selection"));
-
- /* Create a scale widget */
- selectionScale = new Scale (selectionGroup, SWT.NULL);
- selectionScale.setMaximum (100);
- selectionScale.setSelection (50);
- selectionScale.setPageIncrement (10);
- selectionScale.setIncrement (5);
-
- /* 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 (ControlPlugin.getResourceString("SWT_HORIZONTAL"));
- verticalButton = new Button (styleGroup, SWT.RADIO);
- verticalButton.setText (ControlPlugin.getResourceString("SWT_VERTICAL"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (ControlPlugin.getResourceString("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.controls/org/eclipse/swt/examples/controls/SashTab.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/SashTab.java
deleted file mode 100755
index 013cf3487f..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/SashTab.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 = {ControlPlugin.getResourceString("ListData0_0"),
- ControlPlugin.getResourceString("ListData0_1"),
- ControlPlugin.getResourceString("ListData0_2"),
- ControlPlugin.getResourceString("ListData0_3"),
- ControlPlugin.getResourceString("ListData0_4"),
- ControlPlugin.getResourceString("ListData0_5"),
- ControlPlugin.getResourceString("ListData0_6"),
- ControlPlugin.getResourceString("ListData0_7"),
- ControlPlugin.getResourceString("ListData0_8")};
-
- static String [] ListData1 = {ControlPlugin.getResourceString("ListData1_0"),
- ControlPlugin.getResourceString("ListData1_1"),
- ControlPlugin.getResourceString("ListData1_2"),
- ControlPlugin.getResourceString("ListData1_3"),
- ControlPlugin.getResourceString("ListData1_4"),
- ControlPlugin.getResourceString("ListData1_5"),
- ControlPlugin.getResourceString("ListData1_6"),
- ControlPlugin.getResourceString("ListData1_7"),
- ControlPlugin.getResourceString("ListData1_8")};
-
- /* Constants */
- static final int SASH_WIDTH = 3;
-
- /**
- * 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 (ControlPlugin.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 ControlPlugin.getResourceString("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.controls/org/eclipse/swt/examples/controls/ScrollableTab.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ScrollableTab.java
deleted file mode 100755
index 8695173478..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ScrollableTab.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 "Style" group.
- */
- void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- singleButton = new Button (styleGroup, SWT.RADIO);
- singleButton.setText (ControlPlugin.getResourceString("SWT_SINGLE"));
- multiButton = new Button (styleGroup, SWT.RADIO);
- multiButton.setText (ControlPlugin.getResourceString("SWT_MULTI"));
- horizontalButton = new Button (styleGroup, SWT.CHECK);
- horizontalButton.setText (ControlPlugin.getResourceString("SWT_H_SCROLL"));
- verticalButton = new Button (styleGroup, SWT.CHECK);
- verticalButton.setText (ControlPlugin.getResourceString("SWT_V_SCROLL"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (ControlPlugin.getResourceString("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.controls/org/eclipse/swt/examples/controls/ShellTab.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ShellTab.java
deleted file mode 100755
index 1eede5da1f..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ShellTab.java
+++ /dev/null
@@ -1,217 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
- Button createButton, closeAllButton;
- Group parentStyleGroup;
-
- /* Variables used to track the open shells */
- int shellCount = 0;
- Shell [] shells = new Shell [4];
-
- /**
- * 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;
-
- /* 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);
- }
-
- /* Set the size, title and open the shell */
- shells [shellCount].setSize (300, 100);
- shells [shellCount].setText (ControlPlugin.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 (ControlPlugin.getResourceString("Parameters"));
-
- /* Create individual groups inside the "Control" group */
- styleGroup = new Group (controlGroup, SWT.NULL);
- gridLayout = new GridLayout ();
- styleGroup.setLayout (gridLayout);
- gridLayout.numColumns = 2;
- styleGroup.setLayoutData (new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- styleGroup.setText (ControlPlugin.getResourceString("Styles"));
-
- /* Create a group for the parent sytle controls */
- parentStyleGroup = new Group (styleGroup, SWT.NULL);
- parentStyleGroup.setLayout (new GridLayout ());
- GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
- gridData.horizontalSpan = 2;
- parentStyleGroup.setLayoutData (gridData);
- parentStyleGroup.setText (ControlPlugin.getResourceString("Parent"));
- }
-
- /**
- * Creates the "Control" widget children.
- */
- void createControlWidgets () {
-
- /* Create the parent style buttons */
- noParentButton = new Button (parentStyleGroup, SWT.RADIO);
- noParentButton.setText (ControlPlugin.getResourceString("No_Parent"));
- parentButton = new Button (parentStyleGroup, SWT.RADIO);
- parentButton.setText (ControlPlugin.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_CENTER);
- gridData.horizontalSpan = 2;
- decorationStyleGroup.setLayoutData (gridData);
- decorationStyleGroup.setText (ControlPlugin.getResourceString("Decoration_Styles"));
-
- /* Create the decoration style buttons */
- noTrimButton = new Button (decorationStyleGroup, SWT.CHECK);
- noTrimButton.setText (ControlPlugin.getResourceString("SWT_NO_TRIM"));
- closeButton = new Button (decorationStyleGroup, SWT.CHECK);
- closeButton.setText (ControlPlugin.getResourceString("SWT_CLOSE"));
- titleButton = new Button (decorationStyleGroup, SWT.CHECK);
- titleButton.setText (ControlPlugin.getResourceString("SWT_TITLE"));
- minButton = new Button (decorationStyleGroup, SWT.CHECK);
- minButton.setText (ControlPlugin.getResourceString("SWT_MIN"));
- maxButton = new Button (decorationStyleGroup, SWT.CHECK);
- maxButton.setText (ControlPlugin.getResourceString("SWT_MAX"));
- borderButton = new Button (decorationStyleGroup, SWT.CHECK);
- borderButton.setText (ControlPlugin.getResourceString("SWT_BORDER"));
- resizeButton = new Button (decorationStyleGroup, SWT.CHECK);
- resizeButton.setText (ControlPlugin.getResourceString("SWT_RESIZE"));
-
- /* Create the "create" and "closeAll" buttons */
- createButton = new Button (styleGroup, SWT.NULL);
- gridData = new GridData (GridData.HORIZONTAL_ALIGN_CENTER);
- createButton.setLayoutData (gridData);
- createButton.setText (ControlPlugin.getResourceString("Create_Shell"));
- closeAllButton = new Button (styleGroup, SWT.NULL);
- closeAllButton.setText (ControlPlugin.getResourceString("Close_All_Shells"));
- closeAllButton.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_CENTER));
-
- /* 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);
-
- /* Set the default state */
- noParentButton.setSelection (true);
- }
-
- /**
- * Handle a decoration button selection event.
- *
- * @param event org.eclipse.swt.events.SelectionEvent
- */
- public void decorationButtonSelected(SelectionEvent event) {
-
- /*
- * Make sure if the No Trim button is selected then
- * all other decoration buttons are deselected.
- */
- Button widget = (Button) event.widget;
- if (widget.getSelection() && widget != noTrimButton) {
- noTrimButton.setSelection (false);
- return;
- }
- if (widget.getSelection() && widget == noTrimButton) {
- 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 ControlPlugin.getResourceString("Shell");
- }
-}
diff --git a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/SliderTab.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/SliderTab.java
deleted file mode 100755
index 3058d09ca5..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/SliderTab.java
+++ /dev/null
@@ -1,226 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-
- /**
- * 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 (ControlPlugin.getResourceString("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 (ControlPlugin.getResourceString("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 (ControlPlugin.getResourceString("Increment"));
-
- /* Create the scale widget */
- incrementScale = new Scale (incrementGroup, SWT.NULL);
- incrementScale.setMaximum (100);
- incrementScale.setSelection (5);
- incrementScale.setPageIncrement (10);
- incrementScale.setIncrement (5);
-
- /* 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 (ControlPlugin.getResourceString("Page_Increment"));
-
- /* Create the scale widget */
- pageIncrementScale = new Scale (pageIncrementGroup, SWT.NULL);
- pageIncrementScale.setMaximum (100);
- pageIncrementScale.setSelection (10);
- pageIncrementScale.setPageIncrement (10);
- pageIncrementScale.setIncrement (5);
-
- /* Add the listeners */
- pageIncrementScale.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetIncrement ();
- }
- });
- }
-
- /**
- * 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 (ControlPlugin.getResourceString("Thumb"));
-
- /* Create the scale widget */
- thumbScale = new Scale (thumbGroup, SWT.NULL);
- thumbScale.setMaximum (100);
- thumbScale.setSelection (10);
- thumbScale.setPageIncrement (10);
- thumbScale.setIncrement (5);
-
- /* 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 ControlPlugin.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.controls/org/eclipse/swt/examples/controls/Tab.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/Tab.java
deleted file mode 100755
index a28d88aae0..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/Tab.java
+++ /dev/null
@@ -1,364 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-
-/**
- * <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;
-
- /* Common groups and composites */
- Composite tabFolderPage;
- Group exampleGroup, controlGroup, displayGroup, sizeGroup, styleGroup;
-
- /* 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;
-
- /**
- * 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 (ControlPlugin.getResourceString("Parameters"));
-
- /* Create individual groups inside the "Control" group */
- createStyleGroup ();
- createDisplayGroup ();
- createSizeGroup ();
-
- /*
- * 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 curreont 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 "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 (ControlPlugin.getResourceString("State"));
-
- /* Create the controls */
- enabledButton = new Button(displayGroup, SWT.CHECK);
- enabledButton.setText(ControlPlugin.getResourceString("Enabled"));
- visibleButton = new Button(displayGroup, SWT.CHECK);
- visibleButton.setText(ControlPlugin.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 () {
- /*
- * Create the example group. This is the
- * group on the right half of each example
- * tab.
- */
- exampleGroup = new Group (tabFolderPage, SWT.NONE);
- GridLayout gridLayout = new GridLayout ();
- exampleGroup.setLayout (gridLayout);
- exampleGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- }
-
- /**
- * 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 (ControlPlugin.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 (ControlPlugin.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);
-
- /* 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);
-
- /* 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 (ControlPlugin.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 ();
- }
- }
-
- /**
- * 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 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 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 = new GridData ();
- gridData.widthHint = size;
- gridData.heightHint = size;
- controls [i].setLayoutData (gridData);
- }
- /*
- * Force the entire widget tree to layout,
- * even when the child sizes nay 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 ();
- 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.controls/org/eclipse/swt/examples/controls/TableTab.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/TableTab.java
deleted file mode 100755
index 92a68da784..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/TableTab.java
+++ /dev/null
@@ -1,172 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-
- /* Style widgets added to the "Style" group */
- Button fullSelectionButton;
-
- /* Display widgets added to the "Display" group */
- Button headerVisibleButton, linesVisibleButton;
-
- static String [] columnTitles = {ControlPlugin.getResourceString("TableTitle_0"),
- ControlPlugin.getResourceString("TableTitle_1"),
- ControlPlugin.getResourceString("TableTitle_2"),
- ControlPlugin.getResourceString("TableTitle_3")};
-
- static String [] stringLine0 = {ControlPlugin.getResourceString("TableLine0_0"),
- ControlPlugin.getResourceString("TableLine0_1"),
- ControlPlugin.getResourceString("TableLine0_2"),
- ControlPlugin.getResourceString("TableLine0_3")};
-
- static String [] stringLine1 = {ControlPlugin.getResourceString("TableLine1_0"),
- ControlPlugin.getResourceString("TableLine1_1"),
- ControlPlugin.getResourceString("TableLine1_2"),
- ControlPlugin.getResourceString("TableLine1_3")};
-
- static String [] stringLine2 = {ControlPlugin.getResourceString("TableLine2_0"),
- ControlPlugin.getResourceString("TableLine2_1"),
- ControlPlugin.getResourceString("TableLine2_2"),
- ControlPlugin.getResourceString("TableLine2_3")};
-
- /**
- * Creates the "Display" group.
- */
- void createDisplayGroup () {
- super.createDisplayGroup ();
-
- /* Create display controls specific to this example */
- headerVisibleButton = new Button (displayGroup, SWT.CHECK);
- headerVisibleButton.setText (ControlPlugin.getResourceString("Header_Visible"));
- linesVisibleButton = new Button (displayGroup, SWT.CHECK);
- linesVisibleButton.setText (ControlPlugin.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.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- tableGroup.setText (ControlPlugin.getResourceString("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 (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 */
- int[] columnWidths = {150, 60, 75, 150};
- for (int i = 0; i < columnTitles.length; i++) {
- TableColumn tableColumn = new TableColumn(table1, SWT.NULL);
- tableColumn.setWidth(columnWidths[i]);
- tableColumn.setText(columnTitles[i]);
- }
- for (int i=0; i<16; i++) {
- TableItem item = new TableItem (table1, SWT.NULL);
- item.setImage (ControlPlugin.images [i % 3]);
- switch (i % 3) {
- case 0:
- stringLine0 [0] = ControlPlugin.getResourceString("Index") + i;
- item.setText(stringLine0);
- break;
- case 1:
- stringLine1 [0] = ControlPlugin.getResourceString("Index") + i;
- item.setText(stringLine1);
- break;
- case 2:
- stringLine2 [0] = ControlPlugin.getResourceString("Index") + i;
- item.setText(stringLine2);
- break;
- }
- }
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- fullSelectionButton = new Button (styleGroup, SWT.CHECK);
- fullSelectionButton.setText (ControlPlugin.getResourceString("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 ControlPlugin.getResourceString("Table");
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- setWidgetHeaderVisible ();
- setWidgetLinesVisible ();
- 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.controls/org/eclipse/swt/examples/controls/TextTab.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/TextTab.java
deleted file mode 100755
index 58956dde74..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/TextTab.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 richText;
- Group textGroup, richTextGroup;
-
- /* Style widgets added to the "Style" group */
- Button readOnlyButton;
-
- /**
- * 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 (ControlPlugin.getResourceString("Text"));
-
- /* Create a group for the rich text widget */
- richTextGroup = new Group (exampleGroup, SWT.NULL);
- richTextGroup.setLayout (new GridLayout ());
- richTextGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- richTextGroup.setText (ControlPlugin.getResourceString("RichText"));
- }
-
- /**
- * 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 (readOnlyButton.getSelection ()) style |= SWT.READ_ONLY;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- text = new Text (textGroup, style);
- text.setText (ControlPlugin.getResourceString("Example_string"));
- text.append (text.DELIMITER);
- text.append (ControlPlugin.getResourceString("One_Two_Three"));
- richText = new StyledText (richTextGroup, style);
- richText.setText (ControlPlugin.getResourceString("Example_string"));
- richText.append ("\n");
- richText.append (ControlPlugin.getResourceString("One_Two_Three"));
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup();
-
- /* Create the extra widgets */
- readOnlyButton = new Button (styleGroup, SWT.CHECK);
- readOnlyButton.setText (ControlPlugin.getResourceString("SWT_READ_ONLY"));
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {text, richText};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlPlugin.getResourceString("Text");
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- readOnlyButton.setSelection ((text.getStyle () & SWT.READ_ONLY) != 0);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ToolBarTab.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ToolBarTab.java
deleted file mode 100755
index a316f828a4..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/ToolBarTab.java
+++ /dev/null
@@ -1,271 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
- Menu dropDownMenu;
- Group imageToolBarGroup, textToolBarGroup;
-
- /* Style widgets added to the "Style" group */
- Button flatButton, wrapButton;
-
- static String [] MenuData0 = {ControlPlugin.getResourceString("ListData0_0"),
- ControlPlugin.getResourceString("ListData0_1"),
- ControlPlugin.getResourceString("ListData0_2"),
- ControlPlugin.getResourceString("ListData0_3"),
- ControlPlugin.getResourceString("ListData0_4"),
- ControlPlugin.getResourceString("ListData0_5"),
- ControlPlugin.getResourceString("ListData0_6"),
- ControlPlugin.getResourceString("ListData0_7"),
- ControlPlugin.getResourceString("ListData0_8")};
-
- /**
- * Create the drop down menu widget used by the
- * drop down style tool bar item.
- */
- void createDropDownMenu() {
- /* Don't create more than one menu */
- if (dropDownMenu != null) return;
-
- /* Create the menu */
- Shell shell = tabFolderPage.getShell ();
- dropDownMenu = new Menu(shell);
- for (int i = 0; i < MenuData0.length; ++i) {
- if (i != 5) {
- MenuItem menuItem = new MenuItem(dropDownMenu, SWT.NONE);
- menuItem.setText(MenuData0[i]);
- /*
- * 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) {
- disposeDropDownMenu ();
- }
- });
- } else {
- MenuItem menuItem = new MenuItem(dropDownMenu, SWT.SEPARATOR);
- }
- }
- }
-
- /**
- * 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 (ControlPlugin.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 (ControlPlugin.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 (ControlPlugin.images[ControlPlugin.ciClosedFolder]);
- item.setToolTipText(ControlPlugin.getResourceString("SWT_PUSH"));
- item = new ToolItem (imageToolBar, SWT.PUSH);
- item.setImage (ControlPlugin.images[ControlPlugin.ciClosedFolder]);
- item.setToolTipText (ControlPlugin.getResourceString("SWT_PUSH"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (ControlPlugin.images[ControlPlugin.ciOpenFolder]);
- item.setToolTipText (ControlPlugin.getResourceString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (ControlPlugin.images[ControlPlugin.ciOpenFolder]);
- item.setToolTipText (ControlPlugin.getResourceString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.CHECK);
- item.setImage (ControlPlugin.images[ControlPlugin.ciTarget]);
- item.setToolTipText (ControlPlugin.getResourceString("SWT_CHECK"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (ControlPlugin.images[ControlPlugin.ciClosedFolder]);
- item.setToolTipText (ControlPlugin.getResourceString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (ControlPlugin.images[ControlPlugin.ciClosedFolder]);
- item.setToolTipText (ControlPlugin.getResourceString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.SEPARATOR);
- item.setToolTipText(ControlPlugin.getResourceString("SWT_SEPARATOR"));
- item = new ToolItem (imageToolBar, SWT.DROP_DOWN);
- item.setImage (ControlPlugin.images[ControlPlugin.ciTarget]);
- item.setToolTipText (ControlPlugin.getResourceString("SWT_DROP_DOWN"));
-
- /*
- * Add a selection listener to the drop down tool item
- * so that we can show the menu when the drop down area
- * is pressed.
- */
- item.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- dropDownToolItemSelected (event);
- }
- });
-
- /* Create the text tool bar */
- textToolBar = new ToolBar (textToolBarGroup, style);
- item = new ToolItem (textToolBar, SWT.PUSH);
- item.setText (ControlPlugin.getResourceString("Push"));
- item.setToolTipText(ControlPlugin.getResourceString("SWT_PUSH"));
- item = new ToolItem (textToolBar, SWT.PUSH);
- item.setText (ControlPlugin.getResourceString("Push"));
- item.setToolTipText(ControlPlugin.getResourceString("SWT_PUSH"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (ControlPlugin.getResourceString("Radio"));
- item.setToolTipText(ControlPlugin.getResourceString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (ControlPlugin.getResourceString("Radio"));
- item.setToolTipText(ControlPlugin.getResourceString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.CHECK);
- item.setText (ControlPlugin.getResourceString("Check"));
- item.setToolTipText(ControlPlugin.getResourceString("SWT_CHECK"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (ControlPlugin.getResourceString("Radio"));
- item.setToolTipText(ControlPlugin.getResourceString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (ControlPlugin.getResourceString("Radio"));
- item.setToolTipText(ControlPlugin.getResourceString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.SEPARATOR);
- item.setToolTipText(ControlPlugin.getResourceString("SWT_SEPARATOR"));
- item = new ToolItem (textToolBar, SWT.DROP_DOWN);
- item.setText (ControlPlugin.getResourceString("Drop_Down"));
- item.setToolTipText(ControlPlugin.getResourceString("SWT_DROP_DOWN"));
-
- /*
- * 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 (ControlPlugin.getResourceString("SWT_FLAT"));
- wrapButton = new Button (styleGroup, SWT.CHECK);
- wrapButton.setText (ControlPlugin.getResourceString("SWT_WRAP"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (ControlPlugin.getResourceString("SWT_BORDER"));
- }
-
- void disposeDropDownMenu () {
- dropDownMenu.setVisible(false);
- dropDownMenu.dispose();
- dropDownMenu = null;
- }
-
- void disposeExampleWidgets () {
- super.disposeExampleWidgets ();
- disposeDropDownMenu ();
- }
-
- /**
- * Handle the drop down tool item selection event.
- *
- * @param event the selection event
- */
- void dropDownToolItemSelected (SelectionEvent event) {
-
- /*
- * If menu was already dropped down then close it.
- * We would do this regardless of where the tool
- * item was selected.
- */
- if (dropDownMenu != null) {
- disposeDropDownMenu ();
- return;
- }
- createDropDownMenu ();
-
- /**
- * 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.
- * Position the menu below and vertically
- * alligned with the the drop down tool button.
- */
- ToolItem item = (ToolItem) event.widget;
- Rectangle toolItemBounds = item.getBounds ();
- Point point1 = imageToolBar.toDisplay(new Point (toolItemBounds.x, toolItemBounds.y));
- dropDownMenu.setLocation(point1.x, point1.y + toolItemBounds.height);
- dropDownMenu.setVisible(true);
- } else {
- /*
- * Main area of drop down tool item selected.
- * An application would invoke the code was
- * required to perform the action for the tool
- * item.
- */
- }
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {imageToolBar, textToolBar};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlPlugin.getResourceString("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);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/TreeTab.java b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/TreeTab.java
deleted file mode 100755
index 0270245c6d..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/TreeTab.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-
- /**
- * 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 (ControlPlugin.getResourceString("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 (ControlPlugin.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 (borderButton.getSelection()) style |= SWT.BORDER;
-
- /* Create the text tree */
- tree1 = new Tree (treeGroup, style);
- TreeItem node1 = new TreeItem (tree1, SWT.NULL);
- node1.setText (ControlPlugin.getResourceString("Node_1"));
- TreeItem node2 = new TreeItem (tree1, SWT.NULL);
- node2.setText (ControlPlugin.getResourceString("Node_2"));
- TreeItem node3 = new TreeItem (tree1, SWT.NULL);
- node3.setText (ControlPlugin.getResourceString("Node_3"));
- TreeItem node4 = new TreeItem (tree1, SWT.NULL);
- node4.setText (ControlPlugin.getResourceString("Node_4"));
- TreeItem node1_1 = new TreeItem (node1, SWT.NULL);
- node1_1.setText (ControlPlugin.getResourceString("Node_1_1"));
- TreeItem node2_1 = new TreeItem (node2, SWT.NULL);
- node2_1.setText (ControlPlugin.getResourceString("Node_2_1"));
- TreeItem node3_1 = new TreeItem (node3, SWT.NULL);
- node3_1.setText (ControlPlugin.getResourceString("Node_3_1"));
- TreeItem node2_2 = new TreeItem (node2, SWT.NULL);
- node2_2.setText (ControlPlugin.getResourceString("Node_2_2"));
- TreeItem node2_2_1 = new TreeItem (node2_2, SWT.NULL);
- node2_2_1.setText (ControlPlugin.getResourceString("Node_2_2_1"));
-
- /* Create the image tree */
- tree2 = new Tree (imageTreeGroup, style);
- node1 = new TreeItem (tree2, SWT.NULL);
- node1.setText (ControlPlugin.getResourceString("Node_1"));
- node1.setImage (ControlPlugin.images[ControlPlugin.ciClosedFolder]);
- node2 = new TreeItem (tree2, SWT.NULL);
- node2.setText (ControlPlugin.getResourceString("Node_2"));
- node2.setImage (ControlPlugin.images[ControlPlugin.ciClosedFolder]);
- node3 = new TreeItem (tree2, SWT.NULL);
- node3.setText (ControlPlugin.getResourceString("Node_3"));
- node3.setImage (ControlPlugin.images[ControlPlugin.ciClosedFolder]);
- node4 = new TreeItem (tree2, SWT.NULL);
- node4.setText (ControlPlugin.getResourceString("Node_4"));
- node4.setImage (ControlPlugin.images[ControlPlugin.ciClosedFolder]);
- node1_1 = new TreeItem (node1, SWT.NULL);
- node1_1.setText (ControlPlugin.getResourceString("Node_1_1"));
- node1_1.setImage (ControlPlugin.images[ControlPlugin.ciClosedFolder]);
- node2_1 = new TreeItem (node2, SWT.NULL);
- node2_1.setText (ControlPlugin.getResourceString("Node_2_1"));
- node2_1.setImage (ControlPlugin.images[ControlPlugin.ciClosedFolder]);
- node3_1 = new TreeItem (node3, SWT.NULL);
- node3_1.setText (ControlPlugin.getResourceString("Node_3_1"));
- node3_1.setImage (ControlPlugin.images[ControlPlugin.ciClosedFolder]);
- node2_2 = new TreeItem(node2, SWT.NULL);
- node2_2.setText (ControlPlugin.getResourceString("Node_2_2"));
- node2_2.setImage (ControlPlugin.images[ControlPlugin.ciClosedFolder]);
- node2_2_1 = new TreeItem (node2_2, SWT.NULL);
- node2_2_1.setText (ControlPlugin.getResourceString("Node_2_2_1"));
- node2_2_1.setImage (ControlPlugin.images[ControlPlugin.ciClosedFolder]);
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {tree1, tree2};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return ControlPlugin.getResourceString("Tree");
- }
-}
diff --git a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/closedFolder.gif b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/closedFolder.gif
deleted file mode 100755
index 6660d0b11a..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/closedFolder.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/openFolder.gif b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/openFolder.gif
deleted file mode 100755
index fc9943f111..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/openFolder.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/target.gif b/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/target.gif
deleted file mode 100755
index 9807ae648d..0000000000
--- a/examples/org.eclipse.swt.examples.controls/org/eclipse/swt/examples/controls/target.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.controls/plugin.jars b/examples/org.eclipse.swt.examples.controls/plugin.jars
deleted file mode 100755
index 493bce128f..0000000000
--- a/examples/org.eclipse.swt.examples.controls/plugin.jars
+++ /dev/null
@@ -1,3 +0,0 @@
-controls.jar =\
- src, \
- icons
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 82ff5f928b..0000000000
--- a/examples/org.eclipse.swt.examples.controls/plugin.properties
+++ /dev/null
@@ -1,187 +0,0 @@
-plugin.SWTControlsExample.name = SWT Controls Example Plugin
-category.SWTExamples.name = SWT Examples
-view.ControlsExample.name = 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 Standard Widget Toolkit (SWT) UI controls.\n\n\
- The example consists of a shell and tab folder where each tab in the folder allows the user to interact with a control. \
- Each page (tab) of the controls example allows the user to interact with a different SWT control. \
- The name of the control being demonstrated on each page is on the tab.
-
-error.CouldNotLoadResources = Unable to load resources
-
-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
-Dialog_Result = Dialog Result
-ColorDialog = ColorDialog
-DirectoryDialog = DirectoryDialog
-FileDialog = FileDialog
-FontDialog = FontDialog
-MessageBox = MessageBox
-Multi_line = A multi line text widget.
-Example_string = The quick brown fox jumped over the lazy dogs.
-Header_Visible = Header Visible
-Lines_Visible = Lines Visible
-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:
-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
-Button = Button
-Combo = Combo
-Dialog = Dialog
-Label = Label
-List = List
-ProgressBar = ProgressBar
-Sash = Sash
-Shell = Shell
-Slider_and_Scale = Slider and Scale
-Table = Table
-Text = Text
-ToolBar = ToolBar
-Tree = Tree
-RichText = RichText
-Slider = Slider
-Scale = Scale
-SWT_PUSH = SWT.PUSH
-SWT_CHECK = SWT.CHECK
-SWT_RADIO = SWT.RADIO
-SWT_TOGGLE = SWT.TOGGLE
-SWT_ARROW = SWT.ARROW
-SWT_BORDER = SWT.BORDER
-SWT_DROP_DOWN = SWT.DROP_DOWN
-SWT_READ_ONLY = SWT.READ_ONLY
-SWT_SIMPLE = SWT.SIMPLE
-SWT_SEPARATOR = SWT.SEPARATOR
-SWT_HORIZONTAL = SWT.HORIZONTAL
-SWT_VERTICAL = SWT.VERTICAL
-SWT_SHADOW_IN = SWT.SHADOW_IN
-SWT_SHADOW_OUT = SWT.SHADOW_OUT
-SWT_SINGLE = SWT.SINGLE
-SWT_MULTI = SWT.MULTI
-SWT_H_SCROLL = SWT.H_SCROLL
-SWT_V_SCROLL = SWT.V_SCROLL
-SWT_FLAT = SWT.FLAT
-SWT_WRAP = SWT.WRAP
-SWT_SAVE = SWT.SAVE
-SWT_OPEN = SWT.OPEN
-SWT_PRIMARY_MODAL = SWT.PRIMARY_MODAL
-SWT_APPLICATION_MODAL = SWT.APPLICATION_MODAL
-SWT_SYSTEM_MODAL = SWT.SYSTEM_MODAL
-SWT_MODELESS = SWT.MODELESS
-SWT_ICON_ERROR = SWT.ICON_ERROR
-SWT_ICON_INFORMATION = SWT.ICON_INFORMATION
-SWT_ICON_QUESTION = SWT.ICON_QUESTION
-SWT_ICON_WARNING = SWT.ICON_WARNING
-SWT_ICON_WORKING = SWT.ICON_WORKING
-SWT_OK = SWT.OK
-SWT_CANCEL = SWT.CANCEL
-SWT_YES = SWT.YES
-SWT_NO = SWT.NO
-SWT_RETRY = SWT.RETRY
-SWT_ABORT = SWT.ABORT
-SWT_IGNORE = SWT.IGNORE
-SWT_NO_TRIM = SWT.NO_TRIM
-SWT_CLOSE = SWT.CLOSE
-SWT_TITLE = SWT.TITLE
-SWT_MIN = SWT.MIN
-SWT_MAX = SWT.MAX
-SWT_RESIZE = SWT.RESIZE
-SWT_FULL_SELECTION = SWT.FULL_SELECTION
-SWT_SMOOTH = SWT.SMOOTH \ 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 3c27358598..0000000000
--- a/examples/org.eclipse.swt.examples.controls/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.controls"
- name="%plugin.SWTControlsExample.name"
- version="0.9"
- provider-name="Object Technology International, Inc."
- class="org.eclipse.swt.examples.controls.ControlPlugin">
-<!-- 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>
- <library name="controls.jar"/>
-</runtime>
-
-<!-- Extension points -->
-<!-- Extensions -->
-<extension
- point="org.eclipse.ui.views">
- <view
- name="%view.ControlsExample.name"
- category="org.eclipse.swt.examples.category"
- class="org.eclipse.swt.examples.controls.ControlView"
- id="org.eclipse.swt.examples.controls.view"
- icon="icons/controls_example.gif">
- </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"
- description="%launchitem.ControlsExample.description"
- category="org.eclipse.swt.examples.launchViewCategory"
- id="org.eclipse.swt.examples.controls.viewlauncher"
- icon="icons/controls_example.gif">
- <view
- viewId="org.eclipse.swt.examples.controls.view"/>
- <source
- zip="controlssrc.zip"/>
- </item>
-</extension>
-</plugin>
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 945efaadc5..0000000000
--- a/examples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlPlugin.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 ControlPlugin extends AbstractUIPlugin {
- //The shared instance.
- private static ControlPlugin plugin;
- private static ResourceBundle resourceBundle;
-
- static final int
- ciClosedFolder = 0,
- ciOpenFolder = 1,
- ciTarget = 2;
- static final String[] imageLocations = {
- "closedFolder.gif",
- "openFolder.gif",
- "target.gif" };
- static Image images[];
-
- /**
- * The constructor.
- */
- public ControlPlugin(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 ControlPlugin getDefault() {
- return plugin;
- }
-
- /**
- * 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 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.
- */
- 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() {
- Class clazz = ControlPlugin.class;
- 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);
- }
- }
- } catch (Throwable ex) {
- freeResources();
- logError(getResourceString("error.CouldNotLoadResources"), ex);
- 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;
- }
- }
-}
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 9b996280d8..0000000000
--- a/examples/org.eclipse.swt.examples.controls/src/org/eclipse/swt/examples/controls/ControlView.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package org.eclipse.swt.examples.controls;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.part.ViewPart;
-import java.util.ResourceBundle;
-
-/**
- * <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 {
- private ShellTab shellTab;
- private TabFolder tabFolder;
- private Composite mainFrame;
-
- /**
- * The constructor.
- */
- public ControlView() {
- ControlPlugin.initResources();
- }
-
- /**
- * Create the example
- *
- * @see ViewPart#createPartControl
- */
- public void createPartControl(Composite frame) {
- this.mainFrame = frame;
-
- /* Create the tab folder */
- tabFolder = new TabFolder (frame, SWT.NULL);
- Tab [] tabs = new Tab [] {
- new ButtonTab (),
- new ComboTab (),
- new DialogTab (),
- new LabelTab (),
- new ListTab (),
- new ProgressBarTab (),
- new SashTab (),
- shellTab = new ShellTab(),
- new SliderTab (),
- new TableTab (),
- new TextTab (),
- new ToolBarTab (),
- new TreeTab (),
- };
- 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));
- }
-
- }
-
- /**
- * Called when we must grab focus.
- *
- * @see org.eclipse.ui.part.ViewPart#setFocus
- */
- public void setFocus() {
- //tabFolder.setFocus();
- mainFrame.setFocus();
- }
-
- /**
- * Called when the View is to be disposed
- */
-
- 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;
- 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 59d2f2d9bb..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/.classpath
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path=""/>
- <classpathentry kind="var" path="JRE_LIB"/>
- <classpathentry kind="var"
- path="ECLIPSE_PLUGINS/org.eclipse.swt/swt.jar" sourcepath="ECLIPSE_PLUGINS/org.eclipse.swt/swtsrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_PLUGINS/org.eclipse.core.runtime/runtime.jar" sourcepath="ECLIPSE_PLUGINS/org.eclipse.core.runtime/runtimesrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_PLUGINS/org.eclipse.core.resources/resources.jar" sourcepath="ECLIPSE_PLUGINS/org.eclipse.core.resources/resourcessrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_PLUGINS/org.eclipse.ui/workbench.jar" sourcepath="ECLIPSE_PLUGINS/org.eclipse.ui/workbenchsrc.zip"/>
- <classpathentry kind="output" path="bin"/>
- <classpathentry kind="var"
- path="ECLIPSE_PLUGINS/org.eclipse.core.boot/boot.jar" sourcepath="ECLIPSE_PLUGINS/org.eclipse.core.boot/bootsrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_PLUGINS/org.eclipse.jdt.core/jdtcore.jar" sourcepath="ECLIPSE_PLUGINS/org.eclipse.jdt.core/jdtcoresrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_PLUGINS/org.eclipse.jdt.launching/launching.jar" sourcepath="ECLIPSE_PLUGINS/org.eclipse.jdt.launching/launchingsrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_PLUGINS/org.eclipse.debug.core/dtcore.jar" sourcepath="ECLIPSE_PLUGINS/org.eclipse.debug.core/dtcoresrc.zip"/>
- <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/.vcm_meta b/examples/org.eclipse.swt.examples.launcher/.vcm_meta
deleted file mode 100755
index d64b057431..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/.vcm_meta
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project-description>
- <comment></comment>
- <nature id="org.eclipse.jdt.core.javanature"/>
- <nature id="org.eclipse.pde.PluginNature"/>
- <reference project-name="org.eclipse.swt"/>
- <builder name="org.eclipse.jdt.core.javabuilder">
- </builder>
- <builder name="org.eclipse.pde.ManifestBuilder">
- </builder>
- <builder name="org.eclipse.pde.SchemaBuilder">
- </builder>
-</project-description>
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 9b1d518406..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/build.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-build.includes = doc/,\
- doc-html/,\
- icons/,\
- schema/,\
- plugin.properties,\
- plugin.xml
-
-build.vaj.Eclipse\ SWT\ Examples\ Launcher = /
-
-build.excludes = bin/,\
- .cvsignore,\
- .vcm_meta,\
- build.properties \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.launcher/doc-html/hglegal.htm b/examples/org.eclipse.swt.examples.launcher/doc-html/hglegal.htm
deleted file mode 100755
index b071dbdf45..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/doc-html/hglegal.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="Mozilla/4.73 [en] (Win98; U) [Netscape]">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2001. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.launcher/doc-html/ngibmcpy.gif b/examples/org.eclipse.swt.examples.launcher/doc-html/ngibmcpy.gif
deleted file mode 100755
index 360f8e9989..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/doc-html/ngibmcpy.gif
+++ /dev/null
Binary files differ
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 460373ef8d..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/doc-html/swt_launcher_ex.html
+++ /dev/null
@@ -1,59 +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>Example Launcher</h2>
-
-<h3>Introduction</h3>
-<p>The Example Launcher is a tool for enumerating, running and browsing a variety of examples.
-While these operations may be performed manually (with some difficulty), the Example Launcher
-offers a convenient interface.&nbsp; For information on how to manipulate particular examples
-manually, please consult their related documentation.
-</p>
-
-<h3>Running the Example Launcher</h3>
-<p>To run the Example Launcher, pull down the Perspective menu, select the
-Show View menu item, then select Other from the submenu.&nbsp; A dialog
-will come up with a list of views.&nbsp; Expand SWT Examples and select
-the view named SWT Example Launcher.&nbsp; A view containing a list of examples to
-choose will appear.
-</p>
-
-<h3>About the examples</h3>
-<p>The Example Launcher can launch two different types of examples: Workbench Views,
-and Standalone applications.&nbsp; Examples will generally be organized into categories to
-distinguish the one from the other.
-</p>
-<p>Workbench Views are GUI panels that sit inside a given perspective. When the Launcher
-starts a program that is written to interact with the Workbench as a view, it is opened and
-embedded into the currently active perspective.
-</p>
-<p>Standalone applications are programs that run independently of the current
-Eclipse Platform environment.&nbsp; First, a new Java VM and Eclipse Platform runtime
-is started, then the application's main() method is invoked.&nbsp; For this reason,
-these applications may take some time to load.
-</p>
-
-<h3>Details</h3>
-<p>The example launcher view contains a tree list, a text area, and 2 buttons.
-The tree list contains a list of all the SWT examples you can choose
-to run.&nbsp; When an example is selected from the tree, the text area
-shows a short description of each example.&nbsp; The selected example can
-be executed by clicking on the Run button, which can be found just below
-the tree list.&nbsp; For some of the examples, you can also import the example
-source code into a project in the Workspace.&nbsp; A project, with a name specified
-by the user, is created and all the java classes required to run that example
-will be added to that newly created project.
-</p><p>
-Depending on the example and on the configuration of your system, it may be
-necessary to alter Project build paths or to define classpath variables to compile
-or run examples that have been imported to the Workspace.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000" 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 8532deef62..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/doc/org.eclipse.swt.examples.launcher.launchItems.html
+++ /dev/null
@@ -1,61 +0,0 @@
-<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 in new run-time environments.
- Workbench views are created within the active Workbench Perspective.<H2>Markup</H2>
-<p><samp>&nbsp;&nbsp; &lt;!ELEMENT extension (EMPTY)&gt;</samp>
-<br><samp>&nbsp;&nbsp; &lt;!ATTLIST extension</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;point&nbsp;CDATA #REQUIRED</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;id&nbsp;&nbsp;&nbsp;&nbsp;CDATA #IMPLIED</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name&nbsp;&nbsp;CDATA #IMPLIED</samp>
-<br><samp>&nbsp;&nbsp; &gt;</samp>
-<ul>
-<li><b>point</b> - </li><li><b>id</b> - </li><li><b>name</b> - </li></ul>
-<p><samp>&nbsp;&nbsp; &lt;!ELEMENT program (EMPTY)&gt;</samp>
-<br><samp>&nbsp;&nbsp; &lt;!ATTLIST program</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mainClass&nbsp;CDATA #REQUIRED</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pluginId&nbsp;&nbsp;CDATA #REQUIRED</samp>
-<br><samp>&nbsp;&nbsp; &gt;</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>&nbsp;&nbsp; &lt;!ELEMENT view (EMPTY)&gt;</samp>
-<br><samp>&nbsp;&nbsp; &lt;!ATTLIST view</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;viewId&nbsp;CDATA #REQUIRED</samp>
-<br><samp>&nbsp;&nbsp; &gt;</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>&nbsp;&nbsp; &lt;!ELEMENT category (EMPTY)&gt;</samp>
-<br><samp>&nbsp;&nbsp; &lt;!ATTLIST category</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #REQUIRED</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #REQUIRED</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;category&nbsp;CDATA #IMPLIED</samp>
-<br><samp>&nbsp;&nbsp; &gt;</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>&nbsp;&nbsp; &lt;!ELEMENT item (EMPTY)&gt;</samp>
-<br><samp>&nbsp;&nbsp; &lt;!ATTLIST item</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #REQUIRED</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #REQUIRED</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;category&nbsp;&nbsp;&nbsp;&nbsp;CDATA #IMPLIED</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;icon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CDATA #IMPLIED</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;enabled&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(true | false) "false""true"</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;description&nbsp;CDATA #IMPLIED</samp>
-<br><samp>&nbsp;&nbsp; &gt;</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>
-<p><samp>&nbsp;&nbsp; &lt;!ELEMENT source (EMPTY)&gt;</samp>
-<br><samp>&nbsp;&nbsp; &lt;!ATTLIST source</samp>
-<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zip&nbsp;CDATA #IMPLIED</samp>
-<br><samp>&nbsp;&nbsp; &gt;</samp>
-<ul>
-<li><b>zip</b> - The declaring plugin relative path of a ZIP file containing source code associated with a 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
deleted file mode 100755
index beb6ed134c..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/icons/closedFolder.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.launcher/icons/generic_example.gif b/examples/org.eclipse.swt.examples.launcher/icons/generic_example.gif
deleted file mode 100755
index f9fb6b0cab..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/icons/generic_example.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.launcher/icons/launcher_example.gif b/examples/org.eclipse.swt.examples.launcher/icons/launcher_example.gif
deleted file mode 100755
index 3ab4d32c05..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/icons/launcher_example.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.launcher/icons/openFolder.gif b/examples/org.eclipse.swt.examples.launcher/icons/openFolder.gif
deleted file mode 100755
index a9c777343c..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/icons/openFolder.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.launcher/import.properties b/examples/org.eclipse.swt.examples.launcher/import.properties
deleted file mode 100755
index 9185f56fc8..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/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/org/eclipse/swt/examples/launcher/ApplicationRunner.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ApplicationRunner.java
deleted file mode 100755
index 4e9c314b1d..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ApplicationRunner.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package org.eclipse.swt.examples.launcher; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import java.io.*; import java.net.*; import java.util.*; import org.eclipse.core.boot.*; import org.eclipse.core.runtime.*; import org.eclipse.debug.core.*; import org.eclipse.debug.core.model.*; import org.eclipse.jdt.launching.*; /** * ApplicationRunner provides an interface to run registered Eclipse Platform applications * standalone in their own VM. */
-public class ApplicationRunner {
- protected String appName;
- protected String[] appArgs;
- protected String appStatePath = null;
- protected URL[] appPluginsPath = null;
-
- /**
- * Constructs an ApplicationRunner
- *
- * @param applicationName the id of a registered <code>org.eclipse.core.runtime.applications</code>
- * extension point
- * @param args the arguments to pass to the application, or null if none
- */
- public ApplicationRunner(String applicationName, String[] args) {
- this.appName = applicationName;
- this.appArgs = args;
- }
-
- /**
- * Specify the location of the plugins directory used to launch the application and to locate
- * plugins while the application is running.
- * <p>
- * The default is to let the Eclipse Platform search for the plugins directory in the manner
- * specified by <code>org.eclipse.core.boot.BootLoader</code> when no -plugins argument is
- * supplied to startup(). Generally, this means it will look in the current working directory
- * for either a directory of plugins, or a file telling it where to find these directories.
- * </p><p> * Each entry either points to a specific plugin manifest file (e.g. plugin.xml) or * to a directory containing whose subdirectories contain plugin manifest files. * </p> *
- * @param pluginPath an array of fully-qualified URLs to the plugins directories,
- * or null for the default
- * @see #getCurrentPluginsPath
- */
- public void setPluginsPath(URL[] pluginsPath) {
- this.appPluginsPath = pluginsPath;
- }
-
- /**
- * Specify the location of the applicate saved state directory used to store information
- * about the application's state while it is running.
- * <p>
- * The default is to let the Eclipse Platform search for the state directory in the manner
- * specified by <core>org.eclipse.core.boot.BootLoader</code> when no -platform argument is
- * supplied to startup(). Generally, this means it will create its state in the current
- * working directory.
- * </p>
- *
- * @param statePath the absolute filesystem path to the application state directory,
- * or null for the default
- * @see #getCurrentStatePath
- */
- public void setStatePath(String statePath) {
- this.appStatePath = statePath;
- }
-
- /**
- * Returns the plugins directory path in the current Eclipse Platform instance. * <p> * Each entry either points to a specific plugin manifest file (e.g. plugin.xml) or * to a directory containing whose subdirectories contain plugin manifest files. * </p>
- *
- * @return the current plugins directory absolute filesystem paths array
- */
- public static URL[] getCurrentPluginsPath() { Set /* of URL */ paths = new HashSet(); // get the platform's public plugin registry IPluginRegistry pluginRegistry = Platform.getPluginRegistry(); // retrieve plugin descriptors for all plugins // [array may contain multiple versions of a given plugin] IPluginDescriptor[] pluginDescriptors = pluginRegistry.getPluginDescriptors(); for (int i = 0; i < pluginDescriptors.length; ++i) { final IPluginDescriptor pd = pluginDescriptors[i]; try { // getInstallUrl() returns the path of the directory with the plugin manifest file(s) // for a specific plugin final URL installUrl = Platform.resolve(pd.getInstallURL()); // Add the parent directory of the plugin's install location to our Set String path = installUrl.toString(); path = path.substring(0, path.lastIndexOf('/')); // eliminate terminal '/' on directory path = path.substring(0, 1 + path.lastIndexOf('/')); // locate parent directory URL url = new URL(path); paths.add(url); } catch (IOException e) { // Ignore invalid paths } }
- return (URL[]) paths.toArray(new URL[paths.size()]);
- }
-
- /**
- * Returns the state directory path in the current Eclipse Platform instance.
- *
- * @return the current state directory absolute filesystem path
- */
- public static String getCurrentStatePath() {
- return Platform.getLocation().toFile().getAbsolutePath();
- }
-
- /**
- * Run the application asynchronously in its own VM and Eclipse Platform instance.
- *
- * @return a VMRunnerResult with status and control information about the launch, may be null
- */
- public VMRunnerResult run() {
- int numArgs = (appArgs != null) ? appArgs.length : 0;
- numArgs += 4;
- if (appPluginsPath != null && appPluginsPath.length != 0) numArgs += 2;
- if (appStatePath != null) numArgs += 2;
-
- String[] launcherArgs = new String[numArgs];
-
- int arg = 0;
- launcherArgs[arg++] = "-dev"; // tell Eclipse to look in bin subdirectories
- launcherArgs[arg++] = "bin"; // under plugins directories as part of the classpath
- launcherArgs[arg++] = "-application"; // tell Eclipse to launch our application
- launcherArgs[arg++] = appName;
-
- if (appStatePath != null) {
- launcherArgs[arg++] = "-platform"; // tell Eclipse where its saved state should be placed
- launcherArgs[arg++] = appStatePath;
- }
- if (appPluginsPath != null && appPluginsPath.length != 0) {
- // Plugin path information must be stored on disk in a Properties file for some reason...
- Properties properties = new Properties();
- for (int i = 0; i < appPluginsPath.length; ++i) {
- properties.setProperty("pluginPathEntry" + i, appPluginsPath[i].toString());
- }
-
- try {
- File pathFile = File.createTempFile("tempPluginPaths", ".ini");
- pathFile.deleteOnExit();
-
- OutputStream os = new FileOutputStream(pathFile);
- properties.store(os, "");
- os.close();
-
- launcherArgs[arg++] = "-plugins"; // tell Eclipse where its plugins are stored
- launcherArgs[arg++] = pathFile.getAbsoluteFile().toURL().toString();
- } catch (IOException e) {
- return null;
- }
- }
- if (appArgs != null) System.arraycopy(appArgs, 0, launcherArgs, arg, appArgs.length);
-
- return runJavaClass(getPlatformClass(), getPlatformClassPath(),
- new String[0], launcherArgs);
- }
-
- /**
- * Determines if a VMRunnerResult indicates success or failure.
- * <p>
- * A return value of <code>true</code> should be taken on advisory only. There is at present
- * no general way of determining if the operation was completed successfully.
- * </p>
- * @param result the VMRunnerResult to check, null is permissible and causes a return value of false
- * @return true if the VM started correctly (not a guarantee that the application will run!)
- */
- public static boolean isResultOk(VMRunnerResult result) {
- if (result == null) return false;
-
- IProcess[] processes = result.getProcesses();
- return (processes != null && processes.length > 0);
- }
-
- protected static VMRunnerResult runJavaClass(String className, String[] classPath,
- String[] vmArgs, String[] programArgs) {
- IVMRunner vmRunner = getJavaVMRunner();
- if (vmRunner == null) return null;
-
- VMRunnerConfiguration vmRunConfig = new VMRunnerConfiguration(className, classPath);
- vmRunConfig.setVMArguments(vmArgs);
- vmRunConfig.setProgramArguments(programArgs);
- return vmRunner.run(vmRunConfig);
- }
-
- protected static String getPlatformClass() {
- return "org.eclipse.core.launcher.UIMain";
- }
-
- protected static String getPlatformPath() {
- return urlToLocalFile(BootLoader.getInstallURL()).getAbsolutePath();
- }
-
- protected static String[] getPlatformClassPath() {
- final String platformPath = getPlatformPath();
- return new String[] {
- new File(platformPath, "startup.jar").getAbsolutePath(),
- new File(new File(platformPath, "bin"), "startup.jar").getAbsolutePath()
- };
- }
-
- protected static IVMRunner getJavaVMRunner() {
- // get the current install
- IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall();
- if (vmInstall == null) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.CouldNotFindDefaultVM"), null);
- return null;
- }
-
- // get a runner
- IVMRunner vmRunner = vmInstall.getVMRunner(ILaunchManager.RUN_MODE);
- if (vmRunner == null) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.CouldNotFindVMRunner",
- new Object[] { vmInstall.getName() }), null);
- return null;
- }
- return vmRunner;
- } /** * Get a File representing a local path to the resources referenced by a URL. * Use this when you want to know the local path corresponding to aURL but do not * want to access it (yet). * <p> * Cannot resolve paths to non-local [not on filesystem] files or directories. * </p> * * @param url the URL to convert * @return a File representing the URL's location on the filesystem, or null if not accessible */ private static File urlToLocalFile(URL url) { try { url = Platform.resolve(url); } catch (IOException e) { } final String urlProtocol = url.getProtocol(); if (urlProtocol.equals("file")) { return new File(url.getFile()).getAbsoluteFile(); } return null; }
-}
diff --git a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ImportProjectTask.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ImportProjectTask.java
deleted file mode 100755
index b69d15b681..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ImportProjectTask.java
+++ /dev/null
@@ -1,290 +0,0 @@
-package org.eclipse.swt.examples.launcher; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import org.eclipse.core.boot.*; import org.eclipse.core.internal.events.*; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.jdt.core.*; import org.eclipse.jdt.launching.*; import org.eclipse.jface.dialogs.*; import org.eclipse.swt.widgets.*; import org.eclipse.ui.dialogs.*; import org.eclipse.ui.internal.*; import org.eclipse.ui.wizards.datatransfer.*; import java.io.*; import java.lang.reflect.*; import java.net.*; import java.util.*; import java.util.zip.*;
-/** * ImportProjectTask maintains information about a project import session and provides * all necessary user interface support. */
-public class ImportProjectTask { // Support for externalized project properties information private static final String IMPORTPROJECT_PROPERTIES = "import.properties"; private static final String PROPERTYKEY_BUILDERS = "builders"; private static final String PROPERTYKEY_NATURES = "natures"; private static final String PROPERTYKEY_VARIABLES_PREFIX = "var."; private static final String PROPERTYKEY_ARGS_PREFIX = "args."; private static final String PROPERTYKEY_VMARGS_PREFIX = "vmargs."; // Property substitution keywords private static final String SUBST_KEYWORD_INTRO = "<<"; private static final String SUBST_KEYWORD_EXTRO = ">>"; private static final String SUBST_ECLIPSE_PLUGINS = "<<ECLIPSE_PLUGINS>>"; // path to the primary Eclipse plugins root directory private static final String SUBST_SWT_LIBRARY_PATH = "<<SWT_LIBRARY_PATH>>"; // path to the Eclipse libraries (java.library.path) // Default project properties private static final Properties defaultProjectProperties; static { defaultProjectProperties = new Properties(); defaultProjectProperties.setProperty(PROPERTYKEY_NATURES, "org.eclipse.jdt.core.javanature"); defaultProjectProperties.setProperty(PROPERTYKEY_BUILDERS, "org.eclipse.jdt.core.javabuilder"); defaultProjectProperties.setProperty(PROPERTYKEY_VARIABLES_PREFIX + "ECLIPSE_PLUGINS", SUBST_ECLIPSE_PLUGINS); } // Internal data
- private Shell parentShell;
- private String defaultProjectName;
- private URL sourceUrl;
-
- /**
- * Creates an ImportProjectTask specifying information about an import operation
- * to be performed.
- *
- * @param parentShell the Shell instance to use in dialogs.
- * @param defaultProjectName the default name of the project to import into
- * @param sourceUrl the URL of the ZIP/JAR file which we will import
- */
- public ImportProjectTask(Shell parentShell, String defaultProjectName, URL sourceUrl) {
- this.parentShell = parentShell;
- this.defaultProjectName = defaultProjectName;
- this.sourceUrl = sourceUrl;
- }
-
- /**
- * Disposes of operating system and platform resources associated with this instance.
- */
- public void dispose() {
- sourceUrl = null;
- }
-
- /**
- * Perform the import.
- *
- * @return true iff the import succeeded
- */
- public boolean execute() {
- String projectName = getNewProjectName(parentShell, defaultProjectName);
- if (projectName == null) return false;
- return doImportZip(projectName);
- }
-
- /**
- * Returns a project name into which to import a new item.
- *
- * @param defaultProjectName the default name to give the project
- * @return the name a new project, null if the user aborted
- */
- private String getNewProjectName(Shell parentShell, final String defaultProjectName) {
- InputDialog inputDialog = new InputDialog(parentShell,
- LauncherPlugin.getResourceString("dialog.ImportPathInput.title"),
- LauncherPlugin.getResourceString("dialog.ImportPathInput.message"),
- defaultProjectName,
- new IInputValidator() {
- public String isValid(String projectPath) {
- // verify that name is well-formed
- IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
- projectPath = new Path(projectPath).makeAbsolute().toString();
- IStatus status = workspace.validatePath(projectPath,
- IResource.PROJECT | IResource.FOLDER);
- if (! status.isOK()) {
- return LauncherPlugin.getResourceString("dialog.InvalidTargetProjectPath.interactive");
- }
- // verify that project does not already exist
- IWorkspaceRoot workspaceRoot = workspace.getRoot();
- IProject project = workspaceRoot.getProject(projectPath);
- if (project.exists()) {
- return LauncherPlugin.getResourceString("dialog.ExistingProjectPath.interactive");
- }
- return null;
- }
- });
- inputDialog.setBlockOnOpen(true);
- inputDialog.open();
- String path = inputDialog.getValue();
- inputDialog.close();
-
- return (inputDialog.getReturnCode() == InputDialog.OK) ? path : null;
- }
-
- /**
- * Imports a new project from a Zip file.
- * Note that user feedback is provided when the result is false
- *
- * @param projectName the name to give the new project
- * @return true if the operation succeeds
- */
- private boolean doImportZip(String projectName) {
- final IPath projectPath = new Path(projectName).makeAbsolute();
-
- ZipFile zipFile = null;
- try {
- /* Open the Zip file and get a StructureProvider for it */ File file = urlToFile(sourceUrl); if (file == null) throw new Exception();
- zipFile = new ZipFile(file);
- ZipFileStructureProvider provider = new ZipFileStructureProvider(zipFile);
-
- return importExecute(projectPath, provider.getRoot(), provider);
- } catch (Exception e) {
- MessageDialog.openError(parentShell,
- LauncherPlugin.getResourceString("dialog.ImportProgramProblems.title"),
- LauncherPlugin.getResourceString("dialog.ErrorAccessingZipFile.message",
- new Object[] { sourceUrl.getFile(), e.getMessage() }));
- return false;
- } finally {
- try {
- if (zipFile != null) zipFile.close();
- } catch (IOException e) { }
- }
- }
-
- /**
- * Performs an import operation
- * Note that user feedback is provided when the result is false
- *
- * @param projectPath the absolute path of the project to create
- * @param source the source node for the import
- * @param provider the structure provider ImportOperation will use to retrieve file contents
- * @return true if the operation succeeds
- */
- private boolean importExecute(IPath projectPath, Object source, IImportStructureProvider provider) {
- /* Validate the target path */
- if (! importValidateProjectPath(projectPath)) return false;
-
- /* Locate the Project we will import into, or create it anew */
- final IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
- final IWorkspaceRoot workspaceRoot = workspace.getRoot();
- final String projectName = projectPath.toString();
- final IProject project = workspaceRoot.getProject(projectName);
-
- /* Create a progress monitor for the import process */
- ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(parentShell);
- progressDialog.setCancelable(true);
- progressDialog.open();
-
- /* Manipulate the ProjectDescription so that we can build the example */
- String exceptionMessage = null; Properties projectProperties = defaultProjectProperties;
- try {
- if (! project.exists()) {
- /* Create the project */
- exceptionMessage = "dialog.ErrorCreatingNewProject.message";
-
- IProjectDescription projectDesc = workspace.newProjectDescription(projectName);
- project.create(projectDesc, progressDialog.getProgressMonitor());
- }
- /* Open Project */
- project.open(progressDialog.getProgressMonitor());
- /* Import project properties from disk */ try { Object node = findStructuredChildElement(provider, source, IMPORTPROJECT_PROPERTIES); if (node != null) { InputStream is = provider.getContents(node); Properties properties = new Properties(); properties.load(is); projectProperties = properties; } } catch (Exception e) { }
- /* Set Project properties */
- exceptionMessage = "dialog.ErrorUpdatingProjectProperties.message";
-
- IProjectDescription projectDesc = project.getDescription();
- updateProjectDescription(projectDesc, projectProperties);
- project.setDescription(projectDesc, progressDialog.getProgressMonitor());
- } catch (Exception e) {
- if (progressDialog != null) progressDialog.close();
- if (exceptionMessage == null) exceptionMessage = "{0}";
- MessageDialog.openError(parentShell,
- LauncherPlugin.getResourceString("dialog.ImportProgramProblems.title"),
- LauncherPlugin.getResourceString(exceptionMessage, new Object[] { e.getMessage() }));
- return false;
- }
- /* Update the Classpath variables */ updateClasspathVariables(projectProperties, progressDialog.getProgressMonitor());
- /* Create the ImportOperation */
- ImportOperation importOperation = new ImportOperation(projectPath, source, provider,
- new IOverwriteQuery() {
- final String[] responses = new String[] {
- IOverwriteQuery.YES,
- IOverwriteQuery.NO,
- IOverwriteQuery.ALL,
- IOverwriteQuery.CANCEL};
- final String[] labels = new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.CANCEL_LABEL};
-
- /* called to query user if existing files should be overwritten */
- public String queryOverwrite(String pathString) {
- final MessageDialog dialog =
- new MessageDialog(parentShell,
- LauncherPlugin.getResourceString("dialog.ImportProgramOverwrite.title"),
- null, LauncherPlugin.getResourceString("dialog.FileAlreadyExists.message",
- new Object[] { pathString }),
- MessageDialog.QUESTION, labels, 0);
- // run in syncExec because callback is from an operation,
- // which is probably not running in the UI thread.
- parentShell.getDisplay().syncExec(new Runnable() {
- public void run() {
- dialog.open();
- }
- });
- return dialog.getReturnCode() < 0 ? CANCEL : responses[dialog.getReturnCode()];
- }
- });
- importOperation.setOverwriteResources(false); // ask user before overwriting...
-
- /* Execute the operation */
- try {
- progressDialog.run(true, true, importOperation);
- } catch (InterruptedException e) {
- // aborted
- return false;
- } catch (InvocationTargetException e) {
- // failed
- MessageDialog.openError(parentShell,
- LauncherPlugin.getResourceString("dialog.ImportProgramProblems.title"),
- e.getTargetException().getMessage());
- return false;
- }
-
- /* Verify that the operation succeeded */
- IStatus status = importOperation.getStatus();
- if (! status.isOK()) {
- ErrorDialog.openError(parentShell,
- LauncherPlugin.getResourceString("dialog.ImportProgramProblems.title"),
- LauncherPlugin.getResourceString("dialog.ImportFailed.message"),
- status);
- return false;
- } /* Get the IJavaProject for this project */ IJavaProject javaProject = JavaCore.create(project); if (javaProject == null) { MessageDialog.openError(parentShell, LauncherPlugin.getResourceString("dialog.ImportProgramProblems.title"), LauncherPlugin.getResourceString("dialog.UnableToGetJavaProjectHandle.message")); return false; } /* Restore program and VM arguments */ updateProgramAndVMArguments(projectProperties, javaProject); return true;
- }
-
- /**
- * Updates a ProjectDescription prior to an import.
- *
- * @param projectDesc the IProjectDescription to fix * @param properties a Properties file containing entries of the form * natures = <string>[;<string>] * builders = <string>[;<string>] */
- private void updateProjectDescription(IProjectDescription projectDesc, Properties properties) { if (properties == null) return;
- /* Add natures */
- String[] natureIds = projectDesc.getNatureIds(); final String naturesList = properties.getProperty(PROPERTYKEY_NATURES); if (naturesList != null) { StringTokenizer entries = new StringTokenizer(naturesList, "; \t\n\r\f"); while (entries.hasMoreTokens()) { natureIds = addUniqueString(natureIds, entries.nextToken()); } projectDesc.setNatureIds(natureIds); }
-
- /* Add builders */
- ICommand[] buildSpecs = projectDesc.getBuildSpec();
- final String buildersList = properties.getProperty(PROPERTYKEY_BUILDERS); if (buildersList != null) { StringTokenizer entries = new StringTokenizer(buildersList, "; \t\n\r\f"); while (entries.hasMoreTokens()) { buildSpecs = addUniqueCommand(buildSpecs, entries.nextToken(), new HashMap()); } projectDesc.setBuildSpec(buildSpecs); } } /** * Updates the Classpath Variables. * * @param properties a Properties file containing entries of the form * var.<varname> = [<string>|<substitution string>] * @param progressMonitor an IProgressMonitor to use while setting things up */ private void updateClasspathVariables(Properties properties, IProgressMonitor progressMonitor) { Enumeration it = properties.propertyNames(); while (it.hasMoreElements()) { final String name = (String) it.nextElement(); if (name.startsWith(PROPERTYKEY_VARIABLES_PREFIX)) { final String varName = name.substring(PROPERTYKEY_VARIABLES_PREFIX.length()); final String path = properties.getProperty(name); if (path == null || path.length() == 0) continue; IPath oldValue = JavaCore.getClasspathVariable(varName); if (oldValue != null) continue; // silently ignore if set // Variable does not exist, set it. try { final IPath varPath = new Path(expandSubstitutionKeywords(path)); varPath.makeAbsolute(); JavaCore.setClasspathVariable(varName, varPath, progressMonitor); continue; } catch (Exception e) { } MessageDialog.openInformation(parentShell, LauncherPlugin.getResourceString("dialog.ImportProgramProblems.title"), LauncherPlugin.getResourceString("dialog.UnableToSetClasspathVariable.message", new Object[] { varName, path } )); } } } /** * Updates the Program and VM Arguments. * * @param properties a Properties file containing entries of the form * args.<resource path>%<class> = [<string>|<substitution string>] * vmargs.<resource path>%<class> = [<string>|<substitution string>] * @param javaProject the IJavaProject to work on */ private void updateProgramAndVMArguments(Properties properties, IJavaProject javaProject) { Enumeration it = properties.propertyNames(); while (it.hasMoreElements()) { final String name = (String) it.nextElement(); final String entry; final int argId; // 0 is program, 1 is VM // Get property key if (name.startsWith(PROPERTYKEY_ARGS_PREFIX)) { entry = name.substring(PROPERTYKEY_ARGS_PREFIX.length()); argId = 0; } else if (name.startsWith(PROPERTYKEY_VMARGS_PREFIX)) { entry = name.substring(PROPERTYKEY_VMARGS_PREFIX.length()); argId = 1; } else continue; // Parse entry int index = entry.indexOf('%'); if (index == -1) continue; // ignore invalid entry final String resource = entry.substring(0, index); final String className = entry.substring(index + 1); String value = properties.getProperty(name); if (value == null) continue; value = expandSubstitutionKeywords(value); try { IPath resourcePath = new Path(resource); IJavaElement javaElement = javaProject.findElement(resourcePath); if (javaElement != null && javaElement.getElementType() == IJavaElement.COMPILATION_UNIT && javaElement.exists()) { ICompilationUnit compilationUnit = (ICompilationUnit) javaElement; IType javaType = compilationUnit.getType(className); if (javaType != null && javaType.exists()) { ExecutionArguments oldArgs = ExecutionArguments.getArguments(javaType); String vmArgs; String programArgs; if (oldArgs == null) { vmArgs = ""; programArgs = ""; } else { vmArgs = oldArgs.getVMArguments(); programArgs = oldArgs.getProgramArguments(); } if (argId == 0) { programArgs = value; } else { vmArgs = value; } ExecutionArguments newArgs = new ExecutionArguments(vmArgs, programArgs); ExecutionArguments.setArguments(javaType, newArgs); continue; } } } catch (Exception e) { } MessageDialog.openInformation(parentShell, LauncherPlugin.getResourceString("dialog.ImportProgramProblems.title"), LauncherPlugin.getResourceString((argId == 0) ? "dialog.UnableToProgramArguments.message" : "dialog.UnableToVMArguments.message", new Object[] { resource, className, value } )); } } /** * Replaces any substitution keywords with their values. * * @param string the string to work on * @return the expanded string */ private String expandSubstitutionKeywords(String string) { int endIndex = 0; for (;;) { int index = string.indexOf(SUBST_KEYWORD_INTRO, endIndex); if (index == -1) return string; endIndex = string.indexOf(SUBST_KEYWORD_EXTRO, index); if (endIndex == -1) return string; endIndex += SUBST_KEYWORD_EXTRO.length(); final String keyword = string.substring(index, endIndex); String value = null; for (int i = 0; i < substitutionKeywords.length; ++i) { final SubstitutionKeyword subst = substitutionKeywords[i]; if (subst.isMatch(keyword)) { value = subst.getValue(); break; } } if (value == null) { MessageDialog.openInformation(parentShell, LauncherPlugin.getResourceString("dialog.ImportProgramProblems.title"), LauncherPlugin.getResourceString("dialog.UnableExpandSubstitutionKeyword.message", new Object[] { keyword, string } )); } else { string = string.substring(0, index) + value + string.substring(endIndex); } } } /** Data for subsitution keywords **/ static abstract class SubstitutionKeyword { public abstract boolean isMatch(String keyword); public abstract String getValue(); } static final SubstitutionKeyword[] substitutionKeywords = new SubstitutionKeyword[] { // <<ECLIPSE_PLUGINS>> new SubstitutionKeyword() { public boolean isMatch(String keyword) { return keyword.equalsIgnoreCase(SUBST_ECLIPSE_PLUGINS); } public String getValue() { try { // Guess at primary plugins directory location // get the platform's public plugin registry IPluginRegistry pluginRegistry = Platform.getPluginRegistry(); // retrieve plugin descriptor for org.eclipse.core IPluginDescriptor pd = pluginRegistry.getPluginDescriptor("org.eclipse.core.runtime"); // getInstallUrl() returns the path of the directory with the plugin manifest file(s) // for a specific plugin, find the parent directory final URL installUrl = Platform.resolve(pd.getInstallURL()); if (installUrl.getProtocol().equals("file")) { String pluginPath = installUrl.getFile(); pluginPath = pluginPath.substring(0, pluginPath.lastIndexOf('/')); // eliminate terminal '/' on directory pluginPath = pluginPath.substring(0, 1 + pluginPath.lastIndexOf('/')); // locate parent directory return pluginPath; } } catch (Exception e) { } return null; } }, // <<SWT_LIBRARY_PATH>> new SubstitutionKeyword() { public boolean isMatch(String keyword) { return keyword.equalsIgnoreCase(SUBST_SWT_LIBRARY_PATH); } public String getValue() { try { IPluginRegistry pluginRegistry = Platform.getPluginRegistry(); IPluginDescriptor pd = pluginRegistry.getPluginDescriptor("org.eclipse.swt"); final URL installUrl = pd.getInstallURL(); // not supported yet: final URL libraryUrl = new URL(installUrl, "$ws$"); final URL libraryUrl = new URL(installUrl, "ws/" + BootLoader.getWS()); final URL resolveUrl = Platform.resolve(libraryUrl); if (resolveUrl.getProtocol().equals("file")) { return resolveUrl.getFile(); } } catch (Exception e) { } return null; } } }; /**
- * Validates the target project path
- *
- * @param projectPath the project path to verify
- * @return true if the path is valid
- * Note that user feedback is provided when the result is false
- */
- private boolean importValidateProjectPath(IPath projectPath) {
- IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
- IStatus status = workspace.validatePath(projectPath.toString(), IResource.PROJECT | IResource.FOLDER);
- if (! status.isOK()) {
- ErrorDialog.openError(parentShell,
- LauncherPlugin.getResourceString("dialog.ImportProgramProblems.title"),
- LauncherPlugin.getResourceString("dialog.InvalidTargetProjectPath.message",
- new Object[] { projectPath.toString() }),
- status);
- return false;
- }
- return true;
- }
-
- /**
- * Adds a unique String to a String[].
- *
- * @param array the old String array
- * @param string the new String
- * @return the new String array (may be same as old)
- */
- private String[] addUniqueString(String[] array, String string) {
- for (int i = 0; i < array.length; ++i) {
- if (array[i].equals(string)) return array;
- }
- String[] newArray = new String[array.length + 1];
- System.arraycopy(array, 0, newArray, 0, array.length);
- newArray[array.length] = string;
- return newArray;
- }
-
- /**
- * Adds a unique ICommand to a ICommand[].
- *
- * @param array the old ICommand array
- * @param builderName the new builder name
- * @param builderArgs the new arguments
- * @return the new ICommand array (may be same as old)
- */
- private ICommand[] addUniqueCommand(ICommand[] array, String builderName, Map builderArgs) {
- for (int i = 0; i < array.length; ++i) {
- final String name = array[i].getBuilderName();
- final Map args = array[i].getArguments();
-
- if ((name != null) && (name.equals(builderName))) return array;
- }
- ICommand[] newArray = new ICommand[array.length + 1];
- System.arraycopy(array, 0, newArray, 0, array.length);
- BuildCommand newCommand = new BuildCommand();
- newCommand.setBuilderName(builderName);
- newCommand.setArguments(builderArgs);
- newArray[array.length] = newCommand;
- return newArray;
- } /** * Finds a particular child of a container in an IImportStructureProvider. * */ private Object findStructuredChildElement(IImportStructureProvider provider, Object parent, String name) { if (! provider.isFolder(parent)) return null; java.util.List list = provider.getChildren(parent); if (list == null) return null; for (Iterator it = list.iterator(); it.hasNext(); ) { Object item = it.next(); if (provider.getLabel(item).equals(name)) return item; } return null; } /** * Get a File through which it is possible to access the contents of a URL. * Use this when you want to be able to access the contents of a URL immediately. * <p> * Will automatically cache contents from non-local files or Jars on the local filesystem. * Cannot resolve paths to non-local [not on filesystem] directories. * </p> * * @param url the URL to convert * @return a File where the URL's data can be accessed, or null if not accessible */ private static File urlToFile(URL url) { try { url = Platform.asLocalURL(url); } catch (IOException e) { try { url = Platform.resolve(url); // perhaps it is a directory on the local filesystem } catch (IOException e2) { } } final String urlProtocol = url.getProtocol(); if (urlProtocol.equals("file")) { return new File(url.getFile()).getAbsoluteFile(); } return null; }
-}
diff --git a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ItemDescriptor.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ItemDescriptor.java
deleted file mode 100755
index 735291513b..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ItemDescriptor.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.swt.examples.launcher; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ 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 URL sourceCodePath;
- private LaunchDelegate launchDelegate;
-
- /**
- * Constructs an ItemDescriptor.
- *
- * @param id the id
- * @param name the name
- * @param description the description
- * @param launchDelegate a launch delegate for the program to be launched using this descriptor,
- * may be null if item is not launchable
- */
- public ItemDescriptor(String id, String name, String description, URL sourceCodePath,
- Image icon, LaunchDelegate launchDelegate) {
- this.id = id;
- this.name = name;
- this.description = description;
- this.sourceCodePath = sourceCodePath; this.icon = icon;
- this.launchDelegate = launchDelegate;
- }
-
- /**
- * 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 source code path
- *
- * @return a URL specifying the name of a zip/jar or the base of a directory where the source
- * code is stored, null if no source is available
- */
- public URL getSourceCodePath() {
- return sourceCodePath;
- }
- /** * Returns an icon for this descriptor * * @returns an icon, null if the item is a folder */ public Image getIcon() { return icon; }
- /**
- * Returns launch delegate for the program.
- *
- * @return the launch delegate, null if the item is a folder
- */
- public LaunchDelegate getLaunchDelegate() {
- return launchDelegate;
- } /** * Determines if an item is a folder. * * @return true if the item is a folder */ public boolean isFolder() { return launchDelegate == 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/org/eclipse/swt/examples/launcher/ItemTreeNode.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ItemTreeNode.java
deleted file mode 100755
index bc1a5ac185..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ItemTreeNode.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.swt.examples.launcher;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * 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/org/eclipse/swt/examples/launcher/LaunchDelegate.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LaunchDelegate.java
deleted file mode 100755
index 24548a3539..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LaunchDelegate.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.eclipse.swt.examples.launcher;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
- import org.eclipse.core.runtime.*; import org.eclipse.ui.*; /** * LaunchDelegate provide a means of encapsulating a method for launching a * variety of programs of different types along with information about these * programs. */
-interface LaunchDelegate { /** * Launches the program described by this object. * * @param hostView the IViewPart for the launcher program. Use this to ensure that * child programs are visible on the same display / Eclipse perspective as * the launcher application * @return true if the launch was successful */
- public boolean launch(IViewPart hostView);
-}
diff --git a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherApplication.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherApplication.java
deleted file mode 100755
index fce7ce9e58..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherApplication.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.eclipse.swt.examples.launcher; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import java.lang.reflect.*; import java.util.*; import org.eclipse.core.boot.*; import org.eclipse.core.runtime.*; /** * LauncherApplication provides a mechanism for launching arbitrary executable programs * from within the Eclipse Platform. This class binds to the * <core>org.eclipse.core.runtime.applications</code> extension point. */
-public class LauncherApplication implements IPlatformRunnable {
- public static final String APPLICATION_ID = "org.eclipse.swt.examples.launcher.application";
- /** * Invokes the program specified in the arguments. * * @param argsVanilla a String[] containing the arguments, one token per array index. * <ul> * <li>-appclass &lt;class name&gt; the name of the class whose main() method is to be invoked * [note: do not add a .java or .class suffix] * <li>-appplugin &lt;pluginid&gt; the id of the plugin containing the specified class * <li>-appargs &lt;args&gt; all remaining tokens to the right of this switch are passed as * arguments to the main() method when the program is launched * </ul> * @return null */
- public Object run(Object argsVanilla) throws Exception {
- final String[] args = (String[]) argsVanilla;
- String programPluginId = null; // id of plugin containing the program
- String[] programArgs = null; // arguments for the program
- String programClass = null; // class with main() method
-
- try {
- for (int i = 0; i < args.length; ++i) {
- if (args[i].equalsIgnoreCase("-appplugin")) {
- programPluginId = args[++i];
- } else if (args[i].equalsIgnoreCase("-appclass")) {
- programClass = args[++i];
- } else if (args[i].equalsIgnoreCase("-appargs")) {
- ++i;
- programArgs = new String[args.length - i];
- System.arraycopy(args, i, programArgs, 0, programArgs.length);
- break;
- } else {
- // ignore unrecognized argument
- }
- }
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new IllegalArgumentException("run.error.MalformedArgumentList");
- }
-
- if (programPluginId == null) throw new IllegalArgumentException(
- "run.error.MissingAppPlugin");
- if (programClass == null) throw new IllegalArgumentException(
- "run.error.MissincAppClass");
- if (programArgs == null) programArgs = new String[0];
-
- // get the platform's public plugin registry
- IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
- // retrieve plugin descriptors for all plugins matching pluginId
- // [array may contain multiple versions of a given plugin]
- IPluginDescriptor[] pluginDescriptors = pluginRegistry.getPluginDescriptors(programPluginId);
-
- if (pluginDescriptors == null || pluginDescriptors.length == 0) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.CouldNotFindPlugin",
- new Object[] { programPluginId }), null);
- return null;
- }
-
- // sort list of plugins in decreasing order by version number
- Arrays.sort(pluginDescriptors, new Comparator() {
- public int compare(Object a, Object b) {
- final PluginVersionIdentifier versionA = ((IPluginDescriptor) a).getVersionIdentifier();
- final PluginVersionIdentifier versionB = ((IPluginDescriptor) b).getVersionIdentifier();
- return versionA.isGreaterThan(versionB) ? -1 :
- (versionA.equals(versionB) ? 0 : 1);
- }
- });
-
- // attempt to load and run a program in decreasing order by version until we find one
- // that works or we run out of them
- for (int i = 0; i < pluginDescriptors.length; ++i) {
- final IPluginDescriptor pd = pluginDescriptors[i];
- final ClassLoader loader = pd.getPluginClassLoader();
-
- try {
- Class programMainClass = Class.forName(programClass, true, loader);
-
- final Class[] parameterList = { String[].class };
- Method programMainMethod = programMainClass.getMethod("main", parameterList);
-
- final Object[] parameters = { new String[0] };
- programMainMethod.invoke(null, parameters); // SUCCESS! return null; } catch (InvocationTargetException e) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.Execution"), e);
- break; // it ran so stop searching
- } catch (Throwable e) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.Invocation"), e);
- }
- }
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.CouldNotFindMain"), null);
- return null;
- }
-}
diff --git a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherPlugin.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherPlugin.java
deleted file mode 100755
index 1ee79c11e3..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherPlugin.java
+++ /dev/null
@@ -1,413 +0,0 @@
-package org.eclipse.swt.examples.launcher;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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_SOURCE = "source",
- LAUNCH_ITEMS_XML_SOURCE_ZIP = "zip",
- 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));
-
- // 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("Could not find registered extensions", 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);
- 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);
- final URL attribSourceZip;
- final LaunchDelegate launchDelegate;
-
- IConfigurationElement sourceCE = getItemElement(ce, LAUNCH_ITEMS_XML_SOURCE);
- attribSourceZip = (sourceCE != null) ? getSourceCodePath(sourceCE) : null;
-
- IConfigurationElement viewCE = getItemElement(ce, LAUNCH_ITEMS_XML_VIEW);
- if (viewCE != null) {
- final String attribView = getItemAttribute(viewCE, LAUNCH_ITEMS_XML_VIEW_VIEWID, null);
- if (attribView == null) {
- logError(getResourceString("error.IncompleteViewLaunchItem",
- new Object[] { attribId } ), null);
- return null;
- }
- launchDelegate = new ViewLaunchDelegate(attribView);
- } else {
- 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;
- }
- launchDelegate = new ProgramLaunchDelegate(attribPluginId, attribClass);
- } else {
- logError(getResourceString("error.IncompleteLaunchItem",
- new Object[] { attribId } ), null);
- return null;
- }
- }
- return new ItemDescriptor(attribId, attribName, attribDescription, attribSourceZip,
- attribIcon, launchDelegate);
- }
-
- /**
- * 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) {
- }
- }
- }
-
- /**
- * Returns the path of the source code for an item.
- *
- * @param ce the IConfigurationElement describing the item
- * @return a URL containing the source code path, or null if none is available
- */
- private static URL getSourceCodePath(IConfigurationElement ce) {
- String sourcePath = getItemAttribute(ce, LAUNCH_ITEMS_XML_SOURCE_ZIP, "");
- if (sourcePath.length() != 0) {
- try {
- // Extract the URL
- IPluginDescriptor pd = ce.getDeclaringExtension().getDeclaringPluginDescriptor();
- URL sourceUrl = new URL(pd.getInstallURL(), sourcePath);
-
- // Test the URL to make sure there really is a resource here
- // (this helps to prevent the user from seeing "Add to Workspace" if no
- // source bundle is available but one has been specified)
- try {
- InputStream is = sourceUrl.openStream();
- is.close();
- } catch (IOException e) {
- return null;
- }
- return sourceUrl;
- } catch (MalformedURLException e) {
- }
- }
- return null;
- }
-} \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherView.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherView.java
deleted file mode 100755
index cdca531fdc..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/LauncherView.java
+++ /dev/null
@@ -1,222 +0,0 @@
-package org.eclipse.swt.examples.launcher;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.net.*; import org.eclipse.jface.dialogs.*; import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; import org.eclipse.ui.part.*;
-
-/**
- * Launcher uses <code>org.eclipse.swt</code> and <code>org.eclipse.core</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 importButton;
- 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);
- runItem(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) {
- runItem(getSelectedItem());
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- }
- });
-
- importButton = new Button(launchGroup, SWT.PUSH);
- importButton.setText(LauncherPlugin.getResourceString("view.importButton.text"));
- importButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- importItem(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);
- }
-
- /**
- * 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 runItem(final ItemDescriptor itemDescriptor) {
- if ((workbenchShell == null) || (itemDescriptor == null)) return;
- final LaunchDelegate launchDelegate = itemDescriptor.getLaunchDelegate();
- if (launchDelegate == null) return;
-
- boolean result = launchDelegate.launch(this);
- if (! result) {
- MessageDialog.openError(workbenchShell,
- LauncherPlugin.getResourceString("dialog.RunProgramProblems.title"),
- LauncherPlugin.getResourceString("dialog.RunProgramErrorCheckLog.message",
- new Object[] { itemDescriptor.getName() }));
- }
- }
-
- /**
- * Imports the specified launch item into the workspace.
- *
- * @param itemDescriptor the launch item to import.
- */
- private void importItem(final ItemDescriptor itemDescriptor) {
- if ((workbenchShell == null) || (itemDescriptor == null)) return;
-
- URL sourceUrl = itemDescriptor.getSourceCodePath();
- if (sourceUrl == null) return; // oops! can't do that!
-
- ImportProjectTask task = new ImportProjectTask(workbenchShell, itemDescriptor.getName(),
- sourceUrl);
- boolean success = task.execute();
- task.dispose();
- }
- /**
- * 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);
- if (importButton != null) importButton.setEnabled(false);
- } else {
- description = itemDescriptor.getDescription();
- if (description == null)
- description = LauncherPlugin.getResourceString("launchitem.Missing.description");
-
- if (runButton != null) runButton.setEnabled(itemDescriptor.getLaunchDelegate() != null);
- if (importButton != null) importButton.setEnabled(itemDescriptor.getSourceCodePath() != null);
- }
- descriptionText.setText(description);
- }
-} \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ProgramLaunchDelegate.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ProgramLaunchDelegate.java
deleted file mode 100755
index b1e2f2c123..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ProgramLaunchDelegate.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.eclipse.swt.examples.launcher;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.core.runtime.*; import org.eclipse.debug.core.*; import org.eclipse.debug.core.model.*; import org.eclipse.jdt.launching.*; import org.eclipse.ui.*;
-
-/**
- * A launch delegate for running a standalone program embedded inside a plugin package.
- */
-class ProgramLaunchDelegate implements LaunchDelegate {
- private String mainClassName;
- private String pluginId;
-
- public ProgramLaunchDelegate(String pluginId, String mainClassName) {
- this.pluginId = pluginId;
- this.mainClassName = mainClassName;
- }
-
- public boolean launch(IViewPart hostView) {
- boolean result = launchHelper(hostView);
- return result;
- }
-
- public boolean launchHelper(IViewPart hostView) {
- // get the platform's public plugin registry
- IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
- // retrieve plugin descriptors for all plugins matching pluginId
- // [array may contain multiple versions of a given plugin]
- IPluginDescriptor[] pluginDescriptors = pluginRegistry.getPluginDescriptors(pluginId);
-
- if (pluginDescriptors == null || pluginDescriptors.length == 0) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.CouldNotFindPlugin",
- new Object[] { pluginId }), null);
- return false;
- }
-
- String[] appArgs = new String[] { "-appplugin", pluginId, "-appclass", mainClassName };
- ApplicationRunner runner = new ApplicationRunner(LauncherApplication.APPLICATION_ID, appArgs);
- runner.setPluginsPath(ApplicationRunner.getCurrentPluginsPath());
- runner.setStatePath(LauncherPlugin.getDefault().getStateLocation().toFile().getAbsolutePath());
- VMRunnerResult result = runner.run();
- if (! ApplicationRunner.isResultOk(result)) return false;
-
- initWatch(result);
- return true;
- }
-
- private void initWatch(VMRunnerResult result) {
- final IProcess[] processes = result.getProcesses();
- for (int i = 0; i < processes.length; ++i) {
- final IProcess process = processes[i];
- if (process == null) continue;
- final IStreamsProxy streamsProxy = process.getStreamsProxy();
- if (streamsProxy == null) continue;
-
- final IStreamMonitor outMonitor = streamsProxy.getOutputStreamMonitor();
- if (outMonitor != null) {
- outMonitor.addListener(new IStreamListener() {
- public void streamAppended(String text, IStreamMonitor monitor) {
- System.out.println(text);
- }
- });
- }
-
- final IStreamMonitor errMonitor = streamsProxy.getErrorStreamMonitor();
- if (errMonitor != null) {
- errMonitor.addListener(new IStreamListener() {
- public void streamAppended(String text, IStreamMonitor monitor) {
- System.err.println(text);
- }
- });
- }
- }
- }
-}
-
diff --git a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/SplitLayout.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/SplitLayout.java
deleted file mode 100755
index 01913074c4..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/SplitLayout.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.examples.launcher; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ 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.launcher/org/eclipse/swt/examples/launcher/ViewLaunchDelegate.java b/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ViewLaunchDelegate.java
deleted file mode 100755
index fd85c88b56..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/org/eclipse/swt/examples/launcher/ViewLaunchDelegate.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.swt.examples.launcher;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
- import org.eclipse.core.runtime.*; import org.eclipse.ui.*;
- /** * A launch delegate for starting an Eclipse view. */
-class ViewLaunchDelegate implements LaunchDelegate {
- private String pluginViewId;
-
- public ViewLaunchDelegate(String pluginViewId) {
- this.pluginViewId = pluginViewId;
- }
- public boolean launch(IViewPart hostView) { boolean result = launchHelper(hostView); return result; }
- public boolean launchHelper(IViewPart hostView) {
- final IWorkbenchPart workbenchPart = hostView;
- final IWorkbenchPartSite workbenchPartSite = workbenchPart.getSite();
- final IWorkbenchPage workbenchPage = workbenchPartSite.getPage();
-
- try {
- workbenchPage.showView(pluginViewId);
- return true; } catch (PartInitException e) { LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.Invocation"), e); } return false; }
-}
diff --git a/examples/org.eclipse.swt.examples.launcher/plugin.jars b/examples/org.eclipse.swt.examples.launcher/plugin.jars
deleted file mode 100755
index c523749f98..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/plugin.jars
+++ /dev/null
@@ -1 +0,0 @@
-launcher.jar = \ No newline at end of file
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 90ba763c82..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/plugin.properties
+++ /dev/null
@@ -1,96 +0,0 @@
-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 = \
- Introduction\n\
- The Example Launcher is a tool for enumerating, running and browsing a variety of examples. \
- While these operations may be performed manually (with some difficulty), the Example Launcher \
- offers a convenient interface. For information on how to manipulate particular examples \
- manually, please consult their related documentation.\n\n\
- Running the Example Launcher\n\
- To run the Example Launcher, pull down the Perspective menu, select the \
- Show View menu item, then select Other from the submenu. A dialog \
- will come up with a list of views. Expand SWT Examples and select \
- the view named SWT Example Launcher. A view containing a list of examples to \
- choose will appear.\n\n\
- About the examples\n\
- The Example Launcher can launch two different types of examples: Workbench Views, \
- and Standalone applications. Examples will generally be organized into categories to \
- distinguish the one from the other.\n\n\
- Workbench Views are GUI panels that sit inside a given perspective. When the Launcher \
- starts a program that is written to interact with the Workbench as a view, it is opened and \
- embedded into the currently active perspective.\n\n\
- Standalone applications are programs that run independently of the current \
- Eclipse Platform environment. First, a new Java VM and Eclipse Platform runtime \
- is started, then the application's main() method is invoked. For this reason, \
- these applications may take some time to load.\n\n\
- Details\n\n\
- The example launcher view contains a tree list, a text area, and 2 buttons. \
- 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 \
- shows a short description of each example. The selected example can \
- be executed by clicking on the Run button, which can be found just below \
- the tree list. For some of the examples, you can also import the example \
- source code into a project in the Workspace. A project, with a name specified \
- by the user, is created and all the java classes required to run that example \
- will be added to that newly created project.\n\n\
- Depending on the example and on the configuration of your system, it may be \
- necessary to alter Project build paths or to define classpath variables to compile \
- or run examples that have been imported to the Workspace.
-
-error.CouldNotLoadResources = Unable to load resources
-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}
-
-dialog.RunProgramProblems.title = Run Program Problems
-dialog.RunProgramErrorCheckLog.message = Error while running program "{0}", check log for details.
-
-dialog.ImportPathInput.title = Add to Workbench
-dialog.ImportPathInput.message = Enter the name of the new project to create.
-dialog.InvalidTargetProjectPath.interactive = Not a valid project name.
-dialog.ExistingProjectPath.interactive = A project with that name already exists.
-
-dialog.ImportProgramProblems.title = Add to Workbench Problems
-dialog.InvalidTargetProjectPath.message = "{0}" is not a valid project name.
-dialog.ErrorAccessingZipFile.message = Error accessing Zip/Jar file "{0}" for import. {1}
-dialog.ErrorCreatingNewProject.message = Error creating new project. {0}
-dialog.ErrorUpdatingProjectProperties.message = Error updating project properties. {0}
-dialog.UnableToGetJavaProjectHandle.message = Could not retrieve Java Project handle.
-dialog.UnableToSetClasspathVariable.message = Could not set classpath variable "{0}" to "{1}".
-dialog.UnableExpandSubstitutionKeyword.message = Could not expand substitution variable "{0}" in "{1}" line of import.properties.
-dialog.UnableToProgramArguments.message = Could not set program arguments for type "{1}" in resource "{0}" to "{2}".
-dialog.UnableToVMArguments.message = Could not set VM arguments for type "{1}" resource "{0}" to "{2}".
-
-dialog.ImportProgramOverwrite.title = Add to Workbench
-dialog.FileAlreadyExists.message = {0} already exists. Would you like to overwrite it?
-
-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.importButton.text = Add to Workspace
-view.descriptionGroup.text = Description
-
-run.error.Invocation = A fatal error occurred while launching the program.
-run.error.Execution = An uncaught exception occured while running the program.
-run.error.CouldNotFindPlugin = Could not find plugin: {0}
-run.error.CouldNotFindMain = Could not find a suitable main method to run.
-run.error.CouldNotFindDefaultVM = Could not find default VM. Please ensure that a default VM has been selected in the Java Properties editor.
-run.error.CouldNotFindVMRunner = The VM "{0}" does not support launching Java programs in ''Run'' mode. Please select a default VM that supports this mode in the Java Properties editor.
-run.error.CouldNotDetermineClasspath = Internal Error: Unable to determine classpath for plugin: {0}
-run.error.MalformedArgumentList = Malformed argument list
-run.error.MissingAppPlugin = Missing -appplugin argument. Must specify the plugin with the program to launch.
-run.error.MissingAppClass = Missing -appclass argument. Must specify the class with the main() method to invoke.
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 8994a344d9..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/plugin.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- File written by PDE 1.0 -->
-<plugin
- id="org.eclipse.swt.examples.launcher"
- name="%plugin.SWTLauncherExample.name"
- version="0.9"
- provider-name="Object Technology International, Inc."
- class="org.eclipse.swt.examples.launcher.LauncherPlugin">
-<!-- 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"/>
-</requires>
-
-<!-- Runtime -->
-<!-- Runtime -->
-<!-- Runtime -->
-<!-- Runtime -->
-<runtime>
- <library name="launcher.jar"/>
-</runtime>
-
-<!-- Extension points -->
-<extension-point id="launchItems" name="%extension-point.launchItems.name" schema="schema/org.eclipse.swt.examples.launcher.launchItems.xsd"/>
-
-<!-- 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
- enabled="false"
- name="%launchitem.LauncherExample.name"
- 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"/>
- <source
- zip="launchersrc.zip"/>
- </item>
-</extension>
-</plugin>
diff --git a/examples/org.eclipse.swt.examples.launcher/schema/org.eclipse.swt.examples.launcher.launchItems.xsd b/examples/org.eclipse.swt.examples.launcher/schema/org.eclipse.swt.examples.launcher.launchItems.xsd
deleted file mode 100755
index 4dee880333..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/schema/org.eclipse.swt.examples.launcher.launchItems.xsd
+++ /dev/null
@@ -1,217 +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 in new run-time environments.
- Workbench views are created within the active Workbench Perspective.
- </documentation>
-</annotation>
-
- <element name="extension">
- <complexType>
- <all>
- <element ref="category" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="item" minOccurs="0" maxOccurs="unbounded"/>
- </all>
- <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>
- <all>
- <choice>
- <element ref="program"/>
- <element ref="view"/>
- </choice>
- <element ref="source" minOccurs="0" maxOccurs="1"/>
- </all>
- <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>
-
- <element name="source">
- <complexType>
- <attribute name="zip" type="string">
- <annotation>
- <documentation>
- The declaring plugin relative path of a ZIP file containing source code associated with a 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/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 735291513b..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemDescriptor.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.swt.examples.launcher; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ 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 URL sourceCodePath;
- private LaunchDelegate launchDelegate;
-
- /**
- * Constructs an ItemDescriptor.
- *
- * @param id the id
- * @param name the name
- * @param description the description
- * @param launchDelegate a launch delegate for the program to be launched using this descriptor,
- * may be null if item is not launchable
- */
- public ItemDescriptor(String id, String name, String description, URL sourceCodePath,
- Image icon, LaunchDelegate launchDelegate) {
- this.id = id;
- this.name = name;
- this.description = description;
- this.sourceCodePath = sourceCodePath; this.icon = icon;
- this.launchDelegate = launchDelegate;
- }
-
- /**
- * 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 source code path
- *
- * @return a URL specifying the name of a zip/jar or the base of a directory where the source
- * code is stored, null if no source is available
- */
- public URL getSourceCodePath() {
- return sourceCodePath;
- }
- /** * Returns an icon for this descriptor * * @returns an icon, null if the item is a folder */ public Image getIcon() { return icon; }
- /**
- * Returns launch delegate for the program.
- *
- * @return the launch delegate, null if the item is a folder
- */
- public LaunchDelegate getLaunchDelegate() {
- return launchDelegate;
- } /** * Determines if an item is a folder. * * @return true if the item is a folder */ public boolean isFolder() { return launchDelegate == 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 bc1a5ac185..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/ItemTreeNode.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.swt.examples.launcher;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * 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 1ee79c11e3..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherPlugin.java
+++ /dev/null
@@ -1,413 +0,0 @@
-package org.eclipse.swt.examples.launcher;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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_SOURCE = "source",
- LAUNCH_ITEMS_XML_SOURCE_ZIP = "zip",
- 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));
-
- // 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("Could not find registered extensions", 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);
- 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);
- final URL attribSourceZip;
- final LaunchDelegate launchDelegate;
-
- IConfigurationElement sourceCE = getItemElement(ce, LAUNCH_ITEMS_XML_SOURCE);
- attribSourceZip = (sourceCE != null) ? getSourceCodePath(sourceCE) : null;
-
- IConfigurationElement viewCE = getItemElement(ce, LAUNCH_ITEMS_XML_VIEW);
- if (viewCE != null) {
- final String attribView = getItemAttribute(viewCE, LAUNCH_ITEMS_XML_VIEW_VIEWID, null);
- if (attribView == null) {
- logError(getResourceString("error.IncompleteViewLaunchItem",
- new Object[] { attribId } ), null);
- return null;
- }
- launchDelegate = new ViewLaunchDelegate(attribView);
- } else {
- 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;
- }
- launchDelegate = new ProgramLaunchDelegate(attribPluginId, attribClass);
- } else {
- logError(getResourceString("error.IncompleteLaunchItem",
- new Object[] { attribId } ), null);
- return null;
- }
- }
- return new ItemDescriptor(attribId, attribName, attribDescription, attribSourceZip,
- attribIcon, launchDelegate);
- }
-
- /**
- * 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) {
- }
- }
- }
-
- /**
- * Returns the path of the source code for an item.
- *
- * @param ce the IConfigurationElement describing the item
- * @return a URL containing the source code path, or null if none is available
- */
- private static URL getSourceCodePath(IConfigurationElement ce) {
- String sourcePath = getItemAttribute(ce, LAUNCH_ITEMS_XML_SOURCE_ZIP, "");
- if (sourcePath.length() != 0) {
- try {
- // Extract the URL
- IPluginDescriptor pd = ce.getDeclaringExtension().getDeclaringPluginDescriptor();
- URL sourceUrl = new URL(pd.getInstallURL(), sourcePath);
-
- // Test the URL to make sure there really is a resource here
- // (this helps to prevent the user from seeing "Add to Workspace" if no
- // source bundle is available but one has been specified)
- try {
- InputStream is = sourceUrl.openStream();
- is.close();
- } catch (IOException e) {
- return null;
- }
- return sourceUrl;
- } catch (MalformedURLException e) {
- }
- }
- return null;
- }
-} \ 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 cdca531fdc..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/LauncherView.java
+++ /dev/null
@@ -1,222 +0,0 @@
-package org.eclipse.swt.examples.launcher;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.net.*; import org.eclipse.jface.dialogs.*; import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; import org.eclipse.ui.part.*;
-
-/**
- * Launcher uses <code>org.eclipse.swt</code> and <code>org.eclipse.core</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 importButton;
- 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);
- runItem(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) {
- runItem(getSelectedItem());
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- }
- });
-
- importButton = new Button(launchGroup, SWT.PUSH);
- importButton.setText(LauncherPlugin.getResourceString("view.importButton.text"));
- importButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- importItem(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);
- }
-
- /**
- * 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 runItem(final ItemDescriptor itemDescriptor) {
- if ((workbenchShell == null) || (itemDescriptor == null)) return;
- final LaunchDelegate launchDelegate = itemDescriptor.getLaunchDelegate();
- if (launchDelegate == null) return;
-
- boolean result = launchDelegate.launch(this);
- if (! result) {
- MessageDialog.openError(workbenchShell,
- LauncherPlugin.getResourceString("dialog.RunProgramProblems.title"),
- LauncherPlugin.getResourceString("dialog.RunProgramErrorCheckLog.message",
- new Object[] { itemDescriptor.getName() }));
- }
- }
-
- /**
- * Imports the specified launch item into the workspace.
- *
- * @param itemDescriptor the launch item to import.
- */
- private void importItem(final ItemDescriptor itemDescriptor) {
- if ((workbenchShell == null) || (itemDescriptor == null)) return;
-
- URL sourceUrl = itemDescriptor.getSourceCodePath();
- if (sourceUrl == null) return; // oops! can't do that!
-
- ImportProjectTask task = new ImportProjectTask(workbenchShell, itemDescriptor.getName(),
- sourceUrl);
- boolean success = task.execute();
- task.dispose();
- }
- /**
- * 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);
- if (importButton != null) importButton.setEnabled(false);
- } else {
- description = itemDescriptor.getDescription();
- if (description == null)
- description = LauncherPlugin.getResourceString("launchitem.Missing.description");
-
- if (runButton != null) runButton.setEnabled(itemDescriptor.getLaunchDelegate() != null);
- if (importButton != null) importButton.setEnabled(itemDescriptor.getSourceCodePath() != 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 01913074c4..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/SplitLayout.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.examples.launcher; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ 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.ole.win32/.classpath b/examples/org.eclipse.swt.examples.ole.win32/.classpath
deleted file mode 100755
index ff43f54984..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/.classpath
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path=""/>
- <classpathentry kind="var" path="JRE_LIB"/>
- <classpathentry kind="var"
- path="ECLIPSE_PLUGINS/org.eclipse.swt/swt.jar" sourcepath="ECLIPSE_PLUGINS/org.eclipse.swt/swtsrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_PLUGINS/org.eclipse.core.runtime/runtime.jar" sourcepath="ECLIPSE_PLUGINS/org.eclipse.core.runtime/runtimesrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_PLUGINS/org.eclipse.ui/workbench.jar" sourcepath="ECLIPSE_PLUGINS/org.eclipse.ui/workbenchsrc.zip"/>
- <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/.vcm_meta b/examples/org.eclipse.swt.examples.ole.win32/.vcm_meta
deleted file mode 100755
index d64b057431..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/.vcm_meta
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project-description>
- <comment></comment>
- <nature id="org.eclipse.jdt.core.javanature"/>
- <nature id="org.eclipse.pde.PluginNature"/>
- <reference project-name="org.eclipse.swt"/>
- <builder name="org.eclipse.jdt.core.javabuilder">
- </builder>
- <builder name="org.eclipse.pde.ManifestBuilder">
- </builder>
- <builder name="org.eclipse.pde.SchemaBuilder">
- </builder>
-</project-description>
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 12cd2bd26e..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/build.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-build.includes = doc-html/,\
- icons/,\
- plugin.properties,\
- plugin.xml
-
-build.vaj.Eclipse\ SWT\ Examples\ OLE = /
-
-build.excludes = bin/,\
- .cvsignore,\
- .vcm_meta,\
- build.properties \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.ole.win32/doc-html/hglegal.htm b/examples/org.eclipse.swt.examples.ole.win32/doc-html/hglegal.htm
deleted file mode 100755
index b071dbdf45..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/doc-html/hglegal.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="Mozilla/4.73 [en] (Win98; U) [Netscape]">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2001. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.ole.win32/doc-html/ngibmcpy.gif b/examples/org.eclipse.swt.examples.ole.win32/doc-html/ngibmcpy.gif
deleted file mode 100755
index 360f8e9989..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/doc-html/ngibmcpy.gif
+++ /dev/null
Binary files differ
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 d607a1c4e8..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/doc-html/swt_ole_ex.html
+++ /dev/null
@@ -1,40 +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>
-
-<h3>Introduction</h3>
-<p>This example demonstrates how to embed Active X / OLE controls into an
-SWT application or an Eclipse view.&nbsp; When the view is activated, it
-will create an instance of a Windows "Shell.Explorer" control and provide
-a GUI interface to it via OLE Automation.&nbsp; To run this example, Internet
-Explorer must be installed.
-</p>
-
-<h3>Running the example</h3>
-<p>To run the OLE Web Browser Example, pull down the Perspective menu, select the
-Show View menu item, then select Other from the submenu.&nbsp; A dialog
-will come up with a list of views.&nbsp; Expand SWT Examples and select
-the view named OLE Web Browser.&nbsp; A view containing an editor that
-appears similar to your default web browser will appear.
-</p>
-
-<h3>Details</h3>
-<p>The OLE Web Browser has Back and Forward buttons to take you to recently
-visited pages.&nbsp; 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.&nbsp; There is also a Go button which, when clicked, will attempt
-to load the page specified in the Address field.&nbsp; One would expect
-each of these operations on every web browser.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000" 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
deleted file mode 100755
index 5fcf41b783..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/icons/backward_nav.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 3b9b6af9b1..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/icons/forward_nav.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 77a2306ed2..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/icons/home_nav.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index e270e18bde..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/icons/refresh_nav.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 73ac91bddb..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/icons/search_nav.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 653d347b57..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/icons/stop_nav.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 895e22110d..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/icons/webbrowser_example.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.ole.win32/import.properties b/examples/org.eclipse.swt.examples.ole.win32/import.properties
deleted file mode 100755
index 9185f56fc8..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/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/org/eclipse/swt/examples/ole/win32/OleBrowserView.java b/examples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OleBrowserView.java
deleted file mode 100755
index 5f49f6b7cc..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OleBrowserView.java
+++ /dev/null
@@ -1,363 +0,0 @@
-package org.eclipse.swt.examples.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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());
- }
- });
-
- displayArea.addListener(SWT.KeyUp, new Listener() {
- public void handleEvent(Event event) {
- if (webBrowser == null) return;
- if (event.keyCode == 13) {
- 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/org/eclipse/swt/examples/ole/win32/OlePlugin.java b/examples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OlePlugin.java
deleted file mode 100755
index 4fee12a0b9..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OlePlugin.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package org.eclipse.swt.examples.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java b/examples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java
deleted file mode 100755
index 555cfb935e..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java
+++ /dev/null
@@ -1,251 +0,0 @@
-package org.eclipse.swt.examples.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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.ole.win32/plugin.jars b/examples/org.eclipse.swt.examples.ole.win32/plugin.jars
deleted file mode 100755
index 60dff10867..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/plugin.jars
+++ /dev/null
@@ -1 +0,0 @@
-olewin32.jar = \ No newline at end of file
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 b28c799ff5..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/plugin.properties
+++ /dev/null
@@ -1,52 +0,0 @@
-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 Active X / OLE controls into an SWT \
- application or an Eclipse view.\n\n\
- When the view is activated, it will create an instance of a Windows "Shell.Explorer" \
- control and provide a GUI interface to it via OLE Automation. 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. \
- One would expect each of these operations on every web browser.\n\n\
- To run this example, Internet Explorer must be installed.
-
-browser.Back.text = Backward
-browser.Back.tooltip = Surf to previously viewed Web site
-
-browser.Forward.text = Forward
-browser.Forward.tooltip = Surf to next viewed Web site
-
-browser.Home.text = Home
-browser.Home.tooltip = Surf 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 68ed92796b..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="0.9"
- provider-name="Object Technology International, Inc."
- 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>
- <library name="olewin32.jar"/>
-</runtime>
-
-<!-- Extension points -->
-<!-- Extensions -->
-<extension
- point="org.eclipse.ui.views">
- <view
- name="%view.OLEWebBrowserExample.name"
- category="org.eclipse.swt.examples.category"
- class="org.eclipse.swt.examples.ole.win32.OleBrowserView"
- id="org.eclipse.swt.examples.ole.win32.browserView"
- icon="icons/webbrowser_example.gif">
- </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"
- description="%launchitem.OLEWebBrowserExample.description"
- category="org.eclipse.swt.examples.launchWin32OnlyCategory"
- id="org.eclipse.swt.examples.ole.win32.viewlauncher"
- icon="icons/webbrowser_example.gif">
- <view
- viewId="org.eclipse.swt.examples.ole.win32.browserView"/>
- <source
- zip="olewin32src.zip"/>
- </item>
-</extension>
-</plugin>
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 5f49f6b7cc..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleBrowserView.java
+++ /dev/null
@@ -1,363 +0,0 @@
-package org.eclipse.swt.examples.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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());
- }
- });
-
- displayArea.addListener(SWT.KeyUp, new Listener() {
- public void handleEvent(Event event) {
- if (webBrowser == null) return;
- if (event.keyCode == 13) {
- 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 4fee12a0b9..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package org.eclipse.swt.examples.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 555cfb935e..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java
+++ /dev/null
@@ -1,251 +0,0 @@
-package org.eclipse.swt.examples.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 ff43f54984..0000000000
--- a/examples/org.eclipse.swt.examples.paint/.classpath
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path=""/>
- <classpathentry kind="var" path="JRE_LIB"/>
- <classpathentry kind="var"
- path="ECLIPSE_PLUGINS/org.eclipse.swt/swt.jar" sourcepath="ECLIPSE_PLUGINS/org.eclipse.swt/swtsrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_PLUGINS/org.eclipse.core.runtime/runtime.jar" sourcepath="ECLIPSE_PLUGINS/org.eclipse.core.runtime/runtimesrc.zip"/>
- <classpathentry kind="var"
- path="ECLIPSE_PLUGINS/org.eclipse.ui/workbench.jar" sourcepath="ECLIPSE_PLUGINS/org.eclipse.ui/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/.vcm_meta b/examples/org.eclipse.swt.examples.paint/.vcm_meta
deleted file mode 100755
index d64b057431..0000000000
--- a/examples/org.eclipse.swt.examples.paint/.vcm_meta
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project-description>
- <comment></comment>
- <nature id="org.eclipse.jdt.core.javanature"/>
- <nature id="org.eclipse.pde.PluginNature"/>
- <reference project-name="org.eclipse.swt"/>
- <builder name="org.eclipse.jdt.core.javabuilder">
- </builder>
- <builder name="org.eclipse.pde.ManifestBuilder">
- </builder>
- <builder name="org.eclipse.pde.SchemaBuilder">
- </builder>
-</project-description>
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 2225411f06..0000000000
--- a/examples/org.eclipse.swt.examples.paint/build.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-build.includes = doc-html/,\
- icons/,\
- plugin.properties,\
- plugin.xml
-
-build.vaj.Eclipse\ SWT\ Examples\ Paint = /
-
-build.excludes = bin/,\
- .cvsignore,\
- .vcm_meta,\
- build.properties \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.paint/doc-html/hglegal.htm b/examples/org.eclipse.swt.examples.paint/doc-html/hglegal.htm
deleted file mode 100755
index b071dbdf45..0000000000
--- a/examples/org.eclipse.swt.examples.paint/doc-html/hglegal.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="Mozilla/4.73 [en] (Win98; U) [Netscape]">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2001. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.paint/doc-html/ngibmcpy.gif b/examples/org.eclipse.swt.examples.paint/doc-html/ngibmcpy.gif
deleted file mode 100755
index 360f8e9989..0000000000
--- a/examples/org.eclipse.swt.examples.paint/doc-html/ngibmcpy.gif
+++ /dev/null
Binary files differ
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 59b0f95791..0000000000
--- a/examples/org.eclipse.swt.examples.paint/doc-html/swt_paint_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 - Paint Example</title>
-</head>
-<body>
-
-<h2>Example - Paint Example</h2>
-
-<h3>Introduction</h3>
-<p>This example demonstrates the use of SWT graphics operations in the form
-of a rudimentary bitmap painting program.&nbsp; The Airbrush Tool implementation also
-demonstrates a mechanism for managing timed GUI operations in the background
-that are triggered by user input (see ContinuousPaintSession.java).
-</p>
-
-<h3>Running the example</h3>
-<p>To run the Paint Example, pull down the Perspective menu, select the Show
-View menu item, then select Other from the submenu.&nbsp; A dialog will
-come up with a list of views.&nbsp; Expand SWT Examples and select the
-view named Paint.&nbsp; A view containing a drawing area, various toolbar
-buttons, and a color selection palette will appear.
-</p>
-
-<h3>Details</h3>
-<p>Select a tool with which to draw in the drawing area.&nbsp; There are a
-number of tools to choose from on the toolbar.&nbsp; 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>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000" 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
deleted file mode 100755
index d26dd584e7..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/fill_none.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/fill_outline.gif b/examples/org.eclipse.swt.examples.paint/icons/fill_outline.gif
deleted file mode 100755
index c6ccfee10e..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/fill_outline.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/fill_solid.gif b/examples/org.eclipse.swt.examples.paint/icons/fill_solid.gif
deleted file mode 100755
index cb34e64a30..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/fill_solid.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dash.gif b/examples/org.eclipse.swt.examples.paint/icons/linestyle_dash.gif
deleted file mode 100644
index fb57bb38b7..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dash.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dashdot.gif b/examples/org.eclipse.swt.examples.paint/icons/linestyle_dashdot.gif
deleted file mode 100644
index 322968c30b..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dashdot.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dot.gif b/examples/org.eclipse.swt.examples.paint/icons/linestyle_dot.gif
deleted file mode 100644
index 4937ccb06d..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dot.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/linestyle_solid.gif b/examples/org.eclipse.swt.examples.paint/icons/linestyle_solid.gif
deleted file mode 100644
index 70a57ce2c4..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/linestyle_solid.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/options_font.gif b/examples/org.eclipse.swt.examples.paint/icons/options_font.gif
deleted file mode 100755
index 965fe08560..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/options_font.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/paint_example.gif b/examples/org.eclipse.swt.examples.paint/icons/paint_example.gif
deleted file mode 100755
index c48d9a9567..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/paint_example.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_airbrush.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_airbrush.gif
deleted file mode 100755
index a310edddb2..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/tool_airbrush.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_ellipse.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_ellipse.gif
deleted file mode 100755
index dc2142f8e2..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/tool_ellipse.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_line.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_line.gif
deleted file mode 100755
index 2ff819f129..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/tool_line.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_pencil.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_pencil.gif
deleted file mode 100755
index f16a234c13..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/tool_pencil.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_polyline.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_polyline.gif
deleted file mode 100755
index aa384e9b30..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/tool_polyline.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_rectangle.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_rectangle.gif
deleted file mode 100755
index d26dd584e7..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/tool_rectangle.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_roundedrectangle.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_roundedrectangle.gif
deleted file mode 100755
index bf845d7602..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/tool_roundedrectangle.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/icons/tool_text.gif b/examples/org.eclipse.swt.examples.paint/icons/tool_text.gif
deleted file mode 100755
index 0d7457ffa3..0000000000
--- a/examples/org.eclipse.swt.examples.paint/icons/tool_text.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.paint/import.properties b/examples/org.eclipse.swt.examples.paint/import.properties
deleted file mode 100755
index 9185f56fc8..0000000000
--- a/examples/org.eclipse.swt.examples.paint/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/org/eclipse/swt/examples/paint/AirbrushTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/AirbrushTool.java
deleted file mode 100755
index 3480f3a3b2..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/AirbrushTool.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.util.Random; import org.eclipse.swt.graphics.*;
-
-/**
- * An airbrush tool.
- */
-public class AirbrushTool extends ContinuousPaintSession implements PaintTool {
- private Random random;
- private int airbrushRadius;
- private int cachedRadiusSquared;
- private int cachedNumPoints;
- private Color airbrushColor;
-
- /**
- * 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();
- set(toolSettings);
- setRetriggerTimer(10);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- airbrushRadius = toolSettings.airbrushRadius;
- airbrushColor = toolSettings.commonForegroundColor;
-
- // compute things we need to know for drawing
- cachedRadiusSquared = toolSettings.airbrushRadius * toolSettings.airbrushRadius;
- cachedNumPoints = 314 * toolSettings.airbrushIntensity * cachedRadiusSquared / 250000;
- if (cachedNumPoints == 0 && toolSettings.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).
- final PaintSurface ps = getPaintSurface();
- final GC igc = ps.getImageGC();
- final Point ioff = ps.getImageOffset();
- final int x = point.x + ioff.x, y = point.y + ioff.y;
-
- igc.setBackground(airbrushColor);
- for (int i = 0; i < cachedNumPoints; ++i) {
- int randX, randY;
- do {
- randX = (int) ((random.nextDouble() - 0.5) * airbrushRadius * 2.0);
- randY = (int) ((random.nextDouble() - 0.5) * airbrushRadius * 2.0);
- } while (randX * randX + randY * randY > cachedRadiusSquared);
-
- igc.fillRectangle(x + randX, y + randY, 1, 1);
- }
- ps.redrawArea(point.x - airbrushRadius, point.y - airbrushRadius,
- airbrushRadius * 2, airbrushRadius * 2);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/BasicPaintSession.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/BasicPaintSession.java
deleted file mode 100755
index 0af229175a..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/BasicPaintSession.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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/org/eclipse/swt/examples/paint/ContainerFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ContainerFigure.java
deleted file mode 100755
index ac36901c7c..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ContainerFigure.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
- }
- /**
- * 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(GC gc, Point offset) {
- for (int i = 0; i < nextIndex; ++i) objectStack[i].draw(gc, offset);
- }
- public Object drawPreview(GC gc, Point offset) {
- if (nextIndex == 0) return null;
-
- Object[] stateStack = new Object[nextIndex];
- for (int i = 0; i < nextIndex; ++i) stateStack[i] = objectStack[i].drawPreview(gc, offset);
- return stateStack;
- }
- public void erasePreview(GC gc, Point offset, Object rememberedState) {
- if (rememberedState == null) return;
-
- final Object[] stateStack = (Object[]) rememberedState;
- int i = nextIndex;
- while (--i >= 0) {
- objectStack[i].erasePreview(gc, offset, stateStack[i]);
- stateStack[i] = null;
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ContinuousPaintSession.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ContinuousPaintSession.java
deleted file mode 100755
index 428dd2e981..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ContinuousPaintSession.java
+++ /dev/null
@@ -1,236 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-
- /**
- * A unique identifier used to track RetriggerHandlers
- */
- protected int retriggerId = 0;
-
- /**
- * 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().getPaintStatus().
- setMessage(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) {
- getPaintSurface().showCurrentPositionStatus();
- 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 tag the Runnable's with an
- * identifier 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();
- display.timerExec(retriggerInterval, new RetriggerHandler(++retriggerId));
- }
- }
-
- /**
- * Aborts the retrigger timer
- */
- private final void abortRetrigger() {
- ++retriggerId;
- }
-
- /**
- * Handles possible retrigger events generated by timerExec().
- */
- private class RetriggerHandler implements Runnable {
- int id;
- public RetriggerHandler(int id) {
- this.id = id;
- }
- public void run() {
- /*
- * If the id's don't match, then we have cancelled the timed operation.
- */
- if (retriggerId == id) {
- render(points[0]);
- prepareRetrigger();
- }
- }
- }
-
- /**
- * 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/org/eclipse/swt/examples/paint/DragPaintSession.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/DragPaintSession.java
deleted file mode 100755
index 2f89450de0..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/DragPaintSession.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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().getPaintStatus().
- setMessage(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.showCurrentPositionStatus();
- return;
- }
- ps.showCurrentRangeStatus(anchorPosition);
- 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/org/eclipse/swt/examples/paint/EllipseFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseFigure.java
deleted file mode 100755
index 7bcb7c4021..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseFigure.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Ellipse object
- */
-public class EllipseFigure extends StatelessXORFigureHelper {
- private Color color;
- private int 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 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 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(GC gc, Point offset) {
- gc.setForeground(color);
- gcDraw(gc, offset);
- }
- protected void gcDraw(GC gc, Point offset) {
- gc.drawOval(Math.min(x1, x2) + offset.x, Math.min(y1, y2) + offset.y,
- Math.abs(x2 - x1), Math.abs(y2 - y1));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseTool.java
deleted file mode 100755
index ab41a10713..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/EllipseTool.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A drawing tool.
- */
-public class EllipseTool extends DragPaintSession implements PaintTool {
- private Color drawFGColor;
- private Color drawBGColor;
- private int fillType;
-
- /**
- * 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) {
- drawFGColor = toolSettings.commonForegroundColor;
- drawBGColor = toolSettings.commonBackgroundColor;
- fillType = toolSettings.commonFillType;
- }
-
- /**
- * 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 (fillType != ToolSettings.ftNone)
- container.add(new SolidEllipseFigure(drawBGColor, a.x, a.y, b.x, b.y));
- if (fillType != ToolSettings.ftSolid)
- container.add(new EllipseFigure(drawFGColor, a.x, a.y, b.x, b.y));
- return container;
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/Figure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/Figure.java
deleted file mode 100755
index e5d97a2e93..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/Figure.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 an object to the specified GC
- * <p>
- * The GC must be set up as follows (and must be returned to this state before returning)
- * <ul>
- * <li>setXORMode(false)
- * </ul>
- * </p>
- *
- * @param gc the GC to draw on
- * @param offset the offset to add to virtual coordinates to get display coordinates
- */
- public abstract void draw(GC gc, Point offset);
-
- /**
- * Draws a preview copy of the object to the specified GC
- * <p>
- * The GC must be set up as follows (and must be returned to this state before returning)
- * <ul>
- * <li>setXORMode(true)
- * <li>setForeground(new Color(display, 255, 255, 255))
- * <li>setBackground(new Color(display, 127, 127, 127))
- * </ul>
- * </p>
- *
- * @param gc the GC to draw on
- * @param offset the offset to add to virtual coordinates to get display coordinates
- * @return object state that must be passed to erasePreview() later to erase this object
- */
- public abstract Object drawPreview(GC gc, Point offset);
-
- /**
- * Erases a preview copy of the object to the specified GC
- * <p>
- * Note that erasures are guaranteed to occur in the reverse order to the original drawing
- * order and that the GC's contents will be as they were when the drawPreview() that supplied
- * <code>rememberedState</code>returned.
- * </p><p>
- * The GC must be set up and restored as with drawPreview().
- * </p>
- *
- * @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() using this instance
- */
- public abstract void erasePreview(GC gc, Point offset, Object rememberedState);
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/FigureDrawContext.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/FigureDrawContext.java
deleted file mode 100644
index eda60d25b8..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/FigureDrawContext.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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/org/eclipse/swt/examples/paint/LineFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineFigure.java
deleted file mode 100755
index bce1421a0b..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineFigure.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Line object
- */
-public class LineFigure extends StatelessXORFigureHelper {
- private Color color;
- private int x1, y1, x2, y2;
- /**
- * Constructs a Line
- * These objects are defined by their two end-points.
- *
- * @param color the color 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 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(GC gc, Point offset) {
- gc.setForeground(color);
- gcDraw(gc, offset);
- }
- protected void gcDraw(GC gc, Point offset) {
- gc.drawLine(x1 + offset.x, y1 + offset.y, x2 + offset.x, y2 + offset.y);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineTool.java
deleted file mode 100755
index 895155db45..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/LineTool.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A line drawing tool
- */
-public class LineTool extends DragPaintSession implements PaintTool {
- private Color temporaryColor;
- private Color drawColor;
-
- /**
- * 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);
- temporaryColor = new Color(null, 255, 255, 255);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- drawColor = toolSettings.commonForegroundColor;
- }
-
- /**
- * 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(drawColor, a.x, a.y, b.x, b.y);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintPlugin.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintPlugin.java
deleted file mode 100755
index 6e17722f39..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintPlugin.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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/org/eclipse/swt/examples/paint/PaintSession.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintSession.java
deleted file mode 100755
index a688ed8d94..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintSession.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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/org/eclipse/swt/examples/paint/PaintStatus.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintStatus.java
deleted file mode 100755
index 32a07bcb1f..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintStatus.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.eclipse.swt.examples.paint; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Text;
-
-public class PaintStatus {
- private Text statusText;
- private String actionInfo, messageInfo, coordInfo;
- /**
- * Constructs a PaintStatus.
- *
- * @param statusText the handle of status bar text widget to use
- */
- public PaintStatus(Text statusText) {
- this.statusText = statusText;
- clear();
- }
-
- /**
- * Clears the status bar.
- */
- public void clear() {
- clearAction();
- clearMessage();
- clearCoord();
- }
-
- /**
- * Sets the status bar action text.
- *
- * @param action the action in progress
- */
- public void setAction(String action) {
- actionInfo = action;
- update();
- }
-
- /**
- * Clears the status bar action text.
- */
- public void clearAction() {
- actionInfo = "";
- update();
- }
-
- /**
- * Sets the status bar message text.
- *
- * @param message the message to display
- */
- public void setMessage(String message) {
- messageInfo = message;
- update();
- }
-
- /**
- * Clears the status bar message text.
- */
- public void clearMessage() {
- messageInfo = "";
- update();
- }
-
- /**
- * Sets the coordinates in the status bar.
- *
- * @param coord the coordinates to display
- */
- public void setCoord(Point coord) { coordInfo = PaintPlugin.getResourceString("status.Coord.format", new Object[] { new Integer(coord.x), new Integer(coord.y)}); update();
- }
-
- /**
- * Sets the coordinate range in the status bar.
- *
- * @param a the "from" coordinate
- * @param b the "to" coordinate
- */
- public void setCoordRange(Point a, Point b) {
- coordInfo = PaintPlugin.getResourceString("status.CoordRange.format", new Object[] { new Integer(a.x), new Integer(a.y), new Integer(b.x), new Integer(b.y)}); update();
- }
-
- /**
- * Clears the coordinates in the status bar.
- */
- public void clearCoord() {
- coordInfo = ""; update();
- }
-
- /**
- * Updates the display.
- */
- private void update() {
- statusText.setText( PaintPlugin.getResourceString("status.Bar.format", new Object[] { actionInfo, messageInfo, coordInfo })); }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintSurface.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintSurface.java
deleted file mode 100755
index 149a7abcfe..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintSurface.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.swt.examples.paint;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
- 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 PaintStatus paintStatus; private PaintSession paintSession; private Image image; private Rectangle visibleRect; private Rectangle imageRect; private GC displayGC; // the GC used for drawing to the display private GC rubberbandGC; // the GC used exclusively for rubberband drawing private GC imageGC; // the GC used as a permanent backing store private Color rubberbandFGColor, rubberbandBGColor; private ContainerFigure rubberband; // the active rubberband selection private Object rubberbandState; // the active rubberband selection previewing state private int rubberbandHiddenNestingCount; // always >= 0, if > 0 rubberband has been hidden /** * Constructs a PaintSurface. * <p> * paintCanvas must have SWT.NO_REDRAW_RESIZE style, 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 */
- public PaintSurface(Canvas paintCanvas, PaintStatus paintStatus) { this.paintCanvas = paintCanvas; this.paintStatus = paintStatus; /* Set up the drawing surface */ visibleRect = paintCanvas.getClientArea(); imageRect = paintCanvas.getDisplay().getClientArea(); image = new Image(paintCanvas.getDisplay(), imageRect.width, imageRect.height); imageGC = new GC(image); displayGC = new GC(paintCanvas); rubberbandGC = new GC(paintCanvas); rubberbandGC.setXORMode(true); rubberbandFGColor = new Color(paintCanvas.getDisplay(), 255, 255, 255); rubberbandBGColor = new Color(paintCanvas.getDisplay(), 127, 127, 127); rubberbandGC.setForeground(rubberbandFGColor); rubberbandGC.setBackground(rubberbandBGColor); rubberbandHiddenNestingCount = 0; rubberbandState = null; rubberband = new ContainerFigure(); /* Initialize the session */ setPaintSession(null); /* Add our listeners */ 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) { hideRubberband(); displayGC.drawImage(image, visibleRect.x - imageRect.x, visibleRect.y - imageRect.y, visibleRect.width, visibleRect.height, 0, 0, visibleRect.width, visibleRect.height); showRubberband(); } }); 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() { imageGC.dispose(); displayGC.dispose(); rubberbandGC.dispose(); rubberbandFGColor.dispose(); rubberbandBGColor.dispose(); image.dispose(); } /** * 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(); } /**
- * Returns the display Graphics Context associated with this surface. * <p> * Use this GC to draw rubberband line and other temporary entities to the screen. * They will not be committed to the backing store and hence will not be refreshed * should the paint surface become obscured. * </p>
- *
- * @return the display GC associated with this surface
- */
- public GC getDisplayGC() {
- return displayGC;
- }
- /** * Returns the image Graphics Context associated with this surface. * <p> * Use this GC to draw entities that are to be committed to the backing store. * Anything drawn in this manner will persist and be refreshed as appropriate. * </p> * * @return the image GC associated with this surface */ public GC getImageGC() { return imageGC; } /** * Returns the offset to be added to x and y coordinates in order to transform * virtual paint surface coordinates into Display coordinates * * @return the offset */ public Point getDisplayOffset() { return new Point(- visibleRect.x, - visibleRect.y); } /** * Returns the offset to be added to x and y coordinates in order to transform * virtual paint surface coordinates into Image coordinates * * @return the offset */ public Point getImageOffset() { return new Point(- imageRect.x, - imageRect.y); } /**
- * 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;
- paintStatus.clear(); if (paintSession != null) { paintStatus.setAction(paintSession.getDisplayName()); paintSession.beginSession(); } else { paintStatus.setAction(PaintPlugin.getResourceString("tool.Null.displayname")); paintStatus.setMessage(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 status object. * * @return the current paint status object */ public PaintStatus getPaintStatus() { return paintStatus; } /** * 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; } /** * Redraws a specified rectangular area using the backing store * * @param x the left X virtual coordinate of the region * @param y the top Y virtual coordinate of the region * @param width the width of the region * @param height the height of the region * @see getImageGC() */ public void redrawArea(int x, int y, int width, int height) { // Clip to image and screen [computes intersection of the rectangles] final int clipX = Math.max(imageRect.x, visibleRect.x); if (x < clipX) { width -= clipX - x; x = clipX; } final int clipY = Math.max(imageRect.y, visibleRect.y); if (y < clipY) { height -= clipY - y; y = clipY; } final int clipWidth = Math.min(imageRect.width, visibleRect.width) + clipX - x; if (width > clipWidth) width = clipWidth; final int clipHeight = Math.min(imageRect.height, visibleRect.height) + clipY - y; if (height > clipHeight) height = clipHeight; if (width < 0 || height < 0) return; // Redraw the region hideRubberband(); displayGC.drawImage(image, x - imageRect.x, y - imageRect.y, width, height, x - visibleRect.x, y - visibleRect.y, width, height); showRubberband(); }
- /** * 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(getImageGC(), getImageOffset()); object.draw(getDisplayGC(), getDisplayOffset()); } /** * 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) { if (isRubberbandHidden()) { rubberband.add(object); } else { rubberbandState = rubberband.addAndPreview(object, rubberbandGC, getDisplayOffset(), rubberbandState); } } /** * Clears the active rubberband selection. * <p> * Erases any rubberband objects on the screen then clears the selection. * </p> */ public void clearRubberbandSelection() { if (! isRubberbandHidden()) { rubberband.erasePreview(rubberbandGC, getDisplayOffset(), rubberbandState); rubberbandState = null; } 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() { if (! isRubberbandHidden()) { rubberband.erasePreview(rubberbandGC, getDisplayOffset(), rubberbandState); rubberbandState = null; } drawFigure(rubberband); 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) { rubberband.erasePreview(rubberbandGC, getDisplayOffset(), rubberbandState); rubberbandState = null; } } /** * 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) { rubberbandState = rubberband.drawPreview(rubberbandGC, getDisplayOffset()); } } /** * Determines if the rubberband is hidden. * * @return true iff the rubber is hidden */ public boolean isRubberbandHidden() { return rubberbandHiddenNestingCount > 0; } /** * Displays the current position in the status bar. */ public void showCurrentPositionStatus() { paintStatus.setCoord(currentPosition); } /** * Displays the current position in the status bar. */ public void showCurrentRangeStatus(Point anchorPosition) { paintStatus.setCoordRange(anchorPosition, currentPosition); } /** * 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 (imageRect.width > visibleRect.width) { final int oldx = visibleRect.x; visibleRect.x = Math.min(scrollBar.getSelection(), imageRect.width - visibleRect.width); paintCanvas.scroll(Math.max(oldx - visibleRect.x, 0), 0, Math.max(visibleRect.x - oldx, 0), 0, visibleRect.width, visibleRect.height, 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 (imageRect.height > visibleRect.height) { final int oldy = visibleRect.y; visibleRect.y = Math.min(scrollBar.getSelection(), imageRect.height - visibleRect.height); paintCanvas.scroll(0, Math.max(oldy - visibleRect.y, 0), 0, Math.max(visibleRect.y - oldy, 0), visibleRect.width, visibleRect.height, false); } } /** * Handles resize events */ private void handleResize() { visibleRect = paintCanvas.getClientArea(); ScrollBar horizontal = paintCanvas.getHorizontalBar(); if (horizontal != null) { visibleRect.x = Math.min(horizontal.getSelection(), imageRect.width - visibleRect.width); if (imageRect.width <= visibleRect.width) { horizontal.setEnabled(false); horizontal.setSelection(0); } else { final int max = imageRect.width - visibleRect.width; horizontal.setEnabled(true); horizontal.setValues(visibleRect.x, 0, imageRect.width, visibleRect.width, 8, visibleRect.width); } } ScrollBar vertical = paintCanvas.getVerticalBar(); if (vertical != null) { visibleRect.y = Math.min(vertical.getSelection(), imageRect.height - visibleRect.height); if (imageRect.height <= visibleRect.height) { vertical.setEnabled(false); vertical.setSelection(0); } else { final int max = imageRect.height - visibleRect.height; vertical.setEnabled(true); vertical.setValues(visibleRect.y, 0, imageRect.height, visibleRect.height, 8, visibleRect.height); } } } /** * Virtualizes MouseEvent coordinates and stores the current position. */ private void processMouseEventCoordinates(MouseEvent event) { currentPosition.x = event.x = Math.min(Math.max(event.x, 0), visibleRect.width - 1) + visibleRect.x; currentPosition.y = event.y = Math.min(Math.max(event.y, 0), visibleRect.height - 1) + visibleRect.y; } }
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintTool.java
deleted file mode 100755
index f699b868b7..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintTool.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.eclipse.swt.examples.paint;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
- 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/org/eclipse/swt/examples/paint/PaintView.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintView.java
deleted file mode 100755
index 4ac8af08ea..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PaintView.java
+++ /dev/null
@@ -1,462 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-
- // status information
- private PaintStatus paintStatus;
-
- // map action ids to useful data
- private HashMap /* of String to PaintTool */ paintToolMap;
- private HashMap /* of String to Integer */ paintFillTypeMap;
-
- /** 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 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"));
- toolbarManager.appendToGroup("group.options", new SelectFillTypeAction("fill.None"));
- toolbarManager.appendToGroup("group.options", new SelectFillTypeAction("fill.Outline"));
- toolbarManager.appendToGroup("group.options", new SelectFillTypeAction("fill.Solid"));
- toolbarManager.add(new Separator());
- toolbarManager.appendToGroup("group.options", new SelectFontAction("options.Font"));
- actionBars.updateActionBars();
-
- /*** Build GUI ***/
- createGUI(parent);
-
- /*** Set defaults ***/
- setPaintToolByID("tool.Pencil");
- setFillTypeByID("fill.None");
- 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);
- 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 ***/
- // paintStatus
- paintStatus = new PaintStatus(statusText);
-
- // paintSurface
- paintSurface = new PaintSurface(paintCanvas, paintStatus);
-
- // 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));
-
- // 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);
- 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) {
- if (activeToolAction != null) activeToolAction.setChecked(false);
- IAction action = getActionByID(id);
- if (action != null) {
- activeToolAction = action;
- if (! action.isChecked()) action.setChecked(true);
- }
-
- final PaintTool paintTool = (PaintTool) paintToolMap.get(id);
- paintSurface.setPaintSession(paintTool);
- updateToolSettings();
- }
-
- /**
- * Selects a filltype given its ID.
- */
- public void setFillTypeByID(String id) {
- if (activeFillTypeAction != null) activeFillTypeAction.setChecked(false);
- IAction action = getActionByID(id);
- if (action != null) {
- activeFillTypeAction = action;
- if (! action.isChecked()) action.setChecked(true);
- }
-
- final Integer fillType = (Integer) paintFillTypeMap.get(id);
- toolSettings.commonFillType = fillType.intValue();
- updateToolSettings();
- }
-
- /**
- * 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 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/org/eclipse/swt/examples/paint/PencilTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PencilTool.java
deleted file mode 100755
index c86722fa99..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PencilTool.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.util.Random; import org.eclipse.swt.graphics.*;
-
-/**
- * A pencil tool.
- */
-public class PencilTool extends ContinuousPaintSession implements PaintTool {
- private Color drawColor;
-
- /**
- * 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) {
- drawColor = toolSettings.commonForegroundColor;
- }
-
- /**
- * 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();
- final GC igc = ps.getImageGC();
- final Point ioff = ps.getImageOffset();
- final GC dgc = ps.getDisplayGC();
- final Point doff = ps.getDisplayOffset();
- igc.setBackground(drawColor);
- igc.fillRectangle(point.x + ioff.x, point.y + ioff.y, 1, 1);
- dgc.setBackground(drawColor);
- dgc.fillRectangle(point.x + doff.x, point.y + doff.y, 1, 1);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PointFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PointFigure.java
deleted file mode 100644
index a93da19f9c..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PointFigure.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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/org/eclipse/swt/examples/paint/PolyLineTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PolyLineTool.java
deleted file mode 100755
index ef5c2c3ee4..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/PolyLineTool.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A polyline drawing tool.
- */
-public class PolyLineTool extends SegmentedPaintSession implements PaintTool {
- private Color drawFGColor;
- private Color drawBGColor;
- private int fillType;
-
- /**
- * 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) {
- drawFGColor = toolSettings.commonForegroundColor;
- drawBGColor = toolSettings.commonBackgroundColor;
- fillType = toolSettings.commonFillType;
- }
-
- /**
- * Returns the name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.PolyLine.displayname");
- }
-
- /*
- * Template methods for drawing
- */
- protected Figure createFigure(Point[] points, int numPoints, boolean closed) {
- ContainerFigure container = new ContainerFigure();
- if (closed && fillType != ToolSettings.ftNone && numPoints >= 3) {
- container.add(new SolidPolygonFigure(drawBGColor, points, numPoints));
- }
- if (! closed || fillType != 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(drawFGColor, 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(drawFGColor, a.x, a.y, b.x, b.y));
- }
- }
- return container;
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleFigure.java
deleted file mode 100755
index 205f53bf18..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleFigure.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Rectangle object
- */
-public class RectangleFigure extends StatelessXORFigureHelper {
- private Color color;
- private int 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 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 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(GC gc, Point offset) {
- gc.setForeground(color);
- gcDraw(gc, offset);
- }
- protected void gcDraw(GC gc, Point offset) {
- gc.drawRectangle(Math.min(x1, x2) + offset.x, Math.min(y1, y2) + offset.y,
- Math.abs(x2 - x1), Math.abs(y2 - y1));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleTool.java
deleted file mode 100755
index e1281a5555..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RectangleTool.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A drawing tool.
- */
-public class RectangleTool extends DragPaintSession implements PaintTool {
- private Color drawFGColor;
- private Color drawBGColor;
- private int fillType;
-
- /**
- * 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) {
- drawFGColor = toolSettings.commonForegroundColor;
- drawBGColor = toolSettings.commonBackgroundColor;
- fillType = toolSettings.commonFillType;
- }
-
- /**
- * 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 (fillType) {
- default:
- case ToolSettings.ftNone:
- return new RectangleFigure(drawFGColor, a.x, a.y, b.x, b.y);
- case ToolSettings.ftSolid:
- return new SolidRectangleFigure(drawBGColor, a.x, a.y, b.x, b.y);
- case ToolSettings.ftOutline: {
- ContainerFigure container = new ContainerFigure();
- container.add(new RectangleFigure(drawFGColor, a.x, a.y, b.x, b.y));
- container.add(new SolidRectangleFigure(drawBGColor,
- Math.min(a.x, b.x) + 1, Math.min(a.y, b.y) + 1,
- Math.max(a.x, b.x) - 1, Math.max(a.y, b.y) - 1));
- return container;
- }
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java
deleted file mode 100755
index d8ff9b3f7e..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Rectangle object
- */
-public class RoundedRectangleFigure extends StatelessXORFigureHelper {
- private Color color;
- private int 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 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 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(GC gc, Point offset) {
- gc.setForeground(color);
- gcDraw(gc, offset);
- }
- protected void gcDraw(GC gc, Point offset) {
- gc.drawRoundRectangle(Math.min(x1, x2) + offset.x, Math.min(y1, y2) + offset.y,
- Math.abs(x2 - x1), Math.abs(y2 - y1), diameter, diameter);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleTool.java
deleted file mode 100755
index 73bf168564..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/RoundedRectangleTool.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A drawing tool.
- */
-public class RoundedRectangleTool extends DragPaintSession implements PaintTool {
- private Color drawFGColor;
- private Color drawBGColor;
- private int fillType;
- private int cornerDiameter;
-
- /**
- * 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) {
- drawFGColor = toolSettings.commonForegroundColor;
- drawBGColor = toolSettings.commonBackgroundColor;
- fillType = toolSettings.commonFillType;
- cornerDiameter = toolSettings.roundedRectangleCornerDiameter;
- }
-
- /**
- * 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 (fillType != ToolSettings.ftNone)
- container.add(new SolidRoundedRectangleFigure(drawBGColor, a.x, a.y, b.x, b.y, cornerDiameter));
- if (fillType != ToolSettings.ftSolid)
- container.add(new RoundedRectangleFigure(drawFGColor, a.x, a.y, b.x, b.y, cornerDiameter));
- return container;
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SegmentedPaintSession.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SegmentedPaintSession.java
deleted file mode 100755
index 5ca341684f..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SegmentedPaintSession.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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().getPaintStatus().setMessage(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().getPaintStatus().setMessage(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().getPaintStatus().setMessage(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.showCurrentPositionStatus();
- return; // spurious event
- } else {
- ps.showCurrentRangeStatus((Point) controlPoints.elementAt(controlPoints.size() - 1));
- }
-
- 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/org/eclipse/swt/examples/paint/SolidEllipseFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidEllipseFigure.java
deleted file mode 100755
index 869c3e97cd..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidEllipseFigure.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Solid Ellipse object
- */
-public class SolidEllipseFigure extends StatelessXORFigureHelper {
- 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(GC gc, Point offset) {
- gc.setBackground(color);
- gcDraw(gc, offset);
- }
- protected void gcDraw(GC gc, Point offset) {
- gc.fillOval(Math.min(x1, x2) + offset.x, Math.min(y1, y2) + offset.y,
- Math.abs(x2 - x1) + 1, Math.abs(y2 - y1) + 1);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidPolygonFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidPolygonFigure.java
deleted file mode 100755
index a16b1895cf..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidPolygonFigure.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Line object
- */
-public class SolidPolygonFigure extends StatelessXORFigureHelper {
- 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(GC gc, Point offset) {
- gc.setBackground(color);
- gcDraw(gc, offset);
- }
- protected void gcDraw(GC gc, Point offset) {
- gc.fillPolygon(points);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidRectangleFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidRectangleFigure.java
deleted file mode 100755
index 54d6b758d2..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidRectangleFigure.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D SolidRectangle object
- */
-public class SolidRectangleFigure extends StatelessXORFigureHelper {
- 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(GC gc, Point offset) {
- gc.setBackground(color);
- gcDraw(gc, offset);
- }
- protected void gcDraw(GC gc, Point offset) {
- gc.fillRectangle(Math.min(x1, x2) + offset.x, Math.min(y1, y2) + offset.y,
- Math.abs(x2 - x1) + 1, Math.abs(y2 - y1) + 1);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java
deleted file mode 100755
index 320b29c060..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D SolidRectangle object
- */
-public class SolidRoundedRectangleFigure extends StatelessXORFigureHelper {
- 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(GC gc, Point offset) {
- gc.setBackground(color);
- gcDraw(gc, offset);
- }
- protected void gcDraw(GC gc, Point offset) {
- gc.fillRoundRectangle(Math.min(x1, x2) + offset.x, Math.min(y1, y2) + offset.y,
- Math.abs(x2 - x1) + 1, Math.abs(y2 - y1) + 1, diameter, diameter);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/StatelessXORFigureHelper.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/StatelessXORFigureHelper.java
deleted file mode 100755
index c5d314ea8f..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/StatelessXORFigureHelper.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * Superclass for all Figure objects that do not need to store state about preview copies
- * and have self-complementary preview drawing and erasing operations
- * e.g. Those that use XOR drawing operations
- */
-public abstract class StatelessXORFigureHelper extends Figure {
- public Object drawPreview(GC gc, Point offset) {
- gcDraw(gc, offset);
- return null;
- }
- public void erasePreview(GC gc, Point offset, Object rememberedData) {
- gcDraw(gc, offset);
- }
- protected abstract void gcDraw(GC gc, Point offset);
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/TextFigure.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/TextFigure.java
deleted file mode 100755
index 260f3a04f8..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/TextFigure.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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(GC gc, Point offset) {
- gc.setFont(font);
- gc.setForeground(color);
- gc.drawText(text, x + offset.x, y + offset.y, true);
- }
- public Object drawPreview(GC gc, Point offset) {
- Color oldColor = gc.getForeground();
- gc.setFont(font);
- gc.setForeground(color);
- gc.setXORMode(false);
-
- Point textExtent = gc.textExtent(text);
- Image backingStore = new Image(null, textExtent.x, textExtent.y);
- gc.copyArea(backingStore, x + offset.x, y + offset.y);
-
- gc.drawText(text, x + offset.x, y + offset.y, true);
- gc.setForeground(oldColor);
- gc.setXORMode(true);
- return backingStore;
- }
- public void erasePreview(GC gc, Point offset, Object rememberedData) {
- Image backingStore = (Image) rememberedData;
- gc.setXORMode(false);
- gc.drawImage(backingStore, x + offset.x, y + offset.y);
- gc.setXORMode(true);
- backingStore.dispose();
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/TextTool.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/TextTool.java
deleted file mode 100755
index f7403c8263..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/TextTool.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 Color drawColor;
- private Font drawFont;
- 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) {
- drawColor = toolSettings.commonForegroundColor;
- drawFont = toolSettings.commonFont;
- }
-
- /**
- * 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().getPaintStatus().setMessage(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) {
- getPaintSurface().showCurrentPositionStatus();
- getPaintSurface().clearRubberbandSelection();
- getPaintSurface().addRubberbandSelection(
- new TextFigure(drawColor, drawFont, drawText, event.x, event.y));
- }
-}
diff --git a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ToolSettings.java b/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ToolSettings.java
deleted file mode 100755
index 3afeba079a..0000000000
--- a/examples/org.eclipse.swt.examples.paint/org/eclipse/swt/examples/paint/ToolSettings.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.swt.examples.paint;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
- 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;
- /**
- * 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.paint/plugin.jars b/examples/org.eclipse.swt.examples.paint/plugin.jars
deleted file mode 100755
index 69c397a10a..0000000000
--- a/examples/org.eclipse.swt.examples.paint/plugin.jars
+++ /dev/null
@@ -1 +0,0 @@
-paint.jar = bin, src, icons
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 e9877e3fcf..0000000000
--- a/examples/org.eclipse.swt.examples.paint/plugin.properties
+++ /dev/null
@@ -1,103 +0,0 @@
-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 (see ContinuousPaintSession.java).\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.displayname = <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.
-
-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 b60fd868cc..0000000000
--- a/examples/org.eclipse.swt.examples.paint/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.paint"
- name="%plugin.SWTPaintExample.name"
- version="0.9"
- provider-name="Object Technology International, Inc."
- class="org.eclipse.swt.examples.paint.PaintPlugin">
-<!-- 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>
- <library name="paint.jar"/>
-</runtime>
-
-<!-- Extension points -->
-<!-- Extensions -->
-<extension
- point="org.eclipse.ui.views">
- <view
- name="%view.PaintExample.name"
- category="org.eclipse.swt.examples.category"
- class="org.eclipse.swt.examples.paint.PaintView"
- id="org.eclipse.swt.examples.paint.view"
- icon="icons/paint_example.gif">
- </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"
- description="%launchitem.PaintExample.description"
- category="org.eclipse.swt.examples.launchViewCategory"
- icon="icons/paint_example.gif"
- id="org.eclipse.swt.examples.paint.viewlauncher">
- <view
- viewId="org.eclipse.swt.examples.paint.view"/>
- <source
- zip="paintsrc.zip"/>
- </item>
-</extension>
-</plugin>
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 3480f3a3b2..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/AirbrushTool.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.util.Random; import org.eclipse.swt.graphics.*;
-
-/**
- * An airbrush tool.
- */
-public class AirbrushTool extends ContinuousPaintSession implements PaintTool {
- private Random random;
- private int airbrushRadius;
- private int cachedRadiusSquared;
- private int cachedNumPoints;
- private Color airbrushColor;
-
- /**
- * 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();
- set(toolSettings);
- setRetriggerTimer(10);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- airbrushRadius = toolSettings.airbrushRadius;
- airbrushColor = toolSettings.commonForegroundColor;
-
- // compute things we need to know for drawing
- cachedRadiusSquared = toolSettings.airbrushRadius * toolSettings.airbrushRadius;
- cachedNumPoints = 314 * toolSettings.airbrushIntensity * cachedRadiusSquared / 250000;
- if (cachedNumPoints == 0 && toolSettings.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).
- final PaintSurface ps = getPaintSurface();
- final GC igc = ps.getImageGC();
- final Point ioff = ps.getImageOffset();
- final int x = point.x + ioff.x, y = point.y + ioff.y;
-
- igc.setBackground(airbrushColor);
- for (int i = 0; i < cachedNumPoints; ++i) {
- int randX, randY;
- do {
- randX = (int) ((random.nextDouble() - 0.5) * airbrushRadius * 2.0);
- randY = (int) ((random.nextDouble() - 0.5) * airbrushRadius * 2.0);
- } while (randX * randX + randY * randY > cachedRadiusSquared);
-
- igc.fillRectangle(x + randX, y + randY, 1, 1);
- }
- ps.redrawArea(point.x - airbrushRadius, point.y - airbrushRadius,
- airbrushRadius * 2, airbrushRadius * 2);
- }
-}
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 0af229175a..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/BasicPaintSession.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 ac36901c7c..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContainerFigure.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
- }
- /**
- * 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(GC gc, Point offset) {
- for (int i = 0; i < nextIndex; ++i) objectStack[i].draw(gc, offset);
- }
- public Object drawPreview(GC gc, Point offset) {
- if (nextIndex == 0) return null;
-
- Object[] stateStack = new Object[nextIndex];
- for (int i = 0; i < nextIndex; ++i) stateStack[i] = objectStack[i].drawPreview(gc, offset);
- return stateStack;
- }
- public void erasePreview(GC gc, Point offset, Object rememberedState) {
- if (rememberedState == null) return;
-
- final Object[] stateStack = (Object[]) rememberedState;
- int i = nextIndex;
- while (--i >= 0) {
- objectStack[i].erasePreview(gc, offset, stateStack[i]);
- stateStack[i] = null;
- }
- }
-}
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 428dd2e981..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java
+++ /dev/null
@@ -1,236 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-
- /**
- * A unique identifier used to track RetriggerHandlers
- */
- protected int retriggerId = 0;
-
- /**
- * 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().getPaintStatus().
- setMessage(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) {
- getPaintSurface().showCurrentPositionStatus();
- 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 tag the Runnable's with an
- * identifier 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();
- display.timerExec(retriggerInterval, new RetriggerHandler(++retriggerId));
- }
- }
-
- /**
- * Aborts the retrigger timer
- */
- private final void abortRetrigger() {
- ++retriggerId;
- }
-
- /**
- * Handles possible retrigger events generated by timerExec().
- */
- private class RetriggerHandler implements Runnable {
- int id;
- public RetriggerHandler(int id) {
- this.id = id;
- }
- public void run() {
- /*
- * If the id's don't match, then we have cancelled the timed operation.
- */
- if (retriggerId == id) {
- render(points[0]);
- prepareRetrigger();
- }
- }
- }
-
- /**
- * 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 2f89450de0..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/DragPaintSession.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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().getPaintStatus().
- setMessage(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.showCurrentPositionStatus();
- return;
- }
- ps.showCurrentRangeStatus(anchorPosition);
- 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 7bcb7c4021..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseFigure.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Ellipse object
- */
-public class EllipseFigure extends StatelessXORFigureHelper {
- private Color color;
- private int 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 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 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(GC gc, Point offset) {
- gc.setForeground(color);
- gcDraw(gc, offset);
- }
- protected void gcDraw(GC gc, Point offset) {
- gc.drawOval(Math.min(x1, x2) + offset.x, Math.min(y1, y2) + offset.y,
- Math.abs(x2 - x1), Math.abs(y2 - y1));
- }
-}
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 ab41a10713..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseTool.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A drawing tool.
- */
-public class EllipseTool extends DragPaintSession implements PaintTool {
- private Color drawFGColor;
- private Color drawBGColor;
- private int fillType;
-
- /**
- * 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) {
- drawFGColor = toolSettings.commonForegroundColor;
- drawBGColor = toolSettings.commonBackgroundColor;
- fillType = toolSettings.commonFillType;
- }
-
- /**
- * 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 (fillType != ToolSettings.ftNone)
- container.add(new SolidEllipseFigure(drawBGColor, a.x, a.y, b.x, b.y));
- if (fillType != ToolSettings.ftSolid)
- container.add(new EllipseFigure(drawFGColor, 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 e5d97a2e93..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/Figure.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 an object to the specified GC
- * <p>
- * The GC must be set up as follows (and must be returned to this state before returning)
- * <ul>
- * <li>setXORMode(false)
- * </ul>
- * </p>
- *
- * @param gc the GC to draw on
- * @param offset the offset to add to virtual coordinates to get display coordinates
- */
- public abstract void draw(GC gc, Point offset);
-
- /**
- * Draws a preview copy of the object to the specified GC
- * <p>
- * The GC must be set up as follows (and must be returned to this state before returning)
- * <ul>
- * <li>setXORMode(true)
- * <li>setForeground(new Color(display, 255, 255, 255))
- * <li>setBackground(new Color(display, 127, 127, 127))
- * </ul>
- * </p>
- *
- * @param gc the GC to draw on
- * @param offset the offset to add to virtual coordinates to get display coordinates
- * @return object state that must be passed to erasePreview() later to erase this object
- */
- public abstract Object drawPreview(GC gc, Point offset);
-
- /**
- * Erases a preview copy of the object to the specified GC
- * <p>
- * Note that erasures are guaranteed to occur in the reverse order to the original drawing
- * order and that the GC's contents will be as they were when the drawPreview() that supplied
- * <code>rememberedState</code>returned.
- * </p><p>
- * The GC must be set up and restored as with drawPreview().
- * </p>
- *
- * @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() using this instance
- */
- public abstract void erasePreview(GC gc, Point offset, Object rememberedState);
-}
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 eda60d25b8..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/FigureDrawContext.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 bce1421a0b..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineFigure.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Line object
- */
-public class LineFigure extends StatelessXORFigureHelper {
- private Color color;
- private int x1, y1, x2, y2;
- /**
- * Constructs a Line
- * These objects are defined by their two end-points.
- *
- * @param color the color 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 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(GC gc, Point offset) {
- gc.setForeground(color);
- gcDraw(gc, offset);
- }
- protected void gcDraw(GC gc, Point offset) {
- gc.drawLine(x1 + offset.x, y1 + offset.y, x2 + offset.x, y2 + offset.y);
- }
-}
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 895155db45..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/LineTool.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A line drawing tool
- */
-public class LineTool extends DragPaintSession implements PaintTool {
- private Color temporaryColor;
- private Color drawColor;
-
- /**
- * 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);
- temporaryColor = new Color(null, 255, 255, 255);
- }
-
- /**
- * Sets the tool's settings.
- *
- * @param toolSettings the new tool settings
- */
- public void set(ToolSettings toolSettings) {
- drawColor = toolSettings.commonForegroundColor;
- }
-
- /**
- * 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(drawColor, 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 6e17722f39..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintPlugin.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 a688ed8d94..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSession.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 149a7abcfe..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintSurface.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.swt.examples.paint;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
- 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 PaintStatus paintStatus; private PaintSession paintSession; private Image image; private Rectangle visibleRect; private Rectangle imageRect; private GC displayGC; // the GC used for drawing to the display private GC rubberbandGC; // the GC used exclusively for rubberband drawing private GC imageGC; // the GC used as a permanent backing store private Color rubberbandFGColor, rubberbandBGColor; private ContainerFigure rubberband; // the active rubberband selection private Object rubberbandState; // the active rubberband selection previewing state private int rubberbandHiddenNestingCount; // always >= 0, if > 0 rubberband has been hidden /** * Constructs a PaintSurface. * <p> * paintCanvas must have SWT.NO_REDRAW_RESIZE style, 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 */
- public PaintSurface(Canvas paintCanvas, PaintStatus paintStatus) { this.paintCanvas = paintCanvas; this.paintStatus = paintStatus; /* Set up the drawing surface */ visibleRect = paintCanvas.getClientArea(); imageRect = paintCanvas.getDisplay().getClientArea(); image = new Image(paintCanvas.getDisplay(), imageRect.width, imageRect.height); imageGC = new GC(image); displayGC = new GC(paintCanvas); rubberbandGC = new GC(paintCanvas); rubberbandGC.setXORMode(true); rubberbandFGColor = new Color(paintCanvas.getDisplay(), 255, 255, 255); rubberbandBGColor = new Color(paintCanvas.getDisplay(), 127, 127, 127); rubberbandGC.setForeground(rubberbandFGColor); rubberbandGC.setBackground(rubberbandBGColor); rubberbandHiddenNestingCount = 0; rubberbandState = null; rubberband = new ContainerFigure(); /* Initialize the session */ setPaintSession(null); /* Add our listeners */ 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) { hideRubberband(); displayGC.drawImage(image, visibleRect.x - imageRect.x, visibleRect.y - imageRect.y, visibleRect.width, visibleRect.height, 0, 0, visibleRect.width, visibleRect.height); showRubberband(); } }); 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() { imageGC.dispose(); displayGC.dispose(); rubberbandGC.dispose(); rubberbandFGColor.dispose(); rubberbandBGColor.dispose(); image.dispose(); } /** * 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(); } /**
- * Returns the display Graphics Context associated with this surface. * <p> * Use this GC to draw rubberband line and other temporary entities to the screen. * They will not be committed to the backing store and hence will not be refreshed * should the paint surface become obscured. * </p>
- *
- * @return the display GC associated with this surface
- */
- public GC getDisplayGC() {
- return displayGC;
- }
- /** * Returns the image Graphics Context associated with this surface. * <p> * Use this GC to draw entities that are to be committed to the backing store. * Anything drawn in this manner will persist and be refreshed as appropriate. * </p> * * @return the image GC associated with this surface */ public GC getImageGC() { return imageGC; } /** * Returns the offset to be added to x and y coordinates in order to transform * virtual paint surface coordinates into Display coordinates * * @return the offset */ public Point getDisplayOffset() { return new Point(- visibleRect.x, - visibleRect.y); } /** * Returns the offset to be added to x and y coordinates in order to transform * virtual paint surface coordinates into Image coordinates * * @return the offset */ public Point getImageOffset() { return new Point(- imageRect.x, - imageRect.y); } /**
- * 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;
- paintStatus.clear(); if (paintSession != null) { paintStatus.setAction(paintSession.getDisplayName()); paintSession.beginSession(); } else { paintStatus.setAction(PaintPlugin.getResourceString("tool.Null.displayname")); paintStatus.setMessage(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 status object. * * @return the current paint status object */ public PaintStatus getPaintStatus() { return paintStatus; } /** * 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; } /** * Redraws a specified rectangular area using the backing store * * @param x the left X virtual coordinate of the region * @param y the top Y virtual coordinate of the region * @param width the width of the region * @param height the height of the region * @see getImageGC() */ public void redrawArea(int x, int y, int width, int height) { // Clip to image and screen [computes intersection of the rectangles] final int clipX = Math.max(imageRect.x, visibleRect.x); if (x < clipX) { width -= clipX - x; x = clipX; } final int clipY = Math.max(imageRect.y, visibleRect.y); if (y < clipY) { height -= clipY - y; y = clipY; } final int clipWidth = Math.min(imageRect.width, visibleRect.width) + clipX - x; if (width > clipWidth) width = clipWidth; final int clipHeight = Math.min(imageRect.height, visibleRect.height) + clipY - y; if (height > clipHeight) height = clipHeight; if (width < 0 || height < 0) return; // Redraw the region hideRubberband(); displayGC.drawImage(image, x - imageRect.x, y - imageRect.y, width, height, x - visibleRect.x, y - visibleRect.y, width, height); showRubberband(); }
- /** * 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(getImageGC(), getImageOffset()); object.draw(getDisplayGC(), getDisplayOffset()); } /** * 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) { if (isRubberbandHidden()) { rubberband.add(object); } else { rubberbandState = rubberband.addAndPreview(object, rubberbandGC, getDisplayOffset(), rubberbandState); } } /** * Clears the active rubberband selection. * <p> * Erases any rubberband objects on the screen then clears the selection. * </p> */ public void clearRubberbandSelection() { if (! isRubberbandHidden()) { rubberband.erasePreview(rubberbandGC, getDisplayOffset(), rubberbandState); rubberbandState = null; } 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() { if (! isRubberbandHidden()) { rubberband.erasePreview(rubberbandGC, getDisplayOffset(), rubberbandState); rubberbandState = null; } drawFigure(rubberband); 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) { rubberband.erasePreview(rubberbandGC, getDisplayOffset(), rubberbandState); rubberbandState = null; } } /** * 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) { rubberbandState = rubberband.drawPreview(rubberbandGC, getDisplayOffset()); } } /** * Determines if the rubberband is hidden. * * @return true iff the rubber is hidden */ public boolean isRubberbandHidden() { return rubberbandHiddenNestingCount > 0; } /** * Displays the current position in the status bar. */ public void showCurrentPositionStatus() { paintStatus.setCoord(currentPosition); } /** * Displays the current position in the status bar. */ public void showCurrentRangeStatus(Point anchorPosition) { paintStatus.setCoordRange(anchorPosition, currentPosition); } /** * 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 (imageRect.width > visibleRect.width) { final int oldx = visibleRect.x; visibleRect.x = Math.min(scrollBar.getSelection(), imageRect.width - visibleRect.width); paintCanvas.scroll(Math.max(oldx - visibleRect.x, 0), 0, Math.max(visibleRect.x - oldx, 0), 0, visibleRect.width, visibleRect.height, 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 (imageRect.height > visibleRect.height) { final int oldy = visibleRect.y; visibleRect.y = Math.min(scrollBar.getSelection(), imageRect.height - visibleRect.height); paintCanvas.scroll(0, Math.max(oldy - visibleRect.y, 0), 0, Math.max(visibleRect.y - oldy, 0), visibleRect.width, visibleRect.height, false); } } /** * Handles resize events */ private void handleResize() { visibleRect = paintCanvas.getClientArea(); ScrollBar horizontal = paintCanvas.getHorizontalBar(); if (horizontal != null) { visibleRect.x = Math.min(horizontal.getSelection(), imageRect.width - visibleRect.width); if (imageRect.width <= visibleRect.width) { horizontal.setEnabled(false); horizontal.setSelection(0); } else { final int max = imageRect.width - visibleRect.width; horizontal.setEnabled(true); horizontal.setValues(visibleRect.x, 0, imageRect.width, visibleRect.width, 8, visibleRect.width); } } ScrollBar vertical = paintCanvas.getVerticalBar(); if (vertical != null) { visibleRect.y = Math.min(vertical.getSelection(), imageRect.height - visibleRect.height); if (imageRect.height <= visibleRect.height) { vertical.setEnabled(false); vertical.setSelection(0); } else { final int max = imageRect.height - visibleRect.height; vertical.setEnabled(true); vertical.setValues(visibleRect.y, 0, imageRect.height, visibleRect.height, 8, visibleRect.height); } } } /** * Virtualizes MouseEvent coordinates and stores the current position. */ private void processMouseEventCoordinates(MouseEvent event) { currentPosition.x = event.x = Math.min(Math.max(event.x, 0), visibleRect.width - 1) + visibleRect.x; currentPosition.y = event.y = Math.min(Math.max(event.y, 0), visibleRect.height - 1) + visibleRect.y; } }
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 f699b868b7..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintTool.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.eclipse.swt.examples.paint;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
- 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 4ac8af08ea..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintView.java
+++ /dev/null
@@ -1,462 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-
- // status information
- private PaintStatus paintStatus;
-
- // map action ids to useful data
- private HashMap /* of String to PaintTool */ paintToolMap;
- private HashMap /* of String to Integer */ paintFillTypeMap;
-
- /** 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 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"));
- toolbarManager.appendToGroup("group.options", new SelectFillTypeAction("fill.None"));
- toolbarManager.appendToGroup("group.options", new SelectFillTypeAction("fill.Outline"));
- toolbarManager.appendToGroup("group.options", new SelectFillTypeAction("fill.Solid"));
- toolbarManager.add(new Separator());
- toolbarManager.appendToGroup("group.options", new SelectFontAction("options.Font"));
- actionBars.updateActionBars();
-
- /*** Build GUI ***/
- createGUI(parent);
-
- /*** Set defaults ***/
- setPaintToolByID("tool.Pencil");
- setFillTypeByID("fill.None");
- 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);
- 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 ***/
- // paintStatus
- paintStatus = new PaintStatus(statusText);
-
- // paintSurface
- paintSurface = new PaintSurface(paintCanvas, paintStatus);
-
- // 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));
-
- // 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);
- 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) {
- if (activeToolAction != null) activeToolAction.setChecked(false);
- IAction action = getActionByID(id);
- if (action != null) {
- activeToolAction = action;
- if (! action.isChecked()) action.setChecked(true);
- }
-
- final PaintTool paintTool = (PaintTool) paintToolMap.get(id);
- paintSurface.setPaintSession(paintTool);
- updateToolSettings();
- }
-
- /**
- * Selects a filltype given its ID.
- */
- public void setFillTypeByID(String id) {
- if (activeFillTypeAction != null) activeFillTypeAction.setChecked(false);
- IAction action = getActionByID(id);
- if (action != null) {
- activeFillTypeAction = action;
- if (! action.isChecked()) action.setChecked(true);
- }
-
- final Integer fillType = (Integer) paintFillTypeMap.get(id);
- toolSettings.commonFillType = fillType.intValue();
- updateToolSettings();
- }
-
- /**
- * 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 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 c86722fa99..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PencilTool.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.util.Random; import org.eclipse.swt.graphics.*;
-
-/**
- * A pencil tool.
- */
-public class PencilTool extends ContinuousPaintSession implements PaintTool {
- private Color drawColor;
-
- /**
- * 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) {
- drawColor = toolSettings.commonForegroundColor;
- }
-
- /**
- * 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();
- final GC igc = ps.getImageGC();
- final Point ioff = ps.getImageOffset();
- final GC dgc = ps.getDisplayGC();
- final Point doff = ps.getDisplayOffset();
- igc.setBackground(drawColor);
- igc.fillRectangle(point.x + ioff.x, point.y + ioff.y, 1, 1);
- dgc.setBackground(drawColor);
- dgc.fillRectangle(point.x + doff.x, point.y + doff.y, 1, 1);
- }
-}
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 a93da19f9c..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PointFigure.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 ef5c2c3ee4..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, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A polyline drawing tool.
- */
-public class PolyLineTool extends SegmentedPaintSession implements PaintTool {
- private Color drawFGColor;
- private Color drawBGColor;
- private int fillType;
-
- /**
- * 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) {
- drawFGColor = toolSettings.commonForegroundColor;
- drawBGColor = toolSettings.commonBackgroundColor;
- fillType = toolSettings.commonFillType;
- }
-
- /**
- * Returns the name associated with this tool.
- *
- * @return the localized name of this tool
- */
- public String getDisplayName() {
- return PaintPlugin.getResourceString("tool.PolyLine.displayname");
- }
-
- /*
- * Template methods for drawing
- */
- protected Figure createFigure(Point[] points, int numPoints, boolean closed) {
- ContainerFigure container = new ContainerFigure();
- if (closed && fillType != ToolSettings.ftNone && numPoints >= 3) {
- container.add(new SolidPolygonFigure(drawBGColor, points, numPoints));
- }
- if (! closed || fillType != 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(drawFGColor, 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(drawFGColor, 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 205f53bf18..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleFigure.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Rectangle object
- */
-public class RectangleFigure extends StatelessXORFigureHelper {
- private Color color;
- private int 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 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 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(GC gc, Point offset) {
- gc.setForeground(color);
- gcDraw(gc, offset);
- }
- protected void gcDraw(GC gc, Point offset) {
- gc.drawRectangle(Math.min(x1, x2) + offset.x, Math.min(y1, y2) + offset.y,
- Math.abs(x2 - x1), Math.abs(y2 - y1));
- }
-}
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 e1281a5555..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleTool.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A drawing tool.
- */
-public class RectangleTool extends DragPaintSession implements PaintTool {
- private Color drawFGColor;
- private Color drawBGColor;
- private int fillType;
-
- /**
- * 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) {
- drawFGColor = toolSettings.commonForegroundColor;
- drawBGColor = toolSettings.commonBackgroundColor;
- fillType = toolSettings.commonFillType;
- }
-
- /**
- * 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 (fillType) {
- default:
- case ToolSettings.ftNone:
- return new RectangleFigure(drawFGColor, a.x, a.y, b.x, b.y);
- case ToolSettings.ftSolid:
- return new SolidRectangleFigure(drawBGColor, a.x, a.y, b.x, b.y);
- case ToolSettings.ftOutline: {
- ContainerFigure container = new ContainerFigure();
- container.add(new RectangleFigure(drawFGColor, a.x, a.y, b.x, b.y));
- container.add(new SolidRectangleFigure(drawBGColor,
- Math.min(a.x, b.x) + 1, Math.min(a.y, b.y) + 1,
- Math.max(a.x, b.x) - 1, Math.max(a.y, b.y) - 1));
- 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 d8ff9b3f7e..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Rectangle object
- */
-public class RoundedRectangleFigure extends StatelessXORFigureHelper {
- private Color color;
- private int 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 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 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(GC gc, Point offset) {
- gc.setForeground(color);
- gcDraw(gc, offset);
- }
- protected void gcDraw(GC gc, Point offset) {
- gc.drawRoundRectangle(Math.min(x1, x2) + offset.x, Math.min(y1, y2) + offset.y,
- Math.abs(x2 - x1), Math.abs(y2 - y1), diameter, diameter);
- }
-}
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 73bf168564..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleTool.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * A drawing tool.
- */
-public class RoundedRectangleTool extends DragPaintSession implements PaintTool {
- private Color drawFGColor;
- private Color drawBGColor;
- private int fillType;
- private int cornerDiameter;
-
- /**
- * 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) {
- drawFGColor = toolSettings.commonForegroundColor;
- drawBGColor = toolSettings.commonBackgroundColor;
- fillType = toolSettings.commonFillType;
- cornerDiameter = toolSettings.roundedRectangleCornerDiameter;
- }
-
- /**
- * 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 (fillType != ToolSettings.ftNone)
- container.add(new SolidRoundedRectangleFigure(drawBGColor, a.x, a.y, b.x, b.y, cornerDiameter));
- if (fillType != ToolSettings.ftSolid)
- container.add(new RoundedRectangleFigure(drawFGColor, a.x, a.y, b.x, b.y, cornerDiameter));
- 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 5ca341684f..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SegmentedPaintSession.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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().getPaintStatus().setMessage(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().getPaintStatus().setMessage(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().getPaintStatus().setMessage(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.showCurrentPositionStatus();
- return; // spurious event
- } else {
- ps.showCurrentRangeStatus((Point) controlPoints.elementAt(controlPoints.size() - 1));
- }
-
- 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 869c3e97cd..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidEllipseFigure.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Solid Ellipse object
- */
-public class SolidEllipseFigure extends StatelessXORFigureHelper {
- 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(GC gc, Point offset) {
- gc.setBackground(color);
- gcDraw(gc, offset);
- }
- protected void gcDraw(GC gc, Point offset) {
- gc.fillOval(Math.min(x1, x2) + offset.x, Math.min(y1, y2) + offset.y,
- Math.abs(x2 - x1) + 1, Math.abs(y2 - y1) + 1);
- }
-}
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 a16b1895cf..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidPolygonFigure.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D Line object
- */
-public class SolidPolygonFigure extends StatelessXORFigureHelper {
- 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(GC gc, Point offset) {
- gc.setBackground(color);
- gcDraw(gc, offset);
- }
- protected void gcDraw(GC gc, Point offset) {
- gc.fillPolygon(points);
- }
-}
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 54d6b758d2..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRectangleFigure.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D SolidRectangle object
- */
-public class SolidRectangleFigure extends StatelessXORFigureHelper {
- 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(GC gc, Point offset) {
- gc.setBackground(color);
- gcDraw(gc, offset);
- }
- protected void gcDraw(GC gc, Point offset) {
- gc.fillRectangle(Math.min(x1, x2) + offset.x, Math.min(y1, y2) + offset.y,
- Math.abs(x2 - x1) + 1, Math.abs(y2 - y1) + 1);
- }
-}
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 320b29c060..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-
-/**
- * 2D SolidRectangle object
- */
-public class SolidRoundedRectangleFigure extends StatelessXORFigureHelper {
- 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(GC gc, Point offset) {
- gc.setBackground(color);
- gcDraw(gc, offset);
- }
- protected void gcDraw(GC gc, Point offset) {
- gc.fillRoundRectangle(Math.min(x1, x2) + offset.x, Math.min(y1, y2) + offset.y,
- Math.abs(x2 - x1) + 1, Math.abs(y2 - y1) + 1, diameter, diameter);
- }
-}
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 260f3a04f8..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextFigure.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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(GC gc, Point offset) {
- gc.setFont(font);
- gc.setForeground(color);
- gc.drawText(text, x + offset.x, y + offset.y, true);
- }
- public Object drawPreview(GC gc, Point offset) {
- Color oldColor = gc.getForeground();
- gc.setFont(font);
- gc.setForeground(color);
- gc.setXORMode(false);
-
- Point textExtent = gc.textExtent(text);
- Image backingStore = new Image(null, textExtent.x, textExtent.y);
- gc.copyArea(backingStore, x + offset.x, y + offset.y);
-
- gc.drawText(text, x + offset.x, y + offset.y, true);
- gc.setForeground(oldColor);
- gc.setXORMode(true);
- return backingStore;
- }
- public void erasePreview(GC gc, Point offset, Object rememberedData) {
- Image backingStore = (Image) rememberedData;
- gc.setXORMode(false);
- gc.drawImage(backingStore, x + offset.x, y + offset.y);
- gc.setXORMode(true);
- backingStore.dispose();
- }
-}
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 f7403c8263..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextTool.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package org.eclipse.swt.examples.paint;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 Color drawColor;
- private Font drawFont;
- 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) {
- drawColor = toolSettings.commonForegroundColor;
- drawFont = toolSettings.commonFont;
- }
-
- /**
- * 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().getPaintStatus().setMessage(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) {
- getPaintSurface().showCurrentPositionStatus();
- getPaintSurface().clearRubberbandSelection();
- getPaintSurface().addRubberbandSelection(
- new TextFigure(drawColor, drawFont, 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 3afeba079a..0000000000
--- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ToolSettings.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.swt.examples.paint;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
- 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;
- /**
- * 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 53347ea5db..0000000000
--- a/examples/org.eclipse.swt.examples/.classpath
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path=""/>
- <classpathentry kind="var" path="JRE_LIB"/>
- <classpathentry kind="var"
- path="ECLIPSE_PLUGINS/org.eclipse.swt/swt.jar" sourcepath="ECLIPSE_PLUGINS/org.eclipse.swt/swtsrc.zip"/>
- <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/.vcm_meta b/examples/org.eclipse.swt.examples/.vcm_meta
deleted file mode 100755
index d64b057431..0000000000
--- a/examples/org.eclipse.swt.examples/.vcm_meta
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project-description>
- <comment></comment>
- <nature id="org.eclipse.jdt.core.javanature"/>
- <nature id="org.eclipse.pde.PluginNature"/>
- <reference project-name="org.eclipse.swt"/>
- <builder name="org.eclipse.jdt.core.javabuilder">
- </builder>
- <builder name="org.eclipse.pde.ManifestBuilder">
- </builder>
- <builder name="org.eclipse.pde.SchemaBuilder">
- </builder>
-</project-description>
diff --git a/examples/org.eclipse.swt.examples/build.properties b/examples/org.eclipse.swt.examples/build.properties
deleted file mode 100755
index ebc1fa83f7..0000000000
--- a/examples/org.eclipse.swt.examples/build.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-build.includes = doc-html/,\
- plugin.properties,\
- plugin.xml
-
-build.vaj.Eclipse\ SWT\ Examples = /
-
-build.excludes = bin/,\
- .cvsignore,\
- .vcm_meta,\
- build.properties \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/doc-html/hglegal.htm b/examples/org.eclipse.swt.examples/doc-html/hglegal.htm
deleted file mode 100755
index b071dbdf45..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/hglegal.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="Mozilla/4.73 [en] (Win98; U) [Netscape]">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2001. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/doc-html/ngibmcpy.gif b/examples/org.eclipse.swt.examples/doc-html/ngibmcpy.gif
deleted file mode 100755
index 360f8e9989..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/ngibmcpy.gif
+++ /dev/null
Binary files differ
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 451406f7a5..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/swt_addressbook_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 - Address Book Example</title>
-</head>
-<body>
-
-<h2>Standard Widget Toolkit (SWT) Standalone Example - Address Book</h2>
-
-<h3>Introduction</h3>
-<p>
-The AddressBook example shows how the org.eclipse.swt.Table class can be
-used to present tabular information.
-</p>
-
-<h3>Running the example</h3>
-<p>
-If the Example Launcher is installed, select the Address Book item from the Standalone category and click Run.&nbsp;
-Otherwise, install and run the example manually as per the
-<a href="swt_manual_setup.html">Standalone Examples Manual Setup</a> instructions.&nbsp; The executable class is
-<code>org.eclipse.swt.examples.addressbook.AddressBook</code>.
-</p>
-
-<h3>Details</h3>
-<p>
-The application can save and load address books, sort the entries, search for strings within the fields and
-perform other operations that would typically be found in this kind of application.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000" BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_control_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_control_ex.html
deleted file mode 100755
index 5d0a176980..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/swt_control_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 - Controls Example</title>
-</head>
-<body>
-
-<h2>Standard Widget Toolkit (SWT) Standalone Example - Controls</h2>
-
-<h3>Introduction</h3>
-<p>This example is a simple demonstration of common Standard Widget Toolkit
-(SWT) UI controls.&nbsp; It consists of a shell and tab folder where each
-tab in the folder allows the user to interact with a control.
-</p><p>
-This is a standalone version of the <a href="../../org.eclipse.swt.examples.controls/doc-html/swt_controls_ex.html">Controls
-Example.</a>
-</p>
-
-<h3>Running the example</h3>
-<p>Install and run the example manually as per the
-<a href="swt_manual_setup.html">Standalone Examples Manual Setup</a> instructions.&nbsp; The executable class is
-<code>org.eclipse.swt.examples.controlexample.ControlExample</code>.
-</p>
-
-<h3>Details</h3>
-<p>Each page (tab) of the controls example allows the user to interact with
-a different SWT control.&nbsp; The name of the control being demonstrated
-is on the page tab.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000" 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 c1a2a69ff3..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/swt_fileviewer_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 - File Viewer Example</title>
-</head>
-<body>
-
-<h2>Standard Widget Toolkit (SWT) Standalone Example - File Viewer</h2>
-
-<h3>Introduction</h3>
-<p>The File Viewer example shows how a simple application can be implemented
-using SWT.&nbsp; This application provides the ability to browse files
-and folders.&nbsp; 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>If the Example Launcher is installed, select the File Viewer item from the Standalone category and click Run.&nbsp;
-Otherwise, install and run the example manually as per the
-<a href="swt_manual_setup.html">Standalone Examples Manual Setup</a> instructions.&nbsp; The executable class is
-<code>org.eclipse.swt.examples.fileviewer.FileViewer</code>.
-</p>
-
-<h3>Details</h3>
-<p>
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000" 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 50c1fa8524..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/swt_helloworld_ex.html
+++ /dev/null
@@ -1,52 +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>Standard Widget Toolkit (SWT) Standalone Example - Hello World</h2>
-
-<h3>Introduction</h3>
-<p>The Hello World examples shows how to create a shell, use listeners, process
-events, and use SWT controls.
-</p>
-
-<h3>Running the example</h3>
-<p>If the Example Launcher is installed, select the Hello World [1-5] item from the Standalone category and click Run.&nbsp;
-Otherwise, install and run the example manually as per the
-<a href="swt_manual_setup.html">Standalone Examples Manual Setup</a> instructions.&nbsp; The executable classes are
-<code>org.eclipse.swt.examples.helloworld.HelloWorld[1-5]</code>.
-</p>
-
-<h3>Details</h3>
-
-<h4>Hello World 1</h4>
-<p>This example demonstrates the minimum amount of code required to open an
-SWT Shell and process the events.
-</p>
-
-<h4>Hello World 2</h4>
-<p>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.
-</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.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000" 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 d64c6292f5..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/swt_hoverhelp_ex.html
+++ /dev/null
@@ -1,38 +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 - Explorer Example</title>
-</head>
-<body>
-
-<h2>Standard Widget Toolkit (SWT) Standalone Example - Hover Help</h2>
-
-<h3>Introduction</h3>
-<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.
-</p>
-
-<h3>Running the example</h3>
-<p>If the Example Launcher is installed, select the Hover Help item from the Standalone category and click Run.&nbsp;
-Otherwise, install and run the example manually as per the
-<a href="swt_manual_setup.html">Standalone Examples Manual Setup</a> instructions.&nbsp; The executable class is
-<code>org.eclipse.swt.examples.hoverhelp.HoverHelp</code>.
-</p>
-
-<h3>Details</h3>
-<p>The example implements its own tooltip and hover help support.&nbsp; To see
-the custom tooltips in action, hover over an item or button in the UI.&nbsp;
-Notice that images appear in the left-hand corner of the tooltip, unlike
-standard SWT tooltips created using setToolTip() on those widgets
-that natively support them.&nbsp; To see the custom hover help in action,
-hover over an item or button in the UI as before until the tooltip
-is displayed.&nbsp; Without moving the pointer, hit F1.&nbsp; A new Shell will
-pop up with the extended hover help information for the UI element
-in question.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000" 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 c42c4b5c59..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/swt_imageanalyzer_ex.html
+++ /dev/null
@@ -1,56 +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>Standard Widget Toolkit (SWT) Standalone Example - Image Analyzer</h2>
-
-<h3>Introduction</h3>
-<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.&nbsp; 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>
-
-<h3>Running the example</h3>
-<p>If the Example Launcher is installed, select the Image Analyzer item from the Standalone category and click Run.&nbsp;
-Otherwise, install and run the example manually as per the
-<a href="swt_manual_setup.html">Standalone Examples Manual Setup</a> instructions.&nbsp; The executable class is
-<code>org.eclipse.swt.examples.imageanalyzer.ImageAnalyzer</code>.
-</p>
-
-<h3>Details</h3>
-<p>
-The ImageAnalyzer will load and display image files of type GIF, JPEG, BMP, ICO, and PNG.&nbsp;
-To open a file, use the File->Open... menu item, and select the image file in the FileDialog.
-</p><p>
-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.
-</p><p>
-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.&nbsp; If a GIF defines a background color,
-as many animated GIFs do, selecting Background will use the GIF's background color.
-</p><p>
-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.&nbsp; You can change the background color of the ImageAnalyzer to see the transparency work.&nbsp;
-To turn off the transparency, deselect Display Transparency.
-</p><p>
-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.
-</p><p>
-File->Save As... can be used to save the currently loaded image to another type of image file.&nbsp; 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.&nbsp; (In the case of an ICO file or
-multi-image GIF, an array of ImageData instances is created).&nbsp; The ImageAnalyzer displays all of the data stored in the ImageData
-instance(s) for the currently loaded image file, including the pixel data.&nbsp; Hovering over a pixel in the image display will show the RGB
-color data for that pixel.&nbsp; For certain images (particularly animated GIFs) additional data is stored in the org.eclipse.swt.graphics.ImageLoader
-instance used to load the image.&nbsp; The ImageAnalyzer displays this data as well.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000" 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 7f2afe192f..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/swt_javaviewer_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 - Java Syntax Viewer Example</title>
-</head>
-<body>
-
-<h2>Standard Widget Toolkit (SWT) Standalone Example - Java Syntax Viewer</h2>
-
-<h3>Introduction</h3>
-<p>This example demonstrates how to implement a user-defined line styler for
-the StyledText widget.
-</p>
-
-<h3>Running the example</h3>
-<p>If the Example Launcher is installed, select the Java Viewer item from the Standalone category and click Run.&nbsp;
-Otherwise, install and run the example manually as per the
-<a href="swt_manual_setup.html">Standalone Examples Manual Setup</a> instructions.&nbsp; The executable class is
-<code>org.eclipse.swt.examples.javaviewer.JavaViewer</code>.
-</p>
-
-<h3>Details</h3>
-<p>The example provides a typical editor interface.&nbsp; To see the effect of the line
-styler, open a *.java file.&nbsp; When the contents of the file are displayed in the
-editor area, notice that the keywords have been highlighted.
-</p>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000" BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
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 e9bac826c9..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/swt_manual_setup.html
+++ /dev/null
@@ -1,98 +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 Manual Setup</title>
-</head>
-<body>
-
-<h2>Standard Widget Toolkit (SWT) - Standalone Examples Manual Setup</h2>
-
-<h3>Setup</h3>
-<p>There are several steps required to run the SWT standalone examples manually.
-</p>
-
-<ul>
-<li><p>
-Create a Java Project to contain the examples.&nbsp; Call it <b>SWT Examples</b>.
-</p>
-
-<li><p>
-Make sure the <b>swt.jar</b> file is on the java classpath, by doing the following:<br>
-Select the SWT Examples Project and bring up the Properties dialog.<br>
-On the Java Build Path page, select the Libraries tab, click on the Add External JARs button and select <b>swt.jar</b>.<br>
-Next, click on the Attach Source button, then click on the Browse File System button and select <b>swtsrc.zip</b>.<br>
-The files can be found in the following directory, depending one which Operating System you are using to run Eclipse:
-<ul>
-<li>Windows - &lt;install-dir&gt;\eclipse\plugins\org.eclipse.swt\
-<li>Motif - &lt;install-dir&gt;/eclipse/plugins/org.eclipse.swt/
-</ul>
-Click OK to save the Project properties.<br>
-</p>
-
-<li><p>
-Make sure the <b>swtexamples.jar</b> is on the java classpath, by doing the following:<br>
-Select the SWT Examples Project and bring up the Properties dialog.<br>
-On the Java Build Path page, select the Libraries tab, click on the Add External JARs button and select <b>swtexamples.jar</b>.<br>
-Next, click on the Attach Source button, then click on the Browse File System button and select <b>swtexamplessrc.zip</b>.<br>
-The files can be found in the following directory, depending one which Operating System you are using to run Eclipse:
-<ul>
-<li>Windows - &lt;install-dir&gt;\eclipse\plugins\org.eclipse.swt.examples\
-<li>Motif - &lt;install-dir&gt;/eclipse/plugins/org.eclipse.swt.examples/
-</ul>
-Click OK to save the Project properties.<br>
-</p>
-
-<li><p>
-Make sure that referenced libraries are visible in the Packages view, by doing the following:<br>
-In the Packages view of the Java Perspective, drop down the View menu.<br>
-Ensure that <b>Show Referenced Libraries</b> is checked.
-</p>
-
-<li><p>
-Make sure the <b>SWT runtime library</b> is in the library search path, by doing the following:<br>
-In the Packages view of the Java Perspective, expand <b>swtexamples.jar</b>.<br>
-You will see all of the packages and other resource files present in the jar file, including the executable class for each example.<br>
-Select the executable class (the one containing the main() method) for the particular example that you wish to run and bring up the Properties dialog.<br>
-On the Execution Arguments page, select the VM arguments field and enter <b>-Djava.library.path=&lt;runtime-library-path&gt;</b>.<br>
-The runtime library path is the following directory, depending one which Operating System you are using to run Eclipse:
-<ul>
-<li>Windows - &lt;install-dir&gt;\eclipse\plugins\org.eclipse.swt\ws\win32
-<li>Motif - &lt;install-dir&gt;/eclipse/plugins/org.eclipse.swt/ws/motif
-</ul>
-Click OK to save the Java Resource properties.<br>
-</p>
-
-</ul>
-
-<h3><a NAME="Run"></a>Running the Examples</h3>
-<p>In the Packages view of the Java Perspective, expand <b>swtexamples.jar</b>.&nbsp;
-You will see all of the packages and other resource files present in the jar file,
-including the executable class for each example.
-</p>
-<p>All of the standalone SWT examples are intended to be run as Java
-Applications.&nbsp; No parameters need be passed to any of these examples,
-other than any required VM arguments.&nbsp; To run an example, simply
-select the executable class for the particular example, then click the Run button on the toolbar.
-</p>
-
-<h3><a NAME="Package"></a>Examples Manifest</h3>
-<p>Consult the documentation of each individual example for the names of
-its executable class(es) and additional details.
-</p>
-<p>
-<code>swtexamples.jar</code> contains the following examples:
-<ul>
-<li><a href="swt_addressbook_ex.html">Address Book</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_texteditor_ex.html">Text Editor</a>
-</ul>
-</p>
-
-<p><br><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000" 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 636ae51965..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/swt_texteditor_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 - Text Editor Example</title>
-</head>
-<body>
-
-<h2>Standard Widget Toolkit (SWT) Standalone Example - Text Editor</h2>
-
-<h3>Introduction</h3>
-<p>This example demonstrates how to use the StyledText widget to implement
-a text editor with formatting support.
-</p>
-
-<h3>Running the example</h3>
-<p>If the Example Launcher is installed, select the Text Editor item from the Standalone category and click Run.&nbsp;
-Otherwise, install and run the example manually as per the
-<a href="swt_manual_setup.html">Standalone Examples Manual Setup</a> instructions.&nbsp; The executable class is
-<code>org.eclipse.swt.examples.texteditor.TextEditor</code>.
-</p>
-
-<h3>Details</h3>
-<p>The example has a typical text editor interface.&nbsp; The File 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>
-
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000" BORDER=0 height=12 width=195></a></p>
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples/examples_addressbook.properties b/examples/org.eclipse.swt.examples/examples_addressbook.properties
deleted file mode 100755
index b416bed826..0000000000
--- a/examples/org.eclipse.swt.examples/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/examples_control.properties b/examples/org.eclipse.swt.examples/examples_control.properties
deleted file mode 100755
index c3731c71f6..0000000000
--- a/examples/org.eclipse.swt.examples/examples_control.properties
+++ /dev/null
@@ -1,169 +0,0 @@
-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
-Dialog_Result = Dialog Result
-ColorDialog = ColorDialog
-DirectoryDialog = DirectoryDialog
-FileDialog = FileDialog
-FontDialog = FontDialog
-MessageBox = MessageBox
-Multi_line = A multi line text widget.
-Example_string = The quick brown fox jumped over the lazy dogs.
-Header_Visible = Header Visible
-Lines_Visible = Lines Visible
-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:
-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
-Button = Button
-Combo = Combo
-Dialog = Dialog
-Label = Label
-List = List
-ProgressBar = ProgressBar
-Sash = Sash
-Shell = Shell
-Slider_and_Scale = Slider and Scale
-Table = Table
-Text = Text
-ToolBar = ToolBar
-Tree = Tree
-RichText = RichText
-Slider = Slider
-Scale = Scale
-SWT_PUSH = SWT.PUSH
-SWT_CHECK = SWT.CHECK
-SWT_RADIO = SWT.RADIO
-SWT_TOGGLE = SWT.TOGGLE
-SWT_ARROW = SWT.ARROW
-SWT_BORDER = SWT.BORDER
-SWT_DROP_DOWN = SWT.DROP_DOWN
-SWT_READ_ONLY = SWT.READ_ONLY
-SWT_SIMPLE = SWT.SIMPLE
-SWT_SEPARATOR = SWT.SEPARATOR
-SWT_HORIZONTAL = SWT.HORIZONTAL
-SWT_VERTICAL = SWT.VERTICAL
-SWT_SHADOW_IN = SWT.SHADOW_IN
-SWT_SHADOW_OUT = SWT.SHADOW_OUT
-SWT_SINGLE = SWT.SINGLE
-SWT_MULTI = SWT.MULTI
-SWT_H_SCROLL = SWT.H_SCROLL
-SWT_V_SCROLL = SWT.V_SCROLL
-SWT_FLAT = SWT.FLAT
-SWT_WRAP = SWT.WRAP
-SWT_SAVE = SWT.SAVE
-SWT_OPEN = SWT.OPEN
-SWT_PRIMARY_MODAL = SWT.PRIMARY_MODAL
-SWT_APPLICATION_MODAL = SWT.APPLICATION_MODAL
-SWT_SYSTEM_MODAL = SWT.SYSTEM_MODAL
-SWT_MODELESS = SWT.MODELESS
-SWT_ICON_ERROR = SWT.ICON_ERROR
-SWT_ICON_INFORMATION = SWT.ICON_INFORMATION
-SWT_ICON_QUESTION = SWT.ICON_QUESTION
-SWT_ICON_WARNING = SWT.ICON_WARNING
-SWT_ICON_WORKING = SWT.ICON_WORKING
-SWT_OK = SWT.OK
-SWT_CANCEL = SWT.CANCEL
-SWT_YES = SWT.YES
-SWT_NO = SWT.NO
-SWT_RETRY = SWT.RETRY
-SWT_ABORT = SWT.ABORT
-SWT_IGNORE = SWT.IGNORE
-SWT_NO_TRIM = SWT.NO_TRIM
-SWT_CLOSE = SWT.CLOSE
-SWT_TITLE = SWT.TITLE
-SWT_MIN = SWT.MIN
-SWT_MAX = SWT.MAX
-SWT_RESIZE = SWT.RESIZE
-SWT_FULL_SELECTION = SWT.FULL_SELECTION
-SWT_SMOOTH = SWT.SMOOTH \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/examples_fileviewer.properties b/examples/org.eclipse.swt.examples/examples_fileviewer.properties
deleted file mode 100755
index 0d47a65f8d..0000000000
--- a/examples/org.eclipse.swt.examples/examples_fileviewer.properties
+++ /dev/null
@@ -1,47 +0,0 @@
-Title = SWT FileViewer - {0}
-
-menu.Close.text = &Close
-menu.Help.text = &Help Topics
-menu.About.text = &About
-menu.File.text = &File
-menu.Help.text = &Help
-
-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.NumberOfObjects.text = {0} object(s)
-
-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.
-
-simulate.MoveFromTo.text = Simulated move from "{0}" to "{1}".
-simulate.CopyFromTo.text = Simulated copy from "{0}" to "{1}".
-simulate.DirectoriesCreated.text = Simulated directories created for "{0}".
-simulate.DirectoriesCreated.text = Ignoring unknown resource "{0}".
-
-error.FailedLaunch.message = Could not launch "{0}"
-
-exception.Invalid_DND_Mode = Invalid Drag and Drop Mode: {0}
diff --git a/examples/org.eclipse.swt.examples/examples_helloworld.properties b/examples/org.eclipse.swt.examples/examples_helloworld.properties
deleted file mode 100755
index 2db6671c37..0000000000
--- a/examples/org.eclipse.swt.examples/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/examples_hoverhelp.properties b/examples/org.eclipse.swt.examples/examples_hoverhelp.properties
deleted file mode 100755
index b1e118e3fa..0000000000
--- a/examples/org.eclipse.swt.examples/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/examples_images.properties b/examples/org.eclipse.swt.examples/examples_images.properties
deleted file mode 100755
index 6072599352..0000000000
--- a/examples/org.eclipse.swt.examples/examples_images.properties
+++ /dev/null
@@ -1,92 +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}
-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
-Open = &Open...\tCtrl+O
-Reopen = &Reopen
-Save = &Save\tCtrl+S
-Save_as = Save &As...
-Save_mask_as = Save &Mask As...
-Exit = E&xit
-Alpha = Alpha
-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
-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:
-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/examples_javaviewer.properties b/examples/org.eclipse.swt.examples/examples_javaviewer.properties
deleted file mode 100755
index 8c589d1470..0000000000
--- a/examples/org.eclipse.swt.examples/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/examples_texteditor.properties b/examples/org.eclipse.swt.examples/examples_texteditor.properties
deleted file mode 100755
index e53ce09e38..0000000000
--- a/examples/org.eclipse.swt.examples/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/import.properties b/examples/org.eclipse.swt.examples/import.properties
deleted file mode 100755
index 53f7dd67c7..0000000000
--- a/examples/org.eclipse.swt.examples/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/org/eclipse/swt/examples/addressbook/AddressBook.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/AddressBook.java
deleted file mode 100755
index 8b72c7fda8..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/AddressBook.java
+++ /dev/null
@@ -1,908 +0,0 @@
-package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/* Imports */
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.io.*;
-import java.util.zip.*;
-import java.util.ResourceBundle;
-
-/**
- * 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 = ",";
- 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) {
- AddressBook application = new AddressBook();
- application.open();
- application.run();
-}
-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;
-}
-/**
- * Merges two arrays (assumed to be individually sorted) of string arrays into
- * one sorted array by the value stored at the columnIndex parameter. This method
- * is used in <code>mergeSort(String[][] tableItems, int columnIndex)</code>.
- *
- * @param firstHalf String[][]
- * The first array of Strings to be merged.
- * @param secondHalf String[][]
- * The second array of Strings to be merged.
- * @param columnIndex int
- * The column by which the String arrays will be compared.
- * @return String[][]
- * An array of array of String that is the merged (and sorted) combination
- * of the two parameter arrays.
- */
-private String[][] merge(String[][] firstHalf, String[][] secondHalf, int column) {
- int x = firstHalf.length + secondHalf.length;
- int y = Math.max(firstHalf[0].length, secondHalf[0].length);
- String[][] sorted = new String[x][y];
-
- int firstHalfIndex = 0;
- int secondHalfIndex = 0;
- int sortedIndex = 0;
-
- //merge
- while(firstHalfIndex < firstHalf.length && secondHalfIndex < secondHalf.length) {
- if(firstHalf[firstHalfIndex][column].compareToIgnoreCase(secondHalf[secondHalfIndex][column]) <= 0 ) {
- sorted[sortedIndex] = firstHalf[firstHalfIndex];
- sortedIndex++;
- firstHalfIndex++;
- } else {
- sorted[sortedIndex] = secondHalf[secondHalfIndex];
- sortedIndex++;
- secondHalfIndex++;
- }
- }
-
- //copy remaining items into sorted.
- while(firstHalfIndex < firstHalf.length) {
- sorted[sortedIndex] = firstHalf[firstHalfIndex];
- sortedIndex++;
- firstHalfIndex++;
- }
-
- while(secondHalfIndex < secondHalf.length) {
- sorted[sortedIndex] = secondHalf[secondHalfIndex];
- sortedIndex++;
- secondHalfIndex++;
- }
-
- return sorted;
-}
-/**
- * Takes an array of array of Strings and sorts them into ascending order according to the
- * data in the column specified. Note that this sort is recursive.
- *
- * @param tableItems String[][]
- * The array of Strings that will be sorted.
- * @param columnIndex int
- * The column in the String arrays by which the arrays will be compared.
- * @return String[][]
- * The resultant sorted version of the tableItems parameter.
- * @see #merge(String[][] firstHalf, String[][] secondHalf, int columnIndex)
- */
-private String[][] mergeSort(String[][] items, int column) {
- int numItems = items.length;
-
- if(numItems <= 1) return items;
-
- int split = numItems / 2;
- String[][] firstHalf = new String[split][items[0].length];
- String[][] secondHalf = new String[numItems - split][items[0].length];
- for(int i = 0; i < firstHalf.length; i++) {
- firstHalf[i] = items[i];
- }
- for(int i = 0; i < secondHalf.length; i++) {
- secondHalf[i] = items[split + i];
- }
-
- String[][] firstHalfSorted = mergeSort(firstHalf, column);
- String[][] secondHalfSorted = mergeSort(secondHalf, column);
- String[][] sortedItems = merge(firstHalfSorted, secondHalfSorted, column);
-
- return sortedItems;
-}
-private void newAddressBook() {
- shell.setText(resAddressBook.getString("Title_bar") + resAddressBook.getString("New_title"));
- 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 open() {
- Display display = new 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 widgetDoubleSelected(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();
-}
-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]);
- }
- tableInfo = mergeSort(tableInfo, 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 void run() {
- //read and dispatch until termination
- Display display = shell.getDisplay();
- while(!shell.isDisposed()){
- if(!display.readAndDispatch())
- display.sleep();
- }
-}
-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);
- }
- }
-
- data = mergeSort(data, 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();
- }
- });
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/DataEntryDialog.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/DataEntryDialog.java
deleted file mode 100755
index 35e0425bff..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/DataEntryDialog.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/* 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/org/eclipse/swt/examples/addressbook/FindListener.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/FindListener.java
deleted file mode 100755
index 88d70e4791..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/FindListener.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public interface FindListener {
-
-public boolean find();
-
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/SearchDialog.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/SearchDialog.java
deleted file mode 100755
index e110e5ceb3..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/addressbook/SearchDialog.java
+++ /dev/null
@@ -1,196 +0,0 @@
-package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/* 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"));
-
- 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/org/eclipse/swt/examples/controlexample/AlignableTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/AlignableTab.java
deleted file mode 100755
index 10a96c039b..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/AlignableTab.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 "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 (resControls.getString("Alignment"));
-
- /* Create the controls */
- leftButton = new Button (allignmentGroup, SWT.RADIO);
- leftButton.setText (resControls.getString("Left"));
- centerButton = new Button (allignmentGroup, SWT.RADIO);
- centerButton.setText(resControls.getString("Center"));
- rightButton = new Button (allignmentGroup, SWT.RADIO);
- rightButton.setText (resControls.getString("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/org/eclipse/swt/examples/controlexample/ButtonTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ButtonTab.java
deleted file mode 100755
index 0b3697b400..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ButtonTab.java
+++ /dev/null
@@ -1,175 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-/**
-* Creates the "Control" group.
-*/
-void createControlGroup () {
- super.createControlGroup ();
-
- /* Create the controls */
- upButton = new Button (allignmentGroup, SWT.RADIO);
- upButton.setText (resControls.getString("Up"));
- downButton = new Button (allignmentGroup, SWT.RADIO);
- downButton.setText (resControls.getString("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 (resControls.getString("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 (resControls.getString("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 (borderButton.getSelection()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- button1 = new Button(textButtonGroup, style);
- button1.setText(resControls.getString("One"));
- button2 = new Button(textButtonGroup, style);
- button2.setText(resControls.getString("Two"));
- button3 = new Button(textButtonGroup, style);
- button3.setText(resControls.getString("Three"));
- button4 = new Button(imageButtonGroup, style);
- button4.setImage(Images.CLOSED_FOLDER_IMAGE);
- button5 = new Button(imageButtonGroup, style);
- button5.setImage(Images.OPEN_FOLDER_IMAGE);
- button6 = new Button(imageButtonGroup, style);
- button6.setImage(Images.TARGET_IMAGE);
-}
-/**
-* Creates the "Style" group.
-*/
-void createStyleGroup() {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- pushButton = new Button (styleGroup, SWT.RADIO);
- pushButton.setText(resControls.getString("SWT_PUSH"));
- checkButton = new Button (styleGroup, SWT.RADIO);
- checkButton.setText (resControls.getString("SWT_CHECK"));
- radioButton = new Button (styleGroup, SWT.RADIO);
- radioButton.setText (resControls.getString("SWT_RADIO"));
- toggleButton = new Button (styleGroup, SWT.RADIO);
- toggleButton.setText (resControls.getString("SWT_TOGGLE"));
- arrowButton = new Button (styleGroup, SWT.RADIO);
- arrowButton.setText (resControls.getString("SWT_ARROW"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (resControls.getString("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 resControls.getString("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);
- borderButton.setSelection ((button1.getStyle () & SWT.BORDER) != 0);
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ComboTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ComboTab.java
deleted file mode 100755
index 9b4f5fdade..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ComboTab.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 = {resControls.getString("ListData0_0"),
- resControls.getString("ListData0_1"),
- resControls.getString("ListData0_2"),
- resControls.getString("ListData0_3"),
- resControls.getString("ListData0_4"),
- resControls.getString("ListData0_5"),
- resControls.getString("ListData0_6"),
- resControls.getString("ListData0_7"),
- resControls.getString("ListData0_8")};
-/**
-* 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 (resControls.getString("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 (resControls.getString("SWT_DROP_DOWN"));
- simpleButton = new Button (styleGroup, SWT.RADIO);
- simpleButton.setText(resControls.getString("SWT_SIMPLE"));
- readOnlyButton = new Button (styleGroup, SWT.CHECK);
- readOnlyButton.setText (resControls.getString("SWT_READ_ONLY"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (resControls.getString("SWT_BORDER"));
-}
-/**
-* Gets the "Example" widget children.
-*/
-Control [] getExampleWidgets () {
- return new Control [] {combo1};
-}
-/**
-* Gets the text for the tab folder item.
-*/
-String getTabText () {
- return resControls.getString("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/org/eclipse/swt/examples/controlexample/ControlExample.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ControlExample.java
deleted file mode 100755
index 88e477f0ad..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ControlExample.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import java.util.ResourceBundle;
-
-/**
-* <code>ControlExample</code> is a simple demonstration
-* of the controls defined by SWT. It consists of a shell
-* and tab folder where each tab in the folder allows the
-* user to interact with a control.
-*/
-
-public class ControlExample {
- Shell shell;
- TabFolder tabFolder;
- ResourceBundle resControls = ResourceBundle.getBundle("examples_control");
-/**
-* Create a new example and open it.
-*
-* @param args the command line arguments
-*
-*/
-public static void main (String[] args) {
- new ControlExample ().open ();
-}
-/**
-* Open the example.
-*/
-void open () {
-
- /* Load resources */
- Images.loadImages ();
-
- /* Create the shell */
- shell = new Shell ();
- shell.setText (resControls.getString("Control_Example"));
- shell.addControlListener (new ControlAdapter () {
- public void controlResized (ControlEvent e) {
- tabFolder.setBounds (shell.getClientArea ());
- }
- });
-
- /* Create the tab folder */
- ShellTab shellTab = new ShellTab ();
- tabFolder = new TabFolder (shell, SWT.NULL);
- Tab [] tabs = new Tab [] {
- new ButtonTab (),
- new ComboTab (),
- new DialogTab (),
- new LabelTab (),
- new ListTab (),
- new ProgressBarTab (),
- new SashTab (),
- shellTab,
- new SliderTab (),
- new TableTab (),
- new TextTab (),
- new ToolBarTab (),
- new TreeTab (),
- };
- 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));
- }
-
- /* Run the event loop */
- shell.open ();
- Display display = Display.getDefault ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
-
- /*
- * 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.
- */
- shellTab.closeAllShells ();
-
- /* Free resources */
- Images.freeImages ();
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/DialogTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/DialogTab.java
deleted file mode 100755
index 76a56e521e..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/DialogTab.java
+++ /dev/null
@@ -1,417 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 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 = {resControls.getString("FilterName_0"),
- resControls.getString("FilterName_1"),
- resControls.getString("FilterName_2")};
-
-/**
-* 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 (resControls.getString("ColorDialog"))) {
- ColorDialog dialog = new ColorDialog (shell ,style);
- dialog.setRGB (new RGB (100, 100, 100));
- dialog.setText (resControls.getString("Title"));
- RGB result = dialog.open ();
- textWidget.append (resControls.getString("ColorDialog") + Text.DELIMITER);
- textWidget.append (resControls.getString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals (resControls.getString("DirectoryDialog"))) {
- DirectoryDialog dialog = new DirectoryDialog (shell, style);
- dialog.setMessage (resControls.getString("Example_string"));
- dialog.setText (resControls.getString("Title"));
- String result = dialog.open ();
- textWidget.append (resControls.getString("DirectoryDialog") + Text.DELIMITER);
- textWidget.append (resControls.getString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals (resControls.getString("FileDialog"))) {
- FileDialog dialog = new FileDialog (shell, style);
- dialog.setFileName (resControls.getString("readme_txt"));
- dialog.setFilterNames (FilterNames);
- dialog.setFilterExtensions (FilterExtensions);
- dialog.setText (resControls.getString("Title"));
- String result = dialog.open();
- textWidget.append (resControls.getString("FileDialog") + Text.DELIMITER);
- textWidget.append (resControls.getString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals (resControls.getString("FontDialog"))) {
- FontDialog dialog = new FontDialog (shell, style);
- dialog.setText (resControls.getString("Title"));
- FontData result = dialog.open ();
- textWidget.append (resControls.getString("FontDialog") + Text.DELIMITER);
- textWidget.append (resControls.getString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals(resControls.getString("MessageBox"))) {
- MessageBox dialog = new MessageBox (shell, style);
- dialog.setMessage (resControls.getString("Example_string"));
- dialog.setText (resControls.getString("Title"));
- int result = dialog.open ();
- textWidget.append (resControls.getString("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 (resControls.getString("Result") + resControls.getString("SWT_OK"));
- break;
- case SWT.YES:
- textWidget.append (resControls.getString("Result") + resControls.getString("SWT_YES"));
- break;
- case SWT.NO:
- textWidget.append (resControls.getString("Result") + resControls.getString("SWT_NO"));
- break;
- case SWT.CANCEL:
- textWidget.append (resControls.getString("Result") + resControls.getString("SWT_CANCEL"));
- break;
- case SWT.ABORT:
- textWidget.append (resControls.getString("Result") + resControls.getString("SWT_ABORT"));
- break;
- case SWT.RETRY:
- textWidget.append (resControls.getString("Result") + resControls.getString("SWT_RETRY"));
- break;
- case SWT.IGNORE:
- textWidget.append (resControls.getString("Result") + resControls.getString("SWT_IGNORE"));
- break;
- default:
- textWidget.append(resControls.getString("Result") + 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 (resControls.getString("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 (resControls.getString("Dialog_Type"));
-}
-/**
-* Creates the "Control" widget children.
-*/
-void createControlWidgets () {
-
- /* Create the combo */
- String [] strings = {
- resControls.getString("ColorDialog"),
- resControls.getString("DirectoryDialog"),
- resControls.getString("FileDialog"),
- resControls.getString("FontDialog"),
- resControls.getString("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 (resControls.getString("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 (resControls.getString("Button_Styles"));
-
- /* Create the button style buttons */
- okButton = new Button (buttonStyleGroup, SWT.CHECK);
- okButton.setText (resControls.getString("SWT_OK"));
- cancelButton = new Button (buttonStyleGroup, SWT.CHECK);
- cancelButton.setText (resControls.getString("SWT_CANCEL"));
- yesButton = new Button (buttonStyleGroup, SWT.CHECK);
- yesButton.setText (resControls.getString("SWT_YES"));
- noButton = new Button (buttonStyleGroup, SWT.CHECK);
- noButton.setText (resControls.getString("SWT_NO"));
- retryButton = new Button (buttonStyleGroup, SWT.CHECK);
- retryButton.setText (resControls.getString("SWT_RETRY"));
- abortButton = new Button (buttonStyleGroup, SWT.CHECK);
- abortButton.setText (resControls.getString("SWT_ABORT"));
- ignoreButton = new Button (buttonStyleGroup, SWT.CHECK);
- ignoreButton.setText (resControls.getString("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 (resControls.getString("Icon_Styles"));
-
- /* Create the icon style buttons */
- iconErrorButton = new Button (iconStyleGroup, SWT.RADIO);
- iconErrorButton.setText (resControls.getString("SWT_ICON_ERROR"));
- iconInformationButton = new Button (iconStyleGroup, SWT.RADIO);
- iconInformationButton.setText (resControls.getString("SWT_ICON_INFORMATION"));
- iconQuestionButton = new Button (iconStyleGroup, SWT.RADIO);
- iconQuestionButton.setText (resControls.getString("SWT_ICON_QUESTION"));
- iconWarningButton = new Button (iconStyleGroup, SWT.RADIO);
- iconWarningButton.setText (resControls.getString("SWT_ICON_WARNING"));
- iconWorkingButton = new Button (iconStyleGroup, SWT.RADIO);
- iconWorkingButton.setText (resControls.getString("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 (resControls.getString("Modal_Styles"));
-
- /* Create the modal style buttons */
- modelessButton = new Button (modalStyleGroup, SWT.RADIO);
- modelessButton.setText (resControls.getString("SWT_MODELESS"));
- primaryModalButton = new Button (modalStyleGroup, SWT.RADIO);
- primaryModalButton.setText (resControls.getString("SWT_PRIMARY_MODAL"));
- applicationModalButton = new Button (modalStyleGroup, SWT.RADIO);
- applicationModalButton.setText (resControls.getString("SWT_APPLICATION_MODAL"));
- systemModalButton = new Button (modalStyleGroup, SWT.RADIO);
- systemModalButton.setText (resControls.getString("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 (resControls.getString("File_Dialog_Styles"));
-
- /* Create the file dialog style buttons */
- saveButton = new Button (fileDialogStyleGroup, SWT.RADIO);
- saveButton.setText (resControls.getString("SWT_SAVE"));
- openButton = new Button(fileDialogStyleGroup, SWT.RADIO);
- openButton.setText(resControls.getString("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.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- resultGroup.setText (resControls.getString("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.widthHint = 300;
- gridData.heightHint = 400;
- 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 (resControls.getString("MessageBox"));
- boolean isFileDialog = name.equals (resControls.getString("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 resControls.getString("Dialog");
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/Images.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/Images.java
deleted file mode 100755
index 5c536330d4..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/Images.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import java.util.ResourceBundle;
-
-/**
-* <code>Images</code> contains every image
-* that is used by the example.
-*/
-class Images {
- static Image CLOSED_FOLDER_IMAGE;
- static Image OPEN_FOLDER_IMAGE;
- static Image TARGET_IMAGE;
- private static ResourceBundle resControl = ResourceBundle.getBundle("examples_control");
-/**
-* Free the images.
-*/
-public static void freeImages () {
- CLOSED_FOLDER_IMAGE.dispose ();
- OPEN_FOLDER_IMAGE.dispose ();
- TARGET_IMAGE.dispose ();
-}
-/**
- * Load the images.
- */
-public static void loadImages () {
- Class clazz = Images.class;
- try {
- ImageData source = new ImageData(clazz.getResourceAsStream ("folder.gif"));
- ImageData mask = source.getTransparencyMask();
- CLOSED_FOLDER_IMAGE = new Image (null, source, mask);
-
- source = new ImageData(clazz.getResourceAsStream ("folderOpen.gif"));
- mask = source.getTransparencyMask();
- OPEN_FOLDER_IMAGE = new Image (null, source, mask);
-
- source = new ImageData(clazz.getResourceAsStream ("stop.gif"));
- mask = source.getTransparencyMask();
- TARGET_IMAGE = new Image (null, source, mask);
- } catch (Throwable ex) {
- System.out.println (resControl.getString("Images_failed"));
- }
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/LabelTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/LabelTab.java
deleted file mode 100755
index 3a79520f65..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/LabelTab.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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, horizontalButton, verticalButton, shadowInButton, shadowOutButton;
-/**
-* 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 (resControls.getString("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 (resControls.getString("Image_Labels"));
-}
-/**
-* Creates the "Example" widgets.
-*/
-void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (separatorButton.getSelection ()) style |= SWT.SEPARATOR;
- 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(resControls.getString("One"));
- label2 = new Label (textLabelGroup, style);
- label2.setText(resControls.getString("Two"));
- label3 = new Label (textLabelGroup, style);
- label3.setText (resControls.getString("Three"));
- label4 = new Label (imageLabelGroup, style);
- label4.setImage (Images.CLOSED_FOLDER_IMAGE);
- label5 = new Label (imageLabelGroup, style);
- label5.setImage (Images.OPEN_FOLDER_IMAGE);
- label6 = new Label(imageLabelGroup, style);
- label6.setImage (Images.TARGET_IMAGE);
-}
-/**
-* Creates the "Style" group.
-*/
-void createStyleGroup() {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- separatorButton = new Button (styleGroup, SWT.CHECK);
- separatorButton.setText (resControls.getString("SWT_SEPARATOR"));
- horizontalButton = new Button (styleGroup, SWT.RADIO);
- horizontalButton.setText (resControls.getString("SWT_HORIZONTAL"));
- verticalButton = new Button (styleGroup, SWT.RADIO);
- verticalButton.setText (resControls.getString("SWT_VERTICAL"));
- Group styleSubGroup = new Group (styleGroup, SWT.NULL);
- styleSubGroup.setLayout (new GridLayout ());
- shadowInButton = new Button (styleSubGroup, SWT.RADIO);
- shadowInButton.setText (resControls.getString("SWT_SHADOW_IN"));
- shadowOutButton = new Button (styleSubGroup, SWT.RADIO);
- shadowOutButton.setText (resControls.getString("SWT_SHADOW_OUT"));
- borderButton = new Button(styleGroup, SWT.CHECK);
- borderButton.setText(resControls.getString("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 resControls.getString("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;
- 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 (isSeparator && (label1.getStyle () & SWT.SHADOW_OUT) != 0);
- 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/org/eclipse/swt/examples/controlexample/ListTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ListTab.java
deleted file mode 100755
index a9f53e1e45..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ListTab.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 = {resControls.getString("ListData1_0"),
- resControls.getString("ListData1_1"),
- resControls.getString("ListData1_2"),
- resControls.getString("ListData1_3"),
- resControls.getString("ListData1_4"),
- resControls.getString("ListData1_5"),
- resControls.getString("ListData1_6"),
- resControls.getString("ListData1_7"),
- resControls.getString("ListData1_8")};
-
-/**
-* 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 (resControls.getString("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 resControls.getString("List");
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ProgressBarTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ProgressBarTab.java
deleted file mode 100755
index e73b035805..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ProgressBarTab.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 "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 (resControls.getString("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 (resControls.getString("SWT_SMOOTH"));
-}
-/**
-* Gets the "Example" widget children.
-*/
-Control [] getExampleWidgets () {
- return new Control [] {progressBar1};
-}
-/**
-* Gets the text for the tab folder item.
-*/
-String getTabText () {
- return resControls.getString("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 ());
-}
-/**
-* Sets the minimim of the "Example" widgets.
-*/
-void setWidgetMinimum () {
- progressBar1.setMinimum (minimumScale.getSelection ());
-}
-/**
-* Sets the selection of the "Example" widgets.
-*/
-void setWidgetSelection () {
- progressBar1.setSelection (selectionScale.getSelection ());
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/RangeTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/RangeTab.java
deleted file mode 100755
index 4645a9f8b8..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/RangeTab.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 "Control" widget children.
-*/
-void createControlWidgets () {
-
- /* Leave an empty cell */
- new Composite (controlGroup, SWT.NULL);
-
- /* 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 (resControls.getString("Maximum"));
-
- /* Create a scale widget */
- maximumScale = new Scale (maximumGroup, SWT.NULL);
- maximumScale.setMaximum (100);
- maximumScale.setSelection (100);
- maximumScale.setPageIncrement (10);
- maximumScale.setIncrement (5);
-
- /* 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 (resControls.getString("Minimum"));
-
- /* Create a scale widget */
- minimumScale = new Scale (minimumGroup, SWT.NULL);
- minimumScale.setMaximum (100);
- minimumScale.setPageIncrement (10);
- minimumScale.setIncrement (5);
-
- /* 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.HORIZONTAL_ALIGN_CENTER);
- gridData.horizontalSpan = 2;
- selectionGroup.setLayoutData(gridData);
- selectionGroup.setText(resControls.getString("Selection"));
-
- /* Create a scale widget */
- selectionScale = new Scale (selectionGroup, SWT.NULL);
- selectionScale.setMaximum (100);
- selectionScale.setSelection (50);
- selectionScale.setPageIncrement (10);
- selectionScale.setIncrement (5);
-
- /* 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 (resControls.getString("SWT_HORIZONTAL"));
- verticalButton = new Button (styleGroup, SWT.RADIO);
- verticalButton.setText (resControls.getString("SWT_VERTICAL"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (resControls.getString("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/org/eclipse/swt/examples/controlexample/SashTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SashTab.java
deleted file mode 100755
index 0827db8c07..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SashTab.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 = {resControls.getString("ListData0_0"),
- resControls.getString("ListData0_1"),
- resControls.getString("ListData0_2"),
- resControls.getString("ListData0_3"),
- resControls.getString("ListData0_4"),
- resControls.getString("ListData0_5"),
- resControls.getString("ListData0_6"),
- resControls.getString("ListData0_7"),
- resControls.getString("ListData0_8")};
-
- static String [] ListData1 = {resControls.getString("ListData1_0"),
- resControls.getString("ListData1_1"),
- resControls.getString("ListData1_2"),
- resControls.getString("ListData1_3"),
- resControls.getString("ListData1_4"),
- resControls.getString("ListData1_5"),
- resControls.getString("ListData1_6"),
- resControls.getString("ListData1_7"),
- resControls.getString("ListData1_8")};
-
- /* Constants */
- static final int SASH_WIDTH = 3;
-/**
-* 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 (resControls.getString("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 resControls.getString("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/org/eclipse/swt/examples/controlexample/ScrollableTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ScrollableTab.java
deleted file mode 100755
index 9a90516272..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ScrollableTab.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 "Style" group.
-*/
-void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- singleButton = new Button (styleGroup, SWT.RADIO);
- singleButton.setText (resControls.getString("SWT_SINGLE"));
- multiButton = new Button (styleGroup, SWT.RADIO);
- multiButton.setText (resControls.getString("SWT_MULTI"));
- horizontalButton = new Button (styleGroup, SWT.CHECK);
- horizontalButton.setText (resControls.getString("SWT_H_SCROLL"));
- verticalButton = new Button (styleGroup, SWT.CHECK);
- verticalButton.setText (resControls.getString("SWT_V_SCROLL"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (resControls.getString("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/org/eclipse/swt/examples/controlexample/ShellTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ShellTab.java
deleted file mode 100755
index 9fd63330db..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ShellTab.java
+++ /dev/null
@@ -1,212 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
- Button createButton, closeAllButton;
- Group parentStyleGroup;
-
- /* Variables used to track the open shells */
- int shellCount = 0;
- Shell [] shells = new Shell [4];
-/**
-* 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;
-
- /* 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);
- }
-
- /* Set the size, title and open the shell */
- shells [shellCount].setSize (300, 100);
- shells [shellCount].setText (resControls.getString("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 (resControls.getString("Parameters"));
-
- /* Create individual groups inside the "Control" group */
- styleGroup = new Group (controlGroup, SWT.NULL);
- gridLayout = new GridLayout ();
- styleGroup.setLayout (gridLayout);
- gridLayout.numColumns = 2;
- styleGroup.setLayoutData (new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- styleGroup.setText (resControls.getString("Styles"));
-
- /* Create a group for the parent sytle controls */
- parentStyleGroup = new Group (styleGroup, SWT.NULL);
- parentStyleGroup.setLayout (new GridLayout ());
- GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
- gridData.horizontalSpan = 2;
- parentStyleGroup.setLayoutData (gridData);
- parentStyleGroup.setText (resControls.getString("Parent"));
-}
-/**
-* Creates the "Control" widget children.
-*/
-void createControlWidgets () {
-
- /* Create the parent style buttons */
- noParentButton = new Button (parentStyleGroup, SWT.RADIO);
- noParentButton.setText (resControls.getString("No_Parent"));
- parentButton = new Button (parentStyleGroup, SWT.RADIO);
- parentButton.setText (resControls.getString("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_CENTER);
- gridData.horizontalSpan = 2;
- decorationStyleGroup.setLayoutData (gridData);
- decorationStyleGroup.setText (resControls.getString("Decoration_Styles"));
-
- /* Create the decoration style buttons */
- noTrimButton = new Button (decorationStyleGroup, SWT.CHECK);
- noTrimButton.setText (resControls.getString("SWT_NO_TRIM"));
- closeButton = new Button (decorationStyleGroup, SWT.CHECK);
- closeButton.setText (resControls.getString("SWT_CLOSE"));
- titleButton = new Button (decorationStyleGroup, SWT.CHECK);
- titleButton.setText (resControls.getString("SWT_TITLE"));
- minButton = new Button (decorationStyleGroup, SWT.CHECK);
- minButton.setText (resControls.getString("SWT_MIN"));
- maxButton = new Button (decorationStyleGroup, SWT.CHECK);
- maxButton.setText (resControls.getString("SWT_MAX"));
- borderButton = new Button (decorationStyleGroup, SWT.CHECK);
- borderButton.setText (resControls.getString("SWT_BORDER"));
- resizeButton = new Button (decorationStyleGroup, SWT.CHECK);
- resizeButton.setText (resControls.getString("SWT_RESIZE"));
-
- /* Create the "create" and "closeAll" buttons */
- createButton = new Button (styleGroup, SWT.NULL);
- gridData = new GridData (GridData.HORIZONTAL_ALIGN_CENTER);
- createButton.setLayoutData (gridData);
- createButton.setText (resControls.getString("Create_Shell"));
- closeAllButton = new Button (styleGroup, SWT.NULL);
- closeAllButton.setText (resControls.getString("Close_All_Shells"));
- closeAllButton.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_CENTER));
-
- /* 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);
-
- /* Set the default state */
- noParentButton.setSelection (true);
-}
-/**
-* Handle a decoration button selection event.
-*
-* @param event org.eclipse.swt.events.SelectionEvent
-*/
-public void decorationButtonSelected(SelectionEvent event) {
-
- /*
- * Make sure if the No Trim button is selected then
- * all other decoration buttons are deselected.
- */
- Button widget = (Button) event.widget;
- if (widget.getSelection() && widget != noTrimButton) {
- noTrimButton.setSelection (false);
- return;
- }
- if (widget.getSelection() && widget == noTrimButton) {
- 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 resControls.getString("Shell");
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SliderTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SliderTab.java
deleted file mode 100755
index 6aac6dc087..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/SliderTab.java
+++ /dev/null
@@ -1,212 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-/**
-* 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 (resControls.getString("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 (resControls.getString("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 (resControls.getString("Increment"));
-
- /* Create the scale widget */
- incrementScale = new Scale (incrementGroup, SWT.NULL);
- incrementScale.setMaximum (100);
- incrementScale.setSelection (5);
- incrementScale.setPageIncrement (10);
- incrementScale.setIncrement (5);
-
- /* 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 (resControls.getString("Page_Increment"));
-
- /* Create the scale widget */
- pageIncrementScale = new Scale (pageIncrementGroup, SWT.NULL);
- pageIncrementScale.setMaximum (100);
- pageIncrementScale.setSelection (10);
- pageIncrementScale.setPageIncrement (10);
- pageIncrementScale.setIncrement (5);
-
- /* Add the listeners */
- pageIncrementScale.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetIncrement ();
- }
- });
-}
-/**
-* 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 (resControls.getString("Thumb"));
-
- /* Create the scale widget */
- thumbScale = new Scale (thumbGroup, SWT.NULL);
- thumbScale.setMaximum (100);
- thumbScale.setSelection (10);
- thumbScale.setPageIncrement (10);
- thumbScale.setIncrement (5);
-
- /* 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 resControls.getString("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/org/eclipse/swt/examples/controlexample/Tab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/Tab.java
deleted file mode 100755
index 432e492a16..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/Tab.java
+++ /dev/null
@@ -1,354 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-
-/**
-* <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 {
-
- protected static ResourceBundle resControls = ResourceBundle.getBundle("examples_control");
-
- /* Common control buttons */
- Button borderButton, enabledButton, visibleButton;
- Button preferredButton, tooSmallButton, smallButton, largeButton;
-
- /* Common groups and composites */
- Composite tabFolderPage;
- Group exampleGroup, controlGroup, displayGroup, sizeGroup, styleGroup;
-
- /* 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;
-/**
-* 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 (resControls.getString("Parameters"));
-
- /* Create individual groups inside the "Control" group */
- createStyleGroup ();
- createDisplayGroup ();
- createSizeGroup ();
-
- /*
- * 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 curreont 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 "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 (resControls.getString("State"));
-
- /* Create the controls */
- enabledButton = new Button(displayGroup, SWT.CHECK);
- enabledButton.setText(resControls.getString("Enabled"));
- visibleButton = new Button(displayGroup, SWT.CHECK);
- visibleButton.setText(resControls.getString("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 () {
- /*
- * Create the example group. This is the
- * group on the right half of each example
- * tab.
- */
- exampleGroup = new Group (tabFolderPage, SWT.NONE);
- GridLayout gridLayout = new GridLayout ();
- exampleGroup.setLayout (gridLayout);
- exampleGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
-}
-/**
-* 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 (resControls.getString("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 (resControls.getString("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);
-
- /* 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);
-
- /* 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 (resControls.getString("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 ();
- }
-}
-/**
-* 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 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 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 = new GridData ();
- gridData.widthHint = size;
- gridData.heightHint = size;
- controls [i].setLayoutData (gridData);
- }
- /*
- * Force the entire widget tree to layout,
- * even when the child sizes nay 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 ();
- 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/org/eclipse/swt/examples/controlexample/TableTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TableTab.java
deleted file mode 100755
index ab6305dac4..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TableTab.java
+++ /dev/null
@@ -1,172 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-
- /* Style widgets added to the "Style" group */
- Button fullSelectionButton;
-
- /* Display widgets added to the "Display" group */
- Button headerVisibleButton, linesVisibleButton;
-
- static String [] columnTitles = {resControls.getString("TableTitle_0"),
- resControls.getString("TableTitle_1"),
- resControls.getString("TableTitle_2"),
- resControls.getString("TableTitle_3")};
-
- static String [] stringLine0 = {resControls.getString("TableLine0_0"),
- resControls.getString("TableLine0_1"),
- resControls.getString("TableLine0_2"),
- resControls.getString("TableLine0_3")};
-
- static String [] stringLine1 = {resControls.getString("TableLine1_0"),
- resControls.getString("TableLine1_1"),
- resControls.getString("TableLine1_2"),
- resControls.getString("TableLine1_3")};
-
- static String [] stringLine2 = {resControls.getString("TableLine2_0"),
- resControls.getString("TableLine2_1"),
- resControls.getString("TableLine2_2"),
- resControls.getString("TableLine2_3")};
-
-/**
-* Creates the "Display" group.
-*/
-void createDisplayGroup () {
- super.createDisplayGroup ();
-
- /* Create display controls specific to this example */
- headerVisibleButton = new Button (displayGroup, SWT.CHECK);
- headerVisibleButton.setText (resControls.getString("Header_Visible"));
- linesVisibleButton = new Button (displayGroup, SWT.CHECK);
- linesVisibleButton.setText (resControls.getString("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.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- tableGroup.setText (resControls.getString("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 (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 */
- Image [] images = new Image [] {
- Images.CLOSED_FOLDER_IMAGE,
- Images.OPEN_FOLDER_IMAGE,
- Images.TARGET_IMAGE,
- };
- int[] columnWidths = {150, 60, 75, 150};
- for (int i = 0; i < columnTitles.length; i++) {
- TableColumn tableColumn = new TableColumn(table1, SWT.NULL);
- tableColumn.setWidth(columnWidths[i]);
- tableColumn.setText(columnTitles[i]);
- }
- for (int i=0; i<16; i++) {
- TableItem item = new TableItem (table1, SWT.NULL);
- item.setImage (images [i % 3]);
- switch (i % 3) {
- case 0:
- stringLine0 [0] = resControls.getString("Index") + i;
- item.setText(stringLine0);
- break;
- case 1:
- stringLine1 [0] = resControls.getString("Index") + i;
- item.setText(stringLine1);
- break;
- case 2:
- stringLine2 [0] = resControls.getString("Index") + i;
- item.setText(stringLine2);
- break;
- }
- }
-}
-/**
-* Creates the "Style" group.
-*/
-void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- fullSelectionButton = new Button (styleGroup, SWT.CHECK);
- fullSelectionButton.setText (resControls.getString("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 resControls.getString("Table");
-}
-/**
-* Sets the state of the "Example" widgets.
-*/
-void setExampleWidgetState () {
- super.setExampleWidgetState ();
- setWidgetHeaderVisible ();
- setWidgetLinesVisible ();
- 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/org/eclipse/swt/examples/controlexample/TextTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TextTab.java
deleted file mode 100755
index b14d60c03f..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TextTab.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 richText;
- Group textGroup, richTextGroup;
-
- /* Style widgets added to the "Style" group */
- Button readOnlyButton;
-/**
-* 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 (resControls.getString("Text"));
-
- /* Create a group for the rich text widget */
- richTextGroup = new Group (exampleGroup, SWT.NULL);
- richTextGroup.setLayout (new GridLayout ());
- richTextGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- richTextGroup.setText (resControls.getString("RichText"));
-}
-/**
-* 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 (readOnlyButton.getSelection ()) style |= SWT.READ_ONLY;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- text = new Text (textGroup, style);
- text.setText (resControls.getString("Example_string"));
- text.append (text.DELIMITER);
- text.append (resControls.getString("One_Two_Three"));
- richText = new StyledText (richTextGroup, style);
- richText.setText (resControls.getString("Example_string"));
- richText.append ("\n");
- richText.append (resControls.getString("One_Two_Three"));
-}
-/**
-* Creates the "Style" group.
-*/
-void createStyleGroup() {
- super.createStyleGroup();
-
- /* Create the extra widgets */
- readOnlyButton = new Button (styleGroup, SWT.CHECK);
- readOnlyButton.setText (resControls.getString("SWT_READ_ONLY"));
-}
-/**
-* Gets the "Example" widget children.
-*/
-Control [] getExampleWidgets () {
- return new Control [] {text, richText};
-}
-/**
-* Gets the text for the tab folder item.
-*/
-String getTabText () {
- return resControls.getString("Text");
-}
-/**
-* Sets the state of the "Example" widgets.
-*/
-void setExampleWidgetState () {
- super.setExampleWidgetState ();
- readOnlyButton.setSelection ((text.getStyle () & SWT.READ_ONLY) != 0);
-}
-
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ToolBarTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ToolBarTab.java
deleted file mode 100755
index 9d69aae0e5..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/ToolBarTab.java
+++ /dev/null
@@ -1,261 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
- Shell dropDownShell;
- List dropDownList;
- Group imageToolBarGroup, textToolBarGroup;
-
- /* Style widgets added to the "Style" group */
- Button flatButton, wrapButton;
-
- static String [] ListData0 = {resControls.getString("ListData0_0"),
- resControls.getString("ListData0_1"),
- resControls.getString("ListData0_2"),
- resControls.getString("ListData0_3"),
- resControls.getString("ListData0_4"),
- resControls.getString("ListData0_5"),
- resControls.getString("ListData0_6"),
- resControls.getString("ListData0_7"),
- resControls.getString("ListData0_8")};
-
-/**
-* Create the drop down list widget used by the
-* drop down style tool bar item.
-*/
-void createDropDownList() {
-
- /* Don't create more than one list */
- if (dropDownList != null) return;
-
- /* Create the list */
- Shell shell = tabFolderPage.getShell ();
- dropDownShell = new Shell (shell, SWT.NO_TRIM);
- dropDownList = new List(dropDownShell, SWT.VERTICAL);
- dropDownShell.setLayout (new FillLayout ());
- dropDownList.setItems (ListData0);
-
- /*
- * Add a list selection listener so that the list is hidden
- * when the user selects an item from the drop down list.
- */
- dropDownList.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- disposeDropDownList ();
- }
- });
-}
-/**
-* 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 (resControls.getString("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 (resControls.getString("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 (Images.CLOSED_FOLDER_IMAGE);
- item.setToolTipText(resControls.getString("SWT_PUSH"));
- item = new ToolItem (imageToolBar, SWT.PUSH);
- item.setImage (Images.CLOSED_FOLDER_IMAGE);
- item.setToolTipText (resControls.getString("SWT_PUSH"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (Images.OPEN_FOLDER_IMAGE);
- item.setToolTipText (resControls.getString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (Images.OPEN_FOLDER_IMAGE);
- item.setToolTipText (resControls.getString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.CHECK);
- item.setImage (Images.TARGET_IMAGE);
- item.setToolTipText (resControls.getString("SWT_CHECK"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (Images.CLOSED_FOLDER_IMAGE);
- item.setToolTipText (resControls.getString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (Images.CLOSED_FOLDER_IMAGE);
- item.setToolTipText (resControls.getString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.SEPARATOR);
- item.setToolTipText(resControls.getString("SWT_SEPARATOR"));
- item = new ToolItem (imageToolBar, SWT.DROP_DOWN);
- item.setImage (Images.TARGET_IMAGE);
- item.setToolTipText (resControls.getString("SWT_DROP_DOWN"));
-
- /*
- * Add a selection listener to the drop down tool item
- * so that we can show the list when the drop down area
- * is pressed.
- */
- item.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- dropDownToolItemSelected (event);
- }
- });
-
- /* Create the text tool bar */
- textToolBar = new ToolBar (textToolBarGroup, style);
- item = new ToolItem (textToolBar, SWT.PUSH);
- item.setText (resControls.getString("Push"));
- item.setToolTipText(resControls.getString("SWT_PUSH"));
- item = new ToolItem (textToolBar, SWT.PUSH);
- item.setText (resControls.getString("Push"));
- item.setToolTipText(resControls.getString("SWT_PUSH"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (resControls.getString("Radio"));
- item.setToolTipText(resControls.getString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (resControls.getString("Radio"));
- item.setToolTipText(resControls.getString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.CHECK);
- item.setText (resControls.getString("Check"));
- item.setToolTipText(resControls.getString("SWT_CHECK"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (resControls.getString("Radio"));
- item.setToolTipText(resControls.getString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (resControls.getString("Radio"));
- item.setToolTipText(resControls.getString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.SEPARATOR);
- item.setToolTipText(resControls.getString("SWT_SEPARATOR"));
- item = new ToolItem (textToolBar, SWT.DROP_DOWN);
- item.setText (resControls.getString("Drop_Down"));
- item.setToolTipText(resControls.getString("SWT_DROP_DOWN"));
-
- /*
- * 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 (resControls.getString("SWT_FLAT"));
- wrapButton = new Button (styleGroup, SWT.CHECK);
- wrapButton.setText (resControls.getString("SWT_WRAP"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (resControls.getString("SWT_BORDER"));
-}
-void disposeDropDownList () {
- if (dropDownShell != null) dropDownShell.dispose ();
- dropDownShell = null; dropDownList = null;
-}
-void disposeExampleWidgets () {
- super.disposeExampleWidgets ();
- disposeDropDownList ();
-}
-/**
-* Handle the drop down tool item selection event.
-*
-* @param event the selection event
-*/
-void dropDownToolItemSelected (SelectionEvent event) {
-
- /*
- * If list was already dropped down then close it.
- * We would do this regardless of where the tool
- * item was selected.
- */
- createDropDownList ();
- if (dropDownShell.getVisible ()) {
- disposeDropDownList ();
- return;
- }
-
- /**
- * 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.
- * Position the list below and vertically
- * alligned with the the drop down tool button.
- */
- ToolItem item = (ToolItem) event.widget;
- Rectangle toolItemBounds = item.getBounds ();
- Point point1 = imageToolBar.toDisplay (new Point (toolItemBounds.x, toolItemBounds.y));
- dropDownShell.setBounds (point1.x, point1.y + toolItemBounds.height, 100, 100);
- dropDownShell.setVisible (true);
- } else {
- /*
- * Main area of drop down tool item selected.
- * An application would invoke the code was
- * required to perform the action for the tool
- * item.
- */
- }
-}
-/**
-* Gets the "Example" widget children.
-*/
-Control [] getExampleWidgets () {
- return new Control [] {imageToolBar, textToolBar};
-}
-/**
-* Gets the text for the tab folder item.
-*/
-String getTabText () {
- return resControls.getString("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);
-}
-
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TreeTab.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TreeTab.java
deleted file mode 100755
index ef17d660c3..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/TreeTab.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-/**
-* 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 (resControls.getString("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 (resControls.getString("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 (borderButton.getSelection()) style |= SWT.BORDER;
-
- /* Create the text tree */
- tree1 = new Tree (treeGroup, style);
- TreeItem node1 = new TreeItem (tree1, SWT.NULL);
- node1.setText (resControls.getString("Node_1"));
- TreeItem node2 = new TreeItem (tree1, SWT.NULL);
- node2.setText (resControls.getString("Node_2"));
- TreeItem node3 = new TreeItem (tree1, SWT.NULL);
- node3.setText (resControls.getString("Node_3"));
- TreeItem node4 = new TreeItem (tree1, SWT.NULL);
- node4.setText (resControls.getString("Node_4"));
- TreeItem node1_1 = new TreeItem (node1, SWT.NULL);
- node1_1.setText (resControls.getString("Node_1_1"));
- TreeItem node2_1 = new TreeItem (node2, SWT.NULL);
- node2_1.setText (resControls.getString("Node_2_1"));
- TreeItem node3_1 = new TreeItem (node3, SWT.NULL);
- node3_1.setText (resControls.getString("Node_3_1"));
- TreeItem node2_2 = new TreeItem (node2, SWT.NULL);
- node2_2.setText (resControls.getString("Node_2_2"));
- TreeItem node2_2_1 = new TreeItem (node2_2, SWT.NULL);
- node2_2_1.setText (resControls.getString("Node_2_2_1"));
-
- /* Create the image tree */
- tree2 = new Tree (imageTreeGroup, style);
- node1 = new TreeItem (tree2, SWT.NULL);
- node1.setText (resControls.getString("Node_1"));
- node1.setImage (Images.CLOSED_FOLDER_IMAGE);
- node2 = new TreeItem (tree2, SWT.NULL);
- node2.setText (resControls.getString("Node_2"));
- node2.setImage (Images.CLOSED_FOLDER_IMAGE);
- node3 = new TreeItem (tree2, SWT.NULL);
- node3.setText (resControls.getString("Node_3"));
- node3.setImage (Images.CLOSED_FOLDER_IMAGE);
- node4 = new TreeItem (tree2, SWT.NULL);
- node4.setText (resControls.getString("Node_4"));
- node4.setImage (Images.CLOSED_FOLDER_IMAGE);
- node1_1 = new TreeItem (node1, SWT.NULL);
- node1_1.setText (resControls.getString("Node_1_1"));
- node1_1.setImage (Images.CLOSED_FOLDER_IMAGE);
- node2_1 = new TreeItem (node2, SWT.NULL);
- node2_1.setText (resControls.getString("Node_2_1"));
- node2_1.setImage (Images.CLOSED_FOLDER_IMAGE);
- node3_1 = new TreeItem (node3, SWT.NULL);
- node3_1.setText (resControls.getString("Node_3_1"));
- node3_1.setImage (Images.CLOSED_FOLDER_IMAGE);
- node2_2 = new TreeItem(node2, SWT.NULL);
- node2_2.setText (resControls.getString("Node_2_2"));
- node2_2.setImage (Images.CLOSED_FOLDER_IMAGE);
- node2_2_1 = new TreeItem (node2_2, SWT.NULL);
- node2_2_1.setText (resControls.getString("Node_2_2_1"));
- node2_2_1.setImage (Images.CLOSED_FOLDER_IMAGE);
-}
-/**
-* Gets the "Example" widget children.
-*/
-Control [] getExampleWidgets () {
- return new Control [] {tree1, tree2};
-}
-/**
-* Gets the text for the tab folder item.
-*/
-String getTabText () {
- return resControls.getString("Tree");
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/folder.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/folder.gif
deleted file mode 100755
index 6660d0b11a..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/folder.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/folderOpen.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/folderOpen.gif
deleted file mode 100755
index fc9943f111..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/folderOpen.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/stop.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/stop.gif
deleted file mode 100755
index 9807ae648d..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/controlexample/stop.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/ComboView.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/ComboView.java
deleted file mode 100755
index f7537c34fc..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/ComboView.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.eclipse.swt.examples.fileviewer;
- /*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
- import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-
-import java.io.*;
- /**
- * A navigation bar
- */
-public class ComboView {
- /* package */ final Combo combo;
- private final FileViewer viewer;
-
- private File[] roots = null;
- private String lastText = null;
-
- /**
- * Creates the combo box.
- *
- * @param theViewer the viewer to attach to
- * @param parent the parent control
- * @param layoutData the layout data
- */
- public ComboView(FileViewer theViewer, Composite parent, Object layoutData) {
- this.viewer = theViewer;
- combo = new Combo(parent, SWT.NONE);
- combo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- int selection = combo.getSelectionIndex();
- if (selection >= 0 && selection < roots.length) {
- viewer.notifySelectedDirectory(roots[selection]);
- }
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- String text = combo.getText();
- if (text == null) return;
- if (lastText != null && lastText.equals(text)) return;
- lastText = text;
- viewer.notifySelectedDirectory(new File(text));
- }
- });
- combo.setLayoutData(layoutData);
- }
-
- /**
- * Listens to selectedDirectory events.
- * <p>
- * Sets the combo box to point to the current directory.
- * </p>
- *
- * @param dir the directory that was selected, null is not permitted
- */
- /* package */ void selectedDirectory(File dir) {
- combo.clearSelection();
- if (roots == null) return;
-
- for (int i = 0; i < roots.length; ++i) {
- if (dir.equals(roots[i])) {
- combo.select(i);
- return;
- }
- }
- combo.setText(dir.getPath());
- }
- /**
- * Listens to refreshFiles events.
- * <p>
- * Refreshes information about any files in the list and their children.
- * </p>
- *
- * @param files the list of files to be refreshed, null refreshes everything
- */
- /* package */ void refreshFiles(File[] files) {
- if (files == null) {
- roots = viewer.getRoots();
-
- combo.removeAll();
- for (int i = 0; i < roots.length; ++i) {
- final File file = roots[i];
- combo.add(file.getPath());
- }
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/FileDisplayInfo.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/FileDisplayInfo.java
deleted file mode 100755
index 78a5e5f497..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/FileDisplayInfo.java
+++ /dev/null
@@ -1 +0,0 @@
-package org.eclipse.swt.examples.fileviewer; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import org.eclipse.swt.graphics.*; /** * Stores detailed formatted display information about a file entry. */ /* package */ class FileDisplayInfo { public String nameString; public String typeString; public String sizeString; public String dateString; public Image iconImage; /** * Creates a formatted display block. * * @param name the file name string * @param type the file type string * @param size the file size string * @param date the file data string * @param icon the file icon */ public FileDisplayInfo(String name, String type, String size, String date, Image icon) { this.nameString = name; this.typeString = type; this.sizeString = size; this.dateString = date; this.iconImage = icon; } } \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/FileViewer.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/FileViewer.java
deleted file mode 100755
index 40f0ab5b51..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/FileViewer.java
+++ /dev/null
@@ -1,694 +0,0 @@
-package org.eclipse.swt.examples.fileviewer;
- /*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
- private final static String DRIVE_A = "a:" + File.separator;
- private final static String DRIVE_B = "b:" + File.separator;
-
- /* Important UI elements */
- /* package */ Display display;
- private Shell shell;
- private ToolBar toolBar;
- private TreeView treeView;
- private TableView tableView;
- private ComboView comboView;
-
- private Label numObjectsLabel;
- private Label diskSpaceLabel;
-
- private File currentDirectory = null;
-
- private static final DateFormat dateFormat = DateFormat.getDateTimeInstance(
- DateFormat.MEDIUM, DateFormat.MEDIUM);
- /* Simulate only flag */
- // when true, disables actual filesystem manipulations and outputs results to standard out
- private static boolean simulateOnly = false;
-
- /**
- * Runs main program.
- */
- public static void main (String [] args) {
- resourceBundle = ResourceBundle.getBundle("examples_fileviewer");
- new FileViewer().open();
- }
-
- /**
- * Opens the main program.
- */
- /* package */ void open() {
- // Create the window
- display = new Display();
- IconCache.initResources(display);
- shell = new Shell();
- createShellContents();
- notifyRefreshFiles(null);
- shell.open();
- // Event loop
- while (! shell.isDisposed()) {
- if (! display.readAndDispatch()) display.sleep();
- }
- // Cleanup
- tableView.dispose();
- IconCache.freeResources();
- display.dispose();
- }
- /**
- * Closes the main program.
- */
- /* package */ void close() {
- 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.
- */
- /* package */ 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.
- */
- /* package */ 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
- */
- /* package */ 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;
- comboView = new ComboView(this, 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);
- treeView = new TreeView(this, sashForm, null);
- tableView = new TableView(this, sashForm, null);
- 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);
-
- MenuItem item = new MenuItem(menu, SWT.PUSH);
- item.setText(getResourceString("menu.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.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);
- }
-
- /**
- * Notifies the application components that a new current directory has been selected
- *
- * @param dir the directory that was selected, null is ignored
- */
- /* package */ void notifySelectedDirectory(File dir) {
- if (dir == null) return;
- if (currentDirectory != null && dir.equals(currentDirectory)) return;
- currentDirectory = dir;
- shell.setText(getResourceString("Title", new Object[] { currentDirectory.getPath() }));
- // Notify the other components
- comboView.selectedDirectory(dir);
- treeView.selectedDirectory(dir);
- tableView.selectedDirectory(dir);
- }
-
- /**
- * Notifies the application components that files have been selected
- *
- * @param files the files that were selected, null clears the selection
- */
- /* package */ void notifySelectedFiles(File[] files) {
- if (files == null) files = new File[0];
- if (files.length != 0) {
- final File file = files[0];
- notifySelectedDirectory(file.getParentFile());
- }
- tableView.selectedFiles(files);
- }
-
- /**
- * 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
- */
- /* package */ void notifyRefreshFiles(File[] files) {
- if (files != null && files.length == 0) return;
-
- // Notify the other components
- comboView.refreshFiles(files);
- treeView.refreshFiles(files);
- tableView.refreshFiles(files);
- }
-
- /**
- * Performs the default action on a set of files.
- *
- * @param files the array of files to process
- */
- /* package */ 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
- */
- /* package */ void doParent() {
- if (currentDirectory == null) return;
- File parentDirectory = currentDirectory.getParentFile();
- notifySelectedDirectory(parentDirectory);
- }
-
- /**
- * Performs a refresh
- */
- /* package */ void doRefresh() {
- notifyRefreshFiles(null);
- }
- /**
- * Sets the details appropriately for a file
- *
- * @param file the file in question
- */
- /* package */ void setFileDetails(File file) {
- diskSpaceLabel.setText(getResourceString("details.FileSize.text",
- new Object[] { new Long(file.length()) }));
- numObjectsLabel.setText("");
- }
-
- /**
- * Sets the details appropriately for a folder
- *
- * @param folder the folder in question
- * @param files the directory listing
- */
- /* package */ void setFolderDetails(File folder, File[] files) {
- diskSpaceLabel.setText("");
- numObjectsLabel.setText(getResourceString("details.NumberOfObjects.text",
- new Object[] { new Integer(files.length) }));
- }
-
- /**
- * Sets the details appropriately for a selection with > 1 item
- *
- * @param file the file in question
- */
- /* package */ void setSelectionDetails(File[] file) {
- // not implemented
- clearDetails();
- }
-
- /**
- * Blanks out the details
- */
- /* package */ void clearDetails() {
- diskSpaceLabel.setText("");
- numObjectsLabel.setText("");
- }
-
- /**
- * Validate a drop target event
- * <p>
- * Note event.detail is modified by this method
- * </p>
- * @param event the DropTargetEvent we are validating
- * @param targetFile the File representing the drop target location
- * under inspection, or null if none
- * @return an array of files to be operated on, or null on error
- */
- /* package */ File[] validateDrop(DropTargetEvent event, File targetFile) {
- final int dropMode = (event.detail != DND.DROP_NONE) ? event.detail : DND.DROP_MOVE;
- event.detail = DND.DROP_NONE; // simplify error reporting
- // Validate the target
- if (targetFile == null) return null;
- if (! targetFile.isDirectory()) return null;
-
- // Get dropped data (an array of filenames)
- final String[] names = (String[]) event.data;
- final File[] files;
- if (names != null) {
- // Validate the source
- files = new File[names.length];
- for (int i = 0; i < names.length; ++i) {
- files[i] = new File(names[i]);
- if (files[i].equals(targetFile)) return null;
- }
- } else {
- // Files not available yet
- files = null;
- }
- event.detail = dropMode;
- return files;
- }
-
- /**
- * Perform a drop on a target
- * <p>
- * 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
- */
- /* package */ void performDrop(DropTargetEvent event, File targetFile) {
- Vector /* of File */ dirtyFiles = new Vector();
- try {
- final File[] sourceFiles = validateDrop(event, targetFile);
- final int dropMode = event.detail;
-
- event.detail = DND.DROP_NONE; // simplify error reporting
- if (sourceFiles == null) return;
-
- dirtyFiles.add(targetFile);
- for (int i = 0; i < sourceFiles.length; i++){
- final File source = sourceFiles[i];
- final File dest = new File(targetFile, source.getName());
-
- // Perform action on each file
- switch (dropMode) {
- case DND.DROP_COPY:
- if (! copyFileStructure(source, dest)) return;
- break;
- case DND.DROP_MOVE:
- dirtyFiles.add(source);
- if (! moveFileStructure(source, dest)) return;
- break;
- default:
- throw new IllegalArgumentException(getResourceString("exception.Invalid_DND_Mode",
- new Object[] { new Integer(dropMode) }));
- }
- }
- event.detail = dropMode;
- } finally {
- notifyRefreshFiles((File[]) dirtyFiles.toArray(new File[dirtyFiles.size()]));
- }
- }
-
- /**
- * Gets filesystem root entries
- *
- * @return an array of Files corresponding to the root directories on the platform,
- * may be empty but not null
- */
- /* package */ static 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);
- }
- }
- File[] roots = (File[]) list.toArray(new File[list.size()]);
- sortFiles(roots);
- return roots;
- } else {
- return new File[] { new File(File.separator) };
- }
- }
-
- /**
- * 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
- */
- /* package */ static File[] getDirectoryList(File file) {
- File[] list = file.listFiles();
- if (list == null) return new File[0];
- sortFiles(list);
- return list;
- }
-
- /**
- * Gets file information for display purposes
- *
- * @param file the file to query
- * @return the requested information or null if not available
- */
- /* package */ FileDisplayInfo getFileDisplayInfo(File file) {
- final String nameString = file.getName();
- final String dateString = dateFormat.format(new Date(file.lastModified()));
- final String sizeString;
- final String typeString;
- final Image icon;
-
- if (file.isDirectory()) {
- typeString = getResourceString("filetype.Folder");
- sizeString = "";
- icon = 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();
- icon = IconCache.getIconFromProgram(program, extension);
- } else {
- typeString = getResourceString("filetype.Unknown", new Object[] { extension.toUpperCase() });
- icon = IconCache.stockImages[IconCache.iconFile];
- }
- } else {
- typeString = getResourceString("filetype.None");
- icon = IconCache.stockImages[IconCache.iconFile];
- }
- }
- return new FileDisplayInfo(nameString, typeString, sizeString, dateString, icon);
- }
- /**
- * Moves a file or entire directory structure.
- * [Note only works within a specific volume on some platforms for now]
- *
- * @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
- */
- /* package */ static boolean moveFileStructure(File oldFile, File newFile) {
- if (oldFile == null || newFile == null) return false;
- if (! oldFile.exists());
- if (newFile.exists());
- if (simulateOnly) {
- System.out.println(getResourceString("simulate.MoveFromTo.text",
- new Object[] { oldFile.getPath(), newFile.getPath() }));
- return true;
- } else {
- return oldFile.renameTo(newFile);
- }
- }
-
- /**
- * 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
- */
- /* package */ static boolean copyFileStructure(File oldFile, File newFile) {
- if (oldFile == null || newFile == null) return false;
- if (! oldFile.exists());
- if (newFile.exists());
-
- if (oldFile.isFile()) {
- /*
- * 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;
- } else if (oldFile.isDirectory()) {
- /*
- * Copy a directory
- */
- 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) {
- 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;
- }
- }
- return true;
- } else {
- /*
- * Unknown type
- */
- if (simulateOnly) {
- System.out.println(getResourceString("simulate.IgnoringUnknownResource.text",
- new Object[] { oldFile.getPath() }));
- }
- return true; // ignore it
- }
- }
-
- /**
- * Sorts files lexicographically by name.
- *
- * @param files the array of Files to be sorted
- */
- /* package */ 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;
- return a.getName().compareToIgnoreCase(b.getName());
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/IconCache.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/IconCache.java
deleted file mode 100755
index 7abaaf540a..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/IconCache.java
+++ /dev/null
@@ -1,149 +0,0 @@
-package org.eclipse.swt.examples.fileviewer;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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.
- */
-/* package */ class IconCache {
- // Stock images
- public static 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 static 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 static Image stockImages[];
-
- // Stock cursors
- public static final int
- cursorDefault = 0,
- cursorWait = 1;
- public static Cursor stockCursors[];
- // Cached icons
- private static Hashtable iconCache;
- /**
- * Loads the resources
- *
- * @param display the display
- */
- public static 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 static 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 static 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 and extension
- *
- * @param program the Program
- * @param extension the extension
- */
- public static Image getIconFromProgram(Program program, String extension) {
- final String key = program.getName() + "$#$" + extension;
- Image image = (Image) iconCache.get(key);
- if (image == null) {
- ImageData imageData = program.getImageData();
- if (imageData != null) {
- image = new Image(null, imageData, imageData.getTransparencyMask());
- iconCache.put(key, image);
- } else {
- image = stockImages[iconFile];
- }
- }
- return image;
- }
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TableView.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TableView.java
deleted file mode 100755
index a1ed483d37..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TableView.java
+++ /dev/null
@@ -1 +0,0 @@
-package org.eclipse.swt.examples.fileviewer; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import org.eclipse.swt.*; 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.*; /** * A detailed directory listing */ public class TableView { private static final String TABLEITEMDATA_FILE = "TableItem.file"; // File: File associated with table row private final Table table; private final Label contentsOfLabel; private final Shell shell; private final Display display; private final FileViewer viewer; private File activeDir = null; /* Worker thread control */ private UpdateWorker tableUpdateWorker = null; final String[] titles = new String [] { FileViewer.getResourceString("table.Name.title"), FileViewer.getResourceString("table.Size.title"), FileViewer.getResourceString("table.Type.title"), FileViewer.getResourceString("table.Modified.title") }; final int[] widths = new int[] {150, 60, 75, 150}; /** * Creates the file details table. * * @param theViewer the viewer to attach to * @param parent the parent control * @param layoutData the layout data */ public TableView(FileViewer theViewer, Composite parent, Object layoutData) { this.viewer = theViewer; shell = parent.getShell(); display = shell.getDisplay(); Composite composite = new Composite(parent, SWT.NONE); composite.setLayoutData(layoutData); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 1; gridLayout.marginHeight = gridLayout.marginWidth = 2; gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0; composite.setLayout(gridLayout); contentsOfLabel = new Label(composite, SWT.BORDER); contentsOfLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL)); table = new Table(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI); table.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL)); for (int i = 0; i < titles.length; i++) { TableColumn column = new TableColumn(table, SWT.NONE); column.setText(titles [i]); column.setWidth(widths [i]); } table.setHeaderVisible(true); table.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { viewer.notifySelectedFiles(getSelectedFiles()); } public void widgetDefaultSelected(SelectionEvent event) { viewer.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); tableUpdateWorker = new TableUpdateWorker(); } /** * Dispose of allocated resources and shut down. */ public void dispose() { tableUpdateWorker.syncStop(); } /** * Updates the table with file information in the background. * <p> * It is designed such that it can be interrupted cleanly. Rather than put all the code * to manage this here, the balance has been pushed out to UpdateWorker so it can be re-used. * </p> */ private class TableUpdateWorker extends UpdateWorker { private File currentDir = null; private File[] currentFiles = null; private File[] currentDirList = null; public TableUpdateWorker() { super(TableView.this.display); } /** * Updates the table's contents * * @param data arguments in an Object[] * <ul> * <li>File data[0] dir the current directory, null does nothing * <li>File[] data[1] the list of files to select, null does nothing * <li>Boolean data[2] if true, forces a refresh * </ul> */ protected void execute(Object data) { // Get arguments final Object[] args = (Object[]) data; final File argDir = (File) args[0]; final File[] argFiles = (File[]) args[1]; final boolean argForce = ((Boolean) args[2]).booleanValue(); // Update current state if (argDir != null) currentDir = argDir; if (argFiles != null) currentFiles = argFiles; else if (argDir != null) currentFiles = new File[0]; // Perform necessary refreshing if (argDir != null) updateDirectoryListing(); else if (argFiles != null) updateFileSelection(); if (isCancelled()) { currentFiles = null; currentDir = null; currentDirList = null; } } /* * Note the use of 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. */ /** * Updates directory list */ private void updateDirectoryListing() { // Clear existing information TableView.this.display.syncExec(new Runnable() { public void run() { viewer.clearDetails(); contentsOfLabel.setText(FileViewer.getResourceString("details.ContentsOf.text", new Object[] { currentDir.getPath() })); table.removeAll(); table.setRedraw(false); TableView.this.activeDir = currentDir; // synchronize this } }); currentDirList = FileViewer.getDirectoryList(currentDir); updateDetails(); for (int i = 0; (! isCancelled()) && (i < currentDirList.length); i++) { final File theFile = currentDirList[i]; addFileDetails(currentDirList[i]); final boolean doIncrementalRefresh = ((i & 127) == 127); if (doIncrementalRefresh) TableView.this.display.syncExec(new Runnable() { public void run () { table.setRedraw(true); table.setRedraw(false); } }); } // Allow the table to refresh itself TableView.this.display.asyncExec(new Runnable() { public void run() { table.setRedraw(true); } }); } /** * Adds a file's detail information to the directory list */ private void addFileDetails(final File file) { final FileDisplayInfo displayInfo = viewer.getFileDisplayInfo(file); final String[] strings = new String[] { displayInfo.nameString, displayInfo.sizeString, displayInfo.typeString, displayInfo.dateString }; final Image image = displayInfo.iconImage; TableView.this.display.asyncExec(new Runnable() { public void run () { TableItem tableItem = new TableItem(table, 0); tableItem.setText(strings); tableItem.setImage(image); tableItem.setData(TABLEITEMDATA_FILE, file); } }); } /** * Updates the current file selection */ private void updateFileSelection() { updateDetails(); } /** * Updates the detail information */ private void updateDetails() { if (currentFiles.length == 0) { if (currentDir == null) return; final File folder = currentDir; final File[] files = currentDirList; // show directory information TableView.this.display.asyncExec(new Runnable() { public void run() { viewer.setFolderDetails(folder, files); } }); } else if (currentFiles.length == 1) { final File file = currentFiles[0]; // show individual file information TableView.this.display.asyncExec(new Runnable() { public void run() { viewer.setFileDetails(file); } }); } else { // show multi-selection file information final File[] files = currentFiles; TableView.this.display.asyncExec(new Runnable() { public void run() { viewer.setSelectionDetails(files); } }); } } } /** * 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 dragOver(DropTargetEvent event) { viewer.validateDrop(event, getTargetFile(event)); } public void drop(DropTargetEvent event) { viewer.performDrop(event, getTargetFile(event)); } private File getTargetFile(DropTargetEvent event) { // Determine the target File for the drop final TableItem item = table.getItem(table.toControl(new Point(event.x, event.y))); final File targetFile; if (item == null) { // We dropped on an unoccupied area of the table, use the table's root file targetFile = activeDir; } else { // We dropped on a particular item in the table, use the item's file targetFile = (File) item.getData(TABLEITEMDATA_FILE); } return targetFile; } }); return dropTarget; } /** * 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() { public void dragStart(DragSourceEvent e) { e.doit = table.getSelectionCount() > 0; } public void dragSetData(DragSourceEvent event){ if (! FileTransfer.getInstance().isSupportedType(event.dataType)) return; final TableItem[] tableDragItems = table.getSelection(); if (tableDragItems == null || tableDragItems.length == 0) return; final String[] data = new String[tableDragItems.length]; for (int i = 0; i < tableDragItems.length; i++) { File file = (File) tableDragItems[i].getData(TABLEITEMDATA_FILE); data[i] = file.getAbsolutePath(); } event.data = data; } public void dragFinished(DragSourceEvent event) { } }); return dragSource; } /** * Listens to selectedDirectory events. * <p> * Displays the contents in the selected directory. * </p> * * @param dir the directory that was selected, null is not permitted */ /* package */ void selectedDirectory(File dir) { tableUpdateWorker.asyncUpdate(new Object[] { dir, null, new Boolean(false) }); } /** * Listens to selectedFiles events. * <p> * Updates the details to match the specified selection. * </p> * * @param files the array of selected files, null is not permitted */ /* package */ void selectedFiles(File[] files) { tableUpdateWorker.asyncUpdate(new Object[] { null, files, new Boolean(false) }); } /** * Listens to refreshFiles events. * <p> * Refreshes information about any files in the list and their children. * </p> * * @param files the list of files to be refreshed, null refreshes everything */ /* package */ void refreshFiles(File[] files) { tableUpdateWorker.asyncUpdate(new Object[] { null, null, new Boolean(true) }); } } \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TreeExpandDropListener.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TreeExpandDropListener.java
deleted file mode 100755
index 32e3c20b4d..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TreeExpandDropListener.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.swt.examples.fileviewer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * TreeExpandDropListener provides automatic expansion for Trees during drag and drop
- * operations.
- * <p>
- * If the pointer hovers for a time over an item in the Tree that has not yet been
- * expanded, the item is expanded automatically. This behaviour is consistent with
- * that of popular GUI systems.
- * </p><p>
- * To use it send addDropListener(new TreeExpandDropListener(tree)) to the DropTarget
- * object attached to the Tree.
- * </p>
- */
-public class TreeExpandDropListener extends DropTargetAdapter {
- public static final long DEFAULT_EXPAND_DELAY = 1000; // millis
-
- private long hoverThreshhold = DEFAULT_EXPAND_DELAY;
- private long hoverBegin = 0;
- private TreeItem hoverItem = null;
- private Tree tree;
-
- /**
- * Constructs a Tree expanding Drop Listener
- *
- * @param tree the Tree that the DropTarget is attached to
- */
- public TreeExpandDropListener(final Tree tree) {
- this.tree = tree;
- }
-
- /**
- * Handles dragEnter events.
- * This is an implementation detail.
- */
- public void dragEnter(DropTargetEvent event) {
- hoverItem = null;
- }
-
- /**
- * Handles dragOver events.
- * This is an implementation detail.
- */
- public void dragOver(DropTargetEvent event) {
- Point point = tree.toControl(new Point(event.x, event.y));
-
- // Get the item directly under the point
- TreeItem item = tree.getItem(point);
- if (item != hoverItem) {
- // We just started hovering, remember this item
- if ((item != null) && (! item.getExpanded())) {
- hoverBegin = System.currentTimeMillis();
- hoverItem = item;
- } else {
- hoverItem = null;
- }
- } else if (hoverItem != null) {
- // We've been hovering for a while, expand if our timer elapsed
- long hoverCurrent = System.currentTimeMillis();
-
- if (hoverCurrent - hoverBegin >= hoverThreshhold) {
- // Fake as if the user expanded the item manually
- Event hoverEvent = new Event();
- hoverEvent.x = event.x;
- hoverEvent.y = event.y;
- hoverEvent.item = hoverItem;
- hoverEvent.time = (int) hoverCurrent;
- hoverItem.setExpanded(true);
- hoverItem = null;
- tree.notifyListeners(SWT.Expand, hoverEvent);
- }
- }
- }
-} \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TreeScrollDropListener.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TreeScrollDropListener.java
deleted file mode 100755
index 5c7c8d8ad7..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TreeScrollDropListener.java
+++ /dev/null
@@ -1 +0,0 @@
-package org.eclipse.swt.examples.fileviewer; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import org.eclipse.swt.dnd.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; /** * TreeScrollDropListener provides automatic scrolling for Trees during drag and drop * operations. * <p> * If the pointer drags over an item in the Tree near its upper or * lower edges, the Tree will scroll so as to make previous or successive items visible * onscreen. This behaviour is consistent with that of popular GUI systems. * </p><p> * To use it send addDropListener(new TreeScrollDropListener(tree)) to the DropTarget * object attached to the Tree. * </p> */ public class TreeScrollDropListener extends DropTargetAdapter { private Tree tree; /** * Constructs a Tree scrolling Drop Listener * * @param tree the Tree that the DropTarget is attached to */ public TreeScrollDropListener(final Tree tree) { this.tree = tree; } /** * Handles dragOver events. * This is an implementation detail. */ public void dragOver(DropTargetEvent event) { Point point = tree.toControl(new Point(event.x, event.y)); // Get the item directly under the point TreeItem item = tree.getItem(point); if (item == null) return; // Determine scroll direction according to whether we're nearer the top, middle, or bottom Rectangle clientArea = tree.getClientArea(); int scrollRegionSize = Math.min(clientArea.height / 3, 24); // cut region into 3 parts if (scrollRegionSize < 8) return; // don't scroll if the control is too small to make sense TreeItem showItem = item; for(;;) { if (point.y < clientArea.y + scrollRegionSize) { // in upper region showItem = getPreviousVisibleItem(tree, showItem); } else if (point.y > clientArea.height + clientArea.y - scrollRegionSize) { // in lower region showItem = getNextVisibleItem(tree, showItem, false); } else { // in middle region break; } // Show the item (causes a scroll if it is outside of the visible region) if (showItem == null) break; tree.showItem(showItem); // Test that we actually scrolled, if we didn't try again with the next item if (item != tree.getItem(point)) break; } } /** * Given a TreeItem, locates the previous (above the specified item) visible TreeItem in a tree. * <p> * Note that the item may not be actually rendered onscreen though it would be * visible were the control scrolled appropriately. * </p> * * @param tree the Tree containing the items * @param item the TreeItem whose previous visible neighbour is to be found * @return the previous visible item, or null if none. */ private TreeItem getPreviousVisibleItem(Tree tree, TreeItem item) { TreeItem parent = item.getParentItem(); TreeItem[] items = (parent != null) ? parent.getItems() : tree.getItems(); if (items != null) { for (int i = items.length - 1; i > 0; --i) { if (items[i] == item) return getLastVisibleChild(items[i - 1]); } } return parent; } /** * Given a TreeItem, locates the following (below the specified item) visible TreeItem in a tree. * <p> * Note that the item may not be actually rendered onscreen though it would be * visible were the control scrolled appropriately. * </p> * * @param tree the Tree containing the items * @param item the TreeItem whose next visible neighbour is to be found * @return the next visible item, or null if none. */ private TreeItem getNextVisibleItem(Tree tree, TreeItem item, boolean ignoreChildren) { TreeItem parent = item.getParentItem(); TreeItem[] items = (parent != null) ? parent.getItems() : tree.getItems(); if (items != null) { for (int i = 0; i < items.length; ++i) { if (items[i] == item) { if (! ignoreChildren && items[i].getExpanded()) { items = items[i].getItems(); if (items != null && items.length > 0) return items[0]; } if (i + 1 < items.length) return items[i + 1]; break; } } if (parent != null) return getNextVisibleItem(tree, parent, true); } return null; } /** * Given a TreeItem, locates its last (lowest) visible item * <p> * Note that the item may not be actually rendered onscreen though it would be * visible were the control scrolled appropriately. * </p> * * @param item the TreeItem whose last visible child is to be found * @return the last visible child, or <code>item</code> if no visible children. */ private TreeItem getLastVisibleChild(TreeItem item) { if (! item.getExpanded()) return item; TreeItem[] items = item.getItems(); if (items == null || items.length == 0) return item; return getLastVisibleChild(items[items.length - 1]); } } \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TreeView.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TreeView.java
deleted file mode 100755
index ee7a09ae91..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/TreeView.java
+++ /dev/null
@@ -1 +0,0 @@
-package org.eclipse.swt.examples.fileviewer; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import org.eclipse.swt.*; import org.eclipse.swt.dnd.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; import java.io.*; import java.util.*; /** * A directory tree */ class TreeView { private static final String TREEITEMDATA_FILE = "TreeItem.file", // File: File associated with tree item TREEITEMDATA_IMAGEEXPANDED = "TreeItem.imageExpanded", // Image: shown when item is expanded TREEITEMDATA_IMAGECOLLAPSED = "TreeItem.imageCollapsed", // Image: shown when item is collapsed TREEITEMDATA_STUB = "TreeItem.stub"; // Object: if not present or null then the item has not been populated private final Tree tree; private final Label scopeLabel; private final Shell shell; private final Display display; private final FileViewer viewer; /** * Creates the file tree table. * * @param theViewer the viewer to attach to * @param parent the parent control * @param layoutData the layout data */ public TreeView(FileViewer theViewer, Composite parent, Object layoutData) { this.viewer = theViewer; shell = parent.getShell(); display = shell.getDisplay(); Composite composite = new Composite(parent, SWT.NONE); composite.setLayoutData(layoutData); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 1; gridLayout.marginHeight = gridLayout.marginWidth = 2; gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0; composite.setLayout(gridLayout); scopeLabel = new Label(composite, SWT.BORDER); scopeLabel.setText(FileViewer.getResourceString("details.AllFolders.text")); scopeLabel.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); viewer.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); expandTreeItem(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); expandTreeItem(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() { public void dragStart(DragSourceEvent event){ event.doit = tree.getSelectionCount() > 0; } public void dragFinished(DragSourceEvent event){ } public void dragSetData(DragSourceEvent event){ if (! FileTransfer.getInstance().isSupportedType(event.dataType)) return; final TreeItem[] treeDragItems = tree.getSelection(); if (treeDragItems == null || treeDragItems.length == 0) return; final String[] data = new String[treeDragItems.length]; for (int i = 0; i < treeDragItems.length; i++) { File file = (File) treeDragItems[i].getData(TREEITEMDATA_FILE); data[i] = file.getAbsolutePath(); } event.data = data; } }); 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 TreeScrollDropListener(tree)); dropTarget.addDropListener(new TreeExpandDropListener(tree)); dropTarget.addDropListener(new DropTargetAdapter() { public void dragOver(DropTargetEvent event) { viewer.validateDrop(event, getTargetFile(event)); } public void drop(DropTargetEvent event) { viewer.performDrop(event, getTargetFile(event)); } private File getTargetFile(DropTargetEvent event) { // Determine the target File for the drop final TreeItem item = tree.getItem(tree.toControl(new Point(event.x, event.y))); final File targetFile; if (item == null) { // We dropped on an unoccupied area of the tree, we have no recourse. Quit. targetFile = null; } else { // We dropped on 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 expandTreeItem(TreeItem item) { final File file = (File) item.getData(TREEITEMDATA_FILE); final Object stub = item.getData(TREEITEMDATA_STUB); if (stub == null) refreshTreeItem(item, file); } /** * Populates an item in the tree with a complete directory listing. * * @param item the TreeItem to fill in * @param file the directory to use */ private void refreshTreeItem(TreeItem item, File file) { /* Get directory listing */ shell.setCursor(IconCache.stockCursors[IconCache.cursorWait]); File[] subFiles = null; if (file != null) { subFiles = FileViewer.getDirectoryList(file); } /* Eliminate any existing (possibly placeholder) children */ final TreeItem[] oldChildren = item.getItems(); for (int i = 0; i < oldChildren.length; ++i) { oldChildren[i].dispose(); } if (subFiles != null && subFiles.length > 0) { /* Add subdirectory entries */ for (int i = 0; i < subFiles.length; ++i) { final File folder = subFiles[i]; if (! folder.isDirectory()) continue; // add the directory to the tree TreeItem newItem = new TreeItem(item, SWT.NULL); initTreeItemFolder(newItem, folder); // add a placeholder child item so we get the "expand" button TreeItem placeholderItem = new TreeItem(newItem, SWT.NULL); } } else { /* Error or nothing found -- collapse the item */ item.setExpanded(false); } // Clear stub flag item.setData(TREEITEMDATA_STUB, this); shell.setCursor(IconCache.stockCursors[IconCache.cursorDefault]); } /** * Listens to selectedDirectory events. * <p> * If not already expanded, recursively expands the parents of the specified * directory until it is visible. * </p> * * @param dir the directory that was selected, null is not permitted */ /* package */ void selectedDirectory(File dir) { 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); TreeItem item = searchItems(items, pathElement); if (item == null) break; lastItem = item; if (i != 0 && !item.getExpanded()) { item.setExpanded(true); expandTreeItem(item); } items = item.getItems(); } tree.setSelection((lastItem != null) ? new TreeItem[] { lastItem } : new TreeItem[0]); } private TreeItem searchItems(TreeItem[] items, File element) { // No guarantee that the items are sorted, so we'll just sequential scan // shouldn't be more than a couple hundred entries, anyway. for (int i = 0; i < items.length; ++i) { final TreeItem item = items[i]; if (item.isDisposed()) continue; final File itemFile = (File) item.getData(TREEITEMDATA_FILE); if (itemFile != null && itemFile.equals(element)) return item; } return null; } /** * Listens to refreshFiles events. * <p> * Refreshes information about any files in the list and their children. * </p> * * @param files the list of files to be refreshed, null refreshes everything */ /* package */ void refreshFiles(File[] files) { if (files == null) { File[] roots = viewer.getRoots(); tree.removeAll(); for (int i = 0; i < roots.length; ++i) { final File file = roots[i]; TreeItem item = new TreeItem(tree, SWT.NULL); initTreeItemVolume(item, file); // add a placeholder child item so we get the "expand" button TreeItem placeholderItem = new TreeItem(item, SWT.NULL); } } } /** * Initializes a volume item. * * @param item the TreeItem to initialize * @param volume the File associated with this TreeItem */ private void initTreeItemVolume(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]); } /** * Initializes a folder item. * * @param item the TreeItem to initialize * @param folder the File associated with this TreeItem */ private void initTreeItemFolder(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]); } } \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/UpdateWorker.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/UpdateWorker.java
deleted file mode 100755
index 7a03240f33..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/UpdateWorker.java
+++ /dev/null
@@ -1 +0,0 @@
-package org.eclipse.swt.examples.fileviewer; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import org.eclipse.swt.widgets.*; /** * Provides facilities for running worker threads that can be aborted and * restarted on the presence of new data. * * Cooperates appropriately with the SWT event queue. */ public abstract class UpdateWorker implements Runnable { private Display display; private volatile Thread thread; private volatile boolean stopped; private volatile boolean cancelled; private volatile Object newData, activeData; /** * Constructs an UpdateWorker * * @param display the SWT Display running the event queue */ public UpdateWorker(Display display) { this.display = display; this.newData = null; thread = new Thread(this); } /** * Stops the UpdateWorker and waits for it to terminate */ final public void syncStop() { synchronized(this) { cancelled = true; stopped = true; notifyAll(); } while (thread != null && display.readAndDispatch()) display.sleep(); } /** * Notifies the UpdateWorker that it should update itself with new data. * Cancels any previous operation and begins a new one. * * @param data the new data argument */ final public void asyncUpdate(Object newData) { synchronized(this) { this.newData = newData; stopped = false; cancelled = true; notifyAll(); } if (! thread.isAlive()) { stopped = false; thread.start(); } } /** * Notifies the UpdateWorker that it should quit what it is doing and start over * with the same data argument as before. */ final public void asyncRestart() { asyncUpdate(newData); } /** * Internal implementation Detail. */ final public void run() { while (! stopped) { try { synchronized(this) { cancelled = false; activeData = newData; } execute(activeData); synchronized(this) { if (! cancelled) wait(); } } catch (Throwable e) { e.printStackTrace(); } } thread = null; } /** * Determines if the current session has been cancelled due to new data or a syncStop(). * <p> * Subclass implementors should poll this and terminate processing as soon as possible. * </p> * @return true iff the current session has been cancelled */ final protected boolean isCancelled() { return cancelled; } /** * Gets the data argument for the current session * <p> * Subclass implementors should check this value if they don't want to remember the value * they received at execute() time. * </p> */ final protected Object getData() { return activeData; } /** * Executes an operation. * <p> * Subclass implementors must supply a definition for this method that performs the * desired cancellable operation. * </p> * @param data the data argument for the current session */ protected abstract void execute(Object data); } \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Copy.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Copy.gif
deleted file mode 100755
index 4274b070ac..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Copy.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Cut.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Cut.gif
deleted file mode 100755
index eb948b94b0..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Cut.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Delete.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Delete.gif
deleted file mode 100755
index 6f647666d3..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Delete.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Parent.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Parent.gif
deleted file mode 100755
index 9b278e6fa8..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Parent.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Paste.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Paste.gif
deleted file mode 100755
index 75e0ab2352..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Paste.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Print.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Print.gif
deleted file mode 100755
index 4dfa8cd3fa..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Print.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gif
deleted file mode 100755
index a063c230ac..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Rename.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Rename.gif
deleted file mode 100755
index 25b1325e52..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Rename.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Search.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Search.gif
deleted file mode 100755
index 6dc3ebefc9..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/cmd_Search.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/generic_example.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/generic_example.gif
deleted file mode 100755
index f9fb6b0cab..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/generic_example.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gif
deleted file mode 100755
index 04e530e37c..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gif
deleted file mode 100755
index beb6ed134c..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_File.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_File.gif
deleted file mode 100755
index 6b86d07978..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_File.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gif
deleted file mode 100755
index 7b2b6334ca..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gif
deleted file mode 100755
index a9c777343c..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld1.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld1.java
deleted file mode 100755
index 9126eaa3be..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld1.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-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 Shell (display);
- shell.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld2.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld2.java
deleted file mode 100755
index 6dfe3d07f4..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld2.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-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 Shell (display);
- Label label = new Label (shell, SWT.CENTER);
- label.setText (resHello.getString("Hello_world"));
- label.setBounds (shell.getClientArea ());
- shell.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld3.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld3.java
deleted file mode 100755
index acfa7c1f13..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld3.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-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 ();
- 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 ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld4.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld4.java
deleted file mode 100755
index 7c1b36d385..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld4.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-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 Shell (display);
- shell.setLayout(new FillLayout());
- Label label = new Label (shell, SWT.CENTER);
- label.setText (resHello.getString("Hello_world"));
- shell.pack ();
- shell.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld5.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld5.java
deleted file mode 100755
index 056054c772..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld5.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-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 ();
- 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.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- red.dispose();
- display.dispose ();
-}
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/HoverHelp.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/HoverHelp.java
deleted file mode 100755
index 82af776ea6..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/HoverHelp.java
+++ /dev/null
@@ -1,336 +0,0 @@
-package org.eclipse.swt.examples.hoverhelp;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
- 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) {
- resourceBundle = ResourceBundle.getBundle("examples_hoverhelp");
- new HoverHelp().open();
- }
-
- /**
- * Opens the main program.
- */
- public void open() {
- // Create the display
- Display display = new 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 (Throwable ex) {
- System.err.println(getResourceString("error.CouldNotLoadResources",
- new Object[] { ex.getMessage() }));
- display.dispose();
- return;
- }
-
- // Create the window
- Shell shell = new Shell();
- createPartControl(shell);
- shell.pack();
- shell.open();
-
- // Event loop
- while (! shell.isDisposed()) {
- if (! display.readAndDispatch()) display.sleep();
- }
-
- // Cleanup
- display.dispose();
-
- /* 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;
- }
- }
-
- /**
- * 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.NONE);
- 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/org/eclipse/swt/examples/hoverhelp/information.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/information.gif
deleted file mode 100755
index 26c7477336..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/information.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/warning.gif b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/warning.gif
deleted file mode 100755
index cf4fdf93c7..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/hoverhelp/warning.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
deleted file mode 100755
index 29d962c66c..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
+++ /dev/null
@@ -1,1858 +0,0 @@
-package org.eclipse.swt.examples.imageanalyzer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 java.util.*;
-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,
- screenSizeLabel, backgroundPixelLabel, locationLabel,
- disposalMethodLabel, delayTimeLabel, repeatCountLabel,
- paletteLabel, dataLabel, statusLabel;
- Combo backgroundCombo, scaleXCombo, scaleYCombo, alphaCombo;
- Button incrementalCheck, transparentCheck, maskCheck, backgroundCheck;
- Button previousButton, nextButton, animateButton;
- Text 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 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
-
- static final int ALPHA_CONSTANT = 0;
- static final int ALPHA_X = 1;
- static final int ALPHA_Y = 2;
-
- public static void main(String [] args) {
- ImageAnalyzer imageAnalyzer = new ImageAnalyzer();
- imageAnalyzer.open();
- }
-
- void open() {
- // Create a window and set its title.
- shell = new Shell();
- 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 event) {
- if (animate && animateThread != null) {
- // Stop the animation and wait for the
- // thread to die before disposing the shell.
- animate = false;
- while (animateThread.isAlive()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- }
- }
- });
-
- // Create colors and fonts.
- display = shell.getDisplay();
- 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.
- imageCanvasGC = new GC(imageCanvas);
-
- // Open the window, and run an event loop until the window is closed.
- shell.open();
- while (!shell.isDisposed())
- if (!display.readAndDispatch()) display.sleep();
-
- // Clean up.
- if (image != null)
- image.dispose();
- whiteColor.dispose();
- blackColor.dispose();
- redColor.dispose();
- greenColor.dispose();
- blueColor.dispose();
- fixedWidthFont.dispose();
- crossCursor.dispose();
- imageCanvasGC.dispose();
- }
-
- 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();
- }
- });
-
- // Separate the control widgets from the rest of the widgets.
-// Label separator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
-// gridData = new GridData();
-// gridData.horizontalSpan = 2;
-// gridData.horizontalAlignment = GridData.FILL;
-// separator.setLayoutData(gridData);
-
- // 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 = 14;
- 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));
-
- // 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 Text(shell, SWT.BORDER | SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL);
- 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...
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Open"));
- item.setAccelerator(SWT.CTRL + 'O');
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuOpen();
- }
- });
-
- // 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 -> Exit
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Exit"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- animate = false; // stop any animation in progress
- 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 menuOpen() {
- 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.
- imageDataArray = loader.load(filename);
- if (imageDataArray.length > 0) {
-
- // Cache the 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();
- }
- }
-
- /*
- * 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(null, 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) {
- 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);
- 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);
- 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 menuReopen() {
- if (fileName == 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();
- ImageData[] newImageData = loader.load(fileName);
- imageDataIndex = 0;
- displayImage(newImageData[imageDataIndex]);
-
- } catch (SWTException e) {
- showErrorDialog(bundle.getString("Reloading_lc"), fileName, 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);
- }
- // Fill the image canvas with the background color.
- Rectangle clientArea = imageCanvas.getClientArea();
- imageCanvasGC.fillRectangle(
- clientArea.x,
- clientArea.y,
- clientArea.width,
- clientArea.height);
- if (image != null) {
- imageCanvas.redraw();
- }
- }
-
- /*
- * 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.getCaretPosition();
- 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)),
- fileName, 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(null, 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(null, 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(null, newImageData);
- imageData = newImageData;
-
- } catch (SWTException e) {
- showErrorDialog(bundle.getString("Creating_from") + " ", fileName, e);
- image = null;
- return;
- }
-
- // Update the widgets with the new image info.
- String string = createMsg(bundle.getString("Analyzer_on"), fileName);
- 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("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);
-
- dataText.setText(dataHexDump(dataText.getLineDelimiter()));
- 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, SWTException e) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- String message = createMsg(bundle.getString("Error"), new String[] {operation, filename});
-
- String errorMessage = e.getMessage();
- if (e.throwable != null) {
- errorMessage += ":\n" + e.throwable.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/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java
deleted file mode 100755
index 35278148c6..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java
+++ /dev/null
@@ -1,367 +0,0 @@
-package org.eclipse.swt.examples.javaviewer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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; // single line comment: //
- 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 (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
- styles.addElement(new StyleRange(event.lineOffset, event.lineText.length(), colors[1], null));
- event.styles = new StyleRange[styles.size()];
- styles.copyInto(event.styles);
- return;
- }
- scanner.setRange(event.lineText);
- token = scanner.nextToken();
- while (token != EOF) {
- if (token == OTHER) {
- // do nothing
- } else if ((token == WHITE) && (!styles.isEmpty())) {
- int start = scanner.getStartOffset() + event.lineOffset;
- lastStyle = (StyleRange)styles.lastElement();
- if (lastStyle.fontStyle != SWT.NORMAL) {
- if (lastStyle.start + lastStyle.length == start) {
- // have the white space take on the style before it to minimize font style
- // changes
- lastStyle.length += scanner.getLength();
- }
- }
- } else {
- Color color = getColor(token);
- if (color != colors[0]) { // hardcoded default foreground color, black
- 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 {
- lastStyle = (StyleRange)styles.lastElement();
- if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
- lastStyle.length += style.length;
- } else {
- styles.addElement(style);
- }
- }
- }
- }
- 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/org/eclipse/swt/examples/javaviewer/JavaViewer.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/javaviewer/JavaViewer.java
deleted file mode 100755
index 80e2776b51..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/javaviewer/JavaViewer.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package org.eclipse.swt.examples.javaviewer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-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 implements DisposeListener {
- Shell shell;
- StyledText text;
- JavaLineStyler lineStyler = new JavaLineStyler();
- static ResourceBundle resources = ResourceBundle.getBundle("examples_javaviewer");
-
-public void close () {
- if (shell != null && !shell.isDisposed ())
- shell.dispose ();
- lineStyler.disposeColors();
-}
-public void widgetDisposed (DisposeEvent event) {
- text.removeLineStyleListener(lineStyler);
- text.removeDisposeListener(this);
-}
-
-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 () {
- shell = new Shell ();
- shell.setText (resources.getString("Window_title"));
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- shell.setSize(500, 400);
- shell.setLayout(layout);
-}
-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.addDisposeListener(this);
- 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) {
- JavaViewer example = new JavaViewer ();
- example.open ();
- example.run ();
- example.close ();
-}
-
-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 ();
-}
-
-public void open () {
- createShell ();
- createMenuBar ();
- createStyledText ();
- shell.open ();
-}
-
-public void run () {
- Display display = shell.getDisplay ();
- while (!shell.isDisposed ())
- if (!display.readAndDispatch ()) display.sleep ();
-}
-
-
-}
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/Images.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/Images.java
deleted file mode 100755
index a57ad25b53..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/Images.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.swt.examples.texteditor;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-public class Images {
-
- // Bitmap Images
- public static Image Bold;
- public static Image Red;
- public static Image Green;
- public static Image Blue;
- public static Image Erase;
-
- static Image [] AllBitmaps;
-
-public static void freeAll () {
- for (int i=0; i<AllBitmaps.length; i++) AllBitmaps [i].dispose ();
- AllBitmaps = null;
-}
-
-static 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 static 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/org/eclipse/swt/examples/texteditor/TextEditor.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/TextEditor.java
deleted file mode 100755
index b3455b6b32..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/TextEditor.java
+++ /dev/null
@@ -1,355 +0,0 @@
-package org.eclipse.swt.examples.texteditor;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-
- 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");
-
-/*
- * Free the allocated resources.
- */
-public void close () {
- if (shell != null && !shell.isDisposed ())
- shell.dispose ();
- if (font != null) font.dispose();
- Images.freeAll ();
- RED.dispose();
- GREEN.dispose();
- BLUE.dispose();
-}
-
-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;
-}
-/*
- * 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 () {
- shell = new Shell ();
- shell.setText (resources.getString("Window_title"));
- Images.loadAll (shell.getDisplay ());
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- shell.setSize(500, 300);
- shell.setLayout(layout);
-}
-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) {
- TextEditor example = new TextEditor ();
- example.open ();
- example.run ();
- example.close ();
-}
-
-void open () {
- createShell ();
- createMenuBar ();
- createToolBar ();
- createStyledText ();
- shell.open ();
-}
-
-void run () {
- Display display = shell.getDisplay ();
- while (!shell.isDisposed ())
- if (!display.readAndDispatch ()) display.sleep ();
-}
-
-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/org/eclipse/swt/examples/texteditor/blue.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/blue.bmp
deleted file mode 100755
index 84c7ac9a46..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/blue.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/blue_mask.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/blue_mask.bmp
deleted file mode 100755
index 6ce92645e5..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/blue_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/bold.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/bold.bmp
deleted file mode 100755
index a3184bb26c..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/bold.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/bold_mask.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/bold_mask.bmp
deleted file mode 100755
index 382751efa3..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/bold_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/erase.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/erase.bmp
deleted file mode 100755
index 1d2ace7ee3..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/erase.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/erase_mask.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/erase_mask.bmp
deleted file mode 100755
index f6ab21e471..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/erase_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/green.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/green.bmp
deleted file mode 100755
index cca023fd57..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/green.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/green_mask.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/green_mask.bmp
deleted file mode 100755
index 6ce92645e5..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/green_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/red.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/red.bmp
deleted file mode 100755
index 88c63be336..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/red.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/red_mask.bmp b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/red_mask.bmp
deleted file mode 100755
index 6ce92645e5..0000000000
--- a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/texteditor/red_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/plugin.jars b/examples/org.eclipse.swt.examples/plugin.jars
deleted file mode 100755
index bf99fbba4b..0000000000
--- a/examples/org.eclipse.swt.examples/plugin.jars
+++ /dev/null
@@ -1,2 +0,0 @@
-swtexamples.jar=\
- Eclipse SWT Examples \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/plugin.properties b/examples/org.eclipse.swt.examples/plugin.properties
deleted file mode 100755
index c1c22b6776..0000000000
--- a/examples/org.eclipse.swt.examples/plugin.properties
+++ /dev/null
@@ -1,101 +0,0 @@
-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.\n\n\
- These examples may take a moment to start while a new runtime environment \
- is created in the background.
-
-launchitem.AddressBook.name = Address Book
-launchitem.AddressBook.description = \
- The AddressBook example shows how the org.eclipse.swt.Table class can be used to \
- present tabular information.\n\n\
- The application can save and load address books, sort the entries, search for strings within \
- the fields and perform other operations that would typically be found in this kind of application.
-
-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 browse files and folders and manipulate via Drag & 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. \
- Notice that images appear in the left-hand corner of the tooltip, unlike standard SWT tooltips \
- created using setToolTip() on those widgets that natively support them.\n\n\
- To see the custom hover help in action, hover over an item or button in the UI as before until \
- the tooltip is displayed. Without moving the pointer, 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 the minimum amount of code required to open an SWT Shell and \
- process the events.
-
-launchitem.HelloWorld2.name = Hello World (2)
-launchitem.HelloWorld2.description = \
- 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.
-
-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.
-
-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.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 File 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 13bf6d0860..0000000000
--- a/examples/org.eclipse.swt.examples/plugin.xml
+++ /dev/null
@@ -1,150 +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="0.9"
- provider-name="Object Technology International, Inc."
- class="">
-<!-- Required plugins -->
-<requires>
- <import plugin="org.eclipse.swt"/>
-</requires>
-
-<!-- Runtime -->
-<runtime>
- <library name="swtexamples.jar"/>
-</runtime>
-
-<!-- Extension points -->
-<!-- Extensions -->
-<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"/>
- <source
- zip="swtexamplessrc.zip"/>
- </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"/>
- <source
- zip="swtexamplessrc.zip"/>
- </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"/>
- <source
- zip="swtexamplessrc.zip"/>
- </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"/>
- <source
- zip="swtexamplessrc.zip"/>
- </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"/>
- <source
- zip="swtexamplessrc.zip"/>
- </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"/>
- <source
- zip="swtexamplessrc.zip"/>
- </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"/>
- <source
- zip="swtexamplessrc.zip"/>
- </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"/>
- <source
- zip="swtexamplessrc.zip"/>
- </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"/>
- <source
- zip="swtexamplessrc.zip"/>
- </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"/>
- <source
- zip="swtexamplessrc.zip"/>
- </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"/>
- <source
- zip="swtexamplessrc.zip"/>
- </item>
-</extension>
-</plugin>
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 8b72c7fda8..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/AddressBook.java
+++ /dev/null
@@ -1,908 +0,0 @@
-package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/* Imports */
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.io.*;
-import java.util.zip.*;
-import java.util.ResourceBundle;
-
-/**
- * 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 = ",";
- 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) {
- AddressBook application = new AddressBook();
- application.open();
- application.run();
-}
-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;
-}
-/**
- * Merges two arrays (assumed to be individually sorted) of string arrays into
- * one sorted array by the value stored at the columnIndex parameter. This method
- * is used in <code>mergeSort(String[][] tableItems, int columnIndex)</code>.
- *
- * @param firstHalf String[][]
- * The first array of Strings to be merged.
- * @param secondHalf String[][]
- * The second array of Strings to be merged.
- * @param columnIndex int
- * The column by which the String arrays will be compared.
- * @return String[][]
- * An array of array of String that is the merged (and sorted) combination
- * of the two parameter arrays.
- */
-private String[][] merge(String[][] firstHalf, String[][] secondHalf, int column) {
- int x = firstHalf.length + secondHalf.length;
- int y = Math.max(firstHalf[0].length, secondHalf[0].length);
- String[][] sorted = new String[x][y];
-
- int firstHalfIndex = 0;
- int secondHalfIndex = 0;
- int sortedIndex = 0;
-
- //merge
- while(firstHalfIndex < firstHalf.length && secondHalfIndex < secondHalf.length) {
- if(firstHalf[firstHalfIndex][column].compareToIgnoreCase(secondHalf[secondHalfIndex][column]) <= 0 ) {
- sorted[sortedIndex] = firstHalf[firstHalfIndex];
- sortedIndex++;
- firstHalfIndex++;
- } else {
- sorted[sortedIndex] = secondHalf[secondHalfIndex];
- sortedIndex++;
- secondHalfIndex++;
- }
- }
-
- //copy remaining items into sorted.
- while(firstHalfIndex < firstHalf.length) {
- sorted[sortedIndex] = firstHalf[firstHalfIndex];
- sortedIndex++;
- firstHalfIndex++;
- }
-
- while(secondHalfIndex < secondHalf.length) {
- sorted[sortedIndex] = secondHalf[secondHalfIndex];
- sortedIndex++;
- secondHalfIndex++;
- }
-
- return sorted;
-}
-/**
- * Takes an array of array of Strings and sorts them into ascending order according to the
- * data in the column specified. Note that this sort is recursive.
- *
- * @param tableItems String[][]
- * The array of Strings that will be sorted.
- * @param columnIndex int
- * The column in the String arrays by which the arrays will be compared.
- * @return String[][]
- * The resultant sorted version of the tableItems parameter.
- * @see #merge(String[][] firstHalf, String[][] secondHalf, int columnIndex)
- */
-private String[][] mergeSort(String[][] items, int column) {
- int numItems = items.length;
-
- if(numItems <= 1) return items;
-
- int split = numItems / 2;
- String[][] firstHalf = new String[split][items[0].length];
- String[][] secondHalf = new String[numItems - split][items[0].length];
- for(int i = 0; i < firstHalf.length; i++) {
- firstHalf[i] = items[i];
- }
- for(int i = 0; i < secondHalf.length; i++) {
- secondHalf[i] = items[split + i];
- }
-
- String[][] firstHalfSorted = mergeSort(firstHalf, column);
- String[][] secondHalfSorted = mergeSort(secondHalf, column);
- String[][] sortedItems = merge(firstHalfSorted, secondHalfSorted, column);
-
- return sortedItems;
-}
-private void newAddressBook() {
- shell.setText(resAddressBook.getString("Title_bar") + resAddressBook.getString("New_title"));
- 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 open() {
- Display display = new 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 widgetDoubleSelected(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();
-}
-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]);
- }
- tableInfo = mergeSort(tableInfo, 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 void run() {
- //read and dispatch until termination
- Display display = shell.getDisplay();
- while(!shell.isDisposed()){
- if(!display.readAndDispatch())
- display.sleep();
- }
-}
-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);
- }
- }
-
- data = mergeSort(data, 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();
- }
- });
-}
-}
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 35e0425bff..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/DataEntryDialog.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/* 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 88d70e4791..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/FindListener.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 e110e5ceb3..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/SearchDialog.java
+++ /dev/null
@@ -1,196 +0,0 @@
-package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/* 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"));
-
- 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 10a96c039b..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/AlignableTab.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 "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 (resControls.getString("Alignment"));
-
- /* Create the controls */
- leftButton = new Button (allignmentGroup, SWT.RADIO);
- leftButton.setText (resControls.getString("Left"));
- centerButton = new Button (allignmentGroup, SWT.RADIO);
- centerButton.setText(resControls.getString("Center"));
- rightButton = new Button (allignmentGroup, SWT.RADIO);
- rightButton.setText (resControls.getString("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 0b3697b400..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ButtonTab.java
+++ /dev/null
@@ -1,175 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-/**
-* Creates the "Control" group.
-*/
-void createControlGroup () {
- super.createControlGroup ();
-
- /* Create the controls */
- upButton = new Button (allignmentGroup, SWT.RADIO);
- upButton.setText (resControls.getString("Up"));
- downButton = new Button (allignmentGroup, SWT.RADIO);
- downButton.setText (resControls.getString("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 (resControls.getString("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 (resControls.getString("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 (borderButton.getSelection()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- button1 = new Button(textButtonGroup, style);
- button1.setText(resControls.getString("One"));
- button2 = new Button(textButtonGroup, style);
- button2.setText(resControls.getString("Two"));
- button3 = new Button(textButtonGroup, style);
- button3.setText(resControls.getString("Three"));
- button4 = new Button(imageButtonGroup, style);
- button4.setImage(Images.CLOSED_FOLDER_IMAGE);
- button5 = new Button(imageButtonGroup, style);
- button5.setImage(Images.OPEN_FOLDER_IMAGE);
- button6 = new Button(imageButtonGroup, style);
- button6.setImage(Images.TARGET_IMAGE);
-}
-/**
-* Creates the "Style" group.
-*/
-void createStyleGroup() {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- pushButton = new Button (styleGroup, SWT.RADIO);
- pushButton.setText(resControls.getString("SWT_PUSH"));
- checkButton = new Button (styleGroup, SWT.RADIO);
- checkButton.setText (resControls.getString("SWT_CHECK"));
- radioButton = new Button (styleGroup, SWT.RADIO);
- radioButton.setText (resControls.getString("SWT_RADIO"));
- toggleButton = new Button (styleGroup, SWT.RADIO);
- toggleButton.setText (resControls.getString("SWT_TOGGLE"));
- arrowButton = new Button (styleGroup, SWT.RADIO);
- arrowButton.setText (resControls.getString("SWT_ARROW"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (resControls.getString("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 resControls.getString("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);
- 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 9b4f5fdade..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ComboTab.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 = {resControls.getString("ListData0_0"),
- resControls.getString("ListData0_1"),
- resControls.getString("ListData0_2"),
- resControls.getString("ListData0_3"),
- resControls.getString("ListData0_4"),
- resControls.getString("ListData0_5"),
- resControls.getString("ListData0_6"),
- resControls.getString("ListData0_7"),
- resControls.getString("ListData0_8")};
-/**
-* 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 (resControls.getString("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 (resControls.getString("SWT_DROP_DOWN"));
- simpleButton = new Button (styleGroup, SWT.RADIO);
- simpleButton.setText(resControls.getString("SWT_SIMPLE"));
- readOnlyButton = new Button (styleGroup, SWT.CHECK);
- readOnlyButton.setText (resControls.getString("SWT_READ_ONLY"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (resControls.getString("SWT_BORDER"));
-}
-/**
-* Gets the "Example" widget children.
-*/
-Control [] getExampleWidgets () {
- return new Control [] {combo1};
-}
-/**
-* Gets the text for the tab folder item.
-*/
-String getTabText () {
- return resControls.getString("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 88e477f0ad..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import java.util.ResourceBundle;
-
-/**
-* <code>ControlExample</code> is a simple demonstration
-* of the controls defined by SWT. It consists of a shell
-* and tab folder where each tab in the folder allows the
-* user to interact with a control.
-*/
-
-public class ControlExample {
- Shell shell;
- TabFolder tabFolder;
- ResourceBundle resControls = ResourceBundle.getBundle("examples_control");
-/**
-* Create a new example and open it.
-*
-* @param args the command line arguments
-*
-*/
-public static void main (String[] args) {
- new ControlExample ().open ();
-}
-/**
-* Open the example.
-*/
-void open () {
-
- /* Load resources */
- Images.loadImages ();
-
- /* Create the shell */
- shell = new Shell ();
- shell.setText (resControls.getString("Control_Example"));
- shell.addControlListener (new ControlAdapter () {
- public void controlResized (ControlEvent e) {
- tabFolder.setBounds (shell.getClientArea ());
- }
- });
-
- /* Create the tab folder */
- ShellTab shellTab = new ShellTab ();
- tabFolder = new TabFolder (shell, SWT.NULL);
- Tab [] tabs = new Tab [] {
- new ButtonTab (),
- new ComboTab (),
- new DialogTab (),
- new LabelTab (),
- new ListTab (),
- new ProgressBarTab (),
- new SashTab (),
- shellTab,
- new SliderTab (),
- new TableTab (),
- new TextTab (),
- new ToolBarTab (),
- new TreeTab (),
- };
- 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));
- }
-
- /* Run the event loop */
- shell.open ();
- Display display = Display.getDefault ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
-
- /*
- * 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.
- */
- shellTab.closeAllShells ();
-
- /* Free resources */
- Images.freeImages ();
-}
-}
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 76a56e521e..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/DialogTab.java
+++ /dev/null
@@ -1,417 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 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 = {resControls.getString("FilterName_0"),
- resControls.getString("FilterName_1"),
- resControls.getString("FilterName_2")};
-
-/**
-* 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 (resControls.getString("ColorDialog"))) {
- ColorDialog dialog = new ColorDialog (shell ,style);
- dialog.setRGB (new RGB (100, 100, 100));
- dialog.setText (resControls.getString("Title"));
- RGB result = dialog.open ();
- textWidget.append (resControls.getString("ColorDialog") + Text.DELIMITER);
- textWidget.append (resControls.getString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals (resControls.getString("DirectoryDialog"))) {
- DirectoryDialog dialog = new DirectoryDialog (shell, style);
- dialog.setMessage (resControls.getString("Example_string"));
- dialog.setText (resControls.getString("Title"));
- String result = dialog.open ();
- textWidget.append (resControls.getString("DirectoryDialog") + Text.DELIMITER);
- textWidget.append (resControls.getString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals (resControls.getString("FileDialog"))) {
- FileDialog dialog = new FileDialog (shell, style);
- dialog.setFileName (resControls.getString("readme_txt"));
- dialog.setFilterNames (FilterNames);
- dialog.setFilterExtensions (FilterExtensions);
- dialog.setText (resControls.getString("Title"));
- String result = dialog.open();
- textWidget.append (resControls.getString("FileDialog") + Text.DELIMITER);
- textWidget.append (resControls.getString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals (resControls.getString("FontDialog"))) {
- FontDialog dialog = new FontDialog (shell, style);
- dialog.setText (resControls.getString("Title"));
- FontData result = dialog.open ();
- textWidget.append (resControls.getString("FontDialog") + Text.DELIMITER);
- textWidget.append (resControls.getString("Result") + " " + result + Text.DELIMITER + Text.DELIMITER);
- return;
- }
-
- if (name.equals(resControls.getString("MessageBox"))) {
- MessageBox dialog = new MessageBox (shell, style);
- dialog.setMessage (resControls.getString("Example_string"));
- dialog.setText (resControls.getString("Title"));
- int result = dialog.open ();
- textWidget.append (resControls.getString("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 (resControls.getString("Result") + resControls.getString("SWT_OK"));
- break;
- case SWT.YES:
- textWidget.append (resControls.getString("Result") + resControls.getString("SWT_YES"));
- break;
- case SWT.NO:
- textWidget.append (resControls.getString("Result") + resControls.getString("SWT_NO"));
- break;
- case SWT.CANCEL:
- textWidget.append (resControls.getString("Result") + resControls.getString("SWT_CANCEL"));
- break;
- case SWT.ABORT:
- textWidget.append (resControls.getString("Result") + resControls.getString("SWT_ABORT"));
- break;
- case SWT.RETRY:
- textWidget.append (resControls.getString("Result") + resControls.getString("SWT_RETRY"));
- break;
- case SWT.IGNORE:
- textWidget.append (resControls.getString("Result") + resControls.getString("SWT_IGNORE"));
- break;
- default:
- textWidget.append(resControls.getString("Result") + 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 (resControls.getString("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 (resControls.getString("Dialog_Type"));
-}
-/**
-* Creates the "Control" widget children.
-*/
-void createControlWidgets () {
-
- /* Create the combo */
- String [] strings = {
- resControls.getString("ColorDialog"),
- resControls.getString("DirectoryDialog"),
- resControls.getString("FileDialog"),
- resControls.getString("FontDialog"),
- resControls.getString("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 (resControls.getString("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 (resControls.getString("Button_Styles"));
-
- /* Create the button style buttons */
- okButton = new Button (buttonStyleGroup, SWT.CHECK);
- okButton.setText (resControls.getString("SWT_OK"));
- cancelButton = new Button (buttonStyleGroup, SWT.CHECK);
- cancelButton.setText (resControls.getString("SWT_CANCEL"));
- yesButton = new Button (buttonStyleGroup, SWT.CHECK);
- yesButton.setText (resControls.getString("SWT_YES"));
- noButton = new Button (buttonStyleGroup, SWT.CHECK);
- noButton.setText (resControls.getString("SWT_NO"));
- retryButton = new Button (buttonStyleGroup, SWT.CHECK);
- retryButton.setText (resControls.getString("SWT_RETRY"));
- abortButton = new Button (buttonStyleGroup, SWT.CHECK);
- abortButton.setText (resControls.getString("SWT_ABORT"));
- ignoreButton = new Button (buttonStyleGroup, SWT.CHECK);
- ignoreButton.setText (resControls.getString("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 (resControls.getString("Icon_Styles"));
-
- /* Create the icon style buttons */
- iconErrorButton = new Button (iconStyleGroup, SWT.RADIO);
- iconErrorButton.setText (resControls.getString("SWT_ICON_ERROR"));
- iconInformationButton = new Button (iconStyleGroup, SWT.RADIO);
- iconInformationButton.setText (resControls.getString("SWT_ICON_INFORMATION"));
- iconQuestionButton = new Button (iconStyleGroup, SWT.RADIO);
- iconQuestionButton.setText (resControls.getString("SWT_ICON_QUESTION"));
- iconWarningButton = new Button (iconStyleGroup, SWT.RADIO);
- iconWarningButton.setText (resControls.getString("SWT_ICON_WARNING"));
- iconWorkingButton = new Button (iconStyleGroup, SWT.RADIO);
- iconWorkingButton.setText (resControls.getString("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 (resControls.getString("Modal_Styles"));
-
- /* Create the modal style buttons */
- modelessButton = new Button (modalStyleGroup, SWT.RADIO);
- modelessButton.setText (resControls.getString("SWT_MODELESS"));
- primaryModalButton = new Button (modalStyleGroup, SWT.RADIO);
- primaryModalButton.setText (resControls.getString("SWT_PRIMARY_MODAL"));
- applicationModalButton = new Button (modalStyleGroup, SWT.RADIO);
- applicationModalButton.setText (resControls.getString("SWT_APPLICATION_MODAL"));
- systemModalButton = new Button (modalStyleGroup, SWT.RADIO);
- systemModalButton.setText (resControls.getString("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 (resControls.getString("File_Dialog_Styles"));
-
- /* Create the file dialog style buttons */
- saveButton = new Button (fileDialogStyleGroup, SWT.RADIO);
- saveButton.setText (resControls.getString("SWT_SAVE"));
- openButton = new Button(fileDialogStyleGroup, SWT.RADIO);
- openButton.setText(resControls.getString("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.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- resultGroup.setText (resControls.getString("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.widthHint = 300;
- gridData.heightHint = 400;
- 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 (resControls.getString("MessageBox"));
- boolean isFileDialog = name.equals (resControls.getString("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 resControls.getString("Dialog");
-}
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Images.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Images.java
deleted file mode 100755
index 5c536330d4..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Images.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import java.util.ResourceBundle;
-
-/**
-* <code>Images</code> contains every image
-* that is used by the example.
-*/
-class Images {
- static Image CLOSED_FOLDER_IMAGE;
- static Image OPEN_FOLDER_IMAGE;
- static Image TARGET_IMAGE;
- private static ResourceBundle resControl = ResourceBundle.getBundle("examples_control");
-/**
-* Free the images.
-*/
-public static void freeImages () {
- CLOSED_FOLDER_IMAGE.dispose ();
- OPEN_FOLDER_IMAGE.dispose ();
- TARGET_IMAGE.dispose ();
-}
-/**
- * Load the images.
- */
-public static void loadImages () {
- Class clazz = Images.class;
- try {
- ImageData source = new ImageData(clazz.getResourceAsStream ("folder.gif"));
- ImageData mask = source.getTransparencyMask();
- CLOSED_FOLDER_IMAGE = new Image (null, source, mask);
-
- source = new ImageData(clazz.getResourceAsStream ("folderOpen.gif"));
- mask = source.getTransparencyMask();
- OPEN_FOLDER_IMAGE = new Image (null, source, mask);
-
- source = new ImageData(clazz.getResourceAsStream ("stop.gif"));
- mask = source.getTransparencyMask();
- TARGET_IMAGE = new Image (null, source, mask);
- } catch (Throwable ex) {
- System.out.println (resControl.getString("Images_failed"));
- }
-}
-}
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 3a79520f65..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/LabelTab.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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, horizontalButton, verticalButton, shadowInButton, shadowOutButton;
-/**
-* 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 (resControls.getString("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 (resControls.getString("Image_Labels"));
-}
-/**
-* Creates the "Example" widgets.
-*/
-void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (separatorButton.getSelection ()) style |= SWT.SEPARATOR;
- 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(resControls.getString("One"));
- label2 = new Label (textLabelGroup, style);
- label2.setText(resControls.getString("Two"));
- label3 = new Label (textLabelGroup, style);
- label3.setText (resControls.getString("Three"));
- label4 = new Label (imageLabelGroup, style);
- label4.setImage (Images.CLOSED_FOLDER_IMAGE);
- label5 = new Label (imageLabelGroup, style);
- label5.setImage (Images.OPEN_FOLDER_IMAGE);
- label6 = new Label(imageLabelGroup, style);
- label6.setImage (Images.TARGET_IMAGE);
-}
-/**
-* Creates the "Style" group.
-*/
-void createStyleGroup() {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- separatorButton = new Button (styleGroup, SWT.CHECK);
- separatorButton.setText (resControls.getString("SWT_SEPARATOR"));
- horizontalButton = new Button (styleGroup, SWT.RADIO);
- horizontalButton.setText (resControls.getString("SWT_HORIZONTAL"));
- verticalButton = new Button (styleGroup, SWT.RADIO);
- verticalButton.setText (resControls.getString("SWT_VERTICAL"));
- Group styleSubGroup = new Group (styleGroup, SWT.NULL);
- styleSubGroup.setLayout (new GridLayout ());
- shadowInButton = new Button (styleSubGroup, SWT.RADIO);
- shadowInButton.setText (resControls.getString("SWT_SHADOW_IN"));
- shadowOutButton = new Button (styleSubGroup, SWT.RADIO);
- shadowOutButton.setText (resControls.getString("SWT_SHADOW_OUT"));
- borderButton = new Button(styleGroup, SWT.CHECK);
- borderButton.setText(resControls.getString("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 resControls.getString("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;
- 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 (isSeparator && (label1.getStyle () & SWT.SHADOW_OUT) != 0);
- 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 a9f53e1e45..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ListTab.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 = {resControls.getString("ListData1_0"),
- resControls.getString("ListData1_1"),
- resControls.getString("ListData1_2"),
- resControls.getString("ListData1_3"),
- resControls.getString("ListData1_4"),
- resControls.getString("ListData1_5"),
- resControls.getString("ListData1_6"),
- resControls.getString("ListData1_7"),
- resControls.getString("ListData1_8")};
-
-/**
-* 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 (resControls.getString("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 resControls.getString("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 e73b035805..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ProgressBarTab.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 "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 (resControls.getString("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 (resControls.getString("SWT_SMOOTH"));
-}
-/**
-* Gets the "Example" widget children.
-*/
-Control [] getExampleWidgets () {
- return new Control [] {progressBar1};
-}
-/**
-* Gets the text for the tab folder item.
-*/
-String getTabText () {
- return resControls.getString("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 ());
-}
-/**
-* Sets the minimim of the "Example" widgets.
-*/
-void setWidgetMinimum () {
- progressBar1.setMinimum (minimumScale.getSelection ());
-}
-/**
-* Sets the selection of the "Example" widgets.
-*/
-void setWidgetSelection () {
- progressBar1.setSelection (selectionScale.getSelection ());
-}
-}
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 4645a9f8b8..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/RangeTab.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 "Control" widget children.
-*/
-void createControlWidgets () {
-
- /* Leave an empty cell */
- new Composite (controlGroup, SWT.NULL);
-
- /* 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 (resControls.getString("Maximum"));
-
- /* Create a scale widget */
- maximumScale = new Scale (maximumGroup, SWT.NULL);
- maximumScale.setMaximum (100);
- maximumScale.setSelection (100);
- maximumScale.setPageIncrement (10);
- maximumScale.setIncrement (5);
-
- /* 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 (resControls.getString("Minimum"));
-
- /* Create a scale widget */
- minimumScale = new Scale (minimumGroup, SWT.NULL);
- minimumScale.setMaximum (100);
- minimumScale.setPageIncrement (10);
- minimumScale.setIncrement (5);
-
- /* 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.HORIZONTAL_ALIGN_CENTER);
- gridData.horizontalSpan = 2;
- selectionGroup.setLayoutData(gridData);
- selectionGroup.setText(resControls.getString("Selection"));
-
- /* Create a scale widget */
- selectionScale = new Scale (selectionGroup, SWT.NULL);
- selectionScale.setMaximum (100);
- selectionScale.setSelection (50);
- selectionScale.setPageIncrement (10);
- selectionScale.setIncrement (5);
-
- /* 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 (resControls.getString("SWT_HORIZONTAL"));
- verticalButton = new Button (styleGroup, SWT.RADIO);
- verticalButton.setText (resControls.getString("SWT_VERTICAL"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (resControls.getString("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 0827db8c07..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SashTab.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 = {resControls.getString("ListData0_0"),
- resControls.getString("ListData0_1"),
- resControls.getString("ListData0_2"),
- resControls.getString("ListData0_3"),
- resControls.getString("ListData0_4"),
- resControls.getString("ListData0_5"),
- resControls.getString("ListData0_6"),
- resControls.getString("ListData0_7"),
- resControls.getString("ListData0_8")};
-
- static String [] ListData1 = {resControls.getString("ListData1_0"),
- resControls.getString("ListData1_1"),
- resControls.getString("ListData1_2"),
- resControls.getString("ListData1_3"),
- resControls.getString("ListData1_4"),
- resControls.getString("ListData1_5"),
- resControls.getString("ListData1_6"),
- resControls.getString("ListData1_7"),
- resControls.getString("ListData1_8")};
-
- /* Constants */
- static final int SASH_WIDTH = 3;
-/**
-* 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 (resControls.getString("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 resControls.getString("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 9a90516272..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ScrollableTab.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 "Style" group.
-*/
-void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- singleButton = new Button (styleGroup, SWT.RADIO);
- singleButton.setText (resControls.getString("SWT_SINGLE"));
- multiButton = new Button (styleGroup, SWT.RADIO);
- multiButton.setText (resControls.getString("SWT_MULTI"));
- horizontalButton = new Button (styleGroup, SWT.CHECK);
- horizontalButton.setText (resControls.getString("SWT_H_SCROLL"));
- verticalButton = new Button (styleGroup, SWT.CHECK);
- verticalButton.setText (resControls.getString("SWT_V_SCROLL"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (resControls.getString("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 9fd63330db..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ShellTab.java
+++ /dev/null
@@ -1,212 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
- Button createButton, closeAllButton;
- Group parentStyleGroup;
-
- /* Variables used to track the open shells */
- int shellCount = 0;
- Shell [] shells = new Shell [4];
-/**
-* 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;
-
- /* 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);
- }
-
- /* Set the size, title and open the shell */
- shells [shellCount].setSize (300, 100);
- shells [shellCount].setText (resControls.getString("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 (resControls.getString("Parameters"));
-
- /* Create individual groups inside the "Control" group */
- styleGroup = new Group (controlGroup, SWT.NULL);
- gridLayout = new GridLayout ();
- styleGroup.setLayout (gridLayout);
- gridLayout.numColumns = 2;
- styleGroup.setLayoutData (new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- styleGroup.setText (resControls.getString("Styles"));
-
- /* Create a group for the parent sytle controls */
- parentStyleGroup = new Group (styleGroup, SWT.NULL);
- parentStyleGroup.setLayout (new GridLayout ());
- GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
- gridData.horizontalSpan = 2;
- parentStyleGroup.setLayoutData (gridData);
- parentStyleGroup.setText (resControls.getString("Parent"));
-}
-/**
-* Creates the "Control" widget children.
-*/
-void createControlWidgets () {
-
- /* Create the parent style buttons */
- noParentButton = new Button (parentStyleGroup, SWT.RADIO);
- noParentButton.setText (resControls.getString("No_Parent"));
- parentButton = new Button (parentStyleGroup, SWT.RADIO);
- parentButton.setText (resControls.getString("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_CENTER);
- gridData.horizontalSpan = 2;
- decorationStyleGroup.setLayoutData (gridData);
- decorationStyleGroup.setText (resControls.getString("Decoration_Styles"));
-
- /* Create the decoration style buttons */
- noTrimButton = new Button (decorationStyleGroup, SWT.CHECK);
- noTrimButton.setText (resControls.getString("SWT_NO_TRIM"));
- closeButton = new Button (decorationStyleGroup, SWT.CHECK);
- closeButton.setText (resControls.getString("SWT_CLOSE"));
- titleButton = new Button (decorationStyleGroup, SWT.CHECK);
- titleButton.setText (resControls.getString("SWT_TITLE"));
- minButton = new Button (decorationStyleGroup, SWT.CHECK);
- minButton.setText (resControls.getString("SWT_MIN"));
- maxButton = new Button (decorationStyleGroup, SWT.CHECK);
- maxButton.setText (resControls.getString("SWT_MAX"));
- borderButton = new Button (decorationStyleGroup, SWT.CHECK);
- borderButton.setText (resControls.getString("SWT_BORDER"));
- resizeButton = new Button (decorationStyleGroup, SWT.CHECK);
- resizeButton.setText (resControls.getString("SWT_RESIZE"));
-
- /* Create the "create" and "closeAll" buttons */
- createButton = new Button (styleGroup, SWT.NULL);
- gridData = new GridData (GridData.HORIZONTAL_ALIGN_CENTER);
- createButton.setLayoutData (gridData);
- createButton.setText (resControls.getString("Create_Shell"));
- closeAllButton = new Button (styleGroup, SWT.NULL);
- closeAllButton.setText (resControls.getString("Close_All_Shells"));
- closeAllButton.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_CENTER));
-
- /* 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);
-
- /* Set the default state */
- noParentButton.setSelection (true);
-}
-/**
-* Handle a decoration button selection event.
-*
-* @param event org.eclipse.swt.events.SelectionEvent
-*/
-public void decorationButtonSelected(SelectionEvent event) {
-
- /*
- * Make sure if the No Trim button is selected then
- * all other decoration buttons are deselected.
- */
- Button widget = (Button) event.widget;
- if (widget.getSelection() && widget != noTrimButton) {
- noTrimButton.setSelection (false);
- return;
- }
- if (widget.getSelection() && widget == noTrimButton) {
- 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 resControls.getString("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 6aac6dc087..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/SliderTab.java
+++ /dev/null
@@ -1,212 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-/**
-* 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 (resControls.getString("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 (resControls.getString("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 (resControls.getString("Increment"));
-
- /* Create the scale widget */
- incrementScale = new Scale (incrementGroup, SWT.NULL);
- incrementScale.setMaximum (100);
- incrementScale.setSelection (5);
- incrementScale.setPageIncrement (10);
- incrementScale.setIncrement (5);
-
- /* 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 (resControls.getString("Page_Increment"));
-
- /* Create the scale widget */
- pageIncrementScale = new Scale (pageIncrementGroup, SWT.NULL);
- pageIncrementScale.setMaximum (100);
- pageIncrementScale.setSelection (10);
- pageIncrementScale.setPageIncrement (10);
- pageIncrementScale.setIncrement (5);
-
- /* Add the listeners */
- pageIncrementScale.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- setWidgetIncrement ();
- }
- });
-}
-/**
-* 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 (resControls.getString("Thumb"));
-
- /* Create the scale widget */
- thumbScale = new Scale (thumbGroup, SWT.NULL);
- thumbScale.setMaximum (100);
- thumbScale.setSelection (10);
- thumbScale.setPageIncrement (10);
- thumbScale.setIncrement (5);
-
- /* 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 resControls.getString("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 432e492a16..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/Tab.java
+++ /dev/null
@@ -1,354 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-
-/**
-* <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 {
-
- protected static ResourceBundle resControls = ResourceBundle.getBundle("examples_control");
-
- /* Common control buttons */
- Button borderButton, enabledButton, visibleButton;
- Button preferredButton, tooSmallButton, smallButton, largeButton;
-
- /* Common groups and composites */
- Composite tabFolderPage;
- Group exampleGroup, controlGroup, displayGroup, sizeGroup, styleGroup;
-
- /* 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;
-/**
-* 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 (resControls.getString("Parameters"));
-
- /* Create individual groups inside the "Control" group */
- createStyleGroup ();
- createDisplayGroup ();
- createSizeGroup ();
-
- /*
- * 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 curreont 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 "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 (resControls.getString("State"));
-
- /* Create the controls */
- enabledButton = new Button(displayGroup, SWT.CHECK);
- enabledButton.setText(resControls.getString("Enabled"));
- visibleButton = new Button(displayGroup, SWT.CHECK);
- visibleButton.setText(resControls.getString("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 () {
- /*
- * Create the example group. This is the
- * group on the right half of each example
- * tab.
- */
- exampleGroup = new Group (tabFolderPage, SWT.NONE);
- GridLayout gridLayout = new GridLayout ();
- exampleGroup.setLayout (gridLayout);
- exampleGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
-}
-/**
-* 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 (resControls.getString("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 (resControls.getString("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);
-
- /* 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);
-
- /* 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 (resControls.getString("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 ();
- }
-}
-/**
-* 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 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 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 = new GridData ();
- gridData.widthHint = size;
- gridData.heightHint = size;
- controls [i].setLayoutData (gridData);
- }
- /*
- * Force the entire widget tree to layout,
- * even when the child sizes nay 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 ();
- 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 ab6305dac4..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java
+++ /dev/null
@@ -1,172 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-
- /* Style widgets added to the "Style" group */
- Button fullSelectionButton;
-
- /* Display widgets added to the "Display" group */
- Button headerVisibleButton, linesVisibleButton;
-
- static String [] columnTitles = {resControls.getString("TableTitle_0"),
- resControls.getString("TableTitle_1"),
- resControls.getString("TableTitle_2"),
- resControls.getString("TableTitle_3")};
-
- static String [] stringLine0 = {resControls.getString("TableLine0_0"),
- resControls.getString("TableLine0_1"),
- resControls.getString("TableLine0_2"),
- resControls.getString("TableLine0_3")};
-
- static String [] stringLine1 = {resControls.getString("TableLine1_0"),
- resControls.getString("TableLine1_1"),
- resControls.getString("TableLine1_2"),
- resControls.getString("TableLine1_3")};
-
- static String [] stringLine2 = {resControls.getString("TableLine2_0"),
- resControls.getString("TableLine2_1"),
- resControls.getString("TableLine2_2"),
- resControls.getString("TableLine2_3")};
-
-/**
-* Creates the "Display" group.
-*/
-void createDisplayGroup () {
- super.createDisplayGroup ();
-
- /* Create display controls specific to this example */
- headerVisibleButton = new Button (displayGroup, SWT.CHECK);
- headerVisibleButton.setText (resControls.getString("Header_Visible"));
- linesVisibleButton = new Button (displayGroup, SWT.CHECK);
- linesVisibleButton.setText (resControls.getString("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.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- tableGroup.setText (resControls.getString("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 (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 */
- Image [] images = new Image [] {
- Images.CLOSED_FOLDER_IMAGE,
- Images.OPEN_FOLDER_IMAGE,
- Images.TARGET_IMAGE,
- };
- int[] columnWidths = {150, 60, 75, 150};
- for (int i = 0; i < columnTitles.length; i++) {
- TableColumn tableColumn = new TableColumn(table1, SWT.NULL);
- tableColumn.setWidth(columnWidths[i]);
- tableColumn.setText(columnTitles[i]);
- }
- for (int i=0; i<16; i++) {
- TableItem item = new TableItem (table1, SWT.NULL);
- item.setImage (images [i % 3]);
- switch (i % 3) {
- case 0:
- stringLine0 [0] = resControls.getString("Index") + i;
- item.setText(stringLine0);
- break;
- case 1:
- stringLine1 [0] = resControls.getString("Index") + i;
- item.setText(stringLine1);
- break;
- case 2:
- stringLine2 [0] = resControls.getString("Index") + i;
- item.setText(stringLine2);
- break;
- }
- }
-}
-/**
-* Creates the "Style" group.
-*/
-void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- fullSelectionButton = new Button (styleGroup, SWT.CHECK);
- fullSelectionButton.setText (resControls.getString("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 resControls.getString("Table");
-}
-/**
-* Sets the state of the "Example" widgets.
-*/
-void setExampleWidgetState () {
- super.setExampleWidgetState ();
- setWidgetHeaderVisible ();
- setWidgetLinesVisible ();
- 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 b14d60c03f..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TextTab.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 richText;
- Group textGroup, richTextGroup;
-
- /* Style widgets added to the "Style" group */
- Button readOnlyButton;
-/**
-* 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 (resControls.getString("Text"));
-
- /* Create a group for the rich text widget */
- richTextGroup = new Group (exampleGroup, SWT.NULL);
- richTextGroup.setLayout (new GridLayout ());
- richTextGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- richTextGroup.setText (resControls.getString("RichText"));
-}
-/**
-* 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 (readOnlyButton.getSelection ()) style |= SWT.READ_ONLY;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- text = new Text (textGroup, style);
- text.setText (resControls.getString("Example_string"));
- text.append (text.DELIMITER);
- text.append (resControls.getString("One_Two_Three"));
- richText = new StyledText (richTextGroup, style);
- richText.setText (resControls.getString("Example_string"));
- richText.append ("\n");
- richText.append (resControls.getString("One_Two_Three"));
-}
-/**
-* Creates the "Style" group.
-*/
-void createStyleGroup() {
- super.createStyleGroup();
-
- /* Create the extra widgets */
- readOnlyButton = new Button (styleGroup, SWT.CHECK);
- readOnlyButton.setText (resControls.getString("SWT_READ_ONLY"));
-}
-/**
-* Gets the "Example" widget children.
-*/
-Control [] getExampleWidgets () {
- return new Control [] {text, richText};
-}
-/**
-* Gets the text for the tab folder item.
-*/
-String getTabText () {
- return resControls.getString("Text");
-}
-/**
-* Sets the state of the "Example" widgets.
-*/
-void setExampleWidgetState () {
- super.setExampleWidgetState ();
- 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 9d69aae0e5..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ToolBarTab.java
+++ /dev/null
@@ -1,261 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
- Shell dropDownShell;
- List dropDownList;
- Group imageToolBarGroup, textToolBarGroup;
-
- /* Style widgets added to the "Style" group */
- Button flatButton, wrapButton;
-
- static String [] ListData0 = {resControls.getString("ListData0_0"),
- resControls.getString("ListData0_1"),
- resControls.getString("ListData0_2"),
- resControls.getString("ListData0_3"),
- resControls.getString("ListData0_4"),
- resControls.getString("ListData0_5"),
- resControls.getString("ListData0_6"),
- resControls.getString("ListData0_7"),
- resControls.getString("ListData0_8")};
-
-/**
-* Create the drop down list widget used by the
-* drop down style tool bar item.
-*/
-void createDropDownList() {
-
- /* Don't create more than one list */
- if (dropDownList != null) return;
-
- /* Create the list */
- Shell shell = tabFolderPage.getShell ();
- dropDownShell = new Shell (shell, SWT.NO_TRIM);
- dropDownList = new List(dropDownShell, SWT.VERTICAL);
- dropDownShell.setLayout (new FillLayout ());
- dropDownList.setItems (ListData0);
-
- /*
- * Add a list selection listener so that the list is hidden
- * when the user selects an item from the drop down list.
- */
- dropDownList.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- disposeDropDownList ();
- }
- });
-}
-/**
-* 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 (resControls.getString("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 (resControls.getString("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 (Images.CLOSED_FOLDER_IMAGE);
- item.setToolTipText(resControls.getString("SWT_PUSH"));
- item = new ToolItem (imageToolBar, SWT.PUSH);
- item.setImage (Images.CLOSED_FOLDER_IMAGE);
- item.setToolTipText (resControls.getString("SWT_PUSH"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (Images.OPEN_FOLDER_IMAGE);
- item.setToolTipText (resControls.getString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (Images.OPEN_FOLDER_IMAGE);
- item.setToolTipText (resControls.getString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.CHECK);
- item.setImage (Images.TARGET_IMAGE);
- item.setToolTipText (resControls.getString("SWT_CHECK"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (Images.CLOSED_FOLDER_IMAGE);
- item.setToolTipText (resControls.getString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.RADIO);
- item.setImage (Images.CLOSED_FOLDER_IMAGE);
- item.setToolTipText (resControls.getString("SWT_RADIO"));
- item = new ToolItem (imageToolBar, SWT.SEPARATOR);
- item.setToolTipText(resControls.getString("SWT_SEPARATOR"));
- item = new ToolItem (imageToolBar, SWT.DROP_DOWN);
- item.setImage (Images.TARGET_IMAGE);
- item.setToolTipText (resControls.getString("SWT_DROP_DOWN"));
-
- /*
- * Add a selection listener to the drop down tool item
- * so that we can show the list when the drop down area
- * is pressed.
- */
- item.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- dropDownToolItemSelected (event);
- }
- });
-
- /* Create the text tool bar */
- textToolBar = new ToolBar (textToolBarGroup, style);
- item = new ToolItem (textToolBar, SWT.PUSH);
- item.setText (resControls.getString("Push"));
- item.setToolTipText(resControls.getString("SWT_PUSH"));
- item = new ToolItem (textToolBar, SWT.PUSH);
- item.setText (resControls.getString("Push"));
- item.setToolTipText(resControls.getString("SWT_PUSH"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (resControls.getString("Radio"));
- item.setToolTipText(resControls.getString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (resControls.getString("Radio"));
- item.setToolTipText(resControls.getString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.CHECK);
- item.setText (resControls.getString("Check"));
- item.setToolTipText(resControls.getString("SWT_CHECK"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (resControls.getString("Radio"));
- item.setToolTipText(resControls.getString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.RADIO);
- item.setText (resControls.getString("Radio"));
- item.setToolTipText(resControls.getString("SWT_RADIO"));
- item = new ToolItem (textToolBar, SWT.SEPARATOR);
- item.setToolTipText(resControls.getString("SWT_SEPARATOR"));
- item = new ToolItem (textToolBar, SWT.DROP_DOWN);
- item.setText (resControls.getString("Drop_Down"));
- item.setToolTipText(resControls.getString("SWT_DROP_DOWN"));
-
- /*
- * 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 (resControls.getString("SWT_FLAT"));
- wrapButton = new Button (styleGroup, SWT.CHECK);
- wrapButton.setText (resControls.getString("SWT_WRAP"));
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText (resControls.getString("SWT_BORDER"));
-}
-void disposeDropDownList () {
- if (dropDownShell != null) dropDownShell.dispose ();
- dropDownShell = null; dropDownList = null;
-}
-void disposeExampleWidgets () {
- super.disposeExampleWidgets ();
- disposeDropDownList ();
-}
-/**
-* Handle the drop down tool item selection event.
-*
-* @param event the selection event
-*/
-void dropDownToolItemSelected (SelectionEvent event) {
-
- /*
- * If list was already dropped down then close it.
- * We would do this regardless of where the tool
- * item was selected.
- */
- createDropDownList ();
- if (dropDownShell.getVisible ()) {
- disposeDropDownList ();
- return;
- }
-
- /**
- * 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.
- * Position the list below and vertically
- * alligned with the the drop down tool button.
- */
- ToolItem item = (ToolItem) event.widget;
- Rectangle toolItemBounds = item.getBounds ();
- Point point1 = imageToolBar.toDisplay (new Point (toolItemBounds.x, toolItemBounds.y));
- dropDownShell.setBounds (point1.x, point1.y + toolItemBounds.height, 100, 100);
- dropDownShell.setVisible (true);
- } else {
- /*
- * Main area of drop down tool item selected.
- * An application would invoke the code was
- * required to perform the action for the tool
- * item.
- */
- }
-}
-/**
-* Gets the "Example" widget children.
-*/
-Control [] getExampleWidgets () {
- return new Control [] {imageToolBar, textToolBar};
-}
-/**
-* Gets the text for the tab folder item.
-*/
-String getTabText () {
- return resControls.getString("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);
-}
-
-}
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 ef17d660c3..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-/**
-* 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 (resControls.getString("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 (resControls.getString("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 (borderButton.getSelection()) style |= SWT.BORDER;
-
- /* Create the text tree */
- tree1 = new Tree (treeGroup, style);
- TreeItem node1 = new TreeItem (tree1, SWT.NULL);
- node1.setText (resControls.getString("Node_1"));
- TreeItem node2 = new TreeItem (tree1, SWT.NULL);
- node2.setText (resControls.getString("Node_2"));
- TreeItem node3 = new TreeItem (tree1, SWT.NULL);
- node3.setText (resControls.getString("Node_3"));
- TreeItem node4 = new TreeItem (tree1, SWT.NULL);
- node4.setText (resControls.getString("Node_4"));
- TreeItem node1_1 = new TreeItem (node1, SWT.NULL);
- node1_1.setText (resControls.getString("Node_1_1"));
- TreeItem node2_1 = new TreeItem (node2, SWT.NULL);
- node2_1.setText (resControls.getString("Node_2_1"));
- TreeItem node3_1 = new TreeItem (node3, SWT.NULL);
- node3_1.setText (resControls.getString("Node_3_1"));
- TreeItem node2_2 = new TreeItem (node2, SWT.NULL);
- node2_2.setText (resControls.getString("Node_2_2"));
- TreeItem node2_2_1 = new TreeItem (node2_2, SWT.NULL);
- node2_2_1.setText (resControls.getString("Node_2_2_1"));
-
- /* Create the image tree */
- tree2 = new Tree (imageTreeGroup, style);
- node1 = new TreeItem (tree2, SWT.NULL);
- node1.setText (resControls.getString("Node_1"));
- node1.setImage (Images.CLOSED_FOLDER_IMAGE);
- node2 = new TreeItem (tree2, SWT.NULL);
- node2.setText (resControls.getString("Node_2"));
- node2.setImage (Images.CLOSED_FOLDER_IMAGE);
- node3 = new TreeItem (tree2, SWT.NULL);
- node3.setText (resControls.getString("Node_3"));
- node3.setImage (Images.CLOSED_FOLDER_IMAGE);
- node4 = new TreeItem (tree2, SWT.NULL);
- node4.setText (resControls.getString("Node_4"));
- node4.setImage (Images.CLOSED_FOLDER_IMAGE);
- node1_1 = new TreeItem (node1, SWT.NULL);
- node1_1.setText (resControls.getString("Node_1_1"));
- node1_1.setImage (Images.CLOSED_FOLDER_IMAGE);
- node2_1 = new TreeItem (node2, SWT.NULL);
- node2_1.setText (resControls.getString("Node_2_1"));
- node2_1.setImage (Images.CLOSED_FOLDER_IMAGE);
- node3_1 = new TreeItem (node3, SWT.NULL);
- node3_1.setText (resControls.getString("Node_3_1"));
- node3_1.setImage (Images.CLOSED_FOLDER_IMAGE);
- node2_2 = new TreeItem(node2, SWT.NULL);
- node2_2.setText (resControls.getString("Node_2_2"));
- node2_2.setImage (Images.CLOSED_FOLDER_IMAGE);
- node2_2_1 = new TreeItem (node2_2, SWT.NULL);
- node2_2_1.setText (resControls.getString("Node_2_2_1"));
- node2_2_1.setImage (Images.CLOSED_FOLDER_IMAGE);
-}
-/**
-* Gets the "Example" widget children.
-*/
-Control [] getExampleWidgets () {
- return new Control [] {tree1, tree2};
-}
-/**
-* Gets the text for the tab folder item.
-*/
-String getTabText () {
- return resControls.getString("Tree");
-}
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/folder.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/folder.gif
deleted file mode 100755
index 6660d0b11a..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/folder.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/folderOpen.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/folderOpen.gif
deleted file mode 100755
index fc9943f111..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/folderOpen.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/stop.gif b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/stop.gif
deleted file mode 100755
index 9807ae648d..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/stop.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/ComboView.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/ComboView.java
deleted file mode 100755
index f7537c34fc..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/ComboView.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.eclipse.swt.examples.fileviewer;
- /*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
- import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-
-import java.io.*;
- /**
- * A navigation bar
- */
-public class ComboView {
- /* package */ final Combo combo;
- private final FileViewer viewer;
-
- private File[] roots = null;
- private String lastText = null;
-
- /**
- * Creates the combo box.
- *
- * @param theViewer the viewer to attach to
- * @param parent the parent control
- * @param layoutData the layout data
- */
- public ComboView(FileViewer theViewer, Composite parent, Object layoutData) {
- this.viewer = theViewer;
- combo = new Combo(parent, SWT.NONE);
- combo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- int selection = combo.getSelectionIndex();
- if (selection >= 0 && selection < roots.length) {
- viewer.notifySelectedDirectory(roots[selection]);
- }
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- String text = combo.getText();
- if (text == null) return;
- if (lastText != null && lastText.equals(text)) return;
- lastText = text;
- viewer.notifySelectedDirectory(new File(text));
- }
- });
- combo.setLayoutData(layoutData);
- }
-
- /**
- * Listens to selectedDirectory events.
- * <p>
- * Sets the combo box to point to the current directory.
- * </p>
- *
- * @param dir the directory that was selected, null is not permitted
- */
- /* package */ void selectedDirectory(File dir) {
- combo.clearSelection();
- if (roots == null) return;
-
- for (int i = 0; i < roots.length; ++i) {
- if (dir.equals(roots[i])) {
- combo.select(i);
- return;
- }
- }
- combo.setText(dir.getPath());
- }
- /**
- * Listens to refreshFiles events.
- * <p>
- * Refreshes information about any files in the list and their children.
- * </p>
- *
- * @param files the list of files to be refreshed, null refreshes everything
- */
- /* package */ void refreshFiles(File[] files) {
- if (files == null) {
- roots = viewer.getRoots();
-
- combo.removeAll();
- for (int i = 0; i < roots.length; ++i) {
- final File file = roots[i];
- combo.add(file.getPath());
- }
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileDisplayInfo.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileDisplayInfo.java
deleted file mode 100755
index 78a5e5f497..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileDisplayInfo.java
+++ /dev/null
@@ -1 +0,0 @@
-package org.eclipse.swt.examples.fileviewer; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import org.eclipse.swt.graphics.*; /** * Stores detailed formatted display information about a file entry. */ /* package */ class FileDisplayInfo { public String nameString; public String typeString; public String sizeString; public String dateString; public Image iconImage; /** * Creates a formatted display block. * * @param name the file name string * @param type the file type string * @param size the file size string * @param date the file data string * @param icon the file icon */ public FileDisplayInfo(String name, String type, String size, String date, Image icon) { this.nameString = name; this.typeString = type; this.sizeString = size; this.dateString = date; this.iconImage = icon; } } \ No newline at end of file
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 40f0ab5b51..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/FileViewer.java
+++ /dev/null
@@ -1,694 +0,0 @@
-package org.eclipse.swt.examples.fileviewer;
- /*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
- private final static String DRIVE_A = "a:" + File.separator;
- private final static String DRIVE_B = "b:" + File.separator;
-
- /* Important UI elements */
- /* package */ Display display;
- private Shell shell;
- private ToolBar toolBar;
- private TreeView treeView;
- private TableView tableView;
- private ComboView comboView;
-
- private Label numObjectsLabel;
- private Label diskSpaceLabel;
-
- private File currentDirectory = null;
-
- private static final DateFormat dateFormat = DateFormat.getDateTimeInstance(
- DateFormat.MEDIUM, DateFormat.MEDIUM);
- /* Simulate only flag */
- // when true, disables actual filesystem manipulations and outputs results to standard out
- private static boolean simulateOnly = false;
-
- /**
- * Runs main program.
- */
- public static void main (String [] args) {
- resourceBundle = ResourceBundle.getBundle("examples_fileviewer");
- new FileViewer().open();
- }
-
- /**
- * Opens the main program.
- */
- /* package */ void open() {
- // Create the window
- display = new Display();
- IconCache.initResources(display);
- shell = new Shell();
- createShellContents();
- notifyRefreshFiles(null);
- shell.open();
- // Event loop
- while (! shell.isDisposed()) {
- if (! display.readAndDispatch()) display.sleep();
- }
- // Cleanup
- tableView.dispose();
- IconCache.freeResources();
- display.dispose();
- }
- /**
- * Closes the main program.
- */
- /* package */ void close() {
- 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.
- */
- /* package */ 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.
- */
- /* package */ 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
- */
- /* package */ 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;
- comboView = new ComboView(this, 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);
- treeView = new TreeView(this, sashForm, null);
- tableView = new TableView(this, sashForm, null);
- 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);
-
- MenuItem item = new MenuItem(menu, SWT.PUSH);
- item.setText(getResourceString("menu.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.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);
- }
-
- /**
- * Notifies the application components that a new current directory has been selected
- *
- * @param dir the directory that was selected, null is ignored
- */
- /* package */ void notifySelectedDirectory(File dir) {
- if (dir == null) return;
- if (currentDirectory != null && dir.equals(currentDirectory)) return;
- currentDirectory = dir;
- shell.setText(getResourceString("Title", new Object[] { currentDirectory.getPath() }));
- // Notify the other components
- comboView.selectedDirectory(dir);
- treeView.selectedDirectory(dir);
- tableView.selectedDirectory(dir);
- }
-
- /**
- * Notifies the application components that files have been selected
- *
- * @param files the files that were selected, null clears the selection
- */
- /* package */ void notifySelectedFiles(File[] files) {
- if (files == null) files = new File[0];
- if (files.length != 0) {
- final File file = files[0];
- notifySelectedDirectory(file.getParentFile());
- }
- tableView.selectedFiles(files);
- }
-
- /**
- * 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
- */
- /* package */ void notifyRefreshFiles(File[] files) {
- if (files != null && files.length == 0) return;
-
- // Notify the other components
- comboView.refreshFiles(files);
- treeView.refreshFiles(files);
- tableView.refreshFiles(files);
- }
-
- /**
- * Performs the default action on a set of files.
- *
- * @param files the array of files to process
- */
- /* package */ 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
- */
- /* package */ void doParent() {
- if (currentDirectory == null) return;
- File parentDirectory = currentDirectory.getParentFile();
- notifySelectedDirectory(parentDirectory);
- }
-
- /**
- * Performs a refresh
- */
- /* package */ void doRefresh() {
- notifyRefreshFiles(null);
- }
- /**
- * Sets the details appropriately for a file
- *
- * @param file the file in question
- */
- /* package */ void setFileDetails(File file) {
- diskSpaceLabel.setText(getResourceString("details.FileSize.text",
- new Object[] { new Long(file.length()) }));
- numObjectsLabel.setText("");
- }
-
- /**
- * Sets the details appropriately for a folder
- *
- * @param folder the folder in question
- * @param files the directory listing
- */
- /* package */ void setFolderDetails(File folder, File[] files) {
- diskSpaceLabel.setText("");
- numObjectsLabel.setText(getResourceString("details.NumberOfObjects.text",
- new Object[] { new Integer(files.length) }));
- }
-
- /**
- * Sets the details appropriately for a selection with > 1 item
- *
- * @param file the file in question
- */
- /* package */ void setSelectionDetails(File[] file) {
- // not implemented
- clearDetails();
- }
-
- /**
- * Blanks out the details
- */
- /* package */ void clearDetails() {
- diskSpaceLabel.setText("");
- numObjectsLabel.setText("");
- }
-
- /**
- * Validate a drop target event
- * <p>
- * Note event.detail is modified by this method
- * </p>
- * @param event the DropTargetEvent we are validating
- * @param targetFile the File representing the drop target location
- * under inspection, or null if none
- * @return an array of files to be operated on, or null on error
- */
- /* package */ File[] validateDrop(DropTargetEvent event, File targetFile) {
- final int dropMode = (event.detail != DND.DROP_NONE) ? event.detail : DND.DROP_MOVE;
- event.detail = DND.DROP_NONE; // simplify error reporting
- // Validate the target
- if (targetFile == null) return null;
- if (! targetFile.isDirectory()) return null;
-
- // Get dropped data (an array of filenames)
- final String[] names = (String[]) event.data;
- final File[] files;
- if (names != null) {
- // Validate the source
- files = new File[names.length];
- for (int i = 0; i < names.length; ++i) {
- files[i] = new File(names[i]);
- if (files[i].equals(targetFile)) return null;
- }
- } else {
- // Files not available yet
- files = null;
- }
- event.detail = dropMode;
- return files;
- }
-
- /**
- * Perform a drop on a target
- * <p>
- * 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
- */
- /* package */ void performDrop(DropTargetEvent event, File targetFile) {
- Vector /* of File */ dirtyFiles = new Vector();
- try {
- final File[] sourceFiles = validateDrop(event, targetFile);
- final int dropMode = event.detail;
-
- event.detail = DND.DROP_NONE; // simplify error reporting
- if (sourceFiles == null) return;
-
- dirtyFiles.add(targetFile);
- for (int i = 0; i < sourceFiles.length; i++){
- final File source = sourceFiles[i];
- final File dest = new File(targetFile, source.getName());
-
- // Perform action on each file
- switch (dropMode) {
- case DND.DROP_COPY:
- if (! copyFileStructure(source, dest)) return;
- break;
- case DND.DROP_MOVE:
- dirtyFiles.add(source);
- if (! moveFileStructure(source, dest)) return;
- break;
- default:
- throw new IllegalArgumentException(getResourceString("exception.Invalid_DND_Mode",
- new Object[] { new Integer(dropMode) }));
- }
- }
- event.detail = dropMode;
- } finally {
- notifyRefreshFiles((File[]) dirtyFiles.toArray(new File[dirtyFiles.size()]));
- }
- }
-
- /**
- * Gets filesystem root entries
- *
- * @return an array of Files corresponding to the root directories on the platform,
- * may be empty but not null
- */
- /* package */ static 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);
- }
- }
- File[] roots = (File[]) list.toArray(new File[list.size()]);
- sortFiles(roots);
- return roots;
- } else {
- return new File[] { new File(File.separator) };
- }
- }
-
- /**
- * 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
- */
- /* package */ static File[] getDirectoryList(File file) {
- File[] list = file.listFiles();
- if (list == null) return new File[0];
- sortFiles(list);
- return list;
- }
-
- /**
- * Gets file information for display purposes
- *
- * @param file the file to query
- * @return the requested information or null if not available
- */
- /* package */ FileDisplayInfo getFileDisplayInfo(File file) {
- final String nameString = file.getName();
- final String dateString = dateFormat.format(new Date(file.lastModified()));
- final String sizeString;
- final String typeString;
- final Image icon;
-
- if (file.isDirectory()) {
- typeString = getResourceString("filetype.Folder");
- sizeString = "";
- icon = 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();
- icon = IconCache.getIconFromProgram(program, extension);
- } else {
- typeString = getResourceString("filetype.Unknown", new Object[] { extension.toUpperCase() });
- icon = IconCache.stockImages[IconCache.iconFile];
- }
- } else {
- typeString = getResourceString("filetype.None");
- icon = IconCache.stockImages[IconCache.iconFile];
- }
- }
- return new FileDisplayInfo(nameString, typeString, sizeString, dateString, icon);
- }
- /**
- * Moves a file or entire directory structure.
- * [Note only works within a specific volume on some platforms for now]
- *
- * @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
- */
- /* package */ static boolean moveFileStructure(File oldFile, File newFile) {
- if (oldFile == null || newFile == null) return false;
- if (! oldFile.exists());
- if (newFile.exists());
- if (simulateOnly) {
- System.out.println(getResourceString("simulate.MoveFromTo.text",
- new Object[] { oldFile.getPath(), newFile.getPath() }));
- return true;
- } else {
- return oldFile.renameTo(newFile);
- }
- }
-
- /**
- * 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
- */
- /* package */ static boolean copyFileStructure(File oldFile, File newFile) {
- if (oldFile == null || newFile == null) return false;
- if (! oldFile.exists());
- if (newFile.exists());
-
- if (oldFile.isFile()) {
- /*
- * 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;
- } else if (oldFile.isDirectory()) {
- /*
- * Copy a directory
- */
- 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) {
- 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;
- }
- }
- return true;
- } else {
- /*
- * Unknown type
- */
- if (simulateOnly) {
- System.out.println(getResourceString("simulate.IgnoringUnknownResource.text",
- new Object[] { oldFile.getPath() }));
- }
- return true; // ignore it
- }
- }
-
- /**
- * Sorts files lexicographically by name.
- *
- * @param files the array of Files to be sorted
- */
- /* package */ 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;
- return a.getName().compareToIgnoreCase(b.getName());
- }
-}
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 7abaaf540a..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, 2001.
- * All Rights Reserved
- */
-
-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.
- */
-/* package */ class IconCache {
- // Stock images
- public static 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 static 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 static Image stockImages[];
-
- // Stock cursors
- public static final int
- cursorDefault = 0,
- cursorWait = 1;
- public static Cursor stockCursors[];
- // Cached icons
- private static Hashtable iconCache;
- /**
- * Loads the resources
- *
- * @param display the display
- */
- public static 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 static 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 static 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 and extension
- *
- * @param program the Program
- * @param extension the extension
- */
- public static Image getIconFromProgram(Program program, String extension) {
- final String key = program.getName() + "$#$" + extension;
- Image image = (Image) iconCache.get(key);
- if (image == null) {
- ImageData imageData = program.getImageData();
- if (imageData != null) {
- image = new Image(null, imageData, imageData.getTransparencyMask());
- iconCache.put(key, image);
- } else {
- image = stockImages[iconFile];
- }
- }
- return image;
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/TableView.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/TableView.java
deleted file mode 100755
index a1ed483d37..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/TableView.java
+++ /dev/null
@@ -1 +0,0 @@
-package org.eclipse.swt.examples.fileviewer; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import org.eclipse.swt.*; 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.*; /** * A detailed directory listing */ public class TableView { private static final String TABLEITEMDATA_FILE = "TableItem.file"; // File: File associated with table row private final Table table; private final Label contentsOfLabel; private final Shell shell; private final Display display; private final FileViewer viewer; private File activeDir = null; /* Worker thread control */ private UpdateWorker tableUpdateWorker = null; final String[] titles = new String [] { FileViewer.getResourceString("table.Name.title"), FileViewer.getResourceString("table.Size.title"), FileViewer.getResourceString("table.Type.title"), FileViewer.getResourceString("table.Modified.title") }; final int[] widths = new int[] {150, 60, 75, 150}; /** * Creates the file details table. * * @param theViewer the viewer to attach to * @param parent the parent control * @param layoutData the layout data */ public TableView(FileViewer theViewer, Composite parent, Object layoutData) { this.viewer = theViewer; shell = parent.getShell(); display = shell.getDisplay(); Composite composite = new Composite(parent, SWT.NONE); composite.setLayoutData(layoutData); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 1; gridLayout.marginHeight = gridLayout.marginWidth = 2; gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0; composite.setLayout(gridLayout); contentsOfLabel = new Label(composite, SWT.BORDER); contentsOfLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL)); table = new Table(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI); table.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL)); for (int i = 0; i < titles.length; i++) { TableColumn column = new TableColumn(table, SWT.NONE); column.setText(titles [i]); column.setWidth(widths [i]); } table.setHeaderVisible(true); table.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { viewer.notifySelectedFiles(getSelectedFiles()); } public void widgetDefaultSelected(SelectionEvent event) { viewer.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); tableUpdateWorker = new TableUpdateWorker(); } /** * Dispose of allocated resources and shut down. */ public void dispose() { tableUpdateWorker.syncStop(); } /** * Updates the table with file information in the background. * <p> * It is designed such that it can be interrupted cleanly. Rather than put all the code * to manage this here, the balance has been pushed out to UpdateWorker so it can be re-used. * </p> */ private class TableUpdateWorker extends UpdateWorker { private File currentDir = null; private File[] currentFiles = null; private File[] currentDirList = null; public TableUpdateWorker() { super(TableView.this.display); } /** * Updates the table's contents * * @param data arguments in an Object[] * <ul> * <li>File data[0] dir the current directory, null does nothing * <li>File[] data[1] the list of files to select, null does nothing * <li>Boolean data[2] if true, forces a refresh * </ul> */ protected void execute(Object data) { // Get arguments final Object[] args = (Object[]) data; final File argDir = (File) args[0]; final File[] argFiles = (File[]) args[1]; final boolean argForce = ((Boolean) args[2]).booleanValue(); // Update current state if (argDir != null) currentDir = argDir; if (argFiles != null) currentFiles = argFiles; else if (argDir != null) currentFiles = new File[0]; // Perform necessary refreshing if (argDir != null) updateDirectoryListing(); else if (argFiles != null) updateFileSelection(); if (isCancelled()) { currentFiles = null; currentDir = null; currentDirList = null; } } /* * Note the use of 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. */ /** * Updates directory list */ private void updateDirectoryListing() { // Clear existing information TableView.this.display.syncExec(new Runnable() { public void run() { viewer.clearDetails(); contentsOfLabel.setText(FileViewer.getResourceString("details.ContentsOf.text", new Object[] { currentDir.getPath() })); table.removeAll(); table.setRedraw(false); TableView.this.activeDir = currentDir; // synchronize this } }); currentDirList = FileViewer.getDirectoryList(currentDir); updateDetails(); for (int i = 0; (! isCancelled()) && (i < currentDirList.length); i++) { final File theFile = currentDirList[i]; addFileDetails(currentDirList[i]); final boolean doIncrementalRefresh = ((i & 127) == 127); if (doIncrementalRefresh) TableView.this.display.syncExec(new Runnable() { public void run () { table.setRedraw(true); table.setRedraw(false); } }); } // Allow the table to refresh itself TableView.this.display.asyncExec(new Runnable() { public void run() { table.setRedraw(true); } }); } /** * Adds a file's detail information to the directory list */ private void addFileDetails(final File file) { final FileDisplayInfo displayInfo = viewer.getFileDisplayInfo(file); final String[] strings = new String[] { displayInfo.nameString, displayInfo.sizeString, displayInfo.typeString, displayInfo.dateString }; final Image image = displayInfo.iconImage; TableView.this.display.asyncExec(new Runnable() { public void run () { TableItem tableItem = new TableItem(table, 0); tableItem.setText(strings); tableItem.setImage(image); tableItem.setData(TABLEITEMDATA_FILE, file); } }); } /** * Updates the current file selection */ private void updateFileSelection() { updateDetails(); } /** * Updates the detail information */ private void updateDetails() { if (currentFiles.length == 0) { if (currentDir == null) return; final File folder = currentDir; final File[] files = currentDirList; // show directory information TableView.this.display.asyncExec(new Runnable() { public void run() { viewer.setFolderDetails(folder, files); } }); } else if (currentFiles.length == 1) { final File file = currentFiles[0]; // show individual file information TableView.this.display.asyncExec(new Runnable() { public void run() { viewer.setFileDetails(file); } }); } else { // show multi-selection file information final File[] files = currentFiles; TableView.this.display.asyncExec(new Runnable() { public void run() { viewer.setSelectionDetails(files); } }); } } } /** * 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 dragOver(DropTargetEvent event) { viewer.validateDrop(event, getTargetFile(event)); } public void drop(DropTargetEvent event) { viewer.performDrop(event, getTargetFile(event)); } private File getTargetFile(DropTargetEvent event) { // Determine the target File for the drop final TableItem item = table.getItem(table.toControl(new Point(event.x, event.y))); final File targetFile; if (item == null) { // We dropped on an unoccupied area of the table, use the table's root file targetFile = activeDir; } else { // We dropped on a particular item in the table, use the item's file targetFile = (File) item.getData(TABLEITEMDATA_FILE); } return targetFile; } }); return dropTarget; } /** * 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() { public void dragStart(DragSourceEvent e) { e.doit = table.getSelectionCount() > 0; } public void dragSetData(DragSourceEvent event){ if (! FileTransfer.getInstance().isSupportedType(event.dataType)) return; final TableItem[] tableDragItems = table.getSelection(); if (tableDragItems == null || tableDragItems.length == 0) return; final String[] data = new String[tableDragItems.length]; for (int i = 0; i < tableDragItems.length; i++) { File file = (File) tableDragItems[i].getData(TABLEITEMDATA_FILE); data[i] = file.getAbsolutePath(); } event.data = data; } public void dragFinished(DragSourceEvent event) { } }); return dragSource; } /** * Listens to selectedDirectory events. * <p> * Displays the contents in the selected directory. * </p> * * @param dir the directory that was selected, null is not permitted */ /* package */ void selectedDirectory(File dir) { tableUpdateWorker.asyncUpdate(new Object[] { dir, null, new Boolean(false) }); } /** * Listens to selectedFiles events. * <p> * Updates the details to match the specified selection. * </p> * * @param files the array of selected files, null is not permitted */ /* package */ void selectedFiles(File[] files) { tableUpdateWorker.asyncUpdate(new Object[] { null, files, new Boolean(false) }); } /** * Listens to refreshFiles events. * <p> * Refreshes information about any files in the list and their children. * </p> * * @param files the list of files to be refreshed, null refreshes everything */ /* package */ void refreshFiles(File[] files) { tableUpdateWorker.asyncUpdate(new Object[] { null, null, new Boolean(true) }); } } \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/TreeExpandDropListener.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/TreeExpandDropListener.java
deleted file mode 100755
index 32e3c20b4d..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/TreeExpandDropListener.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.swt.examples.fileviewer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * TreeExpandDropListener provides automatic expansion for Trees during drag and drop
- * operations.
- * <p>
- * If the pointer hovers for a time over an item in the Tree that has not yet been
- * expanded, the item is expanded automatically. This behaviour is consistent with
- * that of popular GUI systems.
- * </p><p>
- * To use it send addDropListener(new TreeExpandDropListener(tree)) to the DropTarget
- * object attached to the Tree.
- * </p>
- */
-public class TreeExpandDropListener extends DropTargetAdapter {
- public static final long DEFAULT_EXPAND_DELAY = 1000; // millis
-
- private long hoverThreshhold = DEFAULT_EXPAND_DELAY;
- private long hoverBegin = 0;
- private TreeItem hoverItem = null;
- private Tree tree;
-
- /**
- * Constructs a Tree expanding Drop Listener
- *
- * @param tree the Tree that the DropTarget is attached to
- */
- public TreeExpandDropListener(final Tree tree) {
- this.tree = tree;
- }
-
- /**
- * Handles dragEnter events.
- * This is an implementation detail.
- */
- public void dragEnter(DropTargetEvent event) {
- hoverItem = null;
- }
-
- /**
- * Handles dragOver events.
- * This is an implementation detail.
- */
- public void dragOver(DropTargetEvent event) {
- Point point = tree.toControl(new Point(event.x, event.y));
-
- // Get the item directly under the point
- TreeItem item = tree.getItem(point);
- if (item != hoverItem) {
- // We just started hovering, remember this item
- if ((item != null) && (! item.getExpanded())) {
- hoverBegin = System.currentTimeMillis();
- hoverItem = item;
- } else {
- hoverItem = null;
- }
- } else if (hoverItem != null) {
- // We've been hovering for a while, expand if our timer elapsed
- long hoverCurrent = System.currentTimeMillis();
-
- if (hoverCurrent - hoverBegin >= hoverThreshhold) {
- // Fake as if the user expanded the item manually
- Event hoverEvent = new Event();
- hoverEvent.x = event.x;
- hoverEvent.y = event.y;
- hoverEvent.item = hoverItem;
- hoverEvent.time = (int) hoverCurrent;
- hoverItem.setExpanded(true);
- hoverItem = null;
- tree.notifyListeners(SWT.Expand, hoverEvent);
- }
- }
- }
-} \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/TreeScrollDropListener.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/TreeScrollDropListener.java
deleted file mode 100755
index 5c7c8d8ad7..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/TreeScrollDropListener.java
+++ /dev/null
@@ -1 +0,0 @@
-package org.eclipse.swt.examples.fileviewer; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import org.eclipse.swt.dnd.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; /** * TreeScrollDropListener provides automatic scrolling for Trees during drag and drop * operations. * <p> * If the pointer drags over an item in the Tree near its upper or * lower edges, the Tree will scroll so as to make previous or successive items visible * onscreen. This behaviour is consistent with that of popular GUI systems. * </p><p> * To use it send addDropListener(new TreeScrollDropListener(tree)) to the DropTarget * object attached to the Tree. * </p> */ public class TreeScrollDropListener extends DropTargetAdapter { private Tree tree; /** * Constructs a Tree scrolling Drop Listener * * @param tree the Tree that the DropTarget is attached to */ public TreeScrollDropListener(final Tree tree) { this.tree = tree; } /** * Handles dragOver events. * This is an implementation detail. */ public void dragOver(DropTargetEvent event) { Point point = tree.toControl(new Point(event.x, event.y)); // Get the item directly under the point TreeItem item = tree.getItem(point); if (item == null) return; // Determine scroll direction according to whether we're nearer the top, middle, or bottom Rectangle clientArea = tree.getClientArea(); int scrollRegionSize = Math.min(clientArea.height / 3, 24); // cut region into 3 parts if (scrollRegionSize < 8) return; // don't scroll if the control is too small to make sense TreeItem showItem = item; for(;;) { if (point.y < clientArea.y + scrollRegionSize) { // in upper region showItem = getPreviousVisibleItem(tree, showItem); } else if (point.y > clientArea.height + clientArea.y - scrollRegionSize) { // in lower region showItem = getNextVisibleItem(tree, showItem, false); } else { // in middle region break; } // Show the item (causes a scroll if it is outside of the visible region) if (showItem == null) break; tree.showItem(showItem); // Test that we actually scrolled, if we didn't try again with the next item if (item != tree.getItem(point)) break; } } /** * Given a TreeItem, locates the previous (above the specified item) visible TreeItem in a tree. * <p> * Note that the item may not be actually rendered onscreen though it would be * visible were the control scrolled appropriately. * </p> * * @param tree the Tree containing the items * @param item the TreeItem whose previous visible neighbour is to be found * @return the previous visible item, or null if none. */ private TreeItem getPreviousVisibleItem(Tree tree, TreeItem item) { TreeItem parent = item.getParentItem(); TreeItem[] items = (parent != null) ? parent.getItems() : tree.getItems(); if (items != null) { for (int i = items.length - 1; i > 0; --i) { if (items[i] == item) return getLastVisibleChild(items[i - 1]); } } return parent; } /** * Given a TreeItem, locates the following (below the specified item) visible TreeItem in a tree. * <p> * Note that the item may not be actually rendered onscreen though it would be * visible were the control scrolled appropriately. * </p> * * @param tree the Tree containing the items * @param item the TreeItem whose next visible neighbour is to be found * @return the next visible item, or null if none. */ private TreeItem getNextVisibleItem(Tree tree, TreeItem item, boolean ignoreChildren) { TreeItem parent = item.getParentItem(); TreeItem[] items = (parent != null) ? parent.getItems() : tree.getItems(); if (items != null) { for (int i = 0; i < items.length; ++i) { if (items[i] == item) { if (! ignoreChildren && items[i].getExpanded()) { items = items[i].getItems(); if (items != null && items.length > 0) return items[0]; } if (i + 1 < items.length) return items[i + 1]; break; } } if (parent != null) return getNextVisibleItem(tree, parent, true); } return null; } /** * Given a TreeItem, locates its last (lowest) visible item * <p> * Note that the item may not be actually rendered onscreen though it would be * visible were the control scrolled appropriately. * </p> * * @param item the TreeItem whose last visible child is to be found * @return the last visible child, or <code>item</code> if no visible children. */ private TreeItem getLastVisibleChild(TreeItem item) { if (! item.getExpanded()) return item; TreeItem[] items = item.getItems(); if (items == null || items.length == 0) return item; return getLastVisibleChild(items[items.length - 1]); } } \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/TreeView.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/TreeView.java
deleted file mode 100755
index ee7a09ae91..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/TreeView.java
+++ /dev/null
@@ -1 +0,0 @@
-package org.eclipse.swt.examples.fileviewer; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import org.eclipse.swt.*; import org.eclipse.swt.dnd.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; import java.io.*; import java.util.*; /** * A directory tree */ class TreeView { private static final String TREEITEMDATA_FILE = "TreeItem.file", // File: File associated with tree item TREEITEMDATA_IMAGEEXPANDED = "TreeItem.imageExpanded", // Image: shown when item is expanded TREEITEMDATA_IMAGECOLLAPSED = "TreeItem.imageCollapsed", // Image: shown when item is collapsed TREEITEMDATA_STUB = "TreeItem.stub"; // Object: if not present or null then the item has not been populated private final Tree tree; private final Label scopeLabel; private final Shell shell; private final Display display; private final FileViewer viewer; /** * Creates the file tree table. * * @param theViewer the viewer to attach to * @param parent the parent control * @param layoutData the layout data */ public TreeView(FileViewer theViewer, Composite parent, Object layoutData) { this.viewer = theViewer; shell = parent.getShell(); display = shell.getDisplay(); Composite composite = new Composite(parent, SWT.NONE); composite.setLayoutData(layoutData); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 1; gridLayout.marginHeight = gridLayout.marginWidth = 2; gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0; composite.setLayout(gridLayout); scopeLabel = new Label(composite, SWT.BORDER); scopeLabel.setText(FileViewer.getResourceString("details.AllFolders.text")); scopeLabel.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); viewer.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); expandTreeItem(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); expandTreeItem(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() { public void dragStart(DragSourceEvent event){ event.doit = tree.getSelectionCount() > 0; } public void dragFinished(DragSourceEvent event){ } public void dragSetData(DragSourceEvent event){ if (! FileTransfer.getInstance().isSupportedType(event.dataType)) return; final TreeItem[] treeDragItems = tree.getSelection(); if (treeDragItems == null || treeDragItems.length == 0) return; final String[] data = new String[treeDragItems.length]; for (int i = 0; i < treeDragItems.length; i++) { File file = (File) treeDragItems[i].getData(TREEITEMDATA_FILE); data[i] = file.getAbsolutePath(); } event.data = data; } }); 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 TreeScrollDropListener(tree)); dropTarget.addDropListener(new TreeExpandDropListener(tree)); dropTarget.addDropListener(new DropTargetAdapter() { public void dragOver(DropTargetEvent event) { viewer.validateDrop(event, getTargetFile(event)); } public void drop(DropTargetEvent event) { viewer.performDrop(event, getTargetFile(event)); } private File getTargetFile(DropTargetEvent event) { // Determine the target File for the drop final TreeItem item = tree.getItem(tree.toControl(new Point(event.x, event.y))); final File targetFile; if (item == null) { // We dropped on an unoccupied area of the tree, we have no recourse. Quit. targetFile = null; } else { // We dropped on 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 expandTreeItem(TreeItem item) { final File file = (File) item.getData(TREEITEMDATA_FILE); final Object stub = item.getData(TREEITEMDATA_STUB); if (stub == null) refreshTreeItem(item, file); } /** * Populates an item in the tree with a complete directory listing. * * @param item the TreeItem to fill in * @param file the directory to use */ private void refreshTreeItem(TreeItem item, File file) { /* Get directory listing */ shell.setCursor(IconCache.stockCursors[IconCache.cursorWait]); File[] subFiles = null; if (file != null) { subFiles = FileViewer.getDirectoryList(file); } /* Eliminate any existing (possibly placeholder) children */ final TreeItem[] oldChildren = item.getItems(); for (int i = 0; i < oldChildren.length; ++i) { oldChildren[i].dispose(); } if (subFiles != null && subFiles.length > 0) { /* Add subdirectory entries */ for (int i = 0; i < subFiles.length; ++i) { final File folder = subFiles[i]; if (! folder.isDirectory()) continue; // add the directory to the tree TreeItem newItem = new TreeItem(item, SWT.NULL); initTreeItemFolder(newItem, folder); // add a placeholder child item so we get the "expand" button TreeItem placeholderItem = new TreeItem(newItem, SWT.NULL); } } else { /* Error or nothing found -- collapse the item */ item.setExpanded(false); } // Clear stub flag item.setData(TREEITEMDATA_STUB, this); shell.setCursor(IconCache.stockCursors[IconCache.cursorDefault]); } /** * Listens to selectedDirectory events. * <p> * If not already expanded, recursively expands the parents of the specified * directory until it is visible. * </p> * * @param dir the directory that was selected, null is not permitted */ /* package */ void selectedDirectory(File dir) { 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); TreeItem item = searchItems(items, pathElement); if (item == null) break; lastItem = item; if (i != 0 && !item.getExpanded()) { item.setExpanded(true); expandTreeItem(item); } items = item.getItems(); } tree.setSelection((lastItem != null) ? new TreeItem[] { lastItem } : new TreeItem[0]); } private TreeItem searchItems(TreeItem[] items, File element) { // No guarantee that the items are sorted, so we'll just sequential scan // shouldn't be more than a couple hundred entries, anyway. for (int i = 0; i < items.length; ++i) { final TreeItem item = items[i]; if (item.isDisposed()) continue; final File itemFile = (File) item.getData(TREEITEMDATA_FILE); if (itemFile != null && itemFile.equals(element)) return item; } return null; } /** * Listens to refreshFiles events. * <p> * Refreshes information about any files in the list and their children. * </p> * * @param files the list of files to be refreshed, null refreshes everything */ /* package */ void refreshFiles(File[] files) { if (files == null) { File[] roots = viewer.getRoots(); tree.removeAll(); for (int i = 0; i < roots.length; ++i) { final File file = roots[i]; TreeItem item = new TreeItem(tree, SWT.NULL); initTreeItemVolume(item, file); // add a placeholder child item so we get the "expand" button TreeItem placeholderItem = new TreeItem(item, SWT.NULL); } } } /** * Initializes a volume item. * * @param item the TreeItem to initialize * @param volume the File associated with this TreeItem */ private void initTreeItemVolume(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]); } /** * Initializes a folder item. * * @param item the TreeItem to initialize * @param folder the File associated with this TreeItem */ private void initTreeItemFolder(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]); } } \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/UpdateWorker.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/UpdateWorker.java
deleted file mode 100755
index 7a03240f33..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/UpdateWorker.java
+++ /dev/null
@@ -1 +0,0 @@
-package org.eclipse.swt.examples.fileviewer; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved */ import org.eclipse.swt.widgets.*; /** * Provides facilities for running worker threads that can be aborted and * restarted on the presence of new data. * * Cooperates appropriately with the SWT event queue. */ public abstract class UpdateWorker implements Runnable { private Display display; private volatile Thread thread; private volatile boolean stopped; private volatile boolean cancelled; private volatile Object newData, activeData; /** * Constructs an UpdateWorker * * @param display the SWT Display running the event queue */ public UpdateWorker(Display display) { this.display = display; this.newData = null; thread = new Thread(this); } /** * Stops the UpdateWorker and waits for it to terminate */ final public void syncStop() { synchronized(this) { cancelled = true; stopped = true; notifyAll(); } while (thread != null && display.readAndDispatch()) display.sleep(); } /** * Notifies the UpdateWorker that it should update itself with new data. * Cancels any previous operation and begins a new one. * * @param data the new data argument */ final public void asyncUpdate(Object newData) { synchronized(this) { this.newData = newData; stopped = false; cancelled = true; notifyAll(); } if (! thread.isAlive()) { stopped = false; thread.start(); } } /** * Notifies the UpdateWorker that it should quit what it is doing and start over * with the same data argument as before. */ final public void asyncRestart() { asyncUpdate(newData); } /** * Internal implementation Detail. */ final public void run() { while (! stopped) { try { synchronized(this) { cancelled = false; activeData = newData; } execute(activeData); synchronized(this) { if (! cancelled) wait(); } } catch (Throwable e) { e.printStackTrace(); } } thread = null; } /** * Determines if the current session has been cancelled due to new data or a syncStop(). * <p> * Subclass implementors should poll this and terminate processing as soon as possible. * </p> * @return true iff the current session has been cancelled */ final protected boolean isCancelled() { return cancelled; } /** * Gets the data argument for the current session * <p> * Subclass implementors should check this value if they don't want to remember the value * they received at execute() time. * </p> */ final protected Object getData() { return activeData; } /** * Executes an operation. * <p> * Subclass implementors must supply a definition for this method that performs the * desired cancellable operation. * </p> * @param data the data argument for the current session */ protected abstract void execute(Object data); } \ No newline at end of file
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
deleted file mode 100755
index 4274b070ac..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Copy.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index eb948b94b0..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Cut.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 6f647666d3..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Delete.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 9b278e6fa8..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Parent.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 75e0ab2352..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Paste.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 4dfa8cd3fa..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Print.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index a063c230ac..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Refresh.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 25b1325e52..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Rename.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 6dc3ebefc9..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/cmd_Search.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index f9fb6b0cab..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/generic_example.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 04e530e37c..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedDrive.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index beb6ed134c..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_ClosedFolder.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 6b86d07978..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_File.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 7b2b6334ca..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenDrive.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index a9c777343c..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/fileviewer/icon_OpenFolder.gif
+++ /dev/null
Binary files differ
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 9126eaa3be..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld1.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-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 Shell (display);
- shell.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-}
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 6dfe3d07f4..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld2.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-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 Shell (display);
- Label label = new Label (shell, SWT.CENTER);
- label.setText (resHello.getString("Hello_world"));
- label.setBounds (shell.getClientArea ());
- shell.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-}
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 acfa7c1f13..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld3.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-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 ();
- 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 ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-}
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 7c1b36d385..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld4.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-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 Shell (display);
- shell.setLayout(new FillLayout());
- Label label = new Label (shell, SWT.CENTER);
- label.setText (resHello.getString("Hello_world"));
- shell.pack ();
- shell.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- display.dispose ();
-}
-}
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 056054c772..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/helloworld/HelloWorld5.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.swt.examples.helloworld;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-
-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 ();
- 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.open ();
- while (!shell.isDisposed ()) {
- if (!display.readAndDispatch ()) display.sleep ();
- }
- red.dispose();
- display.dispose ();
-}
-}
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 82af776ea6..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/HoverHelp.java
+++ /dev/null
@@ -1,336 +0,0 @@
-package org.eclipse.swt.examples.hoverhelp;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
- 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) {
- resourceBundle = ResourceBundle.getBundle("examples_hoverhelp");
- new HoverHelp().open();
- }
-
- /**
- * Opens the main program.
- */
- public void open() {
- // Create the display
- Display display = new 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 (Throwable ex) {
- System.err.println(getResourceString("error.CouldNotLoadResources",
- new Object[] { ex.getMessage() }));
- display.dispose();
- return;
- }
-
- // Create the window
- Shell shell = new Shell();
- createPartControl(shell);
- shell.pack();
- shell.open();
-
- // Event loop
- while (! shell.isDisposed()) {
- if (! display.readAndDispatch()) display.sleep();
- }
-
- // Cleanup
- display.dispose();
-
- /* 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;
- }
- }
-
- /**
- * 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.NONE);
- 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
deleted file mode 100755
index 26c7477336..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/information.gif
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index cf4fdf93c7..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/hoverhelp/warning.gif
+++ /dev/null
Binary files differ
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 29d962c66c..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/imageanalyzer/ImageAnalyzer.java
+++ /dev/null
@@ -1,1858 +0,0 @@
-package org.eclipse.swt.examples.imageanalyzer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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 java.util.*;
-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,
- screenSizeLabel, backgroundPixelLabel, locationLabel,
- disposalMethodLabel, delayTimeLabel, repeatCountLabel,
- paletteLabel, dataLabel, statusLabel;
- Combo backgroundCombo, scaleXCombo, scaleYCombo, alphaCombo;
- Button incrementalCheck, transparentCheck, maskCheck, backgroundCheck;
- Button previousButton, nextButton, animateButton;
- Text 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 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
-
- static final int ALPHA_CONSTANT = 0;
- static final int ALPHA_X = 1;
- static final int ALPHA_Y = 2;
-
- public static void main(String [] args) {
- ImageAnalyzer imageAnalyzer = new ImageAnalyzer();
- imageAnalyzer.open();
- }
-
- void open() {
- // Create a window and set its title.
- shell = new Shell();
- 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 event) {
- if (animate && animateThread != null) {
- // Stop the animation and wait for the
- // thread to die before disposing the shell.
- animate = false;
- while (animateThread.isAlive()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- }
- }
- });
-
- // Create colors and fonts.
- display = shell.getDisplay();
- 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.
- imageCanvasGC = new GC(imageCanvas);
-
- // Open the window, and run an event loop until the window is closed.
- shell.open();
- while (!shell.isDisposed())
- if (!display.readAndDispatch()) display.sleep();
-
- // Clean up.
- if (image != null)
- image.dispose();
- whiteColor.dispose();
- blackColor.dispose();
- redColor.dispose();
- greenColor.dispose();
- blueColor.dispose();
- fixedWidthFont.dispose();
- crossCursor.dispose();
- imageCanvasGC.dispose();
- }
-
- 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();
- }
- });
-
- // Separate the control widgets from the rest of the widgets.
-// Label separator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
-// gridData = new GridData();
-// gridData.horizontalSpan = 2;
-// gridData.horizontalAlignment = GridData.FILL;
-// separator.setLayoutData(gridData);
-
- // 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 = 14;
- 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));
-
- // 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 Text(shell, SWT.BORDER | SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL);
- 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...
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Open"));
- item.setAccelerator(SWT.CTRL + 'O');
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuOpen();
- }
- });
-
- // 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 -> Exit
- item = new MenuItem(fileMenu, SWT.NULL);
- item.setText(bundle.getString("Exit"));
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- animate = false; // stop any animation in progress
- 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 menuOpen() {
- 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.
- imageDataArray = loader.load(filename);
- if (imageDataArray.length > 0) {
-
- // Cache the 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();
- }
- }
-
- /*
- * 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(null, 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) {
- 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);
- 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);
- 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 menuReopen() {
- if (fileName == 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();
- ImageData[] newImageData = loader.load(fileName);
- imageDataIndex = 0;
- displayImage(newImageData[imageDataIndex]);
-
- } catch (SWTException e) {
- showErrorDialog(bundle.getString("Reloading_lc"), fileName, 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);
- }
- // Fill the image canvas with the background color.
- Rectangle clientArea = imageCanvas.getClientArea();
- imageCanvasGC.fillRectangle(
- clientArea.x,
- clientArea.y,
- clientArea.width,
- clientArea.height);
- if (image != null) {
- imageCanvas.redraw();
- }
- }
-
- /*
- * 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.getCaretPosition();
- 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)),
- fileName, 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(null, 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(null, 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(null, newImageData);
- imageData = newImageData;
-
- } catch (SWTException e) {
- showErrorDialog(bundle.getString("Creating_from") + " ", fileName, e);
- image = null;
- return;
- }
-
- // Update the widgets with the new image info.
- String string = createMsg(bundle.getString("Analyzer_on"), fileName);
- 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("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);
-
- dataText.setText(dataHexDump(dataText.getLineDelimiter()));
- 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, SWTException e) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- String message = createMsg(bundle.getString("Error"), new String[] {operation, filename});
-
- String errorMessage = e.getMessage();
- if (e.throwable != null) {
- errorMessage += ":\n" + e.throwable.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 35278148c6..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaLineStyler.java
+++ /dev/null
@@ -1,367 +0,0 @@
-package org.eclipse.swt.examples.javaviewer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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; // single line comment: //
- 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 (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) {
- styles.addElement(new StyleRange(event.lineOffset, event.lineText.length(), colors[1], null));
- event.styles = new StyleRange[styles.size()];
- styles.copyInto(event.styles);
- return;
- }
- scanner.setRange(event.lineText);
- token = scanner.nextToken();
- while (token != EOF) {
- if (token == OTHER) {
- // do nothing
- } else if ((token == WHITE) && (!styles.isEmpty())) {
- int start = scanner.getStartOffset() + event.lineOffset;
- lastStyle = (StyleRange)styles.lastElement();
- if (lastStyle.fontStyle != SWT.NORMAL) {
- if (lastStyle.start + lastStyle.length == start) {
- // have the white space take on the style before it to minimize font style
- // changes
- lastStyle.length += scanner.getLength();
- }
- }
- } else {
- Color color = getColor(token);
- if (color != colors[0]) { // hardcoded default foreground color, black
- 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 {
- lastStyle = (StyleRange)styles.lastElement();
- if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) {
- lastStyle.length += style.length;
- } else {
- styles.addElement(style);
- }
- }
- }
- }
- 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 80e2776b51..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/javaviewer/JavaViewer.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package org.eclipse.swt.examples.javaviewer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
-*/
-
-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 implements DisposeListener {
- Shell shell;
- StyledText text;
- JavaLineStyler lineStyler = new JavaLineStyler();
- static ResourceBundle resources = ResourceBundle.getBundle("examples_javaviewer");
-
-public void close () {
- if (shell != null && !shell.isDisposed ())
- shell.dispose ();
- lineStyler.disposeColors();
-}
-public void widgetDisposed (DisposeEvent event) {
- text.removeLineStyleListener(lineStyler);
- text.removeDisposeListener(this);
-}
-
-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 () {
- shell = new Shell ();
- shell.setText (resources.getString("Window_title"));
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- shell.setSize(500, 400);
- shell.setLayout(layout);
-}
-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.addDisposeListener(this);
- 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) {
- JavaViewer example = new JavaViewer ();
- example.open ();
- example.run ();
- example.close ();
-}
-
-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 ();
-}
-
-public void open () {
- createShell ();
- createMenuBar ();
- createStyledText ();
- shell.open ();
-}
-
-public void run () {
- Display display = shell.getDisplay ();
- while (!shell.isDisposed ())
- if (!display.readAndDispatch ()) display.sleep ();
-}
-
-
-}
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 a57ad25b53..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/Images.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.swt.examples.texteditor;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import java.io.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-public class Images {
-
- // Bitmap Images
- public static Image Bold;
- public static Image Red;
- public static Image Green;
- public static Image Blue;
- public static Image Erase;
-
- static Image [] AllBitmaps;
-
-public static void freeAll () {
- for (int i=0; i<AllBitmaps.length; i++) AllBitmaps [i].dispose ();
- AllBitmaps = null;
-}
-
-static 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 static 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 b3455b6b32..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java
+++ /dev/null
@@ -1,355 +0,0 @@
-package org.eclipse.swt.examples.texteditor;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-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;
-
- 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");
-
-/*
- * Free the allocated resources.
- */
-public void close () {
- if (shell != null && !shell.isDisposed ())
- shell.dispose ();
- if (font != null) font.dispose();
- Images.freeAll ();
- RED.dispose();
- GREEN.dispose();
- BLUE.dispose();
-}
-
-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;
-}
-/*
- * 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 () {
- shell = new Shell ();
- shell.setText (resources.getString("Window_title"));
- Images.loadAll (shell.getDisplay ());
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- shell.setSize(500, 300);
- shell.setLayout(layout);
-}
-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) {
- TextEditor example = new TextEditor ();
- example.open ();
- example.run ();
- example.close ();
-}
-
-void open () {
- createShell ();
- createMenuBar ();
- createToolBar ();
- createStyledText ();
- shell.open ();
-}
-
-void run () {
- Display display = shell.getDisplay ();
- while (!shell.isDisposed ())
- if (!display.readAndDispatch ()) display.sleep ();
-}
-
-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
deleted file mode 100755
index 84c7ac9a46..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue.bmp
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 6ce92645e5..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/blue_mask.bmp
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index a3184bb26c..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold.bmp
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 382751efa3..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/bold_mask.bmp
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 1d2ace7ee3..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase.bmp
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index f6ab21e471..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/erase_mask.bmp
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index cca023fd57..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green.bmp
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 6ce92645e5..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/green_mask.bmp
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 88c63be336..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red.bmp
+++ /dev/null
Binary files differ
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
deleted file mode 100755
index 6ce92645e5..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/red_mask.bmp
+++ /dev/null
Binary files differ

Back to the top