From 2ce56e593aae79c5d62b76ce3a484a371a5fa554 Mon Sep 17 00:00:00 2001
From: cvs2svn 20th June, 2002 Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html.
-For purposes of the CPL, "Program" will mean the Content. If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL. If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or
-other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.
-The Controls example is a simple demonstration of common SWT controls.
-It consists of a tab folder where each tab in the folder allows the user
-to interact with a different control.
-The user can change styles and settings and view how this affects the control.
- From the Window menu select Show View --> Other.
-In the Show View dialog, expand SWT Examples and select the
-view named SWT Controls. A view titled SWT Controls will appear in your current perspective.
- 20th June, 2002 Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html.
-For purposes of the CPL, "Program" will mean the Content. If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL. If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or
-other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.
-The Example Launcher is used to launch SWT examples which can either be Workbench Views,
-or Standalone applications.
-
-From the Window menu, select Show View --> Other.
-In the Show View dialog, expand SWT Examples and select the SWT Example Launcher view.
-A view containing a list of examples will appear in your current perspective.
-Select an example from the list. A brief description of the example is displayed.
-Click on the Run button to launch the example.
- The example launcher view contains a tree list, a text area, and a button.
-The tree list contains a list of all the SWT examples you can choose
-to run. When an example is selected from the tree, the text area
-displays a short description of the example. The selected example can
-be launched by clicking on the Run button. Standalone examples are run in the
-same thread as the workbench's UI but they are not integrated into the perspective.
-The launcher invokes the <!ELEMENT extension EMPTY>
- <!ELEMENT program EMPTY>
- <!ELEMENT view EMPTY>
- <!ELEMENT category EMPTY>
- <!ELEMENT item EMPTY>
- 20th June, 2002 Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html.
-For purposes of the CPL, "Program" will mean the Content. If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL. If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or
-other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.
-This example is a simple demonstration of common SWT layouts.
-It consists of a tab folder where each tab allows the
-user to interact with a different SWT layout.
-The user can insert widgets into a layout and set the values of the layout data
-using a property sheet. When the user has a suitable arrangement, code can be
-generated by clicking on the Code button.
- From the Window menu select Show View --> Other.
-In the Show View dialog, expand SWT Examples and select the
-view named SWT Layouts. A view titled SWT Layouts will appear in your current perspective.
- 20th June, 2002 Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html.
-For purposes of the CPL, "Program" will mean the Content. If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL. If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or
-other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.
-This example demonstrates how to embed an Active X control into an SWT application or an Eclipse view.
-
-About This Content
-
-License
-Contributions
-
-
-Notices
-(c) Copyright IBM Corp. 2000, 2002. All Rights Reserved.
-
-
diff --git a/examples/org.eclipse.swt.examples.controls/doc-html/ngibmcpy2002.gif b/examples/org.eclipse.swt.examples.controls/doc-html/ngibmcpy2002.gif
deleted file mode 100644
index 61cef48521..0000000000
Binary files a/examples/org.eclipse.swt.examples.controls/doc-html/ngibmcpy2002.gif and /dev/null 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 d18d828525..0000000000
--- a/examples/org.eclipse.swt.examples.controls/doc-html/swt_controls_ex.html
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
- SWT Example - Controls Example
-
-Running the example
-Controls
is a simple demonstration
- * of the controls defined by SWT. It consists of a workbench
- * view and tab folder where each tab in the folder allows the
- * user to interact with a control.
- *
- * @see ViewPart
- */
-public class ControlView extends ViewPart {
- ControlExample instance = null;
-
- /**
- * Create the example
- *
- * @see ViewPart#createPartControl
- */
- public void createPartControl(Composite frame) {
- instance = new ControlExample(frame);
- }
-
- /**
- * Called when we must grab focus.
- *
- * @see org.eclipse.ui.part.ViewPart#setFocus
- */
- public void setFocus() {
- instance.setFocus();
- }
-
- /**
- * Called when the View is to be disposed
- */
- public void dispose() {
- instance.dispose();
- instance = null;
- super.dispose();
- }
-}
diff --git a/examples/org.eclipse.swt.examples.launcher/.classpath b/examples/org.eclipse.swt.examples.launcher/.classpath
deleted file mode 100755
index eafbb18026..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/.classpath
+++ /dev/null
@@ -1,12 +0,0 @@
-
-About This Content
-
-License
-Contributions
-
-
-Notices
-(c) Copyright IBM Corp. 2000, 2002. All Rights Reserved.
-
-
diff --git a/examples/org.eclipse.swt.examples.launcher/doc-html/ngibmcpy2002.gif b/examples/org.eclipse.swt.examples.launcher/doc-html/ngibmcpy2002.gif
deleted file mode 100644
index 61cef48521..0000000000
Binary files a/examples/org.eclipse.swt.examples.launcher/doc-html/ngibmcpy2002.gif and /dev/null 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 6ed28916dc..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/doc-html/swt_launcher_ex.html
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
- SWT Example Launcher
-
-
-
-
-Running the Example Launcher
-
-Details
-open()
method of the standalone example.
-
-Identifier
-org.eclipse.swt.examples.launcher.launchItemsDescription
-This extension point is used to add 'standalone program' and
-'Workbench view'
-launch items to the Launcher, optionally grouping them into
-categories so as to form a multi-tiered hierarchy.
-Standalone programs are executed using the platform's event loop.
-Workbench views are created within the active Workbench Perspective.Markup
-
<!ATTLIST extension
-
point CDATA #REQUIRED
-
id CDATA #IMPLIED
-
name CDATA #IMPLIED
-
>
-
-
-
<!ATTLIST program
-
mainClass CDATA #REQUIRED
-
pluginId CDATA #REQUIRED
-
>
-
-
-
<!ATTLIST view
-
viewId CDATA #REQUIRED
-
>
-
-
-
<!ATTLIST category
-
name CDATA #REQUIRED
-
id CDATA #REQUIRED
-
category CDATA #IMPLIED
-
>
-
-
-
<!ATTLIST item
-
name CDATA #REQUIRED
-
id CDATA #REQUIRED
-
category CDATA #IMPLIED
-
icon CDATA #IMPLIED
-
enabled (true | false) "false""true"
-
description CDATA #IMPLIED
-
>
-
-
-Example
-API Information
-Supplied Implementation
-
-
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
Binary files a/examples/org.eclipse.swt.examples.launcher/icons/closedFolder.gif and /dev/null 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
Binary files a/examples/org.eclipse.swt.examples.launcher/icons/generic_example.gif and /dev/null 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
Binary files a/examples/org.eclipse.swt.examples.launcher/icons/launcher_example.gif and /dev/null 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
Binary files a/examples/org.eclipse.swt.examples.launcher/icons/openFolder.gif and /dev/null differ
diff --git a/examples/org.eclipse.swt.examples.launcher/plugin.properties b/examples/org.eclipse.swt.examples.launcher/plugin.properties
deleted file mode 100755
index 05c328a5f7..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/plugin.properties
+++ /dev/null
@@ -1,39 +0,0 @@
-providerName = Eclipse.org
-plugin.SWTLauncherExample.name = SWT Launcher Example Plugin
-category.SWTExamples.name = SWT Examples
-view.LauncherExample.name = SWT Example Launcher
-
-extension-point.launchItems.name = Launch Items
-
-launchcategory.SWTViewExamples.name = Workbench Views
-launchcategory.SWTViewExamples.description = \
- A collection of Standard Widget Toolkit examples that run as Views inside the Workbench. \
- These examples will create a new View in the current Perspective.
-
-launchitem.LauncherExample.name = Launcher
-launchitem.LauncherExample.description = \
- The Example Launcher is used to launch SWT examples which can either be \
- Workbench Views, or Standalone applications.\n\n\
- Workbench Views are examples that are integrated into Eclipse. When the Launcher \
- starts a Workbench View, it is opened in the currently active perspective.\n\n\
- Standalone applications are launched in a separate window.
-
-error.CouldNotLoadResources = Unable to load resources
-error.CouldNotFindRegisteredExtensions = Could Not Find Registered Extensions
-error.IncompleteProgramLaunchItem = Incomplete XML ProgramLaunchItem definition, id = {0}
-error.IncompleteViewLaunchItem = Incomplete XML ViewLaunchItem definition, id = {0}
-error.IncompleteLaunchItem = Incomplete or unrecognized XML LaunchItem definition, id = {0}
-
-launchitem.Null.description = <org.eclipse.swt
- * to launch the other registered examples.
- *
- * @see ViewPart
- */
-public class LauncherView extends ViewPart {
- private Shell workbenchShell;
-
- private Tree launchTree;
- private Text descriptionText;
- private Button runButton;
-
- /**
- * Constructs a LauncherView.
- */
- public LauncherView() {
- LauncherPlugin.initResources();
- }
-
- /**
- * Creates the example.
- *
- * @see ViewPart#createPartControl
- */
- public void createPartControl(Composite parent) {
- workbenchShell = getSite().getShell();
- parent.setLayout(new SplitLayout());
-
- Group launchGroup = new Group(parent, SWT.NULL);
- launchGroup.setText(LauncherPlugin.getResourceString("view.launchGroup.text"));
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- launchGroup.setLayout(gridLayout);
-
- launchTree = new Tree(launchGroup, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- gridData.horizontalSpan = 2;
- launchTree.setLayoutData(gridData);
- launchTree.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- final ItemDescriptor item = getSelectedItem();
- setDescriptionByItem(item);
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- final ItemDescriptor item = getSelectedItem();
- setDescriptionByItem(item);
- launchItem(getSelectedItem());
- }
- });
- launchTree.addTreeListener(new TreeListener() {
- public void treeCollapsed(TreeEvent event) {
- final TreeItem item = (TreeItem) event.item;
- if (item == null) return;
- item.setImage(LauncherPlugin.images[LauncherPlugin.liClosedFolder]);
- }
- public void treeExpanded(TreeEvent event) {
- final TreeItem item = (TreeItem) event.item;
- if (item == null) return;
- item.setImage(LauncherPlugin.images[LauncherPlugin.liOpenFolder]);
- }
- });
-
- runButton = new Button(launchGroup, SWT.PUSH);
- runButton.setText(LauncherPlugin.getResourceString("view.launchButton.text"));
- runButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- launchItem(getSelectedItem());
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- }
- });
-
- Group descriptionGroup = new Group(parent, SWT.NULL);
- descriptionGroup.setText(LauncherPlugin.getResourceString("view.descriptionGroup.text"));
- descriptionGroup.setLayout(new FillLayout());
-
- descriptionText = new Text(descriptionGroup, SWT.MULTI | SWT.BORDER |
- SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY);
-
- setDescriptionByItem(null);
- setItemDescriptors(LauncherPlugin.getLaunchItemTree());
- }
-
- /**
- * Called when we must grab focus.
- *
- * @see org.eclipse.ui.part.ViewPart#setFocus
- */
- public void setFocus() {
- launchTree.setFocus();
- runButton.getShell().setDefaultButton(runButton);
- }
-
- /**
- * Called when the View is to be disposed
- */
- public void dispose() {
- workbenchShell = null;
- launchTree = null;
- descriptionText = null;
- runButton = null;
- super.dispose();
- }
-
- /**
- * Installs a new launch list.
- *
- * @param newRoot the new tree of launch items for the UI
- */
- public void setItemDescriptors(final ItemTreeNode newRoot) {
- if (workbenchShell == null) return;
- workbenchShell.getDisplay().syncExec(new Runnable() {
- public void run() {
- if ((launchTree == null) || (launchTree.isDisposed())) return;
- launchTree.removeAll();
-
- for (ItemTreeNode node = newRoot.getFirstChild(); node != null;
- node = node.getNextSibling()) {
- doNode(node, new TreeItem(launchTree, SWT.NONE)); // top-level TreeItem
- }
- }
- private void addGroup(TreeItem parent, ItemTreeNode node) {
- for (;node != null; node = node.getNextSibling()) {
- doNode(node, new TreeItem(parent, SWT.NONE)); // TreeItem at depth > 0
- }
- }
- private void doNode(ItemTreeNode node, TreeItem treeItem) {
- final ItemDescriptor item = node.getDescriptor();
- treeItem.setText(item.getName());
- treeItem.setData(item);
- if (node.getDescriptor().isFolder()) {
- treeItem.setExpanded(false);
- treeItem.setImage(LauncherPlugin.images[LauncherPlugin.liClosedFolder]);
- } else {
- treeItem.setImage(node.getDescriptor().getIcon());
- }
- addGroup(treeItem, node.getFirstChild());
- }
- });
- }
-
- /**
- * Runs the specified launch item.
- *
- * @param itemDescriptor the launch item to execute
- */
- private void launchItem(ItemDescriptor itemDescriptor) {
- /* Case 1: The launch item is a view */
- String pluginViewId = itemDescriptor.getView ();
- if (pluginViewId != null) {
- final IWorkbenchPart workbenchPart = this;
- final IWorkbenchPartSite workbenchPartSite = workbenchPart.getSite();
- final IWorkbenchPage workbenchPage = workbenchPartSite.getPage();
- try {
- workbenchPage.showView(pluginViewId);
- } catch (PartInitException e) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.Invocation"), e);
- }
- return;
- }
- /* Case 2: The launch item is a standalone program */
- if (workbenchShell == null) return;
- try {
- Class cl = Class.forName(itemDescriptor.getMainType());
- Display display = workbenchShell.getDisplay();
- Object exampleInstance = cl.newInstance();
- Method openMethod = cl.getDeclaredMethod("open", new Class[] {Display.class});
- openMethod.invoke(exampleInstance, new Object[] {display});
- } catch (NoSuchMethodException e) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.DoesNotImplementMethod"), null);
- } catch (ClassNotFoundException e) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.CouldNotFindClass"), e);
- } catch (Exception e) {
- LauncherPlugin.logError(LauncherPlugin.getResourceString("run.error.CouldNotInstantiateClass"), e);
- }
- }
-
- /**
- * Obtains the selected launch item.
- *
- * @return the currently selected ItemDescriptor
- */
- private ItemDescriptor getSelectedItem() {
- final TreeItem[] selections = launchTree.getSelection();
- if (selections.length == 0) return null;
- final ItemDescriptor itemDescriptor = (ItemDescriptor) selections[0].getData();
- return itemDescriptor;
- }
-
- /**
- * Sets the currently visible description text to reflect that of a particular ItemDescriptor.
- *
- * @param itemDescriptor the launch item whose description is to be displayed, or null if none
- */
- private void setDescriptionByItem(ItemDescriptor itemDescriptor) {
- String description;
- if (itemDescriptor == null) {
- description = LauncherPlugin.getResourceString("launchitem.Null.description");
- if (runButton != null) runButton.setEnabled(false);
- } else {
- description = itemDescriptor.getDescription();
- if (description == null)
- description = LauncherPlugin.getResourceString("launchitem.Missing.description");
- if (runButton != null) {
- runButton.setEnabled(itemDescriptor.getView() != null || itemDescriptor.getMainType() != null);
- }
- }
- descriptionText.setText(description);
- }
-}
\ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/SplitLayout.java b/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/SplitLayout.java
deleted file mode 100755
index 6eee1cdb9d..0000000000
--- a/examples/org.eclipse.swt.examples.launcher/src/org/eclipse/swt/examples/launcher/SplitLayout.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.eclipse.swt.examples.launcher;
/*
* (c) Copyright IBM Corp. 2000, 2002.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
*/
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
/**
* A Layout class that automatically switches from a horizontal split to a vertical
* split layout to accomodate changing size conditions.
*
* Later on we might improve this class to take into account the "preferred" size of
* the widgets.
*/
-public class SplitLayout extends Layout {
private static final int
splitHorizontally = 0,
splitVertically = 1;
private int splitDirection = splitHorizontally;
public int spacing = 3;
public int marginTop = 3;
- public int marginLeft = 3;
public int marginRight = 3;
public int marginBottom = 3;
/**
- * Creates a new layout
- */
- public SplitLayout() {
}
-
/**
* @see Layout#computeSize(Composite, int, int, boolean)
*/
protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
if (wHint == SWT.DEFAULT) {
if (hHint == SWT.DEFAULT) {
Point hSplitSize = computeHSplitSize(composite, wHint, hHint, flushCache);
Point vSplitSize = computeVSplitSize(composite, wHint, hHint, false);
int hSplitArea = hSplitSize.x * hSplitSize.y;
int vSplitArea = vSplitSize.x * vSplitSize.y;
// Choose direction consuming least area
if (hSplitArea < vSplitArea) {
splitDirection = splitHorizontally;
return hSplitSize;
} else {
splitDirection = splitVertically;
return vSplitSize;
}
} else {
// Constrained in height: split vertically
splitDirection = splitVertically;
return computeVSplitSize(composite, wHint, hHint, flushCache);
}
} else {
if (hHint == SWT.DEFAULT) {
// Constrained in width: split horizontally
splitDirection = splitHorizontally;
return computeHSplitSize(composite, wHint, hHint, flushCache);
} else {
if (hHint < wHint) {
splitDirection = splitVertically;
return computeVSplitSize(composite, wHint, hHint, flushCache);
} else {
splitDirection = splitHorizontally;
return computeHSplitSize(composite, wHint, hHint, flushCache);
}
}
}
}
- /**
- * @see Layout#layout(Composite, boolean)
- */
- protected void layout(Composite composite, boolean flushCache) {
Rectangle clientArea = composite.getClientArea();
computeSize(composite, clientArea.width, clientArea.height, false);
Control[] children = composite.getChildren();
clientArea.x += marginLeft;
clientArea.y += marginTop;
clientArea.width -= marginRight + marginLeft;
clientArea.height -= marginBottom + marginTop;
Point position = new Point(clientArea.x, clientArea.y);
for (int i = 0; i < children.length; ++i) {
final Control child = children[i];
final Rectangle bounds;
if (splitDirection == splitHorizontally) {
int height = clientArea.height / children.length;
bounds = new Rectangle(position.x, position.y, clientArea.width, height);
position.y += height + spacing;
} else {
int width = clientArea.width / children.length;
bounds = new Rectangle(position.x, position.y, width, clientArea.height);
position.x += width + spacing;
}
bounds.width = Math.max(bounds.width, 0);
bounds.height = Math.max(bounds.height, 0);
child.setBounds(bounds);
}
}
-
private Point computeHSplitSize(Composite composite, int wHint, int hHint, boolean flushCache) {
Point size = new Point(marginLeft + marginRight, marginTop + marginBottom);
Control[] children = composite.getChildren();
for (int i = 0; i < children.length; ++i) {
final Control child = children[i];
Point childSize = child.computeSize(wHint, hHint, flushCache);
size.x = Math.max(size.x, childSize.x);
size.y += childSize.y + spacing;
}
return size;
}
private Point computeVSplitSize(Composite composite, int wHint, int hHint, boolean flushCache) {
Point size = new Point(marginLeft + marginRight, marginTop + marginBottom);
Control[] children = composite.getChildren();
for (int i = 0; i < children.length; ++i) {
final Control child = children[i];
Point childSize = child.computeSize(wHint, hHint, flushCache);
size.x += childSize.x + spacing;
size.y = Math.max(size.y, childSize.y);
}
return size;
}
}
diff --git a/examples/org.eclipse.swt.examples.layouts/.classpath b/examples/org.eclipse.swt.examples.layouts/.classpath
deleted file mode 100644
index da6f3cc359..0000000000
--- a/examples/org.eclipse.swt.examples.layouts/.classpath
+++ /dev/null
@@ -1,11 +0,0 @@
-
-About This Content
-
-License
-Contributions
-
-
-Notices
-(c) Copyright IBM Corp. 2000, 2002. All Rights Reserved.
-
-
diff --git a/examples/org.eclipse.swt.examples.layouts/doc-html/ngibmcpy2002.gif b/examples/org.eclipse.swt.examples.layouts/doc-html/ngibmcpy2002.gif
deleted file mode 100644
index 61cef48521..0000000000
Binary files a/examples/org.eclipse.swt.examples.layouts/doc-html/ngibmcpy2002.gif and /dev/null differ
diff --git a/examples/org.eclipse.swt.examples.layouts/doc-html/swt_layout_ex.html b/examples/org.eclipse.swt.examples.layouts/doc-html/swt_layout_ex.html
deleted file mode 100644
index d021ab39fa..0000000000
--- a/examples/org.eclipse.swt.examples.layouts/doc-html/swt_layout_ex.html
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
- SWT Example - Layout Overview
-
-Running the example
-
-Layouts
is a simple demonstration
- * of the layouts defined by SWT. It consists of a workbench
- * view and tab folder where each tab in the folder allows the
- * user to interact with a layout.
- *
- * @see ViewPart
- */
-public class LayoutView extends ViewPart {
- LayoutExample instance = null;
-
- /**
- * Create the example
- *
- * @see ViewPart#createPartControl
- */
- public void createPartControl(Composite frame) {
- instance = new LayoutExample(frame);
- }
-
- /**
- * Called when we must grab focus.
- *
- * @see org.eclipse.ui.part.ViewPart#setFocus
- */
- public void setFocus() {
- instance.setFocus();
- }
-
- /**
- * Called when the View is to be disposed
- */
- public void dispose() {
- instance.dispose();
- instance = null;
- super.dispose();
- }
-}
diff --git a/examples/org.eclipse.swt.examples.ole.win32/.classpath b/examples/org.eclipse.swt.examples.ole.win32/.classpath
deleted file mode 100755
index 34eb16e15f..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/.classpath
+++ /dev/null
@@ -1,10 +0,0 @@
-
-About This Content
-
-License
-Contributions
-
-
-Notices
-(c) Copyright IBM Corp. 2000, 2002. All Rights Reserved.
-
-
diff --git a/examples/org.eclipse.swt.examples.ole.win32/doc-html/ngibmcpy2002.gif b/examples/org.eclipse.swt.examples.ole.win32/doc-html/ngibmcpy2002.gif
deleted file mode 100644
index 61cef48521..0000000000
Binary files a/examples/org.eclipse.swt.examples.ole.win32/doc-html/ngibmcpy2002.gif and /dev/null 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 8191de138f..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/doc-html/swt_ole_ex.html
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
- Example - OLE Web Browser
-
-
-From the Window menu select Show View --> Other. -In the Show View dialog, expand SWT Examples and select -the view named OLE Web Browser (Win32). A view containing a web browser will appear. -
- - - - 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 Binary files a/examples/org.eclipse.swt.examples.ole.win32/icons/backward_nav.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.ole.win32/icons/forward_nav.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.ole.win32/icons/home_nav.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.ole.win32/icons/refresh_nav.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.ole.win32/icons/search_nav.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.ole.win32/icons/stop_nav.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.ole.win32/icons/webbrowser_example.gif and /dev/null differ diff --git a/examples/org.eclipse.swt.examples.ole.win32/plugin.properties b/examples/org.eclipse.swt.examples.ole.win32/plugin.properties deleted file mode 100755 index 82d8e49fe5..0000000000 --- a/examples/org.eclipse.swt.examples.ole.win32/plugin.properties +++ /dev/null @@ -1,50 +0,0 @@ -providerName = Eclipse.org -plugin.SWTOLEExample.name = SWT OLE Example Plugin (Win32) -category.SWTExamples.name = SWT Examples -view.OLEWebBrowserExample.name = OLE Web Browser (Win32) - -launchcategory.SWTWin32OnlyExamples.name = Win32 only -launchcategory.SWTWin32OnlyExamples.description = \ - A collection of Standard Widget Toolkit examples for Windows systems only. - -launchitem.OLEWebBrowserExample.name = OLE Web Browser -launchitem.OLEWebBrowserExample.description = \ - This example demonstrates how to embed an Active X control into an SWT application or an Eclipse view.\n\n\ - When the view is opened, it will create an instance of the Windows Internet Explorer \ - control. The OLE Web Browser has \ - Back and Forward buttons to take you to recently visited pages. The browser also contains \ - a Home button to take you to the web browser's home page, a Stop button which stops the \ - current transfer, a Search button which will search for text typed in the Address text field, and \ - a Refresh button which re-draws the contents of the currently displayed page. There is also a \ - Go button which, when clicked, will attempt to load the page specified in the Address field. - -browser.Back.text = Backward -browser.Back.tooltip = Go to previous Web site in the history list - -browser.Forward.text = Forward -browser.Forward.tooltip = Go to next Web site in the history list - -browser.Home.text = Home -browser.Home.tooltip = Go to home Web site - -browser.Stop.text = Stop -browser.Stop.tooltip = Stop loading current Web site - -browser.Refresh.text = Refresh -browser.Refresh.tooltip = Refresh current Web site - -browser.Search.text = Search -browser.Search.tooltip = Search the Web - -browser.Address.label = Address : - -browser.Go.text = Go - -browser.State.Uninitialized.text = Not ready. -browser.State.Loading.text = Loading Web site... -browser.State.Loaded.text = Ready. -browser.State.Interactive.text = Loading Web site... -browser.State.Complete.text = Done. - -error.CouldNotLoadResources = Unable to load resources -error.CouldNotCreateBrowserControl = Unable to create <org.eclipse.swt
to demonstrate Win32 OLE / ActiveX
- * integration.
- *
- * @see ViewPart
- */
-public class OleBrowserView extends ViewPart {
-
- private Composite displayArea;
-
- private OleFrame webFrame;
- private OleWebBrowser webBrowser;
- private Text webUrl;
- private OleControlSite webControlSite;
- private ProgressBar webProgress;
- private Label webStatus;
- private Button webNavigateButton;
-
- private ToolItem webCommandBackward;
- private ToolItem webCommandForward;
- private ToolItem webCommandHome;
- private ToolItem webCommandStop;
- private ToolItem webCommandRefresh;
- private ToolItem webCommandSearch;
-
- private boolean activated = false;
-
- /**
- * Constructs the OLE browser view.
- */
- public OleBrowserView() {
- OlePlugin.initResources();
- }
-
- /**
- * Creates the example.
- *
- * @see ViewPart#createPartControl
- */
- public void createPartControl(Composite parent) {
- displayArea = new Composite(parent, SWT.NONE);
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- displayArea.setLayout(gridLayout);
-
- createToolbar();
- createBrowserFrame();
- createStatusArea();
- createBrowserControl();
- }
-
- /**
- * Cleanup
- */
- public void dispose() {
- if (activated) {
- webControlSite.deactivateInPlaceClient();
- activated = false;
- }
- if (webBrowser != null) webBrowser.dispose();
- webBrowser = null;
- super.dispose();
- }
-
- /**
- * Called when we must grab focus.
- *
- * @see org.eclipse.ui.part.ViewPart#setFocus
- */
- public void setFocus() {
- webUrl.setFocus();
- }
-
- /**
- * Creates the Web browser toolbar.
- */
- private void createToolbar() {
- // Add a toolbar
- ToolBar bar = new ToolBar(displayArea, SWT.NONE);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.horizontalSpan = 3;
- bar.setLayoutData(gridData);
-
- // Add a button to navigate backwards through previously visited web sites
- webCommandBackward = new ToolItem(bar, SWT.NONE);
- webCommandBackward.setToolTipText(OlePlugin.getResourceString("browser.Back.tooltip"));
- webCommandBackward.setText(OlePlugin.getResourceString("browser.Back.text"));
- webCommandBackward.setImage(OlePlugin.images[OlePlugin.biBack]);
- webCommandBackward.setEnabled(false);
- webCommandBackward.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.GoBack();
- }
- });
-
- // Add a button to navigate forward through previously visited web sites
- webCommandForward = new ToolItem(bar, SWT.NONE);
- webCommandForward.setToolTipText(OlePlugin.getResourceString("browser.Forward.tooltip"));
- webCommandForward.setText(OlePlugin.getResourceString("browser.Forward.text"));
- webCommandForward.setImage(OlePlugin.images[OlePlugin.biForward]);
- webCommandForward.setEnabled(false);
- webCommandForward.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.GoForward();
- }
- });
-
- // Add a separator
- new ToolItem(bar, SWT.SEPARATOR);
-
- // Add a button to navigate to the Home page
- webCommandHome = new ToolItem(bar, SWT.NONE);
- webCommandHome.setToolTipText(OlePlugin.getResourceString("browser.Home.tooltip"));
- webCommandHome.setText(OlePlugin.getResourceString("browser.Home.text"));
- webCommandHome.setImage(OlePlugin.images[OlePlugin.biHome]);
- webCommandHome.setEnabled(false);
- webCommandHome.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.GoHome();
- }
- });
-
- // Add a button to abort web page loading
- webCommandStop = new ToolItem(bar, SWT.NONE);
- webCommandStop.setToolTipText(OlePlugin.getResourceString("browser.Stop.tooltip"));
- webCommandStop.setText(OlePlugin.getResourceString("browser.Stop.text"));
- webCommandStop.setImage(OlePlugin.images[OlePlugin.biStop]);
- webCommandStop.setEnabled(false);
- webCommandStop.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.Stop();
- }
- });
-
- // Add a button to refresh the current web page
- webCommandRefresh = new ToolItem(bar, SWT.NONE);
- webCommandRefresh.setToolTipText(OlePlugin.getResourceString("browser.Refresh.tooltip"));
- webCommandRefresh.setText(OlePlugin.getResourceString("browser.Refresh.text"));
- webCommandRefresh.setImage(OlePlugin.images[OlePlugin.biRefresh]);
- webCommandRefresh.setEnabled(false);
- webCommandRefresh.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.Refresh();
- }
- });
-
- // Add a separator
- new ToolItem(bar, SWT.SEPARATOR);
-
- // Add a button to search the web
- webCommandSearch = new ToolItem(bar, SWT.NONE);
- webCommandSearch.setToolTipText(OlePlugin.getResourceString("browser.Search.tooltip"));
- webCommandSearch.setText(OlePlugin.getResourceString("browser.Search.text"));
- webCommandSearch.setImage(OlePlugin.images[OlePlugin.biSearch]);
- webCommandSearch.setEnabled(false);
- webCommandSearch.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (webBrowser == null) return;
- webBrowser.GoSearch();
- }
- });
-
- // Add a text area for Users to enter a url
- Composite addressBar = new Composite(displayArea, SWT.NONE);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- gridData.horizontalSpan = 3;
- addressBar.setLayoutData(gridData);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- addressBar.setLayout(gridLayout);
-
- Label addressLabel = new Label(addressBar, SWT.NONE);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
- addressLabel.setLayoutData(gridData);
- addressLabel.setText(OlePlugin.getResourceString("browser.Address.label"));
- addressLabel.setFont(OlePlugin.browserFont);
-
- webUrl = new Text(addressBar, SWT.SINGLE | SWT.BORDER);
- webUrl.setFont(OlePlugin.browserFont);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- webUrl.setLayoutData(gridData);
- webUrl.addFocusListener(new FocusAdapter() {
- public void focusGained(FocusEvent e) {
- webNavigateButton.getShell().setDefaultButton(webNavigateButton);
- }
- });
-
- // Add a button to navigate to the web site specified in the Text area defined above
- webNavigateButton = new Button(addressBar, SWT.PUSH);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
- webNavigateButton.setLayoutData(gridData);
- webNavigateButton.setText(OlePlugin.getResourceString("browser.Go.text"));
- webNavigateButton.setFont(OlePlugin.browserFont);
- webNavigateButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- if (webBrowser == null) return;
- webBrowser.Navigate(webUrl.getText());
- }
- });
- }
-
- /**
- * Creates the Web browser OleFrame.
- */
- private void createBrowserFrame() {
- // Every control must have an associated OleFrame:
- webFrame = new OleFrame(displayArea, SWT.NONE);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- gridData.horizontalSpan = 3;
- webFrame.setLayoutData(gridData);
- }
-
- /**
- * Creates the Web browser status area.
- */
- private void createStatusArea() {
- // Add a progress bar to display downloading progress information
- webProgress = new ProgressBar(displayArea, SWT.BORDER);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.BEGINNING;
- gridData.verticalAlignment = GridData.FILL;
- webProgress.setLayoutData(gridData);
-
- // Add a label for displaying status messages as they are received from the control
- webStatus = new Label(displayArea, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- gridData.horizontalSpan = 2;
- webStatus.setLayoutData(gridData);
- webStatus.setFont(OlePlugin.browserFont);
- }
-
- /**
- * Creates Web browser control.
- */
- private void createBrowserControl() {
- try {
- // Create an Automation object for access to extended capabilities
- webControlSite = new OleControlSite(webFrame, SWT.NONE, "Shell.Explorer");
- OleAutomation oleAutomation = new OleAutomation(webControlSite);
- webBrowser = new OleWebBrowser(oleAutomation);
- } catch (SWTException ex) {
- // Creation may have failed because control is not installed on machine
- Label label = new Label(webFrame, SWT.BORDER);
- OlePlugin.logError(OlePlugin.getResourceString("error.CouldNotCreateBrowserControl"), ex);
- label.setText(OlePlugin.getResourceString("error.CouldNotCreateBrowserControl"));
- return;
- }
-
- // Respond to ProgressChange events by updating the Progress bar
- webControlSite.addEventListener(OleWebBrowser.ProgressChange, new OleListener() {
- public void handleEvent(OleEvent event) {
- Variant progress = event.arguments[0];
- Variant maxProgress = event.arguments[1];
- if (progress == null || maxProgress == null)
- return;
- webProgress.setMaximum(maxProgress.getInt());
- webProgress.setSelection(progress.getInt());
- }
- });
-
- // Respond to StatusTextChange events by updating the Status Text label
- webControlSite.addEventListener(OleWebBrowser.StatusTextChange, new OleListener() {
- public void handleEvent(OleEvent event) {
- Variant statusText = event.arguments[0];
- if (statusText == null) return;
- String text = statusText.getString();
- if (text != null)
- webStatus.setText(text);
- }
- });
-
- // Listen for changes to the ready state and print out the current state
- webControlSite.addPropertyListener(OleWebBrowser.DISPID_READYSTATE, new OleListener() {
- public void handleEvent(OleEvent event) {
- if (event.detail == OLE.PROPERTY_CHANGING) return;
- int state = webBrowser.getReadyState();
- switch (state) {
- case OleWebBrowser.READYSTATE_UNINITIALIZED:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Uninitialized.text"));
- webCommandBackward.setEnabled(false);
- webCommandForward.setEnabled(false);
- webCommandHome.setEnabled(false);
- webCommandRefresh.setEnabled(false);
- webCommandStop.setEnabled(false);
- webCommandSearch.setEnabled(false);
- break;
- case OleWebBrowser.READYSTATE_LOADING:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Loading.text"));
- webCommandHome.setEnabled(true);
- webCommandRefresh.setEnabled(true);
- webCommandStop.setEnabled(true);
- webCommandSearch.setEnabled(true);
- break;
- case OleWebBrowser.READYSTATE_LOADED:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Loaded.text"));
- webCommandStop.setEnabled(true);
- break;
- case OleWebBrowser.READYSTATE_INTERACTIVE:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Interactive.text"));
- webCommandStop.setEnabled(true);
- break;
- case OleWebBrowser.READYSTATE_COMPLETE:
- webStatus.setText(
- OlePlugin.getResourceString("browser.State.Complete.text"));
- webCommandStop.setEnabled(false);
- break;
- }
- }
- });
-
- // Listen for changes to the active command states
- webControlSite.addEventListener(OleWebBrowser.CommandStateChange, new OleListener() {
- public void handleEvent(OleEvent event) {
- if (event.type != OleWebBrowser.CommandStateChange) return;
- final int commandID =
- (event.arguments[0] != null) ? event.arguments[0].getInt() : 0;
- final boolean commandEnabled =
- (event.arguments[1] != null) ? event.arguments[1].getBoolean() : false;
-
- switch (commandID) {
- case OleWebBrowser.CSC_NAVIGATEBACK:
- webCommandBackward.setEnabled(commandEnabled);
- break;
- case OleWebBrowser.CSC_NAVIGATEFORWARD:
- webCommandForward.setEnabled(commandEnabled);
- break;
- }
- }
- });
-
- // in place activate the ActiveX control
- activated = (webControlSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE) == OLE.S_OK);
- if (activated) webBrowser.GoHome();
- }
-}
diff --git a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java
deleted file mode 100755
index 478c97be2f..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OlePlugin.java
+++ /dev/null
@@ -1,172 +0,0 @@
-package org.eclipse.swt.examples.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;
import org.eclipse.core.runtime.*;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.ui.plugin.*;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class OlePlugin extends AbstractUIPlugin {
- //The shared instance.
- private static OlePlugin plugin;
- private static ResourceBundle resourceBundle;
-
- static final int
- biBack = 0,
- biForward = 1,
- biHome = 2,
- biStop = 3,
- biRefresh = 4,
- biSearch = 5;
- static final String[] imageLocations = {
- "icons/backward_nav.gif",
- "icons/forward_nav.gif",
- "icons/home_nav.gif",
- "icons/stop_nav.gif",
- "icons/refresh_nav.gif",
- "icons/search_nav.gif" };
- static Image images[];
- static Font browserFont;
-
- /**
- * Constructs an OLE plugin.
- */
- public OlePlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- plugin = this;
- resourceBundle = descriptor.getResourceBundle();
- }
-
- /**
- * Clean up
- */
- public void shutdown() throws CoreException {
- super.shutdown();
- freeResources();
- }
-
- /**
- * Returns the shared instance.
- */
- public static OlePlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns a string from the resource bundle.
- * We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- public static String getResourceString(String key) {
- try {
- return resourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Returns a string from the resource bundle and binds it
- * with the given arguments. If the key is not found,
- * return the key.
- */
- public static String getResourceString(String key, Object[] args) {
- try {
- return MessageFormat.format(getResourceString(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!";
- }
- }
-
- /**
- * Log an error to the ILog for this plugin
- *
- * @param message the localized error message text
- * @param exception the associated exception, or null
- */
- public static void logError(String message, Throwable exception) {
- plugin.getLog().log(new Status(IStatus.ERROR, plugin.getDescriptor().getUniqueIdentifier(),
- 0, message, exception));
- }
-
- /**
- * Loads the resources.
- */
- public static void initResources() {
- if (images == null) {
- images = new Image[imageLocations.length];
-
- for (int i = 0; i < imageLocations.length; ++i) {
- images[i] = getImageFromPlugin(plugin.getDescriptor(), imageLocations[i]);
- if (images[i] == null) {
- freeResources();
- logError(getResourceString("error.CouldNotLoadResources"), null);
- throw new IllegalStateException();
- }
- }
- }
- if (browserFont == null) {
- try {
- browserFont = new Font (null, "MS Sans Serif", 8, SWT.NULL);
- } catch (Throwable ex) {
- }
- }
- if (images == null || browserFont == null) {
- freeResources();
- logError(getResourceString("error.CouldNotLoadResources"), null);
- throw new IllegalStateException();
- }
- }
-
- /**
- * Frees the resources
- */
- public static void freeResources() {
- if (images != null) {
- for (int i = 0; i < images.length; ++i) {
- final Image image = images[i];
- if (image != null) image.dispose();
- }
- images = null;
- }
- if (browserFont != null) browserFont.dispose ();
- browserFont = null;
- }
-
- /**
- * Gets an image from a path relative to the plugin install directory.
- *
- * @param pd the plugin descriptor for the plugin with the image
- * @param iconPath the path relative to the install directory
- * @return the image, or null if not found
- */
- private static Image getImageFromPlugin(IPluginDescriptor pd, String iconPath) {
- InputStream is = null;
- try {
- URL installUrl = pd.getInstallURL();
- URL url = new URL(installUrl, iconPath);
- is = url.openConnection().getInputStream();
- ImageData source = new ImageData(is);
- ImageData mask = source.getTransparencyMask();
- Image image = new Image(null, source, mask);
- return image;
- } catch (Throwable ex) {
- return null;
- } finally {
- try {
- if (is != null) is.close();
- } catch (IOException e) {
- }
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java b/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java
deleted file mode 100755
index b82c9d5cae..0000000000
--- a/examples/org.eclipse.swt.examples.ole.win32/src/org/eclipse/swt/examples/ole/win32/OleWebBrowser.java
+++ /dev/null
@@ -1,224 +0,0 @@
-package org.eclipse.swt.examples.ole.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.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.
- *
- * Typical use:
- *
- * OleControlSite oleControlSite = new OleControlSite(oleFrame, style, "Shell.Explorer");
- *
- * @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 || pVarResult.getType() != OLE.VT_BSTR) 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 || pVarResult.getType() != OLE.VT_BSTR) 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 || pVarResult.getType() != OLE.VT_I4) return -1;
- return pVarResult.getInt();
- }
-
- /**
- * Navigates backwards through previously visited web sites.
- */
- public void GoBack() {
-
- // dispid=100, type=METHOD, name="GoBack"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"GoBack"});
- int dispIdMember = rgdispid[0];
- oleAutomation.invoke(dispIdMember);
- }
-
- /**
- * Navigates backwards through previously visited web sites.
- */
- public void GoForward() {
-
- // dispid=101, type=METHOD, name="GoForward"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"GoForward"});
- int dispIdMember = rgdispid[0];
- oleAutomation.invoke(dispIdMember);
- }
-
- /**
- * Navigates to home page.
- */
- public void GoHome() {
- // dispid=102, type=METHOD, name="GoHome"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"GoHome"});
- int dispIdMember = rgdispid[0];
- oleAutomation.invoke(dispIdMember);
- }
-
- /**
- * Navigates to user-specified Web search gateway.
- */
- public void GoSearch() {
- // dispid=103, type=METHOD, name="GoSearch"
- int[] rgdispid = oleAutomation.getIDsOfNames(new String[]{"GoSearch"});
- int dispIdMember = rgdispid[0];
- oleAutomation.invoke(dispIdMember);
- }
-
- /**
- * Navigates to a particular URL.
- */
- public void 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
- oleAutomation.invoke(dispIdMember, rgvarg, rgdispidNamedArgs);
- }
-
- /**
- * 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];
- 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 bba8e78c79..0000000000
--- a/examples/org.eclipse.swt.examples.paint/.classpath
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
- * OleAutomation oleAutomation = new OleAutomation(oleControlSite);
- * OleWebBrowser webBrowser = new OleWebBrowser(oleControlSite, oleAutomation);
- *
20th June, 2002
-Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html. -For purposes of the CPL, "Program" will mean the Content.
- -If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise -made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such -Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.
- -If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the -host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available -to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also -providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of -the CPL.
- - - \ No newline at end of file diff --git a/examples/org.eclipse.swt.examples.paint/build.properties b/examples/org.eclipse.swt.examples.paint/build.properties deleted file mode 100755 index db39eb3db8..0000000000 --- a/examples/org.eclipse.swt.examples.paint/build.properties +++ /dev/null @@ -1,10 +0,0 @@ -bin.includes = doc-html/,\ - icons/,\ - plugin.properties,\ - plugin.xml,\ - about.html,\ - *.jar - -src.includes = about.html - -source.paint.jar = src/ diff --git a/examples/org.eclipse.swt.examples.paint/doc-html/hglegal2002.htm b/examples/org.eclipse.swt.examples.paint/doc-html/hglegal2002.htm deleted file mode 100644 index 74393f08f3..0000000000 --- a/examples/org.eclipse.swt.examples.paint/doc-html/hglegal2002.htm +++ /dev/null @@ -1,14 +0,0 @@ - - - - - --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. -
--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. -
--Uses SWT's GC and FontDialog, and JFace's InputDialog and action set support. -
- -From the Window menu select Show View --> Other. -In the Show View dialog, expand SWT Examples and select the -view named Paint. A view titled Paint will appear in your current perspective. -
- - - - 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 Binary files a/examples/org.eclipse.swt.examples.paint/icons/fill_none.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.paint/icons/fill_outline.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.paint/icons/fill_solid.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dash.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dashdot.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.paint/icons/linestyle_dot.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.paint/icons/linestyle_solid.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.paint/icons/options_font.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.paint/icons/paint_example.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.paint/icons/tool_airbrush.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.paint/icons/tool_ellipse.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.paint/icons/tool_line.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.paint/icons/tool_pencil.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.paint/icons/tool_polyline.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.paint/icons/tool_rectangle.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.paint/icons/tool_roundedrectangle.gif and /dev/null 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 Binary files a/examples/org.eclipse.swt.examples.paint/icons/tool_text.gif and /dev/null differ diff --git a/examples/org.eclipse.swt.examples.paint/plugin.properties b/examples/org.eclipse.swt.examples.paint/plugin.properties deleted file mode 100755 index 7ec46f1cde..0000000000 --- a/examples/org.eclipse.swt.examples.paint/plugin.properties +++ /dev/null @@ -1,124 +0,0 @@ -providerName = Eclipse.org -plugin.SWTPaintExample.name = SWT Paint Example Plugin -category.SWTExamples.name = SWT Examples -view.PaintExample.name = Paint - -launchcategory.SWTViewExamples.name = Workbench Views -launchcategory.SWTViewExamples.description = \ - A collection of Standard Widget Toolkit examples that run as Views inside the Workbench. \ - These examples will create a new View in the current Perspective. - -launchitem.PaintExample.name = Paint -launchitem.PaintExample.description = \ - This example demonstrates the use of SWT graphics operations in the form of a \ - rudimentary bitmap painting program. The Airbrush Tool implementation also \ - demonstrates a mechanism for managing timed GUI operations in the background \ - that are triggered by user input.\n\n\ - Select a tool with which to draw in the drawing area. There are a number of tools \ - to choose from on the toolbar. To change the color selection, click on a color in the \ - palette below the drawing area: left-click for the foreground color, right-click for the \ - background color.\n\n\ - Uses SWT's GC and FontDialog, and JFace's InputDialog and action set support. - -menu.Tools.label = Tools -menu.Options.label = Options - -tool.Pencil.label = Pencil -tool.Pencil.tooltip = Pencil tool -tool.Pencil.image = icons/tool_pencil.gif -tool.Pencil.description = Selects the Pencil tool. - -tool.Airbrush.label = Airbrush -tool.Airbrush.tooltip = Airbrush tool -tool.Airbrush.image = icons/tool_airbrush.gif -tool.Airbrush.description = Selects the Airbrush tool. - -tool.Line.label = Line -tool.Line.tooltip = Line tool -tool.Line.image = icons/tool_line.gif -tool.Line.description = Selects the Line tool. - -tool.PolyLine.label = Polygon -tool.PolyLine.tooltip = Polygon tool -tool.PolyLine.image = icons/tool_polyline.gif -tool.PolyLine.description = Selects the PolyLine tool. - -tool.Rectangle.label = Rectangle -tool.Rectangle.tooltip = Rectangle tool -tool.Rectangle.image = icons/tool_rectangle.gif -tool.Rectangle.description = Selects the Rectangle tool. - -tool.Ellipse.label = Ellipse -tool.Ellipse.tooltip = Ellipse tool -tool.Ellipse.image = icons/tool_ellipse.gif -tool.Ellipse.description = Selects the Ellipse tool. - -tool.RoundedRectangle.label = Rounded Rectangle -tool.RoundedRectangle.tooltip = Rounded Rectangle -tool.RoundedRectangle.image = icons/tool_roundedrectangle.gif -tool.RoundedRectangle.description = Selects the Rounded Rectangle tool. - -tool.Text.label = Text -tool.Text.tooltip = Text tool -tool.Text.image = icons/tool_text.gif -tool.Text.description = Selects the Text tool. -tool.Text.settings.defaulttext = Hello! -tool.Text.dialog.title = Text Tool Settings -tool.Text.dialog.message = Please enter the new text string to be painted. - -tool.Null.label =- * Note that erasePreview() cannot be called after this point to erase any previous - * drawPreview()'s. - *
- */ - public void clear() { - while (--nextIndex > 0) objectStack[nextIndex] = null; - nextIndex = 0; - } - public void draw(FigureDrawContext fdc) { - for (int i = 0; i < nextIndex; ++i) objectStack[i].draw(fdc); - } - public void addDamagedRegion(FigureDrawContext fdc, Region region) { - for (int i = 0; i < nextIndex; ++i) objectStack[i].addDamagedRegion(fdc, region); - } -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java deleted file mode 100755 index f5efcb789d..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ContinuousPaintSession.java +++ /dev/null @@ -1,228 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; - -/** - * The superclass for paint tools that draw continuously along the path - * traced by the mouse's movement while the button is depressed - */ -public abstract class ContinuousPaintSession extends BasicPaintSession { - /** - * True if a click-drag is in progress. - */ - private boolean dragInProgress = false; - - /** - * A cached Point array for drawing. - */ - private Point[] points = new Point[] { new Point(-1, -1), new Point(-1, -1) }; - - /** - * The time to wait between retriggers in milliseconds. - */ - private int retriggerInterval = 0; - - /** - * The currently valid RetriggerHandler - */ - protected Runnable retriggerHandler = null; - - /** - * Constructs a ContinuousPaintSession. - * - * @param paintSurface the drawing surface to use - */ - protected ContinuousPaintSession(PaintSurface paintSurface) { - super(paintSurface); - } - - /** - * Sets the retrigger timer. - *- * 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. - *
- * @param interval the time in milliseconds to wait between retriggers, 0 to disable - */ - public void setRetriggerTimer(int interval) { - retriggerInterval = interval; - } - - /** - * Activates the tool. - */ - public void beginSession() { - getPaintSurface(). - setStatusMessage(PaintPlugin.getResourceString("session.ContinuousPaint.message")); - dragInProgress = false; - } - - /** - * Deactivates the tool. - */ - public void endSession() { - abortRetrigger(); - } - - /** - * Aborts the current operation. - */ - public void resetSession() { - abortRetrigger(); - } - - /** - * Handles a mouseDown event. - * - * @param event the mouse event detail information - */ - public final void mouseDown(MouseEvent event) { - if (event.button != 1) return; - if (dragInProgress) return; // spurious event - dragInProgress = true; - - points[0].x = event.x; - points[0].y = event.y; - render(points[0]); - prepareRetrigger(); - } - - /** - * Handles a mouseDoubleClick event. - * - * @param event the mouse event detail information - */ - public final void mouseDoubleClick(MouseEvent event) { - } - - /** - * Handles a mouseUp event. - * - * @param event the mouse event detail information - */ - public final void mouseUp(MouseEvent event) { - if (event.button != 1) return; - if (! dragInProgress) return; // spurious event - abortRetrigger(); - mouseSegmentFinished(event); - dragInProgress = false; - } - - /** - * Handles a mouseMove event. - * - * @param event the mouse event detail information - */ - public final void mouseMove(MouseEvent event) { - final PaintSurface ps = getPaintSurface(); - ps.setStatusCoord(ps.getCurrentPosition()); - if (! dragInProgress) return; - mouseSegmentFinished(event); - prepareRetrigger(); - } - - /** - * Handle a rendering segment - * - * @param event the mouse event detail information - */ - private final void mouseSegmentFinished(MouseEvent event) { - if (points[0].x == -1) return; // spurious event - if (points[0].x != event.x || points[0].y != event.y) { - // draw new segment - points[1].x = event.x; - points[1].y = event.y; - renderContinuousSegment(); - } - } - - /** - * Draws a continuous segment from points[0] to points[1]. - * Assumes points[0] has been drawn already. - * - * @post points[0] will refer to the same point as points[1] - */ - protected void renderContinuousSegment() { - /* A lazy but effective line drawing algorithm */ - final int dX = points[1].x - points[0].x; - final int dY = points[1].y - points[0].y; - int absdX = Math.abs(dX); - int absdY = Math.abs(dY); - - if ((dX == 0) && (dY == 0)) return; - - if (absdY > absdX) { - final int incfpX = (dX << 16) / absdY; - final int incY = (dY > 0) ? 1 : -1; - int fpX = points[0].x << 16; // X in fixedpoint format - - while (--absdY >= 0) { - points[0].y += incY; - points[0].x = (fpX += incfpX) >> 16; - render(points[0]); - } - if (points[0].x == points[1].x) return; - points[0].x = points[1].x; - } else { - final int incfpY = (dY << 16) / absdX; - final int incX = (dX > 0) ? 1 : -1; - int fpY = points[0].y << 16; // Y in fixedpoint format - - while (--absdX >= 0) { - points[0].x += incX; - points[0].y = (fpY += incfpY) >> 16; - render(points[0]); - } - if (points[0].y == points[1].y) return; - points[0].y = points[1].y; - } - render(points[0]); - } - - /** - * Prepare the retrigger timer - */ - private final void prepareRetrigger() { - if (retriggerInterval > 0) { - /* - * timerExec() provides a lightweight mechanism for running code at intervals from within - * the event loop when timing accuracy is not important. - * - * Since it is not possible to cancel a timerExec(), we remember the Runnable that is - * active in order to distinguish the valid one from the stale ones. In practice, - * if the interval is 1/100th of a second, then creating a few hundred new RetriggerHandlers - * each second will not cause a significant performance hit. - */ - Display display = getPaintSurface().getDisplay(); - retriggerHandler = new Runnable() { - public void run() { - if (retriggerHandler == this) { - render(points[0]); - prepareRetrigger(); - } - } - }; - display.timerExec(retriggerInterval, retriggerHandler); - } - } - - /** - * Aborts the retrigger timer - */ - private final void abortRetrigger() { - retriggerHandler = null; - } - - /** - * Template method: Renders a point. - * @param point, the point to render - */ - protected abstract void render(Point point); -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/DragPaintSession.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/DragPaintSession.java deleted file mode 100755 index 728f1707a1..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/DragPaintSession.java +++ /dev/null @@ -1,131 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.graphics.*; - -/** - * The superclass for paint tools that use click-drag-release motions to - * draw objects. - */ -public abstract class DragPaintSession extends BasicPaintSession { - /** - * True if a click-drag is in progress - */ - private boolean dragInProgress = false; - - /** - * The position of the first click in a click-drag - */ - private Point anchorPosition = new Point(-1, -1); - - /** - * A temporary point - */ - private Point tempPosition = new Point(-1, -1); - - /** - * Constructs a PaintSession. - * - * @param getPaintSurface() the drawing surface to use - */ - protected DragPaintSession(PaintSurface paintSurface) { - super(paintSurface); - } - - /** - * Activates the tool. - */ - public void beginSession() { - getPaintSurface(). - setStatusMessage(PaintPlugin.getResourceString("session.DragInteractivePaint.message")); - anchorPosition.x = -1; - dragInProgress = false; - } - - /** - * Deactivates the tool. - */ - public void endSession() { - } - - /** - * Resets the tool. - * Aborts any operation in progress. - */ - public void resetSession() { - getPaintSurface().clearRubberbandSelection(); - anchorPosition.x = -1; - dragInProgress = false; - } - - /** - * Handles a mouseDown event. - * - * @param event the mouse event detail information - */ - public void mouseDown(MouseEvent event) { - if (event.button != 1) return; - if (dragInProgress) return; // spurious event - dragInProgress = true; - - anchorPosition.x = event.x; - anchorPosition.y = event.y; - } - - /** - * Handles a mouseDoubleClick event. - * - * @param event the mouse event detail information - */ - public void mouseDoubleClick(MouseEvent event) { - } - - /** - * Handles a mouseUp event. - * - * @param event the mouse event detail information - */ - public void mouseUp(MouseEvent event) { - if (event.button != 1) { - resetSession(); // abort if right or middle mouse button pressed - return; - } - if (! dragInProgress) return; // spurious event - dragInProgress = false; - if (anchorPosition.x == -1) return; // spurious event - - getPaintSurface().commitRubberbandSelection(); - } - - /** - * Handles a mouseMove event. - * - * @param event the mouse event detail information - */ - public void mouseMove(MouseEvent event) { - final PaintSurface ps = getPaintSurface(); - if (! dragInProgress) { - ps.setStatusCoord(ps.getCurrentPosition()); - return; - } - ps.setStatusCoordRange(anchorPosition, ps.getCurrentPosition()); - ps.clearRubberbandSelection(); - tempPosition.x = event.x; - tempPosition.y = event.y; - ps.addRubberbandSelection(createFigure(anchorPosition, tempPosition)); - } - - /** - * Template Method: Creates a Figure for drawing rubberband entities and the final product - * - * @param anchor the anchor point - * @param cursor the point marking the current pointer location - */ - protected abstract Figure createFigure(Point anchor, Point cursor); -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseFigure.java deleted file mode 100755 index 27eedb39b5..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseFigure.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; - -/** - * 2D Ellipse object - */ -public class EllipseFigure extends Figure { - private Color foregroundColor, backgroundColor; - private int lineStyle, x1, y1, x2, y2; - /** - * Constructs an Ellipse - * These objects are defined by any two diametrically opposing corners of a box - * bounding the ellipse. - * - * @param color the color for this object - * @param lineStyle the line style for this object - * @param x1 the virtual X coordinate of the first corner - * @param y1 the virtual Y coordinate of the first corner - * @param x2 the virtual X coordinate of the second corner - * @param y2 the virtual Y coordinate of the second corner - */ - public EllipseFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2) { - this.foregroundColor = foregroundColor; - this.backgroundColor = backgroundColor; - this.lineStyle = lineStyle; - this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; - } - public void draw(FigureDrawContext fdc) { - Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2); - fdc.gc.setForeground(foregroundColor); - fdc.gc.setBackground(backgroundColor); - fdc.gc.setLineStyle(lineStyle); - fdc.gc.drawOval(r.x, r.y, r.width - 1, r.height - 1); - fdc.gc.setLineStyle(SWT.LINE_SOLID); - } - public void addDamagedRegion(FigureDrawContext fdc, Region region) { - region.add(fdc.toClientRectangle(x1, y1, x2, y2)); - } -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseTool.java deleted file mode 100755 index 3b3f11f2d9..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/EllipseTool.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; - -/** - * A drawing tool. - */ -public class EllipseTool extends DragPaintSession implements PaintTool { - private ToolSettings settings; - - /** - * Constructs a EllipseTool. - * - * @param toolSettings the new tool settings - * @param paintSurface the PaintSurface we will render on. - */ - public EllipseTool(ToolSettings toolSettings, PaintSurface paintSurface) { - super(paintSurface); - set(toolSettings); - } - - /** - * Sets the tool's settings. - * - * @param toolSettings the new tool settings - */ - public void set(ToolSettings toolSettings) { - settings = toolSettings; - } - - /** - * Returns name associated with this tool. - * - * @return the localized name of this tool - */ - public String getDisplayName() { - return PaintPlugin.getResourceString("tool.Ellipse.label"); - } - - /* - * Template methods for drawing - */ - protected Figure createFigure(Point a, Point b) { - ContainerFigure container = new ContainerFigure(); - if (settings.commonFillType != ToolSettings.ftNone) - container.add(new SolidEllipseFigure(settings.commonBackgroundColor, a.x, a.y, b.x, b.y)); - if (settings.commonFillType != ToolSettings.ftSolid) - container.add(new EllipseFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle, - a.x, a.y, b.x, b.y)); - return container; - } -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/Figure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/Figure.java deleted file mode 100755 index be049d1700..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/Figure.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; - -/** - * Superinterface for all drawing objects. - * All drawing objects know how to render themselved to the screen and can draw a - * temporary version of themselves for previewing the general appearance of the - * object onscreen before it gets committed. - */ -public abstract class Figure { - /** - * Draws this object. - * - * @param fdc a parameter block specifying drawing-related information - */ - public abstract void draw(FigureDrawContext fdc); - - /** - * Computes the damaged screen region caused by drawing this object (imprecise), then - * appends it to the supplied region. - * - * @param fdc a parameter block specifying drawing-related information - * @param region a region to which additional damage areas will be added - */ - public abstract void addDamagedRegion(FigureDrawContext fdc, Region region); -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/FigureDrawContext.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/FigureDrawContext.java deleted file mode 100644 index 4c08aa86cd..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/FigureDrawContext.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; - -public class FigureDrawContext { - /* - *- * The GC must be set up as follows - * (it will be returned to this state upon completion of drawing operations) - *
* paintCanvas must have SWT.NO_REDRAW_RESIZE and SWT.NO_BACKGROUND styles, * and may have SWT.V_SCROLL and/or SWT.H_SCROLL. *
* @param paintCanvas the Canvas object in which to render * @param paintStatus the PaintStatus object to use for providing user feedback * @param fillColor the color to fill the canvas with initially */ - public PaintSurface(Canvas paintCanvas, Text statusText, Color fillColor) { this.paintCanvas = paintCanvas; this.statusText = statusText; clearStatus(); /* Set up the drawing surface */ Rectangle displayRect = paintCanvas.getDisplay().getClientArea(); imageWidth = displayRect.width; imageHeight = displayRect.height; image = new Image(paintCanvas.getDisplay(), imageWidth, imageHeight); imageFDC.gc = new GC(image); imageFDC.gc.setBackground(fillColor); imageFDC.gc.fillRectangle(0, 0, imageWidth, imageHeight); displayFDC.gc = new GC(paintCanvas); /* Initialize the session */ setPaintSession(null); /* Add our listeners */ paintCanvas.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { displayFDC.gc.dispose(); } }); paintCanvas.addMouseListener(new MouseAdapter() { public void mouseDown(MouseEvent event) { processMouseEventCoordinates(event); if (paintSession != null) paintSession.mouseDown(event); } public void mouseUp(MouseEvent event) { processMouseEventCoordinates(event); if (paintSession != null) paintSession.mouseUp(event); } public void mouseDoubleClick(MouseEvent event) { processMouseEventCoordinates(event); if (paintSession != null) paintSession.mouseDoubleClick(event); } }); paintCanvas.addMouseMoveListener(new MouseMoveListener() { public void mouseMove(MouseEvent event) { processMouseEventCoordinates(event); if (paintSession != null) paintSession.mouseMove(event); } }); paintCanvas.addPaintListener(new PaintListener() { public void paintControl(PaintEvent event) { if (rubberband.isEmpty()) { // Nothing to merge, so we just refresh event.gc.drawImage(image, displayFDC.xOffset + event.x, displayFDC.yOffset + event.y, event.width, event.height, event.x, event.y, event.width, event.height); } else { /* * Avoid flicker when merging overlayed objects by constructing the image on * a backbuffer first, then blitting it to the screen. */ // Check that the backbuffer is large enough if (paintImage != null) { Rectangle rect = paintImage.getBounds(); if ((event.width + event.x > rect.width) || (event.height + event.y > rect.height)) { paintFDC.gc.dispose(); paintImage.dispose(); paintImage = null; } } if (paintImage == null) { Display display = getDisplay(); Rectangle rect = display.getClientArea(); paintImage = new Image(display, Math.max(rect.width, event.width + event.x), Math.max(rect.height, event.height + event.y)); paintFDC.gc = new GC(paintImage); } // Setup clipping and the FDC Region clipRegion = new Region(); event.gc.getClipping(clipRegion); paintFDC.gc.setClipping(clipRegion); clipRegion.dispose(); paintFDC.xOffset = displayFDC.xOffset; paintFDC.yOffset = displayFDC.yOffset; paintFDC.xScale = displayFDC.xScale; paintFDC.yScale = displayFDC.yScale; // Merge the overlayed objects into the image, then blit paintFDC.gc.drawImage(image, displayFDC.xOffset + event.x, displayFDC.yOffset + event.y, event.width, event.height, event.x, event.y, event.width, event.height); rubberband.draw(paintFDC); event.gc.drawImage(paintImage, event.x, event.y, event.width, event.height, event.x, event.y, event.width, event.height); } } }); paintCanvas.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent event) { handleResize(); } }); /* Set up the paint canvas scroll bars */ ScrollBar horizontal = paintCanvas.getHorizontalBar(); horizontal.setVisible(true); horizontal.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { scrollHorizontally((ScrollBar)event.widget); } }); ScrollBar vertical = paintCanvas.getVerticalBar(); vertical.setVisible(true); vertical.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { scrollVertically((ScrollBar)event.widget); } }); handleResize(); } /** * Disposes of the PaintSurface's resources. */ public void dispose() { imageFDC.gc.dispose(); image.dispose(); if (paintImage != null) { paintImage.dispose(); paintFDC.gc.dispose(); } currentPosition = null; paintCanvas = null; paintSession = null; image = null; paintImage = null; displayFDC = null; imageFDC = null; paintFDC = null; rubberband = null; statusText = null; statusActionInfo = null; statusMessageInfo = null; statusCoordInfo = null; } /** * Called when we must grab focus. */ public void setFocus() { paintCanvas.setFocus(); } /** * Returns the Display on which the PaintSurface resides. * @return the Display */ public Display getDisplay() { return paintCanvas.getDisplay(); } /** * Returns the Shell in which the PaintSurface resides. * @return the Shell */ public Shell getShell() { return paintCanvas.getShell(); } /** - * Sets the current paint session. *- * If oldPaintSession != paintSession calls oldPaintSession.end() * and paintSession.begin() *
* - * @param paintSession the paint session to activate; null to disable all sessions - */ - public void setPaintSession(PaintSession paintSession) { - if (this.paintSession != null) { if (this.paintSession == paintSession) return; - this.paintSession.endSession(); } - this.paintSession = paintSession; - clearStatus(); if (paintSession != null) { setStatusAction(paintSession.getDisplayName()); paintSession.beginSession(); } else { setStatusAction(PaintPlugin.getResourceString("tool.Null.label")); setStatusMessage(PaintPlugin.getResourceString("session.Null.message")); } } - - /** - * Returns the current paint session. - * - * @return the current paint session, null if none is active - */ - public PaintSession getPaintSession() { - return paintSession; - } - /** * Returns the current paint tool. * * @return the current paint tool, null if none is active (though some other session * might be) */ public PaintTool getPaintTool() { return (paintSession != null && paintSession instanceof PaintTool) ? (PaintTool)paintSession : null; } /** * Returns the current position in an interactive operation. * * @return the last known position of the pointer */ public Point getCurrentPosition() { return currentPosition; } /** * Draws a Figure object to the screen and to the backing store permanently. * * @param object the object to draw onscreen */ public void drawFigure(Figure object) { object.draw(imageFDC); object.draw(displayFDC); } /** * Adds a Figure object to the active rubberband selection. ** This object will be drawn to the screen as a preview and refreshed appropriately * until the selection is either cleared or committed. *
* * @param object the object to add to the selection */ public void addRubberbandSelection(Figure object) { rubberband.add(object); if (! isRubberbandHidden()) object.draw(displayFDC); } /** * Clears the active rubberband selection. ** Erases any rubberband objects on the screen then clears the selection. *
*/ public void clearRubberbandSelection() { if (! isRubberbandHidden()) { Region region = new Region(); rubberband.addDamagedRegion(displayFDC, region); Rectangle r = region.getBounds(); paintCanvas.redraw(r.x, r.y, r.width, r.height, true); region.dispose(); } rubberband.clear(); } /** * Commits the active rubberband selection. ** Redraws any rubberband objects on the screen as permanent objects then clears the selection. *
*/ public void commitRubberbandSelection() { rubberband.draw(imageFDC); if (isRubberbandHidden()) rubberband.draw(displayFDC); rubberband.clear(); } /** * Hides the rubberband (but does not eliminate it). ** Increments by one the rubberband "hide" nesting count. The rubberband * is hidden from view (but remains active) if it wasn't already hidden. *
*/ public void hideRubberband() { if (rubberbandHiddenNestingCount++ <= 0) { Region region = new Region(); rubberband.addDamagedRegion(displayFDC, region); Rectangle r = region.getBounds(); paintCanvas.redraw(r.x, r.y, r.width, r.height, true); region.dispose(); } } /** * Shows (un-hides) the rubberband. ** 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. *
*/ public void showRubberband() { if (rubberbandHiddenNestingCount <= 0) throw new IllegalStateException("rubberbandHiddenNestingCount > 0"); if (--rubberbandHiddenNestingCount == 0) { rubberband.draw(displayFDC); } } /** * Determines if the rubberband is hidden. * * @return true iff the rubber is hidden */ public boolean isRubberbandHidden() { return rubberbandHiddenNestingCount > 0; } /** * Handles a horizontal scroll event * * @param scrollbar the horizontal scroll bar that posted this event */ public void scrollHorizontally(ScrollBar scrollBar) { if (image == null) return; if (imageWidth > visibleWidth) { final int oldOffset = displayFDC.xOffset; final int newOffset = Math.min(scrollBar.getSelection(), imageWidth - visibleWidth); if (oldOffset != newOffset) { paintCanvas.update(); displayFDC.xOffset = newOffset; paintCanvas.scroll(Math.max(oldOffset - newOffset, 0), 0, Math.max(newOffset - oldOffset, 0), 0, visibleWidth, visibleHeight, false); } } } /** * Handles a vertical scroll event * * @param scrollbar the vertical scroll bar that posted this event */ public void scrollVertically(ScrollBar scrollBar) { if (image == null) return; if (imageHeight > visibleHeight) { final int oldOffset = displayFDC.yOffset; final int newOffset = Math.min(scrollBar.getSelection(), imageHeight - visibleHeight); if (oldOffset != newOffset) { paintCanvas.update(); displayFDC.yOffset = newOffset; paintCanvas.scroll(0, Math.max(oldOffset - newOffset, 0), 0, Math.max(newOffset - oldOffset, 0), visibleWidth, visibleHeight, false); } } } /** * Handles resize events */ private void handleResize() { paintCanvas.update(); Rectangle visibleRect = paintCanvas.getClientArea(); visibleWidth = visibleRect.width; visibleHeight = visibleRect.height; ScrollBar horizontal = paintCanvas.getHorizontalBar(); if (horizontal != null) { displayFDC.xOffset = Math.min(horizontal.getSelection(), imageWidth - visibleWidth); if (imageWidth <= visibleWidth) { horizontal.setEnabled(false); horizontal.setSelection(0); } else { final int max = imageWidth - visibleWidth; horizontal.setEnabled(true); horizontal.setValues(displayFDC.xOffset, 0, imageWidth, visibleWidth, 8, visibleWidth); } } ScrollBar vertical = paintCanvas.getVerticalBar(); if (vertical != null) { displayFDC.yOffset = Math.min(vertical.getSelection(), imageHeight - visibleHeight); if (imageHeight <= visibleHeight) { vertical.setEnabled(false); vertical.setSelection(0); } else { final int max = imageHeight - visibleHeight; vertical.setEnabled(true); vertical.setValues(displayFDC.yOffset, 0, imageHeight, visibleHeight, 8, visibleHeight); } } } /** * Virtualizes MouseEvent coordinates and stores the current position. */ private void processMouseEventCoordinates(MouseEvent event) { currentPosition.x = event.x = Math.min(Math.max(event.x, 0), visibleWidth - 1) + displayFDC.xOffset; currentPosition.y = event.y = Math.min(Math.max(event.y, 0), visibleHeight - 1) + displayFDC.yOffset; } /** * Clears the status bar. */ public void clearStatus() { statusActionInfo = ""; statusMessageInfo = ""; statusCoordInfo = ""; updateStatus(); } /** * Sets the status bar action text. * * @param action the action in progress, null to clear */ public void setStatusAction(String action) { statusActionInfo = (action != null) ? action : ""; updateStatus(); } /** * Sets the status bar message text. * * @param message the message to display, null to clear */ public void setStatusMessage(String message) { statusMessageInfo = (message != null) ? message : ""; updateStatus(); } /** * Sets the coordinates in the status bar. * * @param coord the coordinates to display, null to clear */ public void setStatusCoord(Point coord) { statusCoordInfo = (coord != null) ? PaintPlugin.getResourceString("status.Coord.format", new Object[] { new Integer(coord.x), new Integer(coord.y)}) : ""; updateStatus(); } /** * Sets the coordinate range in the status bar. * * @param a the "from" coordinate, must not be null * @param b the "to" coordinate, must not be null */ public void setStatusCoordRange(Point a, Point b) { statusCoordInfo = PaintPlugin.getResourceString("status.CoordRange.format", new Object[] { new Integer(a.x), new Integer(a.y), new Integer(b.x), new Integer(b.y)}); updateStatus(); } /** * Updates the display. */ private void updateStatus() { statusText.setText( PaintPlugin.getResourceString("status.Bar.format", new Object[] { statusActionInfo, statusMessageInfo, statusCoordInfo })); } } diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintTool.java deleted file mode 100755 index da27e96033..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintTool.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.eclipse.swt.examples.paint; -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - public interface PaintTool extends PaintSession { - /** - * Sets the tool's settings. - * - * @param toolSettings the new tool settings - */ - public void set(ToolSettings toolSettings); -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintView.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintView.java deleted file mode 100755 index 174de42e8d..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PaintView.java +++ /dev/null @@ -1,496 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.jface.action.*; -import org.eclipse.jface.resource.*; -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.ui.*; -import org.eclipse.ui.part.*; - -import java.net.*; -import java.util.*; - -/** - * The view for the paint application. - * All rendering happens inside the area created by createPartControl(). - * - * @see ViewPart - */ -public class PaintView extends ViewPart { - private Display workbenchDisplay; - - // current active settings - private ToolSettings toolSettings; - - // paint surface for drawing - private PaintSurface paintSurface; - - // map action ids to useful data - private HashMap /* of String to PaintTool */ paintToolMap; - private HashMap /* of String to Integer */ paintFillTypeMap; - private HashMap /* of String to Integer */ paintLineStyleMap; - - /** UI data **/ - // handle of currently active tool IAction on the UI - private IAction activeToolAction; - // handle of currently active filltype IAction on the UI - private IAction activeFillTypeAction; - // handle of currently active linetype IAction on the UI - private IAction activeLineStyleAction; - - // handle of active foreground color box Canvas widget - private Canvas activeForegroundColorCanvas; - // handle of active background color box Canvas widget - private Canvas activeBackgroundColorCanvas; - - private static final int numPaletteRows = 3; - private static final int numPaletteCols = 50; - - // shared data - private Color paintColorBlack, paintColorWhite; // alias for paintColors[0] and [1] - private Color[] paintColors; - private Font paintDefaultFont; // do not free - - /** - * Constructs a Paint view. - */ - public PaintView() { - } - - /** - * Cleanup - */ - public void dispose() { - if (paintSurface != null) paintSurface.dispose(); - if (paintColors != null) { - for (int i = 0; i < paintColors.length; ++i) { - final Color color = paintColors[i]; - if (color != null) color.dispose(); - } - } - paintDefaultFont = null; - paintColors = null; - paintSurface = null; - super.dispose(); - } - - /** - * Called when we must grab focus. - * - * @see org.eclipse.ui.part.ViewPart#setFocus - */ - public void setFocus() { - paintSurface.setFocus(); - } - - /** - * Creates the example. - * - * @see ViewPart#createPartControl - */ - public void createPartControl(Composite parent) { - /*** Initialize shared data ***/ - workbenchDisplay = parent.getDisplay(); - - paintColorWhite = new Color(workbenchDisplay, 255, 255, 255); - paintColorBlack = new Color(workbenchDisplay, 0, 0, 0); - - paintDefaultFont = workbenchDisplay.getSystemFont(); - - paintColors = new Color[numPaletteCols * numPaletteRows]; - paintColors[0] = paintColorBlack; - paintColors[1] = paintColorWhite; - for (int i = 2; i < paintColors.length; i++) { - paintColors[i] = new Color(workbenchDisplay, - ((i*7)%255),((i*23)%255), ((i*51)%255)); - } - - toolSettings = new ToolSettings(); - toolSettings.commonForegroundColor = paintColorBlack; - toolSettings.commonBackgroundColor = paintColorWhite; - toolSettings.commonFont = paintDefaultFont; - - /*** Add toolbar contributions ***/ - final IActionBars actionBars = getViewSite().getActionBars(); - IToolBarManager toolbarManager = actionBars.getToolBarManager(); - - toolbarManager.add(new GroupMarker("group.tools")); - toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Pencil")); - toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Airbrush")); - toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Line")); - toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.PolyLine")); - toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Rectangle")); - toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.RoundedRectangle")); - toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Ellipse")); - toolbarManager.appendToGroup("group.tools", new SelectPaintToolAction("tool.Text")); - toolbarManager.add(new Separator()); - toolbarManager.add(new GroupMarker("group.options.fill")); - toolbarManager.appendToGroup("group.options.fill", new SelectFillTypeAction("fill.None")); - toolbarManager.appendToGroup("group.options.fill", new SelectFillTypeAction("fill.Outline")); - toolbarManager.appendToGroup("group.options.fill", new SelectFillTypeAction("fill.Solid")); - toolbarManager.add(new Separator()); - toolbarManager.add(new GroupMarker("group.options.linestyle")); - toolbarManager.appendToGroup("group.options.linestyle", new SelectLineStyleAction("linestyle.Solid")); - toolbarManager.appendToGroup("group.options.linestyle", new SelectLineStyleAction("linestyle.Dash")); - toolbarManager.appendToGroup("group.options.linestyle", new SelectLineStyleAction("linestyle.Dot")); - toolbarManager.appendToGroup("group.options.linestyle", new SelectLineStyleAction("linestyle.DashDot")); - toolbarManager.add(new Separator()); - toolbarManager.add(new GroupMarker("group.options")); - toolbarManager.appendToGroup("group.options", new SelectFontAction("options.Font")); - actionBars.updateActionBars(); - - /*** Build GUI ***/ - createGUI(parent); - - /*** Set defaults ***/ - setPaintToolByID("tool.Pencil"); - setFillTypeByID("fill.None"); - setLineStyleByID("linestyle.Solid"); - setForegroundColor(paintColorBlack); - setBackgroundColor(paintColorWhite); - } - - /** - * Creates the GUI. - */ - private void createGUI(Composite parent) { - GridLayout gridLayout; - GridData gridData; - - /*** Create principal GUI layout elements ***/ - Composite displayArea = new Composite(parent, SWT.NONE); - gridLayout = new GridLayout(); - gridLayout.numColumns = 1; - displayArea.setLayout(gridLayout); - - // Creating these elements here avoids the need to instantiate the GUI elements - // in strict layout order. The natural layout ordering is an artifact of using - // SWT layouts, but unfortunately it is not the same order as that required to - // instantiate all of the non-GUI application elements to satisfy referential - // dependencies. It is possible to reorder the initialization to some extent, but - // this can be very tedious. - - // paint canvas - final Canvas paintCanvas = new Canvas(displayArea, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | - SWT.NO_REDRAW_RESIZE | SWT.NO_BACKGROUND); - gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); - paintCanvas.setLayoutData(gridData); - paintCanvas.setBackground(paintColorWhite); - - // color selector frame - final Composite colorFrame = new Composite(displayArea, SWT.NONE); - gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL); - colorFrame.setLayoutData(gridData); - - // tool settings frame - final Composite toolSettingsFrame = new Composite(displayArea, SWT.NONE); - gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL); - toolSettingsFrame.setLayoutData(gridData); - - // status text - final Text statusText = new Text(displayArea, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY); - gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL); - statusText.setLayoutData(gridData); - - /*** Create the remaining application elements inside the principal GUI layout elements ***/ - // paintSurface - paintSurface = new PaintSurface(paintCanvas, statusText, paintColorWhite); - - // paintToolMap - paintToolMap = new HashMap(); - paintToolMap.put("tool.Pencil", new PencilTool(toolSettings, paintSurface)); - paintToolMap.put("tool.Airbrush", new AirbrushTool(toolSettings, paintSurface)); - paintToolMap.put("tool.Line", new LineTool(toolSettings, paintSurface)); - paintToolMap.put("tool.PolyLine", new PolyLineTool(toolSettings, paintSurface)); - paintToolMap.put("tool.Rectangle", new RectangleTool(toolSettings, paintSurface)); - paintToolMap.put("tool.RoundedRectangle", new RoundedRectangleTool(toolSettings, paintSurface)); - paintToolMap.put("tool.Ellipse", new EllipseTool(toolSettings, paintSurface)); - paintToolMap.put("tool.Text", new TextTool(toolSettings, paintSurface)); - paintToolMap.put("tool.Null", null); - - // paintFillTypeMap - paintFillTypeMap = new HashMap(); - paintFillTypeMap.put("fill.None", new Integer(ToolSettings.ftNone)); - paintFillTypeMap.put("fill.Outline", new Integer(ToolSettings.ftOutline)); - paintFillTypeMap.put("fill.Solid", new Integer(ToolSettings.ftSolid)); - - // paintLineStyleMap - paintLineStyleMap = new HashMap(); - paintLineStyleMap.put("linestyle.Solid", new Integer(SWT.LINE_SOLID)); - paintLineStyleMap.put("linestyle.Dash", new Integer(SWT.LINE_DASH)); - paintLineStyleMap.put("linestyle.Dot", new Integer(SWT.LINE_DOT)); - paintLineStyleMap.put("linestyle.DashDot", new Integer(SWT.LINE_DASHDOT)); - - // colorFrame - gridLayout = new GridLayout(); - gridLayout.numColumns = 3; - gridLayout.marginHeight = 0; - gridLayout.marginWidth = 0; - colorFrame.setLayout(gridLayout); - - // activeForegroundColorCanvas, activeBackgroundColorCanvas - activeForegroundColorCanvas = new Canvas(colorFrame, SWT.BORDER); - gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - gridData.heightHint = 24; - gridData.widthHint = 24; - activeForegroundColorCanvas.setLayoutData(gridData); - - activeBackgroundColorCanvas = new Canvas(colorFrame, SWT.BORDER); - gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - gridData.heightHint = 24; - gridData.widthHint = 24; - activeBackgroundColorCanvas.setLayoutData(gridData); - - // paletteCanvas - final Canvas paletteCanvas = new Canvas(colorFrame, SWT.BORDER | SWT.NO_BACKGROUND); - gridData = new GridData(GridData.FILL_HORIZONTAL); - gridData.heightHint = 24; - paletteCanvas.setLayoutData(gridData); - paletteCanvas.addListener(SWT.MouseDown, new Listener() { - public void handleEvent(Event e) { - Rectangle bounds = paletteCanvas.getClientArea(); - Color color = getColorAt(bounds, e.x, e.y); - - if (e.button == 1) setForegroundColor(color); - else setBackgroundColor(color); - } - private Color getColorAt(Rectangle bounds, int x, int y) { - if (bounds.height <= 1 && bounds.width <= 1) return paintColorWhite; - final int row = (y - bounds.y) * numPaletteRows / bounds.height; - final int col = (x - bounds.x) * numPaletteCols / bounds.width; - return paintColors[Math.min(Math.max(row * numPaletteCols + col, 0), paintColors.length - 1)]; - } - }); - Listener refreshListener = new Listener() { - public void handleEvent(Event e) { - if (e.gc == null) return; - Rectangle bounds = paletteCanvas.getClientArea(); - for (int row = 0; row < numPaletteRows; ++row) { - for (int col = 0; col < numPaletteCols; ++col) { - final int x = bounds.width * col / numPaletteCols; - final int y = bounds.height * row / numPaletteRows; - final int width = Math.max(bounds.width * (col + 1) / numPaletteCols - x, 1); - final int height = Math.max(bounds.height * (row + 1) / numPaletteRows - y, 1); - e.gc.setBackground(paintColors[row * numPaletteCols + col]); - e.gc.fillRectangle(bounds.x + x, bounds.y + y, width, height); - } - } - } - }; - paletteCanvas.addListener(SWT.Resize, refreshListener); - paletteCanvas.addListener(SWT.Paint, refreshListener); - //paletteCanvas.redraw(); - - // toolSettingsFrame - gridLayout = new GridLayout(); - gridLayout.numColumns = 4; - gridLayout.marginHeight = 0; - gridLayout.marginWidth = 0; - toolSettingsFrame.setLayout(gridLayout); - - Label label = new Label(toolSettingsFrame, SWT.NONE); - label.setText(PaintPlugin.getResourceString("settings.AirbrushRadius.text")); - - final Scale airbrushRadiusScale = new Scale(toolSettingsFrame, SWT.HORIZONTAL); - airbrushRadiusScale.setMinimum(5); - airbrushRadiusScale.setMaximum(50); - airbrushRadiusScale.setSelection(toolSettings.airbrushRadius); - airbrushRadiusScale.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL)); - airbrushRadiusScale.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - toolSettings.airbrushRadius = airbrushRadiusScale.getSelection(); - updateToolSettings(); - } - }); - - label = new Label(toolSettingsFrame, SWT.NONE); - label.setText(PaintPlugin.getResourceString("settings.AirbrushIntensity.text")); - - final Scale airbrushIntensityScale = new Scale(toolSettingsFrame, SWT.HORIZONTAL); - airbrushIntensityScale.setMinimum(1); - airbrushIntensityScale.setMaximum(100); - airbrushIntensityScale.setSelection(toolSettings.airbrushIntensity); - airbrushIntensityScale.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL)); - airbrushIntensityScale.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - toolSettings.airbrushIntensity = airbrushIntensityScale.getSelection(); - updateToolSettings(); - } - }); - } - - /** - * Notifies the tool that its settings have changed. - */ - private void updateToolSettings() { - final PaintTool activePaintTool = paintSurface.getPaintTool(); - if (activePaintTool == null) return; - - activePaintTool.endSession(); - activePaintTool.set(toolSettings); - activePaintTool.beginSession(); - } - - /** - * Sets the tool foreground color. - * - * @param color the new color to use - */ - public void setForegroundColor(Color color) { - if (activeForegroundColorCanvas != null) - activeForegroundColorCanvas.setBackground(color); - toolSettings.commonForegroundColor = color; - updateToolSettings(); - } - - /** - * Set the tool background color. - * - * @param color the new color to use - */ - public void setBackgroundColor(Color color) { - if (activeBackgroundColorCanvas != null) - activeBackgroundColorCanvas.setBackground(color); - toolSettings.commonBackgroundColor = color; - updateToolSettings(); - } - - /** - * Selects a tool given its ID. - */ - public void setPaintToolByID(String id) { - activeToolAction = handleRadioAction(activeToolAction, id); - - final PaintTool paintTool = (PaintTool) paintToolMap.get(id); - paintSurface.setPaintSession(paintTool); - updateToolSettings(); - } - - /** - * Selects a filltype given its ID. - */ - public void setFillTypeByID(String id) { - activeFillTypeAction = handleRadioAction(activeFillTypeAction, id); - - final Integer fillType = (Integer) paintFillTypeMap.get(id); - toolSettings.commonFillType = fillType.intValue(); - updateToolSettings(); - } - - /** - * Selects line type given its ID. - */ - public void setLineStyleByID(String id) { - activeLineStyleAction = handleRadioAction(activeLineStyleAction, id); - - final Integer lineType = (Integer) paintLineStyleMap.get(id); - toolSettings.commonLineStyle = lineType.intValue(); - updateToolSettings(); - } - - /** - * Gets the IAction for an ID belonging to a set of mutually exclusive actions, and - * toggles the old action off if necessary. - */ - private IAction handleRadioAction(IAction oldAction, String id) { - IAction action = getActionByID(id); - if (action != null) { - if (oldAction != null) oldAction.setChecked(false); - if (! action.isChecked()) action.setChecked(true); - return action; - } - return oldAction; - } - - /** - * Gets the IAction representing the UI toolbar button with the specified ID. - */ - private IAction getActionByID(String id) { - final IActionBars actionBars = getViewSite().getActionBars(); - IToolBarManager toolbarManager = actionBars.getToolBarManager(); - ActionContributionItem contributionItem = (ActionContributionItem) toolbarManager.find(id); - if (contributionItem == null) return null; - return contributionItem.getAction(); - } - - /** - * Returns the Display. - * - * @return the display we're using - */ - public Display getDisplay() { - return workbenchDisplay; - } - - /** - * Action set glue. - */ - abstract class PaintAction extends Action { - public PaintAction(String id) { - super(); - setId(id); - - try { - final URL installUrl = PaintPlugin.getDefault().getDescriptor().getInstallURL(); - final URL imageUrl = new URL(installUrl, PaintPlugin.getResourceString(id + ".image")); - setImageDescriptor(ImageDescriptor.createFromURL(imageUrl)); - } catch (MalformedURLException e) { - PaintPlugin.logError("", e); - } - - setText(PaintPlugin.getResourceString(id + ".label")); - setToolTipText(PaintPlugin.getResourceString(id + ".tooltip")); - setDescription(PaintPlugin.getResourceString(id + ".description")); - } - } - class SelectPaintToolAction extends PaintAction { - public SelectPaintToolAction(String id) { super(id); } - public int getStyle() { return IAction.AS_CHECK_BOX; } - public void run() { setPaintToolByID(getId()); } - - } - class SelectFillTypeAction extends PaintAction { - public SelectFillTypeAction(String id) { super(id); } - public int getStyle() { return IAction.AS_CHECK_BOX; } - public void run() { setFillTypeByID(getId()); } - } - class SelectLineStyleAction extends PaintAction { - public SelectLineStyleAction(String id) { super(id); } - public int getStyle() { return IAction.AS_CHECK_BOX; } - public void run() { setLineStyleByID(getId()); } - } - class SelectFontAction extends PaintAction { - public SelectFontAction(String id) { super(id); } - public int getStyle() { return IAction.AS_PUSH_BUTTON; } - public void run() { - FontDialog fontDialog = new FontDialog(paintSurface.getShell(), SWT.PRIMARY_MODAL); - FontData[] fontDatum = toolSettings.commonFont.getFontData(); - if (fontDatum != null && fontDatum.length > 0) { - fontDialog.setFontData(fontDatum[0]); - } - fontDialog.setText(PaintPlugin.getResourceString("options.Font.dialog.title")); - - paintSurface.hideRubberband(); - FontData fontData = fontDialog.open(); - paintSurface.showRubberband(); - if (fontData != null) { - try { - Font font = new Font(workbenchDisplay, fontData); - toolSettings.commonFont = font; - updateToolSettings(); - } catch (SWTException e) { - } - } - } - } -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PencilTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PencilTool.java deleted file mode 100755 index ee51916ce9..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PencilTool.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; - -/** - * A pencil tool. - */ -public class PencilTool extends ContinuousPaintSession implements PaintTool { - private ToolSettings settings; - - /** - * Constructs a pencil tool. - * - * @param toolSettings the new tool settings - * @param getPaintSurface() the PaintSurface we will render on. - */ - public PencilTool(ToolSettings toolSettings, PaintSurface paintSurface) { - super(paintSurface); - set(toolSettings); - } - - /** - * Sets the tool's settings. - * - * @param toolSettings the new tool settings - */ - public void set(ToolSettings toolSettings) { - settings = toolSettings; - } - - /** - * Returns the name associated with this tool. - * - * @return the localized name of this tool - */ - public String getDisplayName() { - return PaintPlugin.getResourceString("tool.Pencil.label"); - } - - /* - * Template method for drawing - */ - public void render(final Point point) { - final PaintSurface ps = getPaintSurface(); - ps.drawFigure(new PointFigure(settings.commonForegroundColor, point.x, point.y)); - } -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PointFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PointFigure.java deleted file mode 100644 index 07fedbd352..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PointFigure.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; - -/** - * 2D Point object - */ -public class PointFigure extends Figure { - private Color color; - private int x, y; - /** - * Constructs a Point - * - * @param color the color for this object - * @param x the virtual X coordinate of the first end-point - * @param y the virtual Y coordinate of the first end-point - */ - public PointFigure(Color color, int x, int y) { - this.color = color; this.x = x; this.y = y; - } - public void draw(FigureDrawContext fdc) { - Point p = fdc.toClientPoint(x, y); - fdc.gc.setBackground(color); - fdc.gc.fillRectangle(p.x, p.y, 1, 1); - } - public void addDamagedRegion(FigureDrawContext fdc, Region region) { - region.add(fdc.toClientRectangle(x, y, x, y)); - } -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PolyLineTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PolyLineTool.java deleted file mode 100755 index f2db962fd0..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/PolyLineTool.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; - -/** - * A polyline drawing tool. - */ -public class PolyLineTool extends SegmentedPaintSession implements PaintTool { - private ToolSettings settings; - - /** - * Constructs a PolyLineTool. - * - * @param toolSettings the new tool settings - * @param paintSurface the PaintSurface we will render on. - */ - public PolyLineTool(ToolSettings toolSettings, PaintSurface paintSurface) { - super(paintSurface); - set(toolSettings); - } - - /** - * Sets the tool's settings. - * - * @param toolSettings the new tool settings - */ - public void set(ToolSettings toolSettings) { - settings = toolSettings; - } - - /** - * Returns the name associated with this tool. - * - * @return the localized name of this tool - */ - public String getDisplayName() { - return PaintPlugin.getResourceString("tool.PolyLine.label"); - } - - /* - * Template methods for drawing - */ - protected Figure createFigure(Point[] points, int numPoints, boolean closed) { - ContainerFigure container = new ContainerFigure(); - if (closed && settings.commonFillType != ToolSettings.ftNone && numPoints >= 3) { - container.add(new SolidPolygonFigure(settings.commonBackgroundColor, points, numPoints)); - } - if (! closed || settings.commonFillType != ToolSettings.ftSolid || numPoints < 3) { - for (int i = 0; i < numPoints - 1; ++i) { - final Point a = points[i]; - final Point b = points[i + 1]; - container.add(new LineFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle, - a.x, a.y, b.x, b.y)); - } - if (closed) { - final Point a = points[points.length - 1]; - final Point b = points[0]; - container.add(new LineFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle, - a.x, a.y, b.x, b.y)); - } - } - return container; - } -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleFigure.java deleted file mode 100755 index a2b4625fe6..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleFigure.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; - -/** - * 2D Rectangle object - */ -public class RectangleFigure extends Figure { - private Color foregroundColor, backgroundColor; - private int lineStyle, x1, y1, x2, y2; - /** - * Constructs a Rectangle - * These objects are defined by any two diametrically opposing corners. - * - * @param color the color for this object - * @param lineStyle the line style for this object - * @param x1 the virtual X coordinate of the first corner - * @param y1 the virtual Y coordinate of the first corner - * @param x2 the virtual X coordinate of the second corner - * @param y2 the virtual Y coordinate of the second corner - */ - public RectangleFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2) { - this.foregroundColor = foregroundColor; - this.backgroundColor = backgroundColor; - this.lineStyle = lineStyle; - this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; - } - public void draw(FigureDrawContext fdc) { - Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2); - fdc.gc.setForeground(foregroundColor); - fdc.gc.setBackground(backgroundColor); - fdc.gc.setLineStyle(lineStyle); - fdc.gc.drawRectangle(r.x, r.y, r.width - 1, r.height - 1); - fdc.gc.setLineStyle(SWT.LINE_SOLID); - } - public void addDamagedRegion(FigureDrawContext fdc, Region region) { - region.add(fdc.toClientRectangle(x1, y1, x2, y2)); - } -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleTool.java deleted file mode 100755 index 2da6fa3296..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RectangleTool.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; - -/** - * A drawing tool. - */ -public class RectangleTool extends DragPaintSession implements PaintTool { - private ToolSettings settings; - - /** - * Constructs a RectangleTool. - * - * @param toolSettings the new tool settings - * @param paintSurface the PaintSurface we will render on. - */ - public RectangleTool(ToolSettings toolSettings, PaintSurface paintSurface) { - super(paintSurface); - set(toolSettings); - } - - /** - * Sets the tool's settings. - * - * @param toolSettings the new tool settings - */ - public void set(ToolSettings toolSettings) { - settings = toolSettings; - } - - /** - * Returns name associated with this tool. - * - * @return the localized name of this tool - */ - public String getDisplayName() { - return PaintPlugin.getResourceString("tool.Rectangle.label"); - } - - /* - * Template method for drawing - */ - protected Figure createFigure(Point a, Point b) { - switch (settings.commonFillType) { - default: - case ToolSettings.ftNone: - return new RectangleFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle, - a.x, a.y, b.x, b.y); - case ToolSettings.ftSolid: - return new SolidRectangleFigure(settings.commonBackgroundColor, a.x, a.y, b.x, b.y); - case ToolSettings.ftOutline: { - ContainerFigure container = new ContainerFigure(); - container.add(new SolidRectangleFigure(settings.commonBackgroundColor, a.x, a.y, b.x, b.y)); - container.add(new RectangleFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle, - a.x, a.y, b.x, b.y)); - return container; - } - } - } -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java deleted file mode 100755 index 2dd0bfd29c..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleFigure.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; - -/** - * 2D Rectangle object - */ -public class RoundedRectangleFigure extends Figure { - private Color foregroundColor, backgroundColor; - private int lineStyle, x1, y1, x2, y2, diameter; - /** - * Constructs a Rectangle - * These objects are defined by any two diametrically opposing corners. - * - * @param color the color for this object - * @param lineStyle the line style for this object - * @param x1 the virtual X coordinate of the first corner - * @param y1 the virtual Y coordinate of the first corner - * @param x2 the virtual X coordinate of the second corner - * @param y2 the virtual Y coordinate of the second corner - * @param diameter the diameter of curvature of all four corners - */ - public RoundedRectangleFigure(Color foregroundColor, Color backgroundColor, int lineStyle, int x1, int y1, int x2, int y2, int diameter) { - this.foregroundColor = foregroundColor; - this.backgroundColor = backgroundColor; - this.lineStyle = lineStyle; - this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; - this.diameter = diameter; - } - public void draw(FigureDrawContext fdc) { - Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2); - fdc.gc.setForeground(foregroundColor); - fdc.gc.setBackground(backgroundColor); - fdc.gc.setLineStyle(lineStyle); - fdc.gc.drawRoundRectangle(r.x, r.y, r.width - 1, r.height - 1, diameter, diameter); - fdc.gc.setLineStyle(SWT.LINE_SOLID); - } - public void addDamagedRegion(FigureDrawContext fdc, Region region) { - region.add(fdc.toClientRectangle(x1, y1, x2, y2)); - } -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleTool.java deleted file mode 100755 index beec38ec56..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/RoundedRectangleTool.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; - -/** - * A drawing tool. - */ -public class RoundedRectangleTool extends DragPaintSession implements PaintTool { - private ToolSettings settings; - - /** - * Constructs a RoundedRectangleTool. - * - * @param toolSettings the new tool settings - * @param paintSurface the PaintSurface we will render on. - */ - public RoundedRectangleTool(ToolSettings toolSettings, PaintSurface paintSurface) { - super(paintSurface); - set(toolSettings); - } - - /** - * Sets the tool's settings. - * - * @param toolSettings the new tool settings - */ - public void set(ToolSettings toolSettings) { - settings = toolSettings; - } - - /** - * Returns name associated with this tool. - * - * @return the localized name of this tool - */ - public String getDisplayName() { - return PaintPlugin.getResourceString("tool.RoundedRectangle.label"); - } - - /* - * Template methods for drawing - */ - protected Figure createFigure(Point a, Point b) { - ContainerFigure container = new ContainerFigure(); - if (settings.commonFillType != ToolSettings.ftNone) - container.add(new SolidRoundedRectangleFigure(settings.commonBackgroundColor, - a.x, a.y, b.x, b.y, settings.roundedRectangleCornerDiameter)); - if (settings.commonFillType != ToolSettings.ftSolid) - container.add(new RoundedRectangleFigure(settings.commonForegroundColor, settings.commonBackgroundColor, - settings.commonLineStyle, a.x, a.y, b.x, b.y, settings.roundedRectangleCornerDiameter)); - return container; - } -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SegmentedPaintSession.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SegmentedPaintSession.java deleted file mode 100755 index d1697eb2eb..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SegmentedPaintSession.java +++ /dev/null @@ -1,155 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; - -import java.util.*; - -/** - * The superclass for paint tools that contruct objects from individually - * picked segments. - */ -public abstract class SegmentedPaintSession extends BasicPaintSession { - /** - * The set of control points making up the segmented selection - */ - private Vector /* of Point */ controlPoints = new Vector(); - - /** - * The previous figure (so that we can abort with right-button) - */ - private Figure previousFigure = null; - - /** - * The current figure (so that we can abort with right-button) - */ - private Figure currentFigure = null; - - /** - * Constructs a PaintSession. - * - * @param paintSurface the drawing surface to use - */ - protected SegmentedPaintSession(PaintSurface paintSurface) { - super(paintSurface); - } - - /** - * Activates the tool. - */ - public void beginSession() { - getPaintSurface().setStatusMessage(PaintPlugin.getResourceString( - "session.SegmentedInteractivePaint.message.anchorMode")); - previousFigure = null; - currentFigure = null; - controlPoints.clear(); - } - - /** - * Deactivates the tool. - */ - public void endSession() { - getPaintSurface().clearRubberbandSelection(); - if (previousFigure != null) getPaintSurface().drawFigure(previousFigure); - } - - /** - * Resets the tool. - * Aborts any operation in progress. - */ - public void resetSession() { - getPaintSurface().clearRubberbandSelection(); - if (previousFigure != null) getPaintSurface().drawFigure(previousFigure); - - getPaintSurface().setStatusMessage(PaintPlugin.getResourceString( - "session.SegmentedInteractivePaint.message.anchorMode")); - previousFigure = null; - currentFigure = null; - controlPoints.clear(); - } - - /** - * Handles a mouseDown event. - * - * @param event the mouse event detail information - */ - public void mouseDown(MouseEvent event) { - if (event.button != 1) return; - - getPaintSurface().setStatusMessage(PaintPlugin.getResourceString( - "session.SegmentedInteractivePaint.message.interactiveMode")); - previousFigure = currentFigure; - - if (controlPoints.size() > 0) { - final Point lastPoint = (Point) controlPoints.elementAt(controlPoints.size() - 1); - if (lastPoint.x == event.x || lastPoint.y == event.y) return; // spurious event - } - controlPoints.add(new Point(event.x, event.y)); - } - - /** - * Handles a mouseDoubleClick event. - * - * @param event the mouse event detail information - */ - public void mouseDoubleClick(MouseEvent event) { - if (event.button != 1) return; - if (controlPoints.size() >= 2) { - getPaintSurface().clearRubberbandSelection(); - previousFigure = createFigure( - (Point[]) controlPoints.toArray(new Point[controlPoints.size()]), - controlPoints.size(), true); - } - resetSession(); - } - - /** - * Handles a mouseUp event. - * - * @param event the mouse event detail information - */ - public void mouseUp(MouseEvent event) { - if (event.button != 1) { - resetSession(); // abort if right or middle mouse button pressed - return; - } - } - - /** - * Handles a mouseMove event. - * - * @param event the mouse event detail information - */ - public void mouseMove(MouseEvent event) { - final PaintSurface ps = getPaintSurface(); - if (controlPoints.size() == 0) { - ps.setStatusCoord(ps.getCurrentPosition()); - return; // spurious event - } else { - ps.setStatusCoordRange((Point) controlPoints.elementAt(controlPoints.size() - 1), - ps.getCurrentPosition()); - } - - ps.clearRubberbandSelection(); - Point[] points = (Point[]) controlPoints.toArray(new Point[controlPoints.size() + 1]); - points[controlPoints.size()] = ps.getCurrentPosition(); - currentFigure = createFigure(points, points.length, false); - ps.addRubberbandSelection(currentFigure); - } - - /** - * Template Method: Creates a Figure for drawing rubberband entities and the final product - * - * @param points the array of control points - * @param numPoints the number of valid points in the array (n >= 2) - * @param closed true if the user double-clicked on the final control point - */ - protected abstract Figure createFigure(Point[] points, int numPoints, boolean closed); -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidEllipseFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidEllipseFigure.java deleted file mode 100755 index 123417fd5e..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidEllipseFigure.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; - -/** - * 2D Solid Ellipse object - */ -public class SolidEllipseFigure extends Figure { - private Color color; - private int x1, y1, x2, y2; - /** - * Constructs a SolidEllipse - * These objects are defined by any two diametrically opposing corners of a box - * bounding the ellipse. - * - * @param color the color for this object - * @param x1 the virtual X coordinate of the first corner - * @param y1 the virtual Y coordinate of the first corner - * @param x2 the virtual X coordinate of the second corner - * @param y2 the virtual Y coordinate of the second corner - */ - public SolidEllipseFigure(Color color, int x1, int y1, int x2, int y2) { - this.color = color; this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; - } - public void draw(FigureDrawContext fdc) { - Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2); - fdc.gc.setBackground(color); - fdc.gc.fillOval(r.x, r.y, r.width, r.height); - } - public void addDamagedRegion(FigureDrawContext fdc, Region region) { - region.add(fdc.toClientRectangle(x1, y1, x2, y2)); - } -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidPolygonFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidPolygonFigure.java deleted file mode 100755 index 30b47100b4..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidPolygonFigure.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; - -/** - * 2D Line object - */ -public class SolidPolygonFigure extends Figure { - private Color color; - private int[] points; - /** - * Constructs a SolidPolygon - * These objects are defined by a sequence of vertices. - * - * @param color the color for this object - * @param vertices the array of vertices making up the polygon - * @param numPoint the number of valid points in the array (n >= 3) - */ - public SolidPolygonFigure(Color color, Point[] vertices, int numPoints) { - this.color = color; - this.points = new int[numPoints * 2]; - for (int i = 0; i < numPoints; ++i) { - points[i * 2] = vertices[i].x; - points[i * 2 + 1] = vertices[i].y; - } - } - public void draw(FigureDrawContext fdc) { - int[] drawPoints = new int[points.length]; - for (int i = 0; i < points.length; i += 2) { - drawPoints[i] = points[i] * fdc.xScale - fdc.xOffset; - drawPoints[i + 1] = points[i + 1] * fdc.yScale - fdc.yOffset; - } - fdc.gc.setBackground(color); - fdc.gc.fillPolygon(drawPoints); - } - public void addDamagedRegion(FigureDrawContext fdc, Region region) { - int xmin = Integer.MAX_VALUE, ymin = Integer.MAX_VALUE; - int xmax = Integer.MIN_VALUE, ymax = Integer.MIN_VALUE; - - for (int i = 0; i < points.length; i += 2) { - if (points[i] < xmin) xmin = points[i]; - if (points[i] > xmax) xmax = points[i]; - if (points[i+1] < ymin) ymin = points[i+1]; - if (points[i+1] > ymax) ymax = points[i+1]; - } - region.add(fdc.toClientRectangle(xmin, ymin, xmax, ymax)); - } -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRectangleFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRectangleFigure.java deleted file mode 100755 index 9f2d7b64a3..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRectangleFigure.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; - -/** - * 2D SolidRectangle object - */ -public class SolidRectangleFigure extends Figure { - private Color color; - private int x1, y1, x2, y2; - /** - * Constructs a SolidRectangle - * These objects are defined by any two diametrically opposing corners. - * - * @param color the color for this object - * @param x1 the virtual X coordinate of the first corner - * @param y1 the virtual Y coordinate of the first corner - * @param x2 the virtual X coordinate of the second corner - * @param y2 the virtual Y coordinate of the second corner - */ - public SolidRectangleFigure(Color color, int x1, int y1, int x2, int y2) { - this.color = color; this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; - } - public void draw(FigureDrawContext fdc) { - Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2); - fdc.gc.setBackground(color); - fdc.gc.fillRectangle(r.x, r.y, r.width, r.height); - } - public void addDamagedRegion(FigureDrawContext fdc, Region region) { - region.add(fdc.toClientRectangle(x1, y1, x2, y2)); - } -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java deleted file mode 100755 index de07824310..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/SolidRoundedRectangleFigure.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; - -/** - * 2D SolidRectangle object - */ -public class SolidRoundedRectangleFigure extends Figure { - private Color color; - private int x1, y1, x2, y2, diameter; - /** - * Constructs a SolidRectangle - * These objects are defined by any two diametrically opposing corners. - * - * @param color the color for this object - * @param x1 the virtual X coordinate of the first corner - * @param y1 the virtual Y coordinate of the first corner - * @param x2 the virtual X coordinate of the second corner - * @param y2 the virtual Y coordinate of the second corner - * @param diameter the diameter of curvature of all four corners - */ - public SolidRoundedRectangleFigure(Color color, int x1, int y1, int x2, int y2, int diameter) { - this.color = color; this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; - this.diameter = diameter; - } - public void draw(FigureDrawContext fdc) { - Rectangle r = fdc.toClientRectangle(x1, y1, x2, y2); - fdc.gc.setBackground(color); - fdc.gc.fillRoundRectangle(r.x, r.y, r.width, r.height, diameter, diameter); - } - public void addDamagedRegion(FigureDrawContext fdc, Region region) { - region.add(fdc.toClientRectangle(x1, y1, x2, y2)); - } -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextFigure.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextFigure.java deleted file mode 100755 index 9317772e94..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextFigure.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.graphics.*; - -/** - * 2D Rectangle object - */ -public class TextFigure extends Figure { - private Color color; - private Font font; - private String text; - private int x, y; - /** - * Constructs a TextFigure - * - * @param color the color for this object - * @param font the font for this object - * @param text the text to draw, tab and new-line expansion is performed - * @param x the virtual X coordinate of the top-left corner of the text bounding box - * @param y the virtual Y coordinate of the top-left corner of the text bounding box - */ - public TextFigure(Color color, Font font, String text, int x, int y) { - this.color = color; this.font = font; this.text = text; this.x = x; this.y = y; - } - public void draw(FigureDrawContext fdc) { - Point p = fdc.toClientPoint(x, y); - fdc.gc.setFont(font); - fdc.gc.setForeground(color); - fdc.gc.drawText(text, p.x, p.y, true); - } - public void addDamagedRegion(FigureDrawContext fdc, Region region) { - Font oldFont = fdc.gc.getFont(); - fdc.gc.setFont(font); - Point textExtent = fdc.gc.textExtent(text); - fdc.gc.setFont(oldFont); - region.add(fdc.toClientRectangle(x, y, x + textExtent.x, y + textExtent.y)); - } -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextTool.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextTool.java deleted file mode 100755 index bf051dc1d3..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/TextTool.java +++ /dev/null @@ -1,123 +0,0 @@ -package org.eclipse.swt.examples.paint; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.jface.dialogs.*; -import org.eclipse.swt.events.*; - -/** - * A text drawing tool. - */ -public class TextTool extends BasicPaintSession implements PaintTool { - private ToolSettings settings; - private String drawText = PaintPlugin.getResourceString("tool.Text.settings.defaulttext"); - - /** - * Constructs a PaintTool. - * - * @param toolSettings the new tool settings - * @param paintSurface the PaintSurface we will render on. - */ - public TextTool(ToolSettings toolSettings, PaintSurface paintSurface) { - super(paintSurface); - set(toolSettings); - } - - /** - * Sets the tool's settings. - * - * @param toolSettings the new tool settings - */ - public void set(ToolSettings toolSettings) { - settings = toolSettings; - } - - /** - * Returns name associated with this tool. - * - * @return the localized name of this tool - */ - public String getDisplayName() { - return PaintPlugin.getResourceString("tool.Text.label"); - } - - /** - * Activates the tool. - */ - public void beginSession() { - getPaintSurface().setStatusMessage(PaintPlugin.getResourceString( - "session.Text.message")); - } - - /** - * Deactivates the tool. - */ - public void endSession() { - getPaintSurface().clearRubberbandSelection(); - } - - /** - * Aborts the current operation. - */ - public void resetSession() { - getPaintSurface().clearRubberbandSelection(); - } - - /** - * Handles a mouseDown event. - * - * @param event the mouse event detail information - */ - public void mouseDown(MouseEvent event) { - if (event.button == 1) { - // draw with left mouse button - getPaintSurface().commitRubberbandSelection(); - } else { - // set text with right mouse button - getPaintSurface().clearRubberbandSelection(); - InputDialog inputDialog = new InputDialog(getPaintSurface().getShell(), - PaintPlugin.getResourceString("tool.Text.dialog.title"), - PaintPlugin.getResourceString("tool.Text.dialog.message"), - drawText, null); - inputDialog.setBlockOnOpen(true); - inputDialog.open(); - if (inputDialog.getReturnCode() == InputDialog.OK) drawText = inputDialog.getValue(); - inputDialog.close(); - } - } - - /** - * Handles a mouseDoubleClick event. - * - * @param event the mouse event detail information - */ - public void mouseDoubleClick(MouseEvent event) { - } - - /** - * Handles a mouseUp event. - * - * @param event the mouse event detail information - */ - public void mouseUp(MouseEvent event) { - } - - /** - * Handles a mouseMove event. - * - * @param event the mouse event detail information - */ - public void mouseMove(MouseEvent event) { - final PaintSurface ps = getPaintSurface(); - ps.setStatusCoord(ps.getCurrentPosition()); - ps.clearRubberbandSelection(); - ps.addRubberbandSelection( - new TextFigure(settings.commonForegroundColor, settings.commonFont, - drawText, event.x, event.y)); - } -} diff --git a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ToolSettings.java b/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ToolSettings.java deleted file mode 100755 index 6c5aee8e72..0000000000 --- a/examples/org.eclipse.swt.examples.paint/src/org/eclipse/swt/examples/paint/ToolSettings.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.eclipse.swt.examples.paint; -/* - * (c) Copyright IBM Corp. 2000, 2002. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; - /** * Tool Settings objects group tool-related configuration information. */ -public class ToolSettings { - public static final int ftNone = 0, ftOutline = 1, ftSolid = 2; /** - * commonForegroundColor: current tool foreground colour - */ - public Color commonForegroundColor; - - /** - * commonBackgroundColor: current tool background colour - */ - public Color commonBackgroundColor; - /** * commonFont: current font */ public Font commonFont; /** * commonFillType: current fill type *One of ftNone, ftOutline, ftSolid.
*/ public int commonFillType = ftNone; /** * commonLineStyle: current line type */ public int commonLineStyle = SWT.LINE_SOLID; - /** - * airbrushRadius: coverage radius in pixels - */ - public int airbrushRadius = 10; - - /** - * airbrushIntensity: average surface area coverage in region defined by radius per "jot" - */ - public int airbrushIntensity = 30; /** * roundedRectangleCornerDiameter: the diameter of curvature of corners in a rounded rectangle */ public int roundedRectangleCornerDiameter = 16; } diff --git a/examples/org.eclipse.swt.examples/.classpath b/examples/org.eclipse.swt.examples/.classpath deleted file mode 100755 index 07ce282125..0000000000 --- a/examples/org.eclipse.swt.examples/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - -20th June, 2002
-Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html. -For purposes of the CPL, "Program" will mean the Content.
- -If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise -made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such -Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.
- -If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the -host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available -to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also -providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of -the CPL.
- - - \ No newline at end of file diff --git a/examples/org.eclipse.swt.examples/build.properties b/examples/org.eclipse.swt.examples/build.properties deleted file mode 100755 index 62ce80a8a4..0000000000 --- a/examples/org.eclipse.swt.examples/build.properties +++ /dev/null @@ -1,9 +0,0 @@ -bin.includes = doc-html/,\ - plugin.properties,\ - plugin.xml,\ - about.html,\ - swtexamples.jar - -src.includes = about.html - -source.swtexamples.jar = src/ diff --git a/examples/org.eclipse.swt.examples/doc-html/hglegal2002.htm b/examples/org.eclipse.swt.examples/doc-html/hglegal2002.htm deleted file mode 100644 index 74393f08f3..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/hglegal2002.htm +++ /dev/null @@ -1,14 +0,0 @@ - - - - - --The AddressBook example shows how the Table control can be used to -present information in a tabular format. The application can save and load data -from a file, sort the entries, and search for strings within the fields. -
- --Follow the Manual Setup -instructions to install and run the example from your workspace. -
-
-The "Main" class is org.eclipse.swt.examples.addressbook.AddressBook
.
-
-This example can also be run using the Example Launcher. -Select the Address Book item from the Standalone category and click Run. -
- - - diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_controls_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_controls_ex.html deleted file mode 100644 index 80d63e227d..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/swt_controls_ex.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - --The Controls example is a simple demonstration of common SWT controls. -It consists of a tab folder where each tab in the folder allows the user -to interact with a different control. -The user can change styles and settings and view how this affects the control. -
- --Follow the Manual Setup -instructions to install and run the example from your workspace. -
-
-The "Main" class is org.eclipse.swt.examples.controlexample.ControlExample
.
-
-The File Viewer example shows how a simple application can be implemented using SWT. -This application provides the ability to navigate files and folders and manipulate them via Drag and Drop. -It includes the use of alternate threads for long actions and demonstrates the use of the Tree, -Table, Toolbar and Program. -
- --Follow the Manual Setup -instructions to install and run the example from your workspace. -
-
-The "Main" class is org.eclipse.swt.examples.fileviewer.FileViewer
.
-
-This example can also be run using the Example Launcher. -Select the File Viewer item from the Standalone category and click Run. -
- - - - 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 f9e8953276..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/swt_helloworld_ex.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - --The Hello World examples are a set of introductory examples to show how to get started -creating an application with SWT. They cover creating a shell, using event listeners, -processing events in an event loop, using layouts, and drawing with a Graphic Context. -
- --This example demonstrates how to open a Shell and process the events. -
- --This example builds on HelloWorld1 and demonstrates how to display a Label inside the Shell. -
- --This example builds on HelloWorld2 and demonstrates how to resize the Label -when the Shell resizes using a Listener mechanism. -
- --This example builds on HelloWorld2 and demonstrates how to resize the Label -when the Shell resizes using a Layout. -
- --This example builds on HelloWorld1 and demonstrates how to draw directly -on an SWT Control using a graphic context. -
- --Follow the Manual Setup -instructions to install and run the example from your workspace. -
-
-The "Main" class is org.eclipse.swt.examples.helloworld.HelloWorld[1-5]
.
-
-This example can also be run using the Example Launcher. -Select the Hello World item from the Standalone category and click Run. -
- - - - 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 29712faba7..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/swt_hoverhelp_ex.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - --The Hover Help example shows how to implement custom tooltips and hover help support -on a number of different SWT controls including Buttons, TableItems, ToolItems and TreeItems. -The example implements its own tooltip and hover help support. -To see the custom tooltips in action, hover over an item or button in the UI. -Notice that images appear in the left-hand corner of the tooltip. -To see the custom hover help in action, hover over an item or button in the UI until -the tooltip is displayed. Without moving the mouse, hit F1. A new Shell will pop up with the -extended hover help information for the UI element in question. -
- --Follow the Manual Setup -instructions to install and run the example from your workspace. -
-
-The "Main" class is org.eclipse.swt.examples.hoverhelp.HoverHelp
.
-
-This example can also be run using the Example Launcher. -Select the Hover Help item from the Standalone category and click Run. -
- - - - 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 5a25923051..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/swt_imageanalyzer_ex.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - --The ImageAnalyzer opens image files and displays the visual contents of the file along with a -summary of the data in the image file. -The user can make adjustments to various elements of the image such as scaling and Alpha -blending and can save these changes to a file. -
--The ImageAnalyzer will load and display image files of type GIF, JPEG, BMP, ICO, and PNG. -To open a file, use the File --> Open... menu item, and select the image file in the FileDialog. -If the file is an interlaced GIF or PNG or a progressive JPEG, and Incremental Display is selected, -then the ImageAnalyzer displays the image increments as they are being loaded. -If the file contains an animated GIF, then the Next, Previous, and Animate buttons become enabled, -and they can be used to cycle through the images in the file, or animate them. If a GIF defines a background color, -as many animated GIFs do, selecting Background will use the GIF's background color. -If the image has transparency (possible with GIF, PNG, or ICO), then selecting Display Mask will draw the image's transparency -mask to the right of the image. You can change the background color of the ImageAnalyzer to see the transparency work. -To turn off the transparency, deselect Display Transparency. -After an image is loaded, it can be scaled or have alpha transparency applied, using the Scale and Alpha-K combos, -and the Alpha menu. File --> Reopen restores scaling and Alpha to their default values and reloads the current image file. -File --> Save As... can be used to save the currently loaded image to another type of image file. If the image has transparency, -File --> Save Mask As... saves the image's transparency mask. -
--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. -
- --Follow the Manual Setup -instructions to install and run the example from your workspace. -
-
-The "Main" class is org.eclipse.swt.examples.imageanalyzer.ImageAnalyzer
.
-
-This example can also be run using the Example Launcher. -Select the Image Analyzer item from the Standalone category and click Run. -
- - - - 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 be071be4b3..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/swt_javaviewer_ex.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - --This example demonstrates how to implement a user-defined line styler for the StyledText widget. -The example provides a typical editor interface. -To see the effect of the line styler, open a *.java file. -When the contents of the file are displayed in the editor area, notice that the keywords have been highlighted. -
- --Follow the Manual Setup -instructions to install and run the example from your workspace. -
-
-The "Main" class is org.eclipse.swt.examples.javaviewer.JavaViewer
.
-
-This example can also be run using the Example Launcher. -Select the Java Syntax Viewer item from the Standalone category and click Run. -
- - - - diff --git a/examples/org.eclipse.swt.examples/doc-html/swt_launcher_ex.html b/examples/org.eclipse.swt.examples/doc-html/swt_launcher_ex.html deleted file mode 100644 index 9f882bd4dc..0000000000 --- a/examples/org.eclipse.swt.examples/doc-html/swt_launcher_ex.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - --The Example Launcher is used to launch SWT examples which can either be Workbench Views, -or Standalone applications. -
- --For information on how to run the standalone examples without the SWT Example Launcher, -refer to Manual Setup. -
--The SWT workbench view examples can also be launched directly without using the SWT Example -Launcher. SWT workbench view examples can be found under the SWT Examples category of the -Show Views dialog. -
- --From the Window menu, select Show View --> Other. -In the Show View dialog, expand SWT Examples and select the SWT Example Launcher view. -A view containing a list of examples will appear in your current perspective. -Select an example from the list. A brief description of the example is displayed. -Click on the Run button to launch the example. -
- - -The example launcher view contains a tree list, a text area, and a button.
-The tree list contains a list of all the SWT examples you can choose
-to run. When an example is selected from the tree, the text area
-displays a short description of the example. The selected example can
-be launched by clicking on the Run button. Standalone examples are run in the
-same thread as the workbench's UI but they are not integrated into the perspective.
-The launcher invokes the open()
method of the standalone example.
-
-This example is a simple demonstration of common SWT layouts. -It consists of a tab folder where each tab in the folder allows the -user to interact with a different SWT layout. -The user can insert widgets into a layout and set the values of the layout data -using a property sheet. When the user has a suitable arrangement, code can be -generated by clicking on the Code button. -
- --Follow the Manual Setup -instructions to install and run the example from your workspace. -
-
-The "Main" class is org.eclipse.swt.examples.layoutexample.LayoutExample
.
-
-*** In the following description, substitute the location in which you installed Eclipse for INSTALLDIR *** -
- -Import the example code and all its required resources into your workspace:
- -INSTALLDIR\eclipse\plugins\org.eclipse.swt.examples_2.0.0\swtexamplessrc.zip
- INSTALLDIR/eclipse/plugins/org.eclipse.swt.examples_2.0.0/swtexamplessrc.zip
- INSTALLDIR\eclipse\plugins\org.eclipse.swt.examples_2.0.0\swtexamples.jar
- INSTALLDIR/eclipse/plugins/org.eclipse.swt.examples_2.0.0/swtexamples.jar
- Now you need to compile the SWT examples. In order to do this, you must add the SWT jar(s) to -the compile path:
-INSTALLDIR\eclipse\plugins\org.eclipse.swt.win32_2.0.0\ws\win32\swt.jar
- INSTALLDIR/eclipse/plugins/org.eclipse.swt.gtk_2.0.0/ws/gtk/swt.jar
- INSTALLDIR/eclipse/plugins/org.eclipse.swt.motif_2.0.0/ws/motif/swt.jar
- INSTALLDIR/eclipse/plugins/org.eclipse.swt.photon_2.0.0/ws/photon/swt.jar
- INSTALLDIR/eclipse/plugins/org.eclipse.swt.carbon_2.0.0/ws/carbon/swt.jar
- NOTE: For some platforms (such as GTK), more than one jar is required to run SWT (on -GTK there is a swt.jar and a swt-pi.jar file). In this case, all the required jars must -be added to the class path. This is done by repeating the steps above for each jar file. -All jar files are located in the same directory/folder.
- -At this point your SWT examples should be compiled without any errors. Check the Task
-view for errors. If you get an error like "java.lang.Object
not found" it means
-you have not configured a JRE. Go to the Window --> Preferences dialog.
-Select Java --> Installed JREs and ensure that a JRE is installed
-and that the path to the JRE is correct.
Now you have to configure Eclipse to run the example. This requires putting the SWT -JNI libraries on the library path so that the VM can find them: - -
org.eclipse.swt.examples.addressbook.AddressBook
.
--Djava.library.path=INSTALLDIR\plugins\org.eclipse.swt.win32_2.0.0\os\win32\x86
- -Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.gtk_2.0.0/os/linux/x86
- -Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.motif_2.0.0/os/linux/x86
- -Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.motif_2.0.0/os/solaris/sparc
- -Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.motif_2.0.0/os/aix/ppc
- -Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.motif_2.0.0/os/hpux/PA_RISC
- -Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.photon_2.0.0/os/qnx/x86
- -Djava.library.path=INSTALLDIR/eclipse/plugins/org.eclipse.swt.carbon_2.0.0/os/macosx/ppc
- -Consult the documentation of each individual example for the names of -its Main class and additional details. -
-
-The following examples are included in the swtexamples.jar
:
-
-
-
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 3d5571b25f..0000000000
--- a/examples/org.eclipse.swt.examples/doc-html/swt_texteditor_ex.html
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-This example demonstrates how to use the StyledText widget to implement -a text editor with formatting support. -The example has a typical text editor interface. -The Edit menu contains Cut, Copy, Paste and Set Font items and the toolbar -provides a bold text toggle, three colour tools that operate on the current -selection, and a reset to defaults button that also operates on the current selection. -
- --Follow the Manual Setup -instructions to install and run the example from your workspace. -
-
-The "Main" class is org.eclipse.swt.examples.texteditor.TextEditor
.
-
-This example can also be run using the Example Launcher. -Select the Text Editor item from the Standalone category and click Run. -
- - - - diff --git a/examples/org.eclipse.swt.examples/plugin.properties b/examples/org.eclipse.swt.examples/plugin.properties deleted file mode 100755 index 6382611aed..0000000000 --- a/examples/org.eclipse.swt.examples/plugin.properties +++ /dev/null @@ -1,113 +0,0 @@ -providerName = Eclipse.org -plugin.SWTStandaloneExampleSet.name = SWT Standalone Examples Plugin - -launchcategory.SWTStandaloneExamples.name = Standalone -launchcategory.SWTStandaloneExamples.description = \ - A collection of Standard Widget Toolkit examples that run independant \ - of the Eclipse Platform. - -launchitem.AddressBook.name = Address Book -launchitem.AddressBook.description = \ - The AddressBook example shows how the Table control can be used to \ - present information in a tabular format.\n\n\ - The application can save and load data from a file, sort the entries, and \ - search for strings within the fields. - -launchitem.ControlExample.name = SWT Controls Example -launchitem.ControlExample.description = \ - The Controls example is a simple demonstration of common SWT controls. \n\n\ - It consists of a tab folder where each tab in the folder allows the user \ - to interact with a different control. \ - The user can change styles and settings and view how this affects the control. - -launchitem.FileViewer.name = File Viewer -launchitem.FileViewer.description = \ - The File Viewer example shows how a simple application can be implemented using SWT.\n\n\ - This application provides the ability to navigate files and folders and manipulate them via Drag and Drop. \ - It includes the use of alternate threads for long actions and demonstrates the use of the Tree, \ - Table, Toolbar and Program. - -launchitem.HoverHelp.name = Hover Help -launchitem.HoverHelp.description = \ - The Hover Help example shows how to implement custom tooltips and hover help support \ - on a number of different SWT controls including Buttons, TableItems, ToolItems and TreeItems.\n\n\ - The example implements its own tooltip and hover help support. \ - To see the custom tooltips in action, hover over an item or button in the UI. \ - An image appears in the left-hand corner of the tooltip.\n\n\ - To see the custom hover help in action, hover over an item or button in the UI until \ - the tooltip is displayed. Without moving the mouse, hit F1. A new Shell will pop up with the \ - extended hover help information for the UI element in question - -launchitem.HelloWorld1.name = Hello World (1) -launchitem.HelloWorld1.description = \ - This example demonstrates how to open a Shell and process the events. - -launchitem.HelloWorld2.name = Hello World (2) -launchitem.HelloWorld2.description = \ - This example builds on HelloWorld1 and demonstrates how to display a Label inside the Shell. - -launchitem.HelloWorld3.name = Hello World (3) -launchitem.HelloWorld3.description = \ - This example builds on HelloWorld2 and demonstrates how to resize the Label \ - when the Shell resizes using a Listener mechanism. - -launchitem.HelloWorld4.name = Hello World (4) -launchitem.HelloWorld4.description = \ - This example builds on HelloWorld2 and demonstrates how to resize the Label \ - when the Shell resizes using a Layout. - -launchitem.HelloWorld5.name = Hello World (5) -launchitem.HelloWorld5.description = \ - This example builds on HelloWorld1 and demonstrates how to draw directly on an SWT Control using a graphic context. - -launchitem.ImageAnalyzer.name = Image Analyzer -launchitem.ImageAnalyzer.description = \ - The ImageAnalyzer opens image files and displays the visual contents of the file along with a \ - summary of the data in the image file.\n\n\ - The user can make adjustments to various elements of the image such as scaling and Alpha \ - blending and can save these changes to a file.\n\n\ - The ImageAnalyzer will load and display image files of type GIF, JPEG, BMP, ICO, and PNG. \ - To open a file, use the File->Open... menu item, and select the image file in the FileDialog.\n\n\ - If the file is an interlaced GIF or PNG or a progressive JPEG, and Incremental Display is selected, \ - then the ImageAnalyzer displays the image increments as they are being loaded.\n\n\ - If the file contains an animated GIF, then the Next, Previous, and Animate buttons become enabled, \ - and they can be used to cycle through the images in the file, or animate them. If a GIF defines a background color, \ - as many animated GIFs do, selecting Background will use the GIF's background color.\n\n\ - If the image has transparency (possible with GIF, PNG, or ICO), then selecting Display Mask will draw the image's transparency \ - mask to the right of the image. You can change the background color of the ImageAnalyzer to see the transparency work. \ - To turn off the transparency, deselect Display Transparency.\n\n\ - After an image is loaded, it can be scaled or have alpha transparency applied, using the Scale and Alpha-K combos, \ - and the Alpha menu. File->Reopen restores scaling and Alpha to their default values and reloads the current image file.\n\n\ - File->Save As... can be used to save the currently loaded image to another type of image file. If the image has transparency, \ - File->Save Mask As... saves the image's transparency mask.\n\n\ - When SWT loads an image file, an instance of org.eclipse.swt.graphics.ImageData is created. (In the case of an ICO file or \ - multi-image GIF, an array of ImageData instances is created). The ImageAnalyzer displays all of the data stored in the ImageData \ - instance(s) for the currently loaded image file, including the pixel data. Hovering over a pixel in the image display will show the RGB \ - color data for that pixel. For certain images (particularly animated GIFs) additional data is stored in the org.eclipse.swt.graphics.ImageLoader \ - instance used to load the image. The ImageAnalyzer displays this data as well. - -launchitem.JavaViewer.name = Java Syntax Viewer -launchitem.JavaViewer.description = \ - This example demonstrates how to implement a user-defined line styler for the StyledText widget.\n\n\ - The example provides a typical editor interface. \ - To see the effect of the line styler, open a *.java file. \ - When the contents of the file are displayed in the editor area, notice that the keywords have been highlighted. - -launchitem.LayoutExample.name = Layout Example -launchitem.LayoutExample.description = \ - This example is a simple demonstration of common SWT layouts. \n\n\ - It consists of a tab folder where each tab in the folder allows the \ - user to interact with a different SWT layout. \ - The user can insert widgets into a layout and set the values of the layout data \ - using a property sheet. When the user has a suitable arrangement, code can be \ - generated by clicking on the Code button. - -launchitem.TextEditor.name = Text Editor -launchitem.TextEditor.description = \ - This example demonstrates how to use the StyledText widget to implement \ - a text editor with formatting support.\n\n\ - The example has a typical text editor interface. \ - The Edit menu contains Cut, Copy, Paste and Set Font items and the toolbar \ - provides a bold text toggle, three colour tools that operate on the current \ - selection, and a reset to defaults button that also operates on the current selection. - \ No newline at end of file diff --git a/examples/org.eclipse.swt.examples/plugin.xml b/examples/org.eclipse.swt.examples/plugin.xml deleted file mode 100755 index 3562e1fc6d..0000000000 --- a/examples/org.eclipse.swt.examples/plugin.xml +++ /dev/null @@ -1,142 +0,0 @@ - - -org.eclipse.swt
- * libraries to implement a simple address book. This application has
- * save, load, sorting, and searching functions common
- * to basic address books.
- */
-public class AddressBook {
-
- private static ResourceBundle resAddressBook = ResourceBundle.getBundle("examples_addressbook");
- private Shell shell;
-
- private Table table;
- private SearchDialog searchDialog;
-
- private File file;
- private boolean isModified;
-
- private String[] copyBuffer;
-
- private static final String DELIMITER = "\t";
- private static final String[] columnNames = {resAddressBook.getString("Last_name"),
- resAddressBook.getString("First_name"),
- resAddressBook.getString("Business_phone"),
- resAddressBook.getString("Home_phone"),
- resAddressBook.getString("Email"),
- resAddressBook.getString("Fax")};
-
-public static void main(String[] args) {
- Display display = new Display();
- AddressBook application = new AddressBook();
- Shell shell = application.open(display);
- while(!shell.isDisposed()){
- if(!display.readAndDispatch())
- display.sleep();
- }
- display.dispose();
-}
-public Shell open(Display display) {
- shell = new Shell(display);
- shell.setLayout(new FillLayout());
- shell.addShellListener(new ShellAdapter() {
- public void shellClosed(ShellEvent e) {
- e.doit = closeAddressBook();
- }
- });
-
- createMenuBar();
-
- searchDialog = new SearchDialog(shell);
- searchDialog.setSearchAreaNames(columnNames);
- searchDialog.setSearchAreaLabel(resAddressBook.getString("Column"));
- searchDialog.addFindListener(new FindListener () {
- public boolean find() {
- return findEntry();
- }
- });
-
- table = new Table(shell, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
- table.setHeaderVisible(true);
- table.setMenu(createPopUpMenu());
- table.addSelectionListener(new SelectionAdapter() {
- public void widgetDefaultSelected(SelectionEvent e) {
- TableItem[] items = table.getSelection();
- if (items.length > 0) editEntry(items[0]);
- }
- });
- for(int i = 0; i < columnNames.length; i++) {
- TableColumn column = new TableColumn(table, SWT.NONE);
- column.setText(columnNames[i]);
- column.setWidth(150);
- final int columnIndex = i;
- column.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- sort(columnIndex);
- }
- });
- }
-
- newAddressBook();
-
- shell.setSize(table.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, 300);
- shell.open();
- return shell;
-}
-
-private boolean closeAddressBook() {
- if(isModified) {
- //ask user if they want to save current address book
- MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.YES | SWT.NO | SWT.CANCEL);
- box.setText(shell.getText());
- box.setMessage(resAddressBook.getString("Close_save"));
-
- int choice = box.open();
- if(choice == SWT.CANCEL) {
- return false;
- } else if(choice == SWT.YES) {
- if (!save()) return false;
- }
- }
-
- TableItem[] items = table.getItems();
- for (int i = 0; i < items.length; i ++) {
- items[i].dispose();
- }
-
- return true;
-}
-/**
- * Creates the menu at the top of the shell where most
- * of the programs functionality is accessed.
- *
- * @return The Menu
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 String
to a String array representing a table entry.
- */
-private String[] decodeLine(String line) {
- if(line == null) return null;
-
- String[] parsedLine = new String[table.getColumnCount()];
- for(int i = 0; i < parsedLine.length - 1; i++) {
- String newString = "";
- int index = line.indexOf(DELIMITER);
- if (index > -1) {
- parsedLine[i] = line.substring(0, index);
- line = line.substring(index + DELIMITER.length(), line.length());
- } else {
- return null;
- }
- }
-
- if (line.indexOf(DELIMITER) != -1) return null;
-
- parsedLine[parsedLine.length - 1] = line;
-
- return parsedLine;
-}
-private void displayError(String msg) {
- MessageBox box = new MessageBox(shell, SWT.ICON_ERROR);
- box.setMessage(msg);
- box.open();
-}
-private void editEntry(TableItem item) {
- DataEntryDialog dialog = new DataEntryDialog(shell);
- dialog.setLabels(columnNames);
- String[] values = new String[table.getColumnCount()];
- for (int i = 0; i < values.length; i++) {
- values[i] = item.getText(i);
- }
- dialog.setValues(values);
- values = dialog.open();
- if (values != null) {
- item.setText(values);
- isModified = true;
- }
-}
-private String encodeLine(String[] tableItems) {
- String line = "";
- for (int i = 0; i < tableItems.length - 1; i++) {
- line += tableItems[i] + DELIMITER;
- }
- line += tableItems[tableItems.length - 1] + "\n";
-
- return line;
-}
-private boolean findEntry() {
- Cursor waitCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
-
- boolean matchCase = searchDialog.getMatchCase();
- boolean matchWord = searchDialog.getMatchWord();
- String searchString = searchDialog.getSearchString();
- int column = searchDialog.getSelectedSearchArea();
-
- searchString = matchCase ? searchString : searchString.toLowerCase();
-
- boolean found = false;
- if (searchDialog.getSearchDown()) {
- for(int i = table.getSelectionIndex() + 1; i < table.getItemCount(); i++) {
- if (found = findMatch(searchString, table.getItem(i), column, matchWord, matchCase)){
- table.setSelection(i);
- break;
- }
- }
- } else {
- for(int i = table.getSelectionIndex() - 1; i > -1; i--) {
- if (found = findMatch(searchString, table.getItem(i), column, matchWord, matchCase)){
- table.setSelection(i);
- break;
- }
- }
- }
-
- shell.setCursor(null);
- if (waitCursor != null)
- waitCursor.dispose();
-
- return found;
-}
-private boolean findMatch(String searchString, TableItem item, int column, boolean matchWord, boolean matchCase) {
-
- String tableText = matchCase ? item.getText(column) : item.getText(column).toLowerCase();
- if (matchWord) {
- if (tableText != null && tableText.equals(searchString)) {
- return true;
- }
-
- } else {
- if(tableText!= null && tableText.indexOf(searchString) != -1) {
- return true;
- }
- }
- return false;
-}
-private void newAddressBook() {
- shell.setText(resAddressBook.getString("Title_bar") + resAddressBook.getString("New_title"));
- file = null;
- isModified = false;
-}
-private void newEntry() {
- DataEntryDialog dialog = new DataEntryDialog(shell);
- dialog.setLabels(columnNames);
- String[] data = dialog.open();
- if (data != null) {
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(data);
- isModified = true;
- }
-}
-
-private void openAddressBook() {
- FileDialog fileDialog = new FileDialog(shell, SWT.OPEN);
-
- fileDialog.setFilterExtensions(new String[] {"*.adr;", "*.*"});
- fileDialog.setFilterNames(new String[] {resAddressBook.getString("Book_filter_name") + " (*.adr)",
- resAddressBook.getString("All_filter_name") + " (*.*)"});
- fileDialog.open();
- String name = fileDialog.getFileName();
-
- if(name == null) return;
-
- File file = new File(fileDialog.getFilterPath(), name);
- if (!file.exists()) {
- displayError(resAddressBook.getString("File")+file.getName()+" "+resAddressBook.getString("Does_not_exist"));
- return;
- }
-
- Cursor waitCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
-
- FileReader fileReader = null;
- BufferedReader bufferedReader = null;
- String[] data = new String[0];
- try {
- fileReader = new FileReader(file.getAbsolutePath());
- bufferedReader = new BufferedReader(fileReader);
- String nextLine = bufferedReader.readLine();
- while (nextLine != null){
- String[] newData = new String[data.length + 1];
- System.arraycopy(data, 0, newData, 0, data.length);
- newData[data.length] = nextLine;
- data = newData;
- nextLine = bufferedReader.readLine();
- }
- } catch(FileNotFoundException e) {
- displayError(resAddressBook.getString("File_not_found") + "\n" + file.getName());
- return;
- } catch (IOException e ) {
- displayError(resAddressBook.getString("IO_error_read") + "\n" + file.getName());
- return;
- } finally {
-
- shell.setCursor(null);
- waitCursor.dispose();
-
- if(fileReader != null) {
- try {
- fileReader.close();
- } catch(IOException e) {
- displayError(resAddressBook.getString("IO_error_close") + "\n" + file.getName());
- return;
- }
- }
- }
-
- String[][] tableInfo = new String[data.length][table.getColumnCount()];
- for (int i = 0; i < data.length; i++) {
- tableInfo[i] = decodeLine(data[i]);
- }
-
- Arrays.sort(tableInfo, new RowComparator(0));
-
- for (int i = 0; i < tableInfo.length; i++) {
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(tableInfo[i]);
- }
- shell.setText(resAddressBook.getString("Title_bar")+fileDialog.getFileName());
- isModified = false;
- this.file = file;
-}
-private boolean save() {
- if(file == null) return saveAs();
-
- Cursor waitCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
-
- TableItem[] items = table.getItems();
- String[] lines = new String[items.length];
- for(int i = 0; i < items.length; i++) {
- String[] itemText = new String[table.getColumnCount()];
- for (int j = 0; j < itemText.length; j++) {
- itemText[j] = items[i].getText(j);
- }
- lines[i] = encodeLine(itemText);
- }
-
- FileWriter fileWriter = null;
- try {
- fileWriter = new FileWriter(file.getAbsolutePath(), false);
- for (int i = 0; i < lines.length; i++) {
- fileWriter.write(lines[i]);
- }
- } catch(FileNotFoundException e) {
- displayError(resAddressBook.getString("File_not_found") + "\n" + file.getName());
- return false;
- } catch(IOException e ) {
- displayError(resAddressBook.getString("IO_error_write") + "\n" + file.getName());
- return false;
- } finally {
- shell.setCursor(null);
- waitCursor.dispose();
-
- if(fileWriter != null) {
- try {
- fileWriter.close();
- } catch(IOException e) {
- displayError(resAddressBook.getString("IO_error_close") + "\n" + file.getName());
- return false;
- }
- }
- }
-
- shell.setText(resAddressBook.getString("Title_bar")+file.getName());
- isModified = false;
- return true;
-}
-private boolean saveAs() {
-
- FileDialog saveDialog = new FileDialog(shell, SWT.SAVE);
- saveDialog.setFilterExtensions(new String[] {"*.adr;", "*.*"});
- saveDialog.setFilterNames(new String[] {"Address Books (*.adr)", "All Files "});
-
- saveDialog.open();
- String name = saveDialog.getFileName();
-
- if(name.equals("")) return false;
-
- if(name.indexOf(".adr") != name.length() - 4) {
- name += ".adr";
- }
-
- File file = new File(saveDialog.getFilterPath(), name);
- if(file.exists()) {
- MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.YES | SWT.NO);
- box.setText(resAddressBook.getString("Save_as_title"));
- box.setMessage(resAddressBook.getString("File") + file.getName()+" "+resAddressBook.getString("Query_overwrite"));
- if(box.open() != SWT.YES) {
- return false;
- }
- }
- this.file = file;
- return save();
-}
-private void sort(int column) {
- if(table.getItemCount() <= 1) return;
-
- TableItem[] items = table.getItems();
- String[][] data = new String[items.length][table.getColumnCount()];
- for(int i = 0; i < items.length; i++) {
- for(int j = 0; j < table.getColumnCount(); j++) {
- data[i][j] = items[i].getText(j);
- }
- }
-
- Arrays.sort(data, new RowComparator(column));
-
- for (int i = 0; i < data.length; i++) {
- items[i].setText(data[i]);
- }
-
-}
-/**
- * Creates all the items located in the File submenu and
- * associate all the menu items with their appropriate
- * functions.
- *
- * @param menuBar Menu
- * the Menu
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 Menu
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 Menu
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 Menu
that file contain
- * the Help submenu.
- */
-private void createHelpMenu(Menu menuBar) {
-
- //Help Menu
- MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
- item.setText(resAddressBook.getString("Help_menu_title"));
- Menu menu = new Menu(shell, SWT.DROP_DOWN);
- item.setMenu(menu);
-
- //Help -> About Text Editor
- MenuItem subItem = new MenuItem(menu, SWT.NULL);
- subItem.setText(resAddressBook.getString("About"));
- subItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- MessageBox box = new MessageBox(shell, SWT.NONE);
- box.setText(resAddressBook.getString("About_1") + shell.getText());
- box.setMessage(shell.getText() + resAddressBook.getString("About_2"));
- box.open();
- }
- });
-}
-
-/**
- * To compare entries (rows) by the given column
- */
-private class RowComparator implements Comparator {
- private int column;
-
- /**
- * Constructs a RowComparator given the column index
- * @param col The index (starting at zero) of the column
- */
- public RowComparator(int col) {
- column = col;
- }
-
- /**
- * Compares two rows (type String[]) using the specified
- * column entry.
- * @param obj1 First row to compare
- * @param obj2 Second row to compare
- * @return negative if obj1 less than obj2, positive if
- * obj1 greater than obj2, and zero if equal.
- */
- public int compare(Object obj1, Object obj2) {
- String[] row1 = (String[])obj1;
- String[] row2 = (String[])obj2;
-
- return row1[column].compareTo(row2[column]);
- }
-}
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/DataEntryDialog.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/DataEntryDialog.java
deleted file mode 100755
index 6be9f908bc..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/DataEntryDialog.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-/* Imports */
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.ResourceBundle;
-
-/**
- * DataEntryDialog class uses org.eclipse.swt
- * libraries to implement a dialog that accepts basic personal information that
- * is added to a Table
widget or edits a TableItem
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 Text
widgets in the dialog in a
- * String
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 Text
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 Text
widgets of the dialog to
- * the values supplied in the parameter array.
- *
- * @param itemInfo String[]
- * The values to which the dialog contents will be set.
- */
-public void setValues(String[] itemInfo) {
- if (labels == null) return;
-
- if (values == null)
- values = new String[labels.length];
-
- int numItems = Math.min(values.length, itemInfo.length);
- for(int i = 0; i < numItems; i++) {
- values[i] = itemInfo[i];
- }
-}
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/FindListener.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/FindListener.java
deleted file mode 100755
index ab0f020fa6..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/FindListener.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-public interface FindListener {
-
-public boolean find();
-
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/SearchDialog.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/SearchDialog.java
deleted file mode 100755
index 4835dc06af..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/SearchDialog.java
+++ /dev/null
@@ -1,198 +0,0 @@
-package org.eclipse.swt.examples.addressbook;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-/* Imports */
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-import java.util.ResourceBundle;
-
-/**
- * SearchDialog is a simple class that uses org.eclipse.swt
- * libraries to implement a basic search dialog.
- */
-public class SearchDialog {
-
- private static ResourceBundle resAddressBook = ResourceBundle.getBundle("examples_addressbook");
-
- Shell shell;
- Text searchText;
- Combo searchArea;
- Label searchAreaLabel;
- Button matchCase;
- Button matchWord;
- Button findButton;
- Button down;
- FindListener findHandler;
-
-/**
- * Class constructor that sets the parent shell and the table widget that
- * the dialog will search.
- *
- * @param parent Shell
- * The shell that is the parent of the dialog.
- */
-public SearchDialog(Shell parent) {
- shell = new Shell(parent, SWT.CLOSE | SWT.BORDER | SWT.TITLE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- shell.setLayout(layout);
- shell.setText(resAddressBook.getString("Search_dialog_title"));
- shell.addShellListener(new ShellAdapter(){
- public void shellClosed(ShellEvent e) {
- // don't dispose of the shell, just hide it for later use
- e.doit = false;
- shell.setVisible(false);
- }
- });
-
- Label label = new Label(shell, SWT.LEFT);
- label.setText(resAddressBook.getString("Dialog_find_what"));
- searchText = new Text(shell, SWT.BORDER);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.widthHint = 200;
- searchText.setLayoutData(gridData);
- searchText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- boolean enableFind = (searchText.getCharCount() != 0);
- findButton.setEnabled(enableFind);
- }
- });
-
- searchAreaLabel = new Label(shell, SWT.LEFT);
- searchArea = new Combo(shell, SWT.DROP_DOWN | SWT.READ_ONLY);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.widthHint = 200;
- searchArea.setLayoutData(gridData);
-
- matchCase = new Button(shell, SWT.CHECK);
- matchCase.setText(resAddressBook.getString("Dialog_match_case"));
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- matchCase.setLayoutData(gridData);
-
- matchWord = new Button(shell, SWT.CHECK);
- matchWord.setText(resAddressBook.getString("Dialog_match_word"));
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- matchWord.setLayoutData(gridData);
-
- Group direction = new Group(shell, SWT.NONE);
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- direction.setLayoutData(gridData);
- direction.setLayout (new FillLayout ());
- direction.setText(resAddressBook.getString("Dialog_direction"));
-
- Button up = new Button(direction, SWT.RADIO);
- up.setText(resAddressBook.getString("Dialog_dir_up"));
- up.setSelection(false);
-
- down = new Button(direction, SWT.RADIO);
- down.setText(resAddressBook.getString("Dialog_dir_down"));
- down.setSelection(true);
-
- Composite composite = new Composite(shell, SWT.NONE);
- gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gridData.horizontalSpan = 2;
- composite.setLayoutData(gridData);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth = true;
- composite.setLayout(layout);
-
- findButton = new Button(composite, SWT.PUSH);
- findButton.setText(resAddressBook.getString("Dialog_find"));
- findButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- findButton.setEnabled(false);
- findButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (!findHandler.find()){
- MessageBox box = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK | SWT.PRIMARY_MODAL);
- box.setText(shell.getText());
- box.setMessage(resAddressBook.getString("Cannot_find") + "\"" + searchText.getText() + "\"");
- box.open();
- }
- }
- });
-
- Button cancelButton = new Button(composite, SWT.PUSH);
- cancelButton.setText(resAddressBook.getString("Cancel"));
- cancelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- cancelButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- shell.setVisible(false);
- }
- });
-
- shell.pack();
-}
-public String getSearchAreaLabel(String label) {
- return searchAreaLabel.getText();
-}
-
-public String[] getsearchAreaNames() {
- return searchArea.getItems();
-}
-public boolean getMatchCase() {
- return matchCase.getSelection();
-}
-public boolean getMatchWord() {
- return matchWord.getSelection();
-}
-public String getSearchString() {
- return searchText.getText();
-}
-public boolean getSearchDown(){
- return down.getSelection();
-}
-public int getSelectedSearchArea() {
- return searchArea.getSelectionIndex();
-}
-public void open() {
- if (shell.isVisible()) {
- shell.setFocus();
- } else {
- shell.open();
- }
- searchText.setFocus();
-}
-public void setSearchAreaNames(String[] names) {
- for (int i = 0; i < names.length; i++) {
- searchArea.add(names[i]);
- }
- searchArea.select(0);
-}
-public void setSearchAreaLabel(String label) {
- searchAreaLabel.setText(label);
-}
-public void setMatchCase(boolean match) {
- matchCase.setSelection(match);
-}
-public void setMatchWord(boolean match) {
- matchWord.setSelection(match);
-}
-public void setSearchDown(boolean searchDown){
- down.setSelection(searchDown);
-}
-public void setSearchString(String searchString) {
- searchText.setText(searchString);
-}
-
-public void setSelectedSearchArea(int index) {
- searchArea.select(index);
-}
-public void addFindListener(FindListener listener) {
- this.findHandler = listener;
-}
-public void removeFindListener(FindListener listener) {
- this.findHandler = null;
-}
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/AlignableTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/AlignableTab.java
deleted file mode 100755
index 0ae087ce9c..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/AlignableTab.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-/**
- * AlignableTab
is the abstract
- * superclass of example controls that can be
- * aligned.
- */
-abstract class AlignableTab extends Tab {
-
- /* Allignment Controls */
- Button leftButton, rightButton, centerButton;
-
- /* Alignment Group */
- Group allignmentGroup;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- AlignableTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Control" group.
- */
- void createControlGroup () {
- super.createControlGroup ();
-
- /* Create the group */
- allignmentGroup = new Group (controlGroup, SWT.NULL);
- allignmentGroup.setLayout (new GridLayout ());
- allignmentGroup.setLayoutData (new GridData(GridData.HORIZONTAL_ALIGN_FILL |
- GridData.VERTICAL_ALIGN_FILL));
- allignmentGroup.setText (ControlExample.getResourceString("Alignment"));
-
- /* Create the controls */
- leftButton = new Button (allignmentGroup, SWT.RADIO);
- leftButton.setText (ControlExample.getResourceString("Left"));
- centerButton = new Button (allignmentGroup, SWT.RADIO);
- centerButton.setText(ControlExample.getResourceString("Center"));
- rightButton = new Button (allignmentGroup, SWT.RADIO);
- rightButton.setText (ControlExample.getResourceString("Right"));
-
- /* Add the listeners */
- SelectionListener selectionListener = new SelectionAdapter () {
- public void widgetSelected(SelectionEvent event) {
- if (!((Button) event.widget).getSelection ()) return;
- setExampleWidgetAlignment ();
- };
- };
- leftButton.addSelectionListener (selectionListener);
- centerButton.addSelectionListener (selectionListener);
- rightButton.addSelectionListener (selectionListener);
- }
-
- /**
- * Sets the alignment of the "Example" widgets.
- */
- abstract void setExampleWidgetAlignment ();
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- Control [] controls = getExampleWidgets ();
- if (controls.length != 0) {
- leftButton.setSelection ((controls [0].getStyle () & SWT.LEFT) != 0);
- centerButton.setSelection ((controls [0].getStyle () & SWT.CENTER) != 0);
- rightButton.setSelection ((controls [0].getStyle () & SWT.RIGHT) != 0);
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ButtonTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ButtonTab.java
deleted file mode 100755
index fcc841449a..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ButtonTab.java
+++ /dev/null
@@ -1,193 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-/**
- * ButtonTab
is the class that
- * demonstrates SWT buttons.
- */
-class ButtonTab extends AlignableTab {
-
- /* Example widgets and groups that contain them */
- Button button1, button2, button3, button4, button5, button6;
- Group textButtonGroup, imageButtonGroup;
-
- /* Allignment widgets added to the "Control" group */
- Button upButton, downButton;
-
- /* Style widgets added to the "Style" group */
- Button pushButton, checkButton, radioButton, toggleButton, arrowButton, flatButton;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ButtonTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Control" group.
- */
- void createControlGroup () {
- super.createControlGroup ();
-
- /* Create the controls */
- upButton = new Button (allignmentGroup, SWT.RADIO);
- upButton.setText (ControlExample.getResourceString("Up"));
- downButton = new Button (allignmentGroup, SWT.RADIO);
- downButton.setText (ControlExample.getResourceString("Down"));
-
- /* Add the listeners */
- SelectionListener selectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- if (!((Button) event.widget).getSelection()) return;
- setExampleWidgetAlignment ();
- };
- };
- upButton.addSelectionListener(selectionListener);
- downButton.addSelectionListener(selectionListener);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for text buttons */
- textButtonGroup = new Group(exampleGroup, SWT.NONE);
- GridLayout gridLayout = new GridLayout ();
- textButtonGroup.setLayout(gridLayout);
- gridLayout.numColumns = 3;
- textButtonGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- textButtonGroup.setText (ControlExample.getResourceString("Text_Buttons"));
-
- /* Create a group for the image buttons */
- imageButtonGroup = new Group(exampleGroup, SWT.NONE);
- gridLayout = new GridLayout();
- imageButtonGroup.setLayout(gridLayout);
- gridLayout.numColumns = 3;
- imageButtonGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- imageButtonGroup.setText (ControlExample.getResourceString("Image_Buttons"));
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (pushButton.getSelection()) style |= SWT.PUSH;
- if (checkButton.getSelection()) style |= SWT.CHECK;
- if (radioButton.getSelection()) style |= SWT.RADIO;
- if (toggleButton.getSelection()) style |= SWT.TOGGLE;
- if (arrowButton.getSelection()) style |= SWT.ARROW;
- if (flatButton.getSelection()) style |= SWT.FLAT;
- if (borderButton.getSelection()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- button1 = new Button(textButtonGroup, style);
- button1.setText(ControlExample.getResourceString("One"));
- button2 = new Button(textButtonGroup, style);
- button2.setText(ControlExample.getResourceString("Two"));
- button3 = new Button(textButtonGroup, style);
- button3.setText(ControlExample.getResourceString("Three"));
- button4 = new Button(imageButtonGroup, style);
- button4.setImage(instance.images[ControlExample.ciClosedFolder]);
- button5 = new Button(imageButtonGroup, style);
- button5.setImage(instance.images[ControlExample.ciOpenFolder]);
- button6 = new Button(imageButtonGroup, style);
- button6.setImage(instance.images[ControlExample.ciTarget]);
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup() {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- pushButton = new Button (styleGroup, SWT.RADIO);
- pushButton.setText("SWT.PUSH");
- checkButton = new Button (styleGroup, SWT.RADIO);
- checkButton.setText ("SWT.CHECK");
- radioButton = new Button (styleGroup, SWT.RADIO);
- radioButton.setText ("SWT.RADIO");
- toggleButton = new Button (styleGroup, SWT.RADIO);
- toggleButton.setText ("SWT.TOGGLE");
- arrowButton = new Button (styleGroup, SWT.RADIO);
- arrowButton.setText ("SWT.ARROW");
- flatButton = new Button (styleGroup, SWT.CHECK);
- flatButton.setText ("SWT.FLAT");
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText ("SWT.BORDER");
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {button1, button2, button3, button4, button5, button6};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return "Button";
- }
-
- /**
- * Sets the alignment of the "Example" widgets.
- */
- void setExampleWidgetAlignment () {
- int allignment = 0;
- if (leftButton.getSelection ()) allignment = SWT.LEFT;
- if (centerButton.getSelection ()) allignment = SWT.CENTER;
- if (rightButton.getSelection ()) allignment = SWT.RIGHT;
- if (upButton.getSelection ()) allignment = SWT.UP;
- if (downButton.getSelection ()) allignment = SWT.DOWN;
- button1.setAlignment (allignment);
- button2.setAlignment (allignment);
- button3.setAlignment (allignment);
- button4.setAlignment (allignment);
- button5.setAlignment (allignment);
- button6.setAlignment (allignment);
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- if (arrowButton.getSelection ()) {
- upButton.setEnabled (true);
- centerButton.setEnabled (false);
- downButton.setEnabled (true);
- } else {
- upButton.setEnabled (false);
- centerButton.setEnabled (true);
- downButton.setEnabled (false);
- }
- upButton.setSelection ((button1.getStyle () & SWT.UP) != 0);
- downButton.setSelection ((button1.getStyle () & SWT.DOWN) != 0);
- pushButton.setSelection ((button1.getStyle () & SWT.PUSH) != 0);
- checkButton.setSelection ((button1.getStyle () & SWT.CHECK) != 0);
- radioButton.setSelection ((button1.getStyle () & SWT.RADIO) != 0);
- toggleButton.setSelection ((button1.getStyle () & SWT.TOGGLE) != 0);
- arrowButton.setSelection ((button1.getStyle () & SWT.ARROW) != 0);
- flatButton.setSelection ((button1.getStyle () & SWT.FLAT) != 0);
- borderButton.setSelection ((button1.getStyle () & SWT.BORDER) != 0);
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ComboTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ComboTab.java
deleted file mode 100755
index 6c8af38278..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ComboTab.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-
-class ComboTab extends Tab {
-
- /* Example widgets and groups that contain them */
- Combo combo1;
- Group comboGroup;
-
- /* Style widgets added to the "Style" group */
- Button dropDownButton, readOnlyButton, simpleButton;
-
- static String [] ListData = {ControlExample.getResourceString("ListData0_0"),
- ControlExample.getResourceString("ListData0_1"),
- ControlExample.getResourceString("ListData0_2"),
- ControlExample.getResourceString("ListData0_3"),
- ControlExample.getResourceString("ListData0_4"),
- ControlExample.getResourceString("ListData0_5"),
- ControlExample.getResourceString("ListData0_6"),
- ControlExample.getResourceString("ListData0_7"),
- ControlExample.getResourceString("ListData0_8")};
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- ComboTab(ControlExample instance) {
- super(instance);
- }
-
- /**
- * Creates the "Example" group.
- */
- void createExampleGroup () {
- super.createExampleGroup ();
-
- /* Create a group for the combo box */
- comboGroup = new Group (exampleGroup, SWT.NULL);
- comboGroup.setLayout (new GridLayout ());
- comboGroup.setLayoutData (new GridData (GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- comboGroup.setText ("Combo");
- }
-
- /**
- * Creates the "Example" widgets.
- */
- void createExampleWidgets () {
-
- /* Compute the widget style */
- int style = SWT.NONE;
- if (dropDownButton.getSelection ()) style |= SWT.DROP_DOWN;
- if (readOnlyButton.getSelection ()) style |= SWT.READ_ONLY;
- if (simpleButton.getSelection ()) style |= SWT.SIMPLE;
- if (borderButton.getSelection ()) style |= SWT.BORDER;
-
- /* Create the example widgets */
- combo1 = new Combo (comboGroup, style);
- combo1.setItems (ListData);
- if (ListData.length >= 3) {
- combo1.setText(ListData [2]);
- }
- }
-
- /**
- * Creates the "Style" group.
- */
- void createStyleGroup () {
- super.createStyleGroup ();
-
- /* Create the extra widgets */
- dropDownButton = new Button (styleGroup, SWT.RADIO);
- dropDownButton.setText ("SWT.DROP_DOWN");
- simpleButton = new Button (styleGroup, SWT.RADIO);
- simpleButton.setText("SWT.SIMPLE");
- readOnlyButton = new Button (styleGroup, SWT.CHECK);
- readOnlyButton.setText ("SWT.READ_ONLY");
- borderButton = new Button (styleGroup, SWT.CHECK);
- borderButton.setText ("SWT.BORDER");
- }
-
- /**
- * Gets the "Example" widget children.
- */
- Control [] getExampleWidgets () {
- return new Control [] {combo1};
- }
-
- /**
- * Gets the text for the tab folder item.
- */
- String getTabText () {
- return "Combo";
- }
-
- /**
- * Sets the state of the "Example" widgets.
- */
- void setExampleWidgetState () {
- super.setExampleWidgetState ();
- dropDownButton.setSelection ((combo1.getStyle () & SWT.DROP_DOWN) != 0);
- simpleButton.setSelection ((combo1.getStyle () & SWT.SIMPLE) != 0);
- readOnlyButton.setSelection ((combo1.getStyle () & SWT.READ_ONLY) != 0);
- borderButton.setSelection ((combo1.getStyle () & SWT.BORDER) != 0);
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java
deleted file mode 100755
index 300e4333a7..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java
+++ /dev/null
@@ -1,179 +0,0 @@
-package org.eclipse.swt.examples.controlexample;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-import java.text.*;
-import java.util.*;
-
-public class ControlExample {
- private static ResourceBundle resourceBundle =
- ResourceBundle.getBundle("examples_control");
- private ShellTab shellTab;
- private TabFolder tabFolder;
-
- static final int
- ciClosedFolder = 0,
- ciOpenFolder = 1,
- ciTarget = 2;
- static final String[] imageLocations = {
- "closedFolder.gif",
- "openFolder.gif",
- "target.gif" };
- Image images[];
-
- /**
- * Creates an instance of a ControlExample embedded inside
- * the supplied parent Composite.
- *
- * @param parent the container of the example
- */
- public ControlExample(Composite parent) {
- initResources();
- tabFolder = new TabFolder (parent, SWT.NULL);
- Tab [] tabs = new Tab [] {
- new ButtonTab (this),
- new ComboTab (this),
- new CoolBarTab (this),
- new DialogTab (this),
- new LabelTab (this),
- new ListTab (this),
- new ProgressBarTab (this),
- new SashTab (this),
- shellTab = new ShellTab(this),
- new SliderTab (this),
- new TableTab (this),
- new TextTab (this),
- new ToolBarTab (this),
- new TreeTab (this),
- };
- for (int i=0; iTab
is the abstract superclass of every page
- * in the example's tab folder. Each page in the tab folder
- * describes a control.
- *
- * A Tab itself is not a control but instead provides a
- * hierarchy with which to share code that is common to
- * every page in the folder.
- *
- * A typical page in a Tab contains a two column composite.
- * The left column contains the "Example" group. The right
- * column contains "Control" group. The "Control" group
- * contains controls that allow the user to interact with
- * the example control. The "Control" group typically
- * contains a "Style", "Display" and "Size" group. Subclasses
- * can override these defaults to augment a group or stop
- * a group from being created.
- */
-abstract class Tab {
- /* Common control buttons */
- Button borderButton, enabledButton, visibleButton;
- Button preferredButton, tooSmallButton, smallButton, largeButton, fillButton;
-
- /* Common groups and composites */
- Composite tabFolderPage;
- Group exampleGroup, controlGroup, displayGroup, sizeGroup, styleGroup, colorGroup;
-
- /* Controlling instance */
- final ControlExample instance;
-
- /* Sizing constants for the "Size" group */
- static final int TOO_SMALL_SIZE = 10;
- static final int SMALL_SIZE = 50;
- static final int LARGE_SIZE = 100;
-
- /* Common controls for the "Colors" group */
- Button backgroundButton, foregroundButton, fontButton;
- Color backgroundColor, foregroundColor;
- Font font;
-
- /**
- * Creates the Tab within a given instance of ControlExample.
- */
- Tab(ControlExample instance) {
- this.instance = instance;
- }
-
- /**
- * Creates the "Control" group. The "Control" group
- * is typically the right hand column in the tab.
- */
- void createControlGroup () {
-
- /*
- * Create the "Control" group. This is the group on the
- * left half of each example tab. It consists of the
- * style group, the display group and the size group.
- */
- controlGroup = new Group (tabFolderPage, SWT.NONE);
- GridLayout gridLayout= new GridLayout ();
- controlGroup.setLayout (gridLayout);
- gridLayout.numColumns = 2;
- gridLayout.makeColumnsEqualWidth = true;
- controlGroup.setLayoutData (new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- controlGroup.setText (ControlExample.getResourceString("Parameters"));
-
- /* Create individual groups inside the "Control" group */
- createStyleGroup ();
- createDisplayGroup ();
- createSizeGroup ();
- createColorGroup ();
-
- /*
- * For each Button child in the style group, add a selection
- * listener that will recreate the example controls. If the
- * style group button is a RADIO button, ensure that the radio
- * button is selected before recreating the example controls.
- * When the user selects a RADIO button, the current RADIO
- * button in the group is deselected and the new RADIO button
- * is selected automatically. The listeners are notified for
- * both these operations but typically only do work when a RADIO
- * button is selected.
- */
- SelectionListener selectionListener = new SelectionAdapter () {
- public void widgetSelected (SelectionEvent event) {
- if ((event.widget.getStyle () & SWT.RADIO) != 0) {
- if (!((Button) event.widget).getSelection ()) return;
- }
- recreateExampleWidgets ();
- };
- };
- Control [] children = styleGroup.getChildren ();
- for (int i=0; i
- * Used in dragOver() and dropAccept().
- * Note event.detail is set to DND.DROP_NONE by this method if the target is not valid.
- *
- * Used in drop().
- * Note event.detail is modified by this method.
- *
- * Used in dragFinished().
- *
- * Implementation notes: - *
AttachDialog
is the class that creates a
- * dialog specific for this example. It creates a dialog
- * with controls to set the values in a FormAttachment.
- */
- public class AttachDialog extends Dialog {
- String result = "";
- String controlInput, positionInput, alignmentInput, offsetInput;
- int col = 0;
-
- public AttachDialog (Shell parent, int style) {
- super (parent, style);
- }
-
- public AttachDialog (Shell parent) {
- this (parent, 0);
- }
-
- public void setColumn (int col) {
- this.col = col;
- }
-
- public String open () {
- Shell parent = getParent ();
- final Shell shell = new Shell (parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
- shell.setText (getText ());
- GridLayout layout = new GridLayout ();
- layout.numColumns = 3;
- layout.makeColumnsEqualWidth = true;
- shell.setLayout (layout);
-
- /* Find out what was previously set as an attachment */
- TableItem newItem = leftEditor.getItem ();
- result = newItem.getText (col);
- String oldAttach = result;
- String oldPos = "0", oldControl = "", oldAlign = "DEFAULT", oldOffset = "0";
- boolean isControl = false;
- if (oldAttach.length () != 0) {
- char first = oldAttach.charAt (0);
- if (Character.isLetter(first)) {
- /* We have a control */
- isControl = true;
- oldControl = oldAttach.substring (0, oldAttach.indexOf (','));
- oldAlign = oldAttach.substring (oldAttach.indexOf (':') + 1);
- oldOffset = oldAttach.substring (oldAttach.indexOf (',') + 1, oldAttach.indexOf (':'));
- } else {
- /* We have a position */
- oldPos = oldAttach.substring (0, oldAttach.indexOf (','));
- oldOffset = oldAttach.substring (oldAttach.indexOf (',') + 1);
- if (oldOffset.endsWith (")")) { // i.e. (Default)
- oldOffset = oldOffset.substring (0, oldOffset.indexOf (' '));
- }
- }
- }
-
- /* Add position field */
- final Button posButton = new Button (shell, SWT.RADIO);
- posButton.setText (LayoutExample.getResourceString ("Position"));
- posButton.setSelection (!isControl);
- final Combo position = new Combo (shell, SWT.NONE);
- position.setItems (new String [] {"0","25","50","75","100"});
- position.setText (oldPos);
- position.setEnabled (!isControl);
- GridData data = new GridData (GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- position.setLayoutData (data);
-
- /* Add control field */
- final Button contButton = new Button (shell, SWT.RADIO);
- contButton.setText (LayoutExample.getResourceString ("Control"));
- contButton.setSelection (isControl);
- final Combo control = new Combo (shell, SWT.READ_ONLY);
- TableItem [] items = table.getItems ();
- TableItem currentItem = leftEditor.getItem ();
- for (int i = 0; i < table.getItemCount (); i++) {
- if (items [i].getText (0).length() > 0) {
- if (items [i] != currentItem) {
- control.add (items [i].getText (COMBO_COL) + i);
- }
- }
- }
- if (oldControl.length () != 0) control.setText (oldControl);
- else control.select (0);
- control.setEnabled (isControl);
- data = new GridData (GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- control.setLayoutData (data);
-
- /* Add alignment field */
- new Label (shell, SWT.NONE).setText (LayoutExample.getResourceString ("Alignment"));
- final Combo alignment = new Combo (shell, SWT.NONE);
- String[] alignmentValues;
- if (col == LEFT_COL || col == RIGHT_COL) {
- alignmentValues = new String [] {"SWT.LEFT", "SWT.RIGHT", "SWT.CENTER", "SWT.DEFAULT"};
- } else {
- // col == TOP_COL || col == BOTTOM_COL
- alignmentValues = new String [] {"SWT.TOP", "SWT.BOTTOM", "SWT.CENTER", "SWT.DEFAULT"};
- }
- alignment.setItems (alignmentValues);
- alignment.setText ("SWT." + oldAlign);
- alignment.setEnabled (isControl);
- data = new GridData (GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- alignment.setLayoutData (data);
-
- /* Add offset field */
- new Label (shell, SWT.NONE).setText (LayoutExample.getResourceString ("Offset"));
- final Text offset = new Text (shell, SWT.SINGLE | SWT.BORDER);
- offset.setText (oldOffset);
- data = new GridData (GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- offset.setLayoutData (data);
-
- /* Add listeners for choosing between position and control */
- posButton.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent e) {
- position.setEnabled (true);
- control.setEnabled (false);
- alignment.setEnabled(false);
- }
- });
- contButton.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent e) {
- position.setEnabled (false);
- control.setEnabled (true);
- alignment.setEnabled(true);
- }
- });
-
- Button clear = new Button (shell, SWT.PUSH);
- clear.setText (LayoutExample.getResourceString ("Clear"));
- clear.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_END));
- clear.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent e) {
- result = "";
- shell.close ();
- }
- });
- /* OK button sets data into table */
- Button ok = new Button (shell, SWT.PUSH);
- ok.setText (LayoutExample.getResourceString ("OK"));
- ok.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_CENTER));
- ok.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent e) {
- controlInput = control.getText ();
- alignmentInput = alignment.getText ().substring (4);
- positionInput = position.getText ();
- if (positionInput.length () == 0) positionInput = "0";
- try {
- new Integer (positionInput).intValue ();
- } catch (NumberFormatException except) {
- positionInput = "0";
- }
- offsetInput = offset.getText ();
- if (offsetInput.length () == 0) offsetInput = "0";
- try {
- new Integer (offsetInput).intValue ();
- } catch (NumberFormatException except) {
- offsetInput = "0";
- }
- if (posButton.getSelection() || controlInput.length () == 0) {
- result = positionInput + "," + offsetInput;
- } else {
- result = controlInput + "," + offsetInput + ":" + alignmentInput;
- }
- shell.close ();
- }
- });
- Button cancel = new Button (shell, SWT.PUSH);
- cancel.setText (LayoutExample.getResourceString ("Cancel"));
- cancel.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_BEGINNING));
- cancel.addSelectionListener (new SelectionAdapter () {
- public void widgetSelected (SelectionEvent e) {
- shell.close ();
- }
- });
-
- shell.setDefaultButton (ok);
- shell.pack ();
- /* Center the dialog */
- Point center = parent.getLocation ();
- center.x = center.x + (parent.getBounds ().width / 2) - (shell.getBounds ().width / 2);
- center.y = center.y + (parent.getBounds ().height / 2) - (shell.getBounds ().height / 2);
- shell.setLocation (center);
- shell.open ();
- Display display = shell.getDisplay ();
- while (!shell.isDisposed ()) {
- if (display.readAndDispatch ()) display.sleep ();
- }
-
- return result;
- }
- }
-}
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java
deleted file mode 100644
index e45f67f810..0000000000
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/layoutexample/GridLayoutTab.java
+++ /dev/null
@@ -1,586 +0,0 @@
-package org.eclipse.swt.examples.layoutexample;
-
-/*
- * Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-
-class GridLayoutTab extends Tab {
- /* Controls for setting layout parameters */
- Text numColumns;
- Button makeColumnsEqualWidth;
- Combo marginHeight, marginWidth, horizontalSpacing, verticalSpacing;
- /* The example layout instance */
- GridLayout gridLayout;
- /* TableEditors and related controls*/
- TableEditor comboEditor, widthEditor, heightEditor;
- TableEditor vAlignEditor, hAlignEditor, hIndentEditor;
- TableEditor hSpanEditor, vSpanEditor, hGrabEditor, vGrabEditor;
- CCombo combo, vAlign, hAlign, hGrab, vGrab;
- Text widthText, heightText, hIndent, hSpan, vSpan;
-
- /* Constants */
- final int COMBO_COL = 1;
- final int WIDTH_COL = 2;
- final int HEIGHT_COL = 3;
- final int HALIGN_COL = 4;
- final int VALIGN_COL = 5;
- final int HINDENT_COL = 6;
- final int HSPAN_COL = 7;
- final int VSPAN_COL = 8;
- final int HGRAB_COL = 9;
- final int VGRAB_COL = 10;
-
- final int TOTAL_COLS = 11;
-
- /**
- * Creates the Tab within a given instance of LayoutExample.
- */
- GridLayoutTab(LayoutExample instance) {
- super(instance);
- }
-
- /**
- * Creates the widgets in the "child" group.
- */
- void createChildWidgets () {
- /* Create the TraverseListener */
- final TraverseListener traverseListener = new TraverseListener () {
- public void keyTraversed (TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_RETURN || e.detail == SWT.TRAVERSE_TAB_NEXT)
- resetEditors ();
- if (e.detail == SWT.TRAVERSE_ESCAPE)
- disposeEditors ();
- };
- };
-
- /* Add common controls */
- super.createChildWidgets ();
-
- /* Add TableEditors */
- comboEditor = new TableEditor (table);
- widthEditor = new TableEditor (table);
- heightEditor = new TableEditor (table);
- vAlignEditor = new TableEditor (table);
- hAlignEditor = new TableEditor (table);
- hIndentEditor = new TableEditor (table);
- hSpanEditor = new TableEditor (table);
- vSpanEditor = new TableEditor (table);
- hGrabEditor = new TableEditor (table);
- vGrabEditor = new TableEditor (table);
- table.addMouseListener (new MouseAdapter () {
- public void mouseDown(MouseEvent e) {
- resetEditors();
- index = table.getSelectionIndex ();
- Point pt = new Point (e.x, e.y);
- newItem = table.getItem (pt);
- if (newItem == null) return;
- TableItem oldItem = comboEditor.getItem ();
- if (newItem == oldItem || newItem != lastSelected) {
- lastSelected = newItem;
- return;
- }
- table.showSelection ();
-
- combo = new CCombo (table, SWT.READ_ONLY);
- createComboEditor (combo, comboEditor);
-
- widthText = new Text (table, SWT.SINGLE);
- widthText.setText (((String [])data.elementAt (index)) [WIDTH_COL]);
- createTextEditor (widthText, widthEditor, WIDTH_COL);
-
- heightText = new Text (table, SWT.SINGLE);
- heightText.setText (((String [])data.elementAt (index)) [HEIGHT_COL]);
- createTextEditor (heightText, heightEditor, HEIGHT_COL);
- String [] alignValues = new String [] {"BEGINNING","CENTER","END","FILL"};
- hAlign = new CCombo (table, SWT.NONE);
- hAlign.setItems (alignValues);
- hAlign.setText (newItem.getText (HALIGN_COL));
- hAlignEditor.horizontalAlignment = SWT.LEFT;
- hAlignEditor.grabHorizontal = true;
- hAlignEditor.minimumWidth = 50;
- hAlignEditor.setEditor (hAlign, newItem, HALIGN_COL);
- hAlign.addTraverseListener (traverseListener);
-
- vAlign = new CCombo (table, SWT.NONE);
- vAlign.setItems (alignValues);
- vAlign.setText (newItem.getText (VALIGN_COL));
- vAlignEditor.horizontalAlignment = SWT.LEFT;
- vAlignEditor.grabHorizontal = true;
- vAlignEditor.minimumWidth = 50;
- vAlignEditor.setEditor (vAlign, newItem, VALIGN_COL);
- vAlign.addTraverseListener (traverseListener);
-
- hIndent = new Text (table, SWT.SINGLE);
- hIndent.setText (((String [])data.elementAt (index)) [HINDENT_COL]);
- createTextEditor (hIndent, hIndentEditor, HINDENT_COL);
-
- hSpan = new Text (table, SWT.SINGLE);
- hSpan.setText (((String [])data.elementAt (index)) [HSPAN_COL]);
- createTextEditor (hSpan, hSpanEditor, HSPAN_COL);
-
- vSpan = new Text (table, SWT.SINGLE);
- vSpan.setText (((String [])data.elementAt (index)) [VSPAN_COL]);
- createTextEditor (vSpan, vSpanEditor, VSPAN_COL);
-
- String [] boolValues = new String [] {"false","true"};
- hGrab = new CCombo (table, SWT.NONE);
- hGrab.setItems (boolValues);
- hGrab.setText (newItem.getText (HGRAB_COL));
- hGrabEditor.horizontalAlignment = SWT.LEFT;
- hGrabEditor.grabHorizontal = true;
- hGrabEditor.minimumWidth = 50;
- hGrabEditor.setEditor (hGrab, newItem, HGRAB_COL);
- hGrab.addTraverseListener (traverseListener);;
-
- vGrab = new CCombo (table, SWT.NONE);
- vGrab.setItems (boolValues);
- vGrab.setText (newItem.getText (VGRAB_COL));
- vGrabEditor.horizontalAlignment = SWT.LEFT;
- vGrabEditor.grabHorizontal = true;
- vGrabEditor.minimumWidth = 50;
- vGrabEditor.setEditor (vGrab, newItem, VGRAB_COL);
- vGrab.addTraverseListener (traverseListener);
-
- for (int i=0; itrue
if the point specified by the
- * arguments is inside the area specified by the receiver.
- */
-public void test_containsII(){
- Rectangle r = new Rectangle(1, 2, 3, 4);
- assertTrue("Rectangle should contain point (1, 2)", r.contains(1, 2));
-
- assertTrue("Rectangle should contain point (3, 4)", r.contains(3, 4));
-
- assertTrue("Rectangle should contain point (3, 5)", r.contains(3, 5));
-
-// assertTrue("Rectangle should contain point (3, 6)", r.contains(3, 6));
-//
-// assertTrue("Rectangle should contain point (4, 5)", r.contains(4, 5));
-//
-// assertTrue("Rectangle should contain point (4, 6)", r.contains(4, 6));
-
- assertTrue("Rectangle should not contain point (9, 10)", !r.contains(9, 10));
-
- assertTrue("Rectangle should not contain point (-1, -1)", !r.contains(-1, -1));
-}
-
-/**
- * Returns true
if the given point is inside the
- * area specified by the receiver.
- *
- * @exception IllegalArgumentException true
if the given rectangle intersects
- * with the receiver and false
otherwise.
- *
- * @exception IllegalArgumentException true
if the receiver does not cover any
- * area in the (x, y) coordinate plane, and false
if
- * the receiver does cover some area in the plane.
- * - * A rectangle is considered to cover area in the - * (x, y) coordinate plane if both its width and height are - * non-zero. - *
- */ -public void test_isEmpty(){ - Rectangle r = new Rectangle(1, 2, 0, 0); - assertTrue("Rectangle is empty", r.isEmpty()); - - r = new Rectangle(1, 2, -3, -4); - assertTrue("Rectangle is empty", r.isEmpty()); - - r = new Rectangle(1, 2, 3, 4); - assertTrue("Rectangle is not empty", !r.isEmpty()); -} - -public void test_toString(){ - Rectangle r = new Rectangle(3, 4, 5, 6); - assertNotNull(r.toString()); - assertTrue(r.toString().length() > 0); - assertEquals("Rectangle {3, 4, 5, 6}", r.toString()); -} - -/** - * Returns a new rectangle which represents the union of - * the receiver and the given rectangle. - * - * @exception IllegalArgumentExceptionLEFT
, RIGHT
or CENTER
- * unless the receiver is a SEPARATOR
label, in
- * which case, NONE
is returned.
- */
-public void test_getAlignment(){
- int[] cases = {SWT.LEFT, SWT.RIGHT, SWT.CENTER};
- for (int i=0; iRIGHT
- * or CENTER
. If the receiver is a SEPARATOR
- * label, the argument is ignored and the alignment is not changed.
- */
-public void test_setAlignmentI(){
- int[] cases = {SWT.LEFT, SWT.RIGHT, SWT.CENTER};
- for (int i=0; i
- * Note: To add an item at the end of the list, use the
- * result of calling getItemCount()
as the
- * index or use add(String)
.
- *
- * The list is searched starting at 0 until an - * item is found that is equal to the search item. - * If no item is found, -1 is returned. Indexing - * is zero based. - * - * @param string the search item - * @return the index of the item - * - * @exception IllegalArgumentException
remove
'ing the old item at the index, and then
- * add
'ing the new item at that index.
- *
- * @param index the index for the item
- * @param string the new text for the item
- *
- * @exception IllegalArgumentException - * Note: This is not the actual structure used by the receiver - * to maintain its list of items, so modifying the array will - * not affect the receiver. - *
- */ -public void test_getItems(){ - int number = 5; - MenuItem[] items = new MenuItem[number]; - for (int i = 0; iMenuItem
or null when the receiver is a
- * root.
- */
-public void test_getParentItem(){
- MenuItem mItem = new MenuItem(menu, SWT.CASCADE);
- Menu newMenu = new Menu(shell, SWT.DROP_DOWN);
- assertNull(newMenu.getParentItem());
- mItem.setMenu(newMenu);
- assertEquals(newMenu.getParentItem(), mItem);
-}
-
-/**
- * Returns the receiver's parent item, which must be a
- * Menu
or null when the receiver is a
- * root.
- */
-public void test_getParentMenu(){
- MenuItem mItem = new MenuItem(menu, SWT.CASCADE);
- Menu newMenu = new Menu(shell, SWT.DROP_DOWN);
- assertNull(newMenu.getParentMenu());
- mItem.setMenu(newMenu);
- assertEquals(newMenu.getParentMenu(), menu);
-}
-
-/**
- * Returns the receiver's shell. For all controls other than
- * shells, this simply returns the control's nearest ancestor
- * shell. Shells return themselves, even if they are children
- * of other shells.
- */
-public void test_getShell(){
- assertEquals(menu.getShell(), shell);
-}
-
-public void test_getVisible() {
- warnUnimpl("Test test_getVisible not written");
-}
-
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param item the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException true
if the receiver is visible, and
- * false
otherwise.
- * - * If one of the receiver's ancestors is not visible or some - * other condition makes the receiver not visible, this method - * may still indicate that it is considered visible even though - * it may not actually be showing. - *
- */ -public void test_isVisible(){ - // This test can not be run as it currently is written. On Windows, if a - // menu has no menu items, it will not become visible. - // If we add menu items to the menu then a second problem is encountered - // because menu.setVisible() enters into a modal loop and execution of - // the JUnit test case will not continue until the menu is selected and closed. - if (true) return; - menu.setVisible(true); - assertTrue(menu.isVisible()); - - // api not implemented yet - if (fCheckVisibility) { - menu.setVisible(false); - assertEquals(menu.isVisible(), false); - } -} - -public void test_removeHelpListenerLorg_eclipse_swt_events_HelpListener() { - warnUnimpl("Test test_removeHelpListenerLorg_eclipse_swt_events_HelpListener not written"); -} - -public void test_removeMenuListenerLorg_eclipse_swt_events_MenuListener() { - warnUnimpl("Test test_removeMenuListenerLorg_eclipse_swt_events_MenuListener not written"); -} - -/** - * Sets the default menu item to the argument or removes - * the default emphasis when the argument isnull
.
- *
- * @param item the default menu item or null
- *
- * @exception IllegalArgumentException true
,
- * and marks it invisible otherwise.
- * - * If one of the receiver's ancestors is not visible or some - * other condition makes the receiver not visible, marking - * it visible may not actually cause it to be displayed. - *
- */ -/* tests both getVisible and setVisble */ -public void test_setVisibleZ(){ - // This test can not be run as it currently is written. On Windows, if a - // menu has no menu items, it will not become visible. - // If we add menu items to the menu then a second problem is encountered - // because menu.setVisible() enters into a modal loop and execution of - // the JUnit test case will not continue until the menu is selected and closed. - if (true) return; - menu.setVisible(true); - assertTrue(menu.getVisible()); - // API not implemented yet - if (fCheckVisibility) { - menu.setVisible(false); - assertEquals(menu.getVisible(), false); - } -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Menu((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_DecorationsI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Menu"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_MenuItem"); - methodNames.addElement("test_addHelpListenerLorg_eclipse_swt_events_HelpListener"); - methodNames.addElement("test_addMenuListenerLorg_eclipse_swt_events_MenuListener"); - methodNames.addElement("test_getDefaultItem"); - methodNames.addElement("test_getDisplay"); - methodNames.addElement("test_getEnabled"); - methodNames.addElement("test_getItemI"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getParentItem"); - methodNames.addElement("test_getParentMenu"); - methodNames.addElement("test_getShell"); - methodNames.addElement("test_getVisible"); - methodNames.addElement("test_indexOfLorg_eclipse_swt_widgets_MenuItem"); - methodNames.addElement("test_isEnabled"); - methodNames.addElement("test_isVisible"); - methodNames.addElement("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener"); - methodNames.addElement("test_removeMenuListenerLorg_eclipse_swt_events_MenuListener"); - methodNames.addElement("test_setDefaultItemLorg_eclipse_swt_widgets_MenuItem"); - methodNames.addElement("test_setEnabledZ"); - methodNames.addElement("test_setLocationII"); - methodNames.addElement("test_setVisibleZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Control")) test_ConstructorLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_DecorationsI")) test_ConstructorLorg_eclipse_swt_widgets_DecorationsI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Menu")) test_ConstructorLorg_eclipse_swt_widgets_Menu(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_MenuItem")) test_ConstructorLorg_eclipse_swt_widgets_MenuItem(); - else if (getName().equals("test_addHelpListenerLorg_eclipse_swt_events_HelpListener")) test_addHelpListenerLorg_eclipse_swt_events_HelpListener(); - else if (getName().equals("test_addMenuListenerLorg_eclipse_swt_events_MenuListener")) test_addMenuListenerLorg_eclipse_swt_events_MenuListener(); - else if (getName().equals("test_getDefaultItem")) test_getDefaultItem(); - else if (getName().equals("test_getDisplay")) test_getDisplay(); - else if (getName().equals("test_getEnabled")) test_getEnabled(); - else if (getName().equals("test_getItemI")) test_getItemI(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getParentItem")) test_getParentItem(); - else if (getName().equals("test_getParentMenu")) test_getParentMenu(); - else if (getName().equals("test_getShell")) test_getShell(); - else if (getName().equals("test_getVisible")) test_getVisible(); - else if (getName().equals("test_indexOfLorg_eclipse_swt_widgets_MenuItem")) test_indexOfLorg_eclipse_swt_widgets_MenuItem(); - else if (getName().equals("test_isEnabled")) test_isEnabled(); - else if (getName().equals("test_isVisible")) test_isVisible(); - else if (getName().equals("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener")) test_removeHelpListenerLorg_eclipse_swt_events_HelpListener(); - else if (getName().equals("test_removeMenuListenerLorg_eclipse_swt_events_MenuListener")) test_removeMenuListenerLorg_eclipse_swt_events_MenuListener(); - else if (getName().equals("test_setDefaultItemLorg_eclipse_swt_widgets_MenuItem")) test_setDefaultItemLorg_eclipse_swt_widgets_MenuItem(); - else if (getName().equals("test_setEnabledZ")) test_setEnabledZ(); - else if (getName().equals("test_setLocationII")) test_setLocationII(); - else if (getName().equals("test_setVisibleZ")) test_setVisibleZ(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MenuItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MenuItem.java deleted file mode 100644 index 403172c3a6..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MenuItem.java +++ /dev/null @@ -1,281 +0,0 @@ -package org.eclipse.swt.tests.junit; - -/* - * (c) Copyright IBM Corp. 2000, 2002. All rights reserved. - * This file is made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - */ - -import org.eclipse.swt.events.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.MenuItem - * - * @see org.eclipse.swt.widgets.MenuItem - */ -public class Test_org_eclipse_swt_widgets_MenuItem extends Test_org_eclipse_swt_widgets_Item { - -Menu menu; -MenuItem menuItem; - -public Test_org_eclipse_swt_widgets_MenuItem(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - menu = new Menu(shell); - menuItem = new MenuItem(menu, 0); - setWidget(menuItem); -} - -protected void tearDown() { - super.tearDown(); -} - -/** - * Possible exceptions: - * - * @exception IllegalArgumentExceptionMenu
.
- */
- public void test_getParent(){
- assertEquals(menuItem.getParent(), menu);
-}
-
-public void test_getSelection() {
- warnUnimpl("Test test_getSelection not written");
-}
-
-/**
- * Returns true
if the receiver is enabled, and
- * false
otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- */
-public void test_isEnabled(){
- menuItem.setEnabled(true);
- assertTrue(menuItem.isEnabled());
- menuItem.setEnabled(false);
- assertEquals(menuItem.isEnabled(), false);
-}
-
-public void test_removeArmListenerLorg_eclipse_swt_events_ArmListener() {
- warnUnimpl("Test test_removeArmListenerLorg_eclipse_swt_events_ArmListener not written");
-}
-
-public void test_removeHelpListenerLorg_eclipse_swt_events_HelpListener() {
- warnUnimpl("Test test_removeHelpListenerLorg_eclipse_swt_events_HelpListener not written");
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-/**
- * Sets the widget accelerator. An accelerator is the bit-wise
- * OR of zero or more modifier masks and a key. Examples:
- * SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2
.
- */
-public void test_setAcceleratorI(){
- menuItem.setAccelerator(SWT.CTRL + 'Z');
- assertEquals(menuItem.getAccelerator(), SWT.CTRL + 'Z');
-
-}
-
-/**
- * Enables the receiver if the argument is true
,
- * and disables it otherwise. A disabled control is typically
- * not selectable from the user interface and draws with an
- * inactive or "grayed" look.
- */
-public void test_setEnabledZ(){
- menuItem.setEnabled(true);
- assertTrue(menuItem.getEnabled());
- menuItem.setEnabled(false);
- assertEquals(menuItem.getEnabled(), false);
-}
-
-public void test_setImageLorg_eclipse_swt_graphics_Image() {
- warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written");
-}
-
-/**
- * Sets the receiver's pull down menu to the argument.
- * Only CASCADE
menu items can have a
- * pull down menu. The sequence of key strokes, button presses
- * and/or button releases that are used to request a pull down
- * menu is platform specific.
- *
- * @param menu the new pull down menu
- *
- * @exception IllegalArgumentException CASCADE
- * When the receiver is of type 20th June, 2002 Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html.
-For purposes of the CPL, "Program" will mean the Content. If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL. If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or
-other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.CHECK
or RADIO
,
- * it is selected when it is checked.
- */
-public void test_setSelectionZ(){
-
- int[] itemStyles = {SWT.CHECK, SWT.RADIO};
- for (int i=0; i
- *
- */
-public void test_ConstructorLorg_eclipse_swt_widgets_Shell(){
- if (fCheckSwtNullExceptions) {
- MessageBox mb = new MessageBox(shell);
- try {
- mb = new MessageBox(null);
- fail("No exception thrown for parent == null");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() {
- warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ShellI not written");
-}
-
-public void test_getMessage() {
- warnUnimpl("Test test_getMessage not written");
-}
-
-/**
- * Makes the dialog visible and brings it to the front
- * of the display.
- *
- * @return the ID of the button that was selected to dismiss the
- * message box (e.g. SWT.OK, SWT.CANCEL, etc...)
- */
-public void test_open(){
- if (fTestDialogOpen)
- messageBox.open();
-}
-
-/**
- * Sets the dialog's message, which is a description of
- * the purpose for which it was opened. This message will be
- * visible on the dialog while it is open.
- */
-public void test_setMessageLjava_lang_String(){
- assertEquals(messageBox.getMessage(), "");
- String testStr = "test string";
- messageBox.setMessage(testStr);
- assertEquals(messageBox.getMessage(), testStr);
- messageBox.setMessage("");
- assertEquals(messageBox.getMessage(), "");
- if (fCheckSwtNullExceptions) {
- try {
- messageBox.setMessage(null);
- fail("No exception thrown");
- }
- catch (IllegalArgumentException e) {
- }
- }
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_MessageBox((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell");
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI");
- methodNames.addElement("test_getMessage");
- methodNames.addElement("test_open");
- methodNames.addElement("test_setMessageLjava_lang_String");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Dialog.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell();
- else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI();
- else if (getName().equals("test_getMessage")) test_getMessage();
- else if (getName().equals("test_open")) test_open();
- else if (getName().equals("test_setMessageLjava_lang_String")) test_setMessageLjava_lang_String();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ProgressBar.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ProgressBar.java
deleted file mode 100644
index f252d1cefd..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ProgressBar.java
+++ /dev/null
@@ -1,629 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.ProgressBar
- *
- * @see org.eclipse.swt.widgets.ProgressBar
- */
-public class Test_org_eclipse_swt_widgets_ProgressBar extends Test_org_eclipse_swt_widgets_Control {
-
-ProgressBar progressBar;
-
-public Test_org_eclipse_swt_widgets_ProgressBar(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- progressBar = new ProgressBar(shell, 0);
- setWidget(progressBar);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-// this method must be private or protected so the auto-gen tool keeps it
-private void report(String call, int set, int minExpected, int maxExpected, int selectionExpected) {
- // Uncomment these lines and comment out call to check() if you want the test to report all errors without
- // stopping.
-
- //if (progressBar.getMinimum() != minExpected)
- //System.out.println(call + "(" + set + "): Minimum Expected: " + minExpected + " Actual: " + progressBar.getMinimum());
- //if (progressBar.getMaximum() != maxExpected)
- //System.out.println(call + "(" + set + "): Maximum Expected: " + maxExpected + " Actual: " + progressBar.getMaximum());
- //if (progressBar.getSelection() != selectionExpected)
- //System.out.println(call + "(" + set + "): Selection Expected: " + selectionExpected + " Actual: " + progressBar.getSelection());
-
- check(minExpected, maxExpected, selectionExpected);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private void check(int minExpected, int maxExpected, int selectionExpected) {
- assertEquals(progressBar.getMaximum(), maxExpected);
- assertEquals(progressBar.getMinimum(), minExpected);
- assertEquals(progressBar.getSelection(), selectionExpected);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMinimumValues() {
-return new int[][] {
-{-15, 10, 100, 50, },
-{-14, 10, 100, 50, },
-{-13, 10, 100, 50, },
-{-12, 10, 100, 50, },
-{-11, 10, 100, 50, },
-{-10, 10, 100, 50, },
-{-9, 10, 100, 50, },
-{-8, 10, 100, 50, },
-{-7, 10, 100, 50, },
-{-6, 10, 100, 50, },
-{-5, 10, 100, 50, },
-{-4, 10, 100, 50, },
-{-3, 10, 100, 50, },
-{-2, 10, 100, 50, },
-{-1, 10, 100, 50, },
-{0, 0, 100, 50, },
-{1, 1, 100, 50, },
-{2, 2, 100, 50, },
-{3, 3, 100, 50, },
-{4, 4, 100, 50, },
-{5, 5, 100, 50, },
-{6, 6, 100, 50, },
-{7, 7, 100, 50, },
-{8, 8, 100, 50, },
-{9, 9, 100, 50, },
-{10, 10, 100, 50, },
-{11, 11, 100, 50, },
-{12, 12, 100, 50, },
-{13, 13, 100, 50, },
-{14, 14, 100, 50, },
-{15, 15, 100, 50, },
-{16, 16, 100, 50, },
-{17, 17, 100, 50, },
-{18, 18, 100, 50, },
-{19, 19, 100, 50, },
-{20, 20, 100, 50, },
-{21, 21, 100, 50, },
-{22, 22, 100, 50, },
-{23, 23, 100, 50, },
-{24, 24, 100, 50, },
-{25, 25, 100, 50, },
-{26, 26, 100, 50, },
-{27, 27, 100, 50, },
-{28, 28, 100, 50, },
-{29, 29, 100, 50, },
-{30, 30, 100, 50, },
-{31, 31, 100, 50, },
-{32, 32, 100, 50, },
-{33, 33, 100, 50, },
-{34, 34, 100, 50, },
-{35, 35, 100, 50, },
-{36, 36, 100, 50, },
-{37, 37, 100, 50, },
-{38, 38, 100, 50, },
-{39, 39, 100, 50, },
-{40, 40, 100, 50, },
-{41, 41, 100, 50, },
-{42, 42, 100, 50, },
-{43, 43, 100, 50, },
-{44, 44, 100, 50, },
-{45, 45, 100, 50, },
-{46, 46, 100, 50, },
-{47, 47, 100, 50, },
-{48, 48, 100, 50, },
-{49, 49, 100, 50, },
-{50, 50, 100, 50, },
-{51, 51, 100, 51, },
-{52, 52, 100, 52, },
-{53, 53, 100, 53, },
-{54, 54, 100, 54, },
-{55, 55, 100, 55, },
-{56, 56, 100, 56, },
-{57, 57, 100, 57, },
-{58, 58, 100, 58, },
-{59, 59, 100, 59, },
-{60, 60, 100, 60, },
-{61, 61, 100, 61, },
-{62, 62, 100, 62, },
-{63, 63, 100, 63, },
-{64, 64, 100, 64, },
-{65, 65, 100, 65, },
-{66, 66, 100, 66, },
-{67, 67, 100, 67, },
-{68, 68, 100, 68, },
-{69, 69, 100, 69, },
-{70, 70, 100, 70, },
-{71, 71, 100, 71, },
-{72, 72, 100, 72, },
-{73, 73, 100, 73, },
-{74, 74, 100, 74, },
-{75, 75, 100, 75, },
-{76, 76, 100, 76, },
-{77, 77, 100, 77, },
-{78, 78, 100, 78, },
-{79, 79, 100, 79, },
-{80, 80, 100, 80, },
-{81, 81, 100, 81, },
-{82, 82, 100, 82, },
-{83, 83, 100, 83, },
-{84, 84, 100, 84, },
-{85, 85, 100, 85, },
-{86, 86, 100, 86, },
-{87, 87, 100, 87, },
-{88, 88, 100, 88, },
-{89, 89, 100, 89, },
-{90, 90, 100, 90, },
-{91, 91, 100, 91, },
-{92, 92, 100, 92, },
-{93, 93, 100, 93, },
-{94, 94, 100, 94, },
-{95, 95, 100, 95, },
-{96, 96, 100, 96, },
-{97, 97, 100, 97, },
-{98, 98, 100, 98, },
-{99, 99, 100, 99, },
-{100, 10, 100, 50, },
-{101, 10, 100, 50, },
-{102, 10, 100, 50, },
-{103, 10, 100, 50, },
-{104, 10, 100, 50, },
-{105, 10, 100, 50, },
-{106, 10, 100, 50, },
-{107, 10, 100, 50, },
-{108, 10, 100, 50, },
-{109, 10, 100, 50, },
-{110, 10, 100, 50, },
-{111, 10, 100, 50, },
-{112, 10, 100, 50, },
-{113, 10, 100, 50, },
-{114, 10, 100, 50, },
-{115, 10, 100, 50, },
-{116, 10, 100, 50, },
-{117, 10, 100, 50, },
-{118, 10, 100, 50, },
-{119, 10, 100, 50, },
-{120, 10, 100, 50, },
-{121, 10, 100, 50, },
-{122, 10, 100, 50, },
-{123, 10, 100, 50, },
-{124, 10, 100, 50, },
-};
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMaximumValues() {
-return new int[][] {
-{-15, 10, 100, 50, },
-{-14, 10, 100, 50, },
-{-13, 10, 100, 50, },
-{-12, 10, 100, 50, },
-{-11, 10, 100, 50, },
-{-10, 10, 100, 50, },
-{-9, 10, 100, 50, },
-{-8, 10, 100, 50, },
-{-7, 10, 100, 50, },
-{-6, 10, 100, 50, },
-{-5, 10, 100, 50, },
-{-4, 10, 100, 50, },
-{-3, 10, 100, 50, },
-{-2, 10, 100, 50, },
-{-1, 10, 100, 50, },
-{0, 10, 100, 50, },
-{1, 10, 100, 50, },
-{2, 10, 100, 50, },
-{3, 10, 100, 50, },
-{4, 10, 100, 50, },
-{5, 10, 100, 50, },
-{6, 10, 100, 50, },
-{7, 10, 100, 50, },
-{8, 10, 100, 50, },
-{9, 10, 100, 50, },
-{10, 10, 100, 50, },
-{11, 10, 11, 11, },
-{12, 10, 12, 12, },
-{13, 10, 13, 13, },
-{14, 10, 14, 14, },
-{15, 10, 15, 15, },
-{16, 10, 16, 16, },
-{17, 10, 17, 17, },
-{18, 10, 18, 18, },
-{19, 10, 19, 19, },
-{20, 10, 20, 20, },
-{21, 10, 21, 21, },
-{22, 10, 22, 22, },
-{23, 10, 23, 23, },
-{24, 10, 24, 24, },
-{25, 10, 25, 25, },
-{26, 10, 26, 26, },
-{27, 10, 27, 27, },
-{28, 10, 28, 28, },
-{29, 10, 29, 29, },
-{30, 10, 30, 30, },
-{31, 10, 31, 31, },
-{32, 10, 32, 32, },
-{33, 10, 33, 33, },
-{34, 10, 34, 34, },
-{35, 10, 35, 35, },
-{36, 10, 36, 36, },
-{37, 10, 37, 37, },
-{38, 10, 38, 38, },
-{39, 10, 39, 39, },
-{40, 10, 40, 40, },
-{41, 10, 41, 41, },
-{42, 10, 42, 42, },
-{43, 10, 43, 43, },
-{44, 10, 44, 44, },
-{45, 10, 45, 45, },
-{46, 10, 46, 46, },
-{47, 10, 47, 47, },
-{48, 10, 48, 48, },
-{49, 10, 49, 49, },
-{50, 10, 50, 50, },
-{51, 10, 51, 50, },
-{52, 10, 52, 50, },
-{53, 10, 53, 50, },
-{54, 10, 54, 50, },
-{55, 10, 55, 50, },
-{56, 10, 56, 50, },
-{57, 10, 57, 50, },
-{58, 10, 58, 50, },
-{59, 10, 59, 50, },
-{60, 10, 60, 50, },
-{61, 10, 61, 50, },
-{62, 10, 62, 50, },
-{63, 10, 63, 50, },
-{64, 10, 64, 50, },
-{65, 10, 65, 50, },
-{66, 10, 66, 50, },
-{67, 10, 67, 50, },
-{68, 10, 68, 50, },
-{69, 10, 69, 50, },
-{70, 10, 70, 50, },
-{71, 10, 71, 50, },
-{72, 10, 72, 50, },
-{73, 10, 73, 50, },
-{74, 10, 74, 50, },
-{75, 10, 75, 50, },
-{76, 10, 76, 50, },
-{77, 10, 77, 50, },
-{78, 10, 78, 50, },
-{79, 10, 79, 50, },
-{80, 10, 80, 50, },
-{81, 10, 81, 50, },
-{82, 10, 82, 50, },
-{83, 10, 83, 50, },
-{84, 10, 84, 50, },
-{85, 10, 85, 50, },
-{86, 10, 86, 50, },
-{87, 10, 87, 50, },
-{88, 10, 88, 50, },
-{89, 10, 89, 50, },
-{90, 10, 90, 50, },
-{91, 10, 91, 50, },
-{92, 10, 92, 50, },
-{93, 10, 93, 50, },
-{94, 10, 94, 50, },
-{95, 10, 95, 50, },
-{96, 10, 96, 50, },
-{97, 10, 97, 50, },
-{98, 10, 98, 50, },
-{99, 10, 99, 50, },
-{100, 10, 100, 50, },
-{101, 10, 101, 50, },
-{102, 10, 102, 50, },
-{103, 10, 103, 50, },
-{104, 10, 104, 50, },
-{105, 10, 105, 50, },
-{106, 10, 106, 50, },
-{107, 10, 107, 50, },
-{108, 10, 108, 50, },
-{109, 10, 109, 50, },
-{110, 10, 110, 50, },
-{111, 10, 111, 50, },
-{112, 10, 112, 50, },
-{113, 10, 113, 50, },
-{114, 10, 114, 50, },
-{115, 10, 115, 50, },
-{116, 10, 116, 50, },
-{117, 10, 117, 50, },
-{118, 10, 118, 50, },
-{119, 10, 119, 50, },
-{120, 10, 120, 50, },
-{121, 10, 121, 50, },
-{122, 10, 122, 50, },
-{123, 10, 123, 50, },
-{124, 10, 124, 50, },
-};
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private void setDefaults() {
- progressBar.setMaximum(100);
- progressBar.setMinimum(10);
- progressBar.setSelection(50);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetSelectionValues() {
-return new int[][] {
-{-15, 10, 100, 50, },
-{-14, 10, 100, 50, },
-{-13, 10, 100, 50, },
-{-12, 10, 100, 50, },
-{-11, 10, 100, 50, },
-{-10, 10, 100, 50, },
-{-9, 10, 100, 50, },
-{-8, 10, 100, 50, },
-{-7, 10, 100, 50, },
-{-6, 10, 100, 50, },
-{-5, 10, 100, 50, },
-{-4, 10, 100, 50, },
-{-3, 10, 100, 50, },
-{-2, 10, 100, 50, },
-{-1, 10, 100, 50, },
-{0, 10, 100, 10, },
-{1, 10, 100, 10, },
-{2, 10, 100, 10, },
-{3, 10, 100, 10, },
-{4, 10, 100, 10, },
-{5, 10, 100, 10, },
-{6, 10, 100, 10, },
-{7, 10, 100, 10, },
-{8, 10, 100, 10, },
-{9, 10, 100, 10, },
-{10, 10, 100, 10, },
-{11, 10, 100, 11, },
-{12, 10, 100, 12, },
-{13, 10, 100, 13, },
-{14, 10, 100, 14, },
-{15, 10, 100, 15, },
-{16, 10, 100, 16, },
-{17, 10, 100, 17, },
-{18, 10, 100, 18, },
-{19, 10, 100, 19, },
-{20, 10, 100, 20, },
-{21, 10, 100, 21, },
-{22, 10, 100, 22, },
-{23, 10, 100, 23, },
-{24, 10, 100, 24, },
-{25, 10, 100, 25, },
-{26, 10, 100, 26, },
-{27, 10, 100, 27, },
-{28, 10, 100, 28, },
-{29, 10, 100, 29, },
-{30, 10, 100, 30, },
-{31, 10, 100, 31, },
-{32, 10, 100, 32, },
-{33, 10, 100, 33, },
-{34, 10, 100, 34, },
-{35, 10, 100, 35, },
-{36, 10, 100, 36, },
-{37, 10, 100, 37, },
-{38, 10, 100, 38, },
-{39, 10, 100, 39, },
-{40, 10, 100, 40, },
-{41, 10, 100, 41, },
-{42, 10, 100, 42, },
-{43, 10, 100, 43, },
-{44, 10, 100, 44, },
-{45, 10, 100, 45, },
-{46, 10, 100, 46, },
-{47, 10, 100, 47, },
-{48, 10, 100, 48, },
-{49, 10, 100, 49, },
-{50, 10, 100, 50, },
-{51, 10, 100, 51, },
-{52, 10, 100, 52, },
-{53, 10, 100, 53, },
-{54, 10, 100, 54, },
-{55, 10, 100, 55, },
-{56, 10, 100, 56, },
-{57, 10, 100, 57, },
-{58, 10, 100, 58, },
-{59, 10, 100, 59, },
-{60, 10, 100, 60, },
-{61, 10, 100, 61, },
-{62, 10, 100, 62, },
-{63, 10, 100, 63, },
-{64, 10, 100, 64, },
-{65, 10, 100, 65, },
-{66, 10, 100, 66, },
-{67, 10, 100, 67, },
-{68, 10, 100, 68, },
-{69, 10, 100, 69, },
-{70, 10, 100, 70, },
-{71, 10, 100, 71, },
-{72, 10, 100, 72, },
-{73, 10, 100, 73, },
-{74, 10, 100, 74, },
-{75, 10, 100, 75, },
-{76, 10, 100, 76, },
-{77, 10, 100, 77, },
-{78, 10, 100, 78, },
-{79, 10, 100, 79, },
-{80, 10, 100, 80, },
-{81, 10, 100, 81, },
-{82, 10, 100, 82, },
-{83, 10, 100, 83, },
-{84, 10, 100, 84, },
-{85, 10, 100, 85, },
-{86, 10, 100, 86, },
-{87, 10, 100, 87, },
-{88, 10, 100, 88, },
-{89, 10, 100, 89, },
-{90, 10, 100, 90, },
-{91, 10, 100, 91, },
-{92, 10, 100, 92, },
-{93, 10, 100, 93, },
-{94, 10, 100, 94, },
-{95, 10, 100, 95, },
-{96, 10, 100, 96, },
-{97, 10, 100, 97, },
-{98, 10, 100, 98, },
-{99, 10, 100, 99, },
-{100, 10, 100, 100, },
-{101, 10, 100, 100, },
-{102, 10, 100, 100, },
-{103, 10, 100, 100, },
-{104, 10, 100, 100, },
-{105, 10, 100, 100, },
-{106, 10, 100, 100, },
-{107, 10, 100, 100, },
-{108, 10, 100, 100, },
-{109, 10, 100, 100, },
-{110, 10, 100, 100, },
-{111, 10, 100, 100, },
-{112, 10, 100, 100, },
-{113, 10, 100, 100, },
-{114, 10, 100, 100, },
-{115, 10, 100, 100, },
-{116, 10, 100, 100, },
-{117, 10, 100, 100, },
-{118, 10, 100, 100, },
-{119, 10, 100, 100, },
-{120, 10, 100, 100, },
-{121, 10, 100, 100, },
-{122, 10, 100, 100, },
-{123, 10, 100, 100, },
-{124, 10, 100, 100, },
-};
-}
-
-/**
- * Possible exceptions:
- *
- * @exception IllegalArgumentException
- *
- * @exception SWTException
- *
- */
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- try {
- progressBar = new ProgressBar(null, 0);
- fail("No exception thrown"); //should never get here
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {0, SWT.HORIZONTAL, SWT.VERTICAL};
- for (int i = 0; i < cases.length; i++)
- progressBar = new ProgressBar(shell, cases[i]);
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_getMaximum() {
- warnUnimpl("Test test_getMaximum not written");
-}
-
-public void test_getMinimum() {
- warnUnimpl("Test test_getMinimum not written");
-}
-
-public void test_getSelection() {
- warnUnimpl("Test test_getSelection not written");
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- */
-public void test_setMaximumI(){
-
- int [][] testValues = getSetMaximumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- progressBar.setMaximum(intArray[0]);
- report("setMaximum", intArray[0], intArray[1], intArray[2], intArray[3]);
- }
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- */
-public void test_setMinimumI(){
-
- int [][] testValues = getSetMinimumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- progressBar.setMinimum(intArray[0]);
- report("setMinimum", intArray[0], intArray[1], intArray[2], intArray[3]);
- }
-}
-
-/**
- * Sets the single selection that is the receiver's
- * position to the argument which must be greater than or equal
- * to zero.
- */
-public void test_setSelectionI(){
-
- int [][] testValues = getSetSelectionValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- progressBar.setSelection(intArray[0]);
- report("setSelection", intArray[0], intArray[1], intArray[2], intArray[3]);
- }
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_ProgressBar((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_getMaximum");
- methodNames.addElement("test_getMinimum");
- methodNames.addElement("test_getSelection");
- methodNames.addElement("test_setMaximumI");
- methodNames.addElement("test_setMinimumI");
- methodNames.addElement("test_setSelectionI");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_getMaximum")) test_getMaximum();
- else if (getName().equals("test_getMinimum")) test_getMinimum();
- else if (getName().equals("test_getSelection")) test_getSelection();
- else if (getName().equals("test_setMaximumI")) test_setMaximumI();
- else if (getName().equals("test_setMinimumI")) test_setMinimumI();
- else if (getName().equals("test_setSelectionI")) test_setSelectionI();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Sash.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Sash.java
deleted file mode 100644
index e88bccc9c4..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Sash.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Sash
- *
- * @see org.eclipse.swt.widgets.Sash
- */
-public class Test_org_eclipse_swt_widgets_Sash extends Test_org_eclipse_swt_widgets_Control {
-
-Sash sash;
-
-public Test_org_eclipse_swt_widgets_Sash(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- sash = new Sash(shell, 0);
- setWidget(sash);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-/**
- * Possible exceptions:
- *
- * @exception IllegalArgumentException
- *
- * @exception SWTException
- *
- */
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- try {
- sash = new Sash(null, 0);
- fail("No exception thrown"); //should never get here
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {0, SWT.HORIZONTAL, SWT.VERTICAL};
- for (int i = 0; i < cases.length; i++)
- sash = new Sash(shell, cases[i]);
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_setFontLorg_eclipse_swt_graphics_Font() {
- // overridden from Control because it does not make sense
- // to set the font of a Sash.
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Sash((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scale.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scale.java
deleted file mode 100644
index f19b299953..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scale.java
+++ /dev/null
@@ -1,671 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.Scale
- *
- * @see org.eclipse.swt.widgets.Scale
- */
-public class Test_org_eclipse_swt_widgets_Scale extends Test_org_eclipse_swt_widgets_Control {
-
-Scale scale;
-
-public Test_org_eclipse_swt_widgets_Scale(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- scale = new Scale(shell, 0);
- setWidget(scale);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-// this method must be private or protected so the auto-gen tool keeps it
-private void report(String call, int set, int minExpected, int maxExpected, int selectionExpected) {
- //Uncomment these lines and comment out call to check() if you want the test to report all errors without
- //stopping.
-
- //if (trackBar.getMinimum() != minExpected)
- //System.out.println(call + "(" + set + "): Minimum Expected: " + minExpected + " Actual: " + trackBar.getMinimum());
- //if (trackBar.getMaximum() != maxExpected)
- //System.out.println(call + "(" + set + "): Maximum Expected: " + maxExpected + " Actual: " + trackBar.getMaximum());
- //if (trackBar.getSelection() != selectionExpected)
- //System.out.println(call + "(" + set + "): Selection Expected: " + selectionExpected + " Actual: " + trackBar.getSelection());
- check(minExpected, maxExpected, selectionExpected);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private void check(int minExpected, int maxExpected, int selectionExpected) {
- assertEquals(scale.getMaximum(), maxExpected);
- assertEquals(scale.getMinimum(), minExpected);
- assertEquals(scale.getSelection(), selectionExpected);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMinimumValues() {
-return new int[][] {
-{-15, 10, 100, 50, },
-{-14, 10, 100, 50, },
-{-13, 10, 100, 50, },
-{-12, 10, 100, 50, },
-{-11, 10, 100, 50, },
-{-10, 10, 100, 50, },
-{-9, 10, 100, 50, },
-{-8, 10, 100, 50, },
-{-7, 10, 100, 50, },
-{-6, 10, 100, 50, },
-{-5, 10, 100, 50, },
-{-4, 10, 100, 50, },
-{-3, 10, 100, 50, },
-{-2, 10, 100, 50, },
-{-1, 10, 100, 50, },
-{0, 0, 100, 50, },
-{1, 1, 100, 50, },
-{2, 2, 100, 50, },
-{3, 3, 100, 50, },
-{4, 4, 100, 50, },
-{5, 5, 100, 50, },
-{6, 6, 100, 50, },
-{7, 7, 100, 50, },
-{8, 8, 100, 50, },
-{9, 9, 100, 50, },
-{10, 10, 100, 50, },
-{11, 11, 100, 50, },
-{12, 12, 100, 50, },
-{13, 13, 100, 50, },
-{14, 14, 100, 50, },
-{15, 15, 100, 50, },
-{16, 16, 100, 50, },
-{17, 17, 100, 50, },
-{18, 18, 100, 50, },
-{19, 19, 100, 50, },
-{20, 20, 100, 50, },
-{21, 21, 100, 50, },
-{22, 22, 100, 50, },
-{23, 23, 100, 50, },
-{24, 24, 100, 50, },
-{25, 25, 100, 50, },
-{26, 26, 100, 50, },
-{27, 27, 100, 50, },
-{28, 28, 100, 50, },
-{29, 29, 100, 50, },
-{30, 30, 100, 50, },
-{31, 31, 100, 50, },
-{32, 32, 100, 50, },
-{33, 33, 100, 50, },
-{34, 34, 100, 50, },
-{35, 35, 100, 50, },
-{36, 36, 100, 50, },
-{37, 37, 100, 50, },
-{38, 38, 100, 50, },
-{39, 39, 100, 50, },
-{40, 40, 100, 50, },
-{41, 41, 100, 50, },
-{42, 42, 100, 50, },
-{43, 43, 100, 50, },
-{44, 44, 100, 50, },
-{45, 45, 100, 50, },
-{46, 46, 100, 50, },
-{47, 47, 100, 50, },
-{48, 48, 100, 50, },
-{49, 49, 100, 50, },
-{50, 50, 100, 50, },
-{51, 51, 100, 51, },
-{52, 52, 100, 52, },
-{53, 53, 100, 53, },
-{54, 54, 100, 54, },
-{55, 55, 100, 55, },
-{56, 56, 100, 56, },
-{57, 57, 100, 57, },
-{58, 58, 100, 58, },
-{59, 59, 100, 59, },
-{60, 60, 100, 60, },
-{61, 61, 100, 61, },
-{62, 62, 100, 62, },
-{63, 63, 100, 63, },
-{64, 64, 100, 64, },
-{65, 65, 100, 65, },
-{66, 66, 100, 66, },
-{67, 67, 100, 67, },
-{68, 68, 100, 68, },
-{69, 69, 100, 69, },
-{70, 70, 100, 70, },
-{71, 71, 100, 71, },
-{72, 72, 100, 72, },
-{73, 73, 100, 73, },
-{74, 74, 100, 74, },
-{75, 75, 100, 75, },
-{76, 76, 100, 76, },
-{77, 77, 100, 77, },
-{78, 78, 100, 78, },
-{79, 79, 100, 79, },
-{80, 80, 100, 80, },
-{81, 81, 100, 81, },
-{82, 82, 100, 82, },
-{83, 83, 100, 83, },
-{84, 84, 100, 84, },
-{85, 85, 100, 85, },
-{86, 86, 100, 86, },
-{87, 87, 100, 87, },
-{88, 88, 100, 88, },
-{89, 89, 100, 89, },
-{90, 90, 100, 90, },
-{91, 91, 100, 91, },
-{92, 92, 100, 92, },
-{93, 93, 100, 93, },
-{94, 94, 100, 94, },
-{95, 95, 100, 95, },
-{96, 96, 100, 96, },
-{97, 97, 100, 97, },
-{98, 98, 100, 98, },
-{99, 99, 100, 99, },
-{100, 10, 100, 50, },
-{101, 10, 100, 50, },
-{102, 10, 100, 50, },
-{103, 10, 100, 50, },
-{104, 10, 100, 50, },
-{105, 10, 100, 50, },
-{106, 10, 100, 50, },
-{107, 10, 100, 50, },
-{108, 10, 100, 50, },
-{109, 10, 100, 50, },
-{110, 10, 100, 50, },
-{111, 10, 100, 50, },
-{112, 10, 100, 50, },
-{113, 10, 100, 50, },
-{114, 10, 100, 50, },
-{115, 10, 100, 50, },
-{116, 10, 100, 50, },
-{117, 10, 100, 50, },
-{118, 10, 100, 50, },
-{119, 10, 100, 50, },
-{120, 10, 100, 50, },
-{121, 10, 100, 50, },
-{122, 10, 100, 50, },
-{123, 10, 100, 50, },
-{124, 10, 100, 50, },
-};
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMaximumValues() {
-return new int[][] {
-{-15, 10, 100, 50, },
-{-14, 10, 100, 50, },
-{-13, 10, 100, 50, },
-{-12, 10, 100, 50, },
-{-11, 10, 100, 50, },
-{-10, 10, 100, 50, },
-{-9, 10, 100, 50, },
-{-8, 10, 100, 50, },
-{-7, 10, 100, 50, },
-{-6, 10, 100, 50, },
-{-5, 10, 100, 50, },
-{-4, 10, 100, 50, },
-{-3, 10, 100, 50, },
-{-2, 10, 100, 50, },
-{-1, 10, 100, 50, },
-{0, 10, 100, 50, },
-{1, 10, 100, 50, },
-{2, 10, 100, 50, },
-{3, 10, 100, 50, },
-{4, 10, 100, 50, },
-{5, 10, 100, 50, },
-{6, 10, 100, 50, },
-{7, 10, 100, 50, },
-{8, 10, 100, 50, },
-{9, 10, 100, 50, },
-{10, 10, 100, 50, },
-{11, 10, 11, 11, },
-{12, 10, 12, 12, },
-{13, 10, 13, 13, },
-{14, 10, 14, 14, },
-{15, 10, 15, 15, },
-{16, 10, 16, 16, },
-{17, 10, 17, 17, },
-{18, 10, 18, 18, },
-{19, 10, 19, 19, },
-{20, 10, 20, 20, },
-{21, 10, 21, 21, },
-{22, 10, 22, 22, },
-{23, 10, 23, 23, },
-{24, 10, 24, 24, },
-{25, 10, 25, 25, },
-{26, 10, 26, 26, },
-{27, 10, 27, 27, },
-{28, 10, 28, 28, },
-{29, 10, 29, 29, },
-{30, 10, 30, 30, },
-{31, 10, 31, 31, },
-{32, 10, 32, 32, },
-{33, 10, 33, 33, },
-{34, 10, 34, 34, },
-{35, 10, 35, 35, },
-{36, 10, 36, 36, },
-{37, 10, 37, 37, },
-{38, 10, 38, 38, },
-{39, 10, 39, 39, },
-{40, 10, 40, 40, },
-{41, 10, 41, 41, },
-{42, 10, 42, 42, },
-{43, 10, 43, 43, },
-{44, 10, 44, 44, },
-{45, 10, 45, 45, },
-{46, 10, 46, 46, },
-{47, 10, 47, 47, },
-{48, 10, 48, 48, },
-{49, 10, 49, 49, },
-{50, 10, 50, 50, },
-{51, 10, 51, 50, },
-{52, 10, 52, 50, },
-{53, 10, 53, 50, },
-{54, 10, 54, 50, },
-{55, 10, 55, 50, },
-{56, 10, 56, 50, },
-{57, 10, 57, 50, },
-{58, 10, 58, 50, },
-{59, 10, 59, 50, },
-{60, 10, 60, 50, },
-{61, 10, 61, 50, },
-{62, 10, 62, 50, },
-{63, 10, 63, 50, },
-{64, 10, 64, 50, },
-{65, 10, 65, 50, },
-{66, 10, 66, 50, },
-{67, 10, 67, 50, },
-{68, 10, 68, 50, },
-{69, 10, 69, 50, },
-{70, 10, 70, 50, },
-{71, 10, 71, 50, },
-{72, 10, 72, 50, },
-{73, 10, 73, 50, },
-{74, 10, 74, 50, },
-{75, 10, 75, 50, },
-{76, 10, 76, 50, },
-{77, 10, 77, 50, },
-{78, 10, 78, 50, },
-{79, 10, 79, 50, },
-{80, 10, 80, 50, },
-{81, 10, 81, 50, },
-{82, 10, 82, 50, },
-{83, 10, 83, 50, },
-{84, 10, 84, 50, },
-{85, 10, 85, 50, },
-{86, 10, 86, 50, },
-{87, 10, 87, 50, },
-{88, 10, 88, 50, },
-{89, 10, 89, 50, },
-{90, 10, 90, 50, },
-{91, 10, 91, 50, },
-{92, 10, 92, 50, },
-{93, 10, 93, 50, },
-{94, 10, 94, 50, },
-{95, 10, 95, 50, },
-{96, 10, 96, 50, },
-{97, 10, 97, 50, },
-{98, 10, 98, 50, },
-{99, 10, 99, 50, },
-{100, 10, 100, 50, },
-{101, 10, 101, 50, },
-{102, 10, 102, 50, },
-{103, 10, 103, 50, },
-{104, 10, 104, 50, },
-{105, 10, 105, 50, },
-{106, 10, 106, 50, },
-{107, 10, 107, 50, },
-{108, 10, 108, 50, },
-{109, 10, 109, 50, },
-{110, 10, 110, 50, },
-{111, 10, 111, 50, },
-{112, 10, 112, 50, },
-{113, 10, 113, 50, },
-{114, 10, 114, 50, },
-{115, 10, 115, 50, },
-{116, 10, 116, 50, },
-{117, 10, 117, 50, },
-{118, 10, 118, 50, },
-{119, 10, 119, 50, },
-{120, 10, 120, 50, },
-{121, 10, 121, 50, },
-{122, 10, 122, 50, },
-{123, 10, 123, 50, },
-{124, 10, 124, 50, },
-};
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private void setDefaults() {
- scale.setMaximum(100);
- scale.setMinimum(10);
- scale.setSelection(50);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetSelectionValues() {
-return new int[][] {
-{-15, 10, 100, 50, },
-{-14, 10, 100, 50, },
-{-13, 10, 100, 50, },
-{-12, 10, 100, 50, },
-{-11, 10, 100, 50, },
-{-10, 10, 100, 50, },
-{-9, 10, 100, 50, },
-{-8, 10, 100, 50, },
-{-7, 10, 100, 50, },
-{-6, 10, 100, 50, },
-{-5, 10, 100, 50, },
-{-4, 10, 100, 50, },
-{-3, 10, 100, 50, },
-{-2, 10, 100, 50, },
-{-1, 10, 100, 50, },
-{0, 10, 100, 10, },
-{1, 10, 100, 10, },
-{2, 10, 100, 10, },
-{3, 10, 100, 10, },
-{4, 10, 100, 10, },
-{5, 10, 100, 10, },
-{6, 10, 100, 10, },
-{7, 10, 100, 10, },
-{8, 10, 100, 10, },
-{9, 10, 100, 10, },
-{10, 10, 100, 10, },
-{11, 10, 100, 11, },
-{12, 10, 100, 12, },
-{13, 10, 100, 13, },
-{14, 10, 100, 14, },
-{15, 10, 100, 15, },
-{16, 10, 100, 16, },
-{17, 10, 100, 17, },
-{18, 10, 100, 18, },
-{19, 10, 100, 19, },
-{20, 10, 100, 20, },
-{21, 10, 100, 21, },
-{22, 10, 100, 22, },
-{23, 10, 100, 23, },
-{24, 10, 100, 24, },
-{25, 10, 100, 25, },
-{26, 10, 100, 26, },
-{27, 10, 100, 27, },
-{28, 10, 100, 28, },
-{29, 10, 100, 29, },
-{30, 10, 100, 30, },
-{31, 10, 100, 31, },
-{32, 10, 100, 32, },
-{33, 10, 100, 33, },
-{34, 10, 100, 34, },
-{35, 10, 100, 35, },
-{36, 10, 100, 36, },
-{37, 10, 100, 37, },
-{38, 10, 100, 38, },
-{39, 10, 100, 39, },
-{40, 10, 100, 40, },
-{41, 10, 100, 41, },
-{42, 10, 100, 42, },
-{43, 10, 100, 43, },
-{44, 10, 100, 44, },
-{45, 10, 100, 45, },
-{46, 10, 100, 46, },
-{47, 10, 100, 47, },
-{48, 10, 100, 48, },
-{49, 10, 100, 49, },
-{50, 10, 100, 50, },
-{51, 10, 100, 51, },
-{52, 10, 100, 52, },
-{53, 10, 100, 53, },
-{54, 10, 100, 54, },
-{55, 10, 100, 55, },
-{56, 10, 100, 56, },
-{57, 10, 100, 57, },
-{58, 10, 100, 58, },
-{59, 10, 100, 59, },
-{60, 10, 100, 60, },
-{61, 10, 100, 61, },
-{62, 10, 100, 62, },
-{63, 10, 100, 63, },
-{64, 10, 100, 64, },
-{65, 10, 100, 65, },
-{66, 10, 100, 66, },
-{67, 10, 100, 67, },
-{68, 10, 100, 68, },
-{69, 10, 100, 69, },
-{70, 10, 100, 70, },
-{71, 10, 100, 71, },
-{72, 10, 100, 72, },
-{73, 10, 100, 73, },
-{74, 10, 100, 74, },
-{75, 10, 100, 75, },
-{76, 10, 100, 76, },
-{77, 10, 100, 77, },
-{78, 10, 100, 78, },
-{79, 10, 100, 79, },
-{80, 10, 100, 80, },
-{81, 10, 100, 81, },
-{82, 10, 100, 82, },
-{83, 10, 100, 83, },
-{84, 10, 100, 84, },
-{85, 10, 100, 85, },
-{86, 10, 100, 86, },
-{87, 10, 100, 87, },
-{88, 10, 100, 88, },
-{89, 10, 100, 89, },
-{90, 10, 100, 90, },
-{91, 10, 100, 91, },
-{92, 10, 100, 92, },
-{93, 10, 100, 93, },
-{94, 10, 100, 94, },
-{95, 10, 100, 95, },
-{96, 10, 100, 96, },
-{97, 10, 100, 97, },
-{98, 10, 100, 98, },
-{99, 10, 100, 99, },
-{100, 10, 100, 100, },
-{101, 10, 100, 100, },
-{102, 10, 100, 100, },
-{103, 10, 100, 100, },
-{104, 10, 100, 100, },
-{105, 10, 100, 100, },
-{106, 10, 100, 100, },
-{107, 10, 100, 100, },
-{108, 10, 100, 100, },
-{109, 10, 100, 100, },
-{110, 10, 100, 100, },
-{111, 10, 100, 100, },
-{112, 10, 100, 100, },
-{113, 10, 100, 100, },
-{114, 10, 100, 100, },
-{115, 10, 100, 100, },
-{116, 10, 100, 100, },
-{117, 10, 100, 100, },
-{118, 10, 100, 100, },
-{119, 10, 100, 100, },
-{120, 10, 100, 100, },
-{121, 10, 100, 100, },
-{122, 10, 100, 100, },
-{123, 10, 100, 100, },
-{124, 10, 100, 100, },
-};
-}
-
-/**
- * Possible exceptions:
- *
- * @exception IllegalArgumentException
- *
- *
- * @exception SWTException
- *
- */
-public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){
- try {
- scale = new Scale(null, 0);
- fail("No exception occurred"); //should never get here
- }
- catch (IllegalArgumentException e) {
- }
-
- int[] cases = {0, SWT.HORIZONTAL, SWT.VERTICAL};
- for (int i = 0; i < cases.length; i++)
- scale = new Scale(shell, cases[i]);
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_computeSizeIIZ() {
- warnUnimpl("Test test_computeSizeIIZ not written");
-}
-
-public void test_getIncrement() {
- warnUnimpl("Test test_getIncrement not written");
-}
-
-public void test_getMaximum() {
- warnUnimpl("Test test_getMaximum not written");
-}
-
-public void test_getMinimum() {
- warnUnimpl("Test test_getMinimum not written");
-}
-
-public void test_getPageIncrement() {
- warnUnimpl("Test test_getPageIncrement not written");
-}
-
-public void test_getSelection() {
- warnUnimpl("Test test_getSelection not written");
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_setFontLorg_eclipse_swt_graphics_Font() {
- // overridden from Control because it does not make sense
- // to set the font of a Scale.
-}
-
-public void test_setIncrementI() {
- warnUnimpl("Test test_setIncrementI not written");
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- */
-public void test_setMaximumI(){
-
- int [][] testValues = getSetMaximumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- scale.setMaximum(intArray[0]);
- report("setMaximum", intArray[0], intArray[1], intArray[2], intArray[3]);
- }
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- */
-public void test_setMinimumI(){
-
-
- int [][] testValues = getSetMinimumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- scale.setMinimum(intArray[0]);
- report("setMinimum", intArray[0], intArray[1], intArray[2], intArray[3]);
- }
-}
-
-public void test_setPageIncrementI() {
- warnUnimpl("Test test_setPageIncrementI not written");
-}
-
-/**
- * Sets the single selection that is the receiver's
- * value to the argument which must be greater than or equal
- * to zero.
- */
-public void test_setSelectionI() {
-
- int [][] testValues = getSetSelectionValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- scale.setSelection(intArray[0]);
- report("setSelection", intArray[0], intArray[1], intArray[2], intArray[3]);
- }
-}
-
-public static Test suite() {
- TestSuite suite = new TestSuite();
- java.util.Vector methodNames = methodNames();
- java.util.Enumeration e = methodNames.elements();
- while (e.hasMoreElements()) {
- suite.addTest(new Test_org_eclipse_swt_widgets_Scale((String)e.nextElement()));
- }
- return suite;
-}
-public static java.util.Vector methodNames() {
- java.util.Vector methodNames = new java.util.Vector();
- methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI");
- methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_computeSizeIIZ");
- methodNames.addElement("test_getIncrement");
- methodNames.addElement("test_getMaximum");
- methodNames.addElement("test_getMinimum");
- methodNames.addElement("test_getPageIncrement");
- methodNames.addElement("test_getSelection");
- methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener");
- methodNames.addElement("test_setIncrementI");
- methodNames.addElement("test_setMaximumI");
- methodNames.addElement("test_setMinimumI");
- methodNames.addElement("test_setPageIncrementI");
- methodNames.addElement("test_setSelectionI");
- methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names
- return methodNames;
-}
-protected void runTest() throws Throwable {
- if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI();
- else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ();
- else if (getName().equals("test_getIncrement")) test_getIncrement();
- else if (getName().equals("test_getMaximum")) test_getMaximum();
- else if (getName().equals("test_getMinimum")) test_getMinimum();
- else if (getName().equals("test_getPageIncrement")) test_getPageIncrement();
- else if (getName().equals("test_getSelection")) test_getSelection();
- else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener();
- else if (getName().equals("test_setIncrementI")) test_setIncrementI();
- else if (getName().equals("test_setMaximumI")) test_setMaximumI();
- else if (getName().equals("test_setMinimumI")) test_setMinimumI();
- else if (getName().equals("test_setPageIncrementI")) test_setPageIncrementI();
- else if (getName().equals("test_setSelectionI")) test_setSelectionI();
- else super.runTest();
-}
-}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ScrollBar.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ScrollBar.java
deleted file mode 100644
index 0c40d5ad06..0000000000
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ScrollBar.java
+++ /dev/null
@@ -1,892 +0,0 @@
-package org.eclipse.swt.tests.junit;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import junit.framework.*;
-import junit.textui.*;
-
-/**
- * Automated Test Suite for class org.eclipse.swt.widgets.ScrollBar
- *
- * @see org.eclipse.swt.widgets.ScrollBar
- */
-public class Test_org_eclipse_swt_widgets_ScrollBar extends Test_org_eclipse_swt_widgets_Widget {
-
-ScrollBar scrollBar;
-Canvas canvas;
-
-public Test_org_eclipse_swt_widgets_ScrollBar(String name) {
- super(name);
-}
-
-public static void main(String[] args) {
- TestRunner.run(suite());
-}
-
-protected void setUp() {
- super.setUp();
- canvas = new Canvas(shell, SWT.H_SCROLL | SWT.V_SCROLL);
- scrollBar = canvas.getHorizontalBar();
- setWidget(scrollBar);
-}
-
-protected void tearDown() {
- super.tearDown();
-}
-
-// this method must be private or protected so the auto-gen tool keeps it
-private void report(String call, int set, int minExpected, int maxExpected, int selectionExpected, int thumbExpected) {
- // Uncomment these lines and comment out call to check() if you want the test to report all errors without
- // stopping.
-
- //if (scrollBar.getMinimum() != minExpected)
- //System.out.println(call + "(" + set + "): Minimum Expected: " + minExpected + " Actual: " + scrollBar.getMinimum());
- //if (scrollBar.getMaximum() != maxExpected)
- //System.out.println(call + "(" + set + "): Maximum Expected: " + maxExpected + " Actual: " + scrollBar.getMaximum());
- //if (scrollBar.getSelection() != selectionExpected)
- //System.out.println(call + "(" + set + "): Selection Expected: " + selectionExpected + " Actual: " + scrollBar.getSelection());
- //if (scrollBar.getThumb() != thumbExpected)
- //System.out.println(call + "(" + set + "): Thumb Expected: " + thumbExpected + " Actual: " + scrollBar.getThumb());
- check(minExpected, maxExpected, selectionExpected, thumbExpected);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private void check(int minExpected, int maxExpected, int selectionExpected, int thumbExpected) {
- assertEquals(scrollBar.getMaximum(), maxExpected);
- assertEquals(scrollBar.getMinimum(), minExpected);
- assertEquals(scrollBar.getSelection(), selectionExpected);
- assertEquals(scrollBar.getThumb(), thumbExpected);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetThumbValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 10, 100, 50, 10},
-{1, 10, 100, 50, 1},
-{2, 10, 100, 50, 2},
-{3, 10, 100, 50, 3},
-{4, 10, 100, 50, 4},
-{5, 10, 100, 50, 5},
-{6, 10, 100, 50, 6},
-{7, 10, 100, 50, 7},
-{8, 10, 100, 50, 8},
-{9, 10, 100, 50, 9},
-{10, 10, 100, 50, 10},
-{11, 10, 100, 50, 11},
-{12, 10, 100, 50, 12},
-{13, 10, 100, 50, 13},
-{14, 10, 100, 50, 14},
-{15, 10, 100, 50, 15},
-{16, 10, 100, 50, 16},
-{17, 10, 100, 50, 17},
-{18, 10, 100, 50, 18},
-{19, 10, 100, 50, 19},
-{20, 10, 100, 50, 20},
-{21, 10, 100, 50, 21},
-{22, 10, 100, 50, 22},
-{23, 10, 100, 50, 23},
-{24, 10, 100, 50, 24},
-{25, 10, 100, 50, 25},
-{26, 10, 100, 50, 26},
-{27, 10, 100, 50, 27},
-{28, 10, 100, 50, 28},
-{29, 10, 100, 50, 29},
-{30, 10, 100, 50, 30},
-{31, 10, 100, 50, 31},
-{32, 10, 100, 50, 32},
-{33, 10, 100, 50, 33},
-{34, 10, 100, 50, 34},
-{35, 10, 100, 50, 35},
-{36, 10, 100, 50, 36},
-{37, 10, 100, 50, 37},
-{38, 10, 100, 50, 38},
-{39, 10, 100, 50, 39},
-{40, 10, 100, 50, 40},
-{41, 10, 100, 50, 41},
-{42, 10, 100, 50, 42},
-{43, 10, 100, 50, 43},
-{44, 10, 100, 50, 44},
-{45, 10, 100, 50, 45},
-{46, 10, 100, 50, 46},
-{47, 10, 100, 50, 47},
-{48, 10, 100, 50, 48},
-{49, 10, 100, 50, 49},
-{50, 10, 100, 50, 50},
-{51, 10, 100, 49, 51},
-{52, 10, 100, 48, 52},
-{53, 10, 100, 47, 53},
-{54, 10, 100, 46, 54},
-{55, 10, 100, 45, 55},
-{56, 10, 100, 44, 56},
-{57, 10, 100, 43, 57},
-{58, 10, 100, 42, 58},
-{59, 10, 100, 41, 59},
-{60, 10, 100, 40, 60},
-{61, 10, 100, 39, 61},
-{62, 10, 100, 38, 62},
-{63, 10, 100, 37, 63},
-{64, 10, 100, 36, 64},
-{65, 10, 100, 35, 65},
-{66, 10, 100, 34, 66},
-{67, 10, 100, 33, 67},
-{68, 10, 100, 32, 68},
-{69, 10, 100, 31, 69},
-{70, 10, 100, 30, 70},
-{71, 10, 100, 29, 71},
-{72, 10, 100, 28, 72},
-{73, 10, 100, 27, 73},
-{74, 10, 100, 26, 74},
-{75, 10, 100, 25, 75},
-{76, 10, 100, 24, 76},
-{77, 10, 100, 23, 77},
-{78, 10, 100, 22, 78},
-{79, 10, 100, 21, 79},
-{80, 10, 100, 20, 80},
-{81, 10, 100, 19, 81},
-{82, 10, 100, 18, 82},
-{83, 10, 100, 17, 83},
-{84, 10, 100, 16, 84},
-{85, 10, 100, 15, 85},
-{86, 10, 100, 14, 86},
-{87, 10, 100, 13, 87},
-{88, 10, 100, 12, 88},
-{89, 10, 100, 11, 89},
-{90, 10, 100, 10, 90},
-{91, 10, 100, 50, 10},
-{92, 10, 100, 50, 10},
-{93, 10, 100, 50, 10},
-{94, 10, 100, 50, 10},
-{95, 10, 100, 50, 10},
-{96, 10, 100, 50, 10},
-{97, 10, 100, 50, 10},
-{98, 10, 100, 50, 10},
-{99, 10, 100, 50, 10},
-{100, 10, 100, 50, 10},
-{101, 10, 100, 50, 10},
-{102, 10, 100, 50, 10},
-{103, 10, 100, 50, 10},
-{104, 10, 100, 50, 10},
-{105, 10, 100, 50, 10},
-{106, 10, 100, 50, 10},
-{107, 10, 100, 50, 10},
-{108, 10, 100, 50, 10},
-{109, 10, 100, 50, 10},
-{110, 10, 100, 50, 10},
-{111, 10, 100, 50, 10},
-{112, 10, 100, 50, 10},
-{113, 10, 100, 50, 10},
-{114, 10, 100, 50, 10},
-{115, 10, 100, 50, 10},
-{116, 10, 100, 50, 10},
-{117, 10, 100, 50, 10},
-{118, 10, 100, 50, 10},
-{119, 10, 100, 50, 10},
-{120, 10, 100, 50, 10},
-{121, 10, 100, 50, 10},
-{122, 10, 100, 50, 10},
-{123, 10, 100, 50, 10},
-{124, 10, 100, 50, 10},
-};
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMinimumValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 0, 100, 50, 10},
-{1, 1, 100, 50, 10},
-{2, 2, 100, 50, 10},
-{3, 3, 100, 50, 10},
-{4, 4, 100, 50, 10},
-{5, 5, 100, 50, 10},
-{6, 6, 100, 50, 10},
-{7, 7, 100, 50, 10},
-{8, 8, 100, 50, 10},
-{9, 9, 100, 50, 10},
-{10, 10, 100, 50, 10},
-{11, 11, 100, 50, 10},
-{12, 12, 100, 50, 10},
-{13, 13, 100, 50, 10},
-{14, 14, 100, 50, 10},
-{15, 15, 100, 50, 10},
-{16, 16, 100, 50, 10},
-{17, 17, 100, 50, 10},
-{18, 18, 100, 50, 10},
-{19, 19, 100, 50, 10},
-{20, 20, 100, 50, 10},
-{21, 21, 100, 50, 10},
-{22, 22, 100, 50, 10},
-{23, 23, 100, 50, 10},
-{24, 24, 100, 50, 10},
-{25, 25, 100, 50, 10},
-{26, 26, 100, 50, 10},
-{27, 27, 100, 50, 10},
-{28, 28, 100, 50, 10},
-{29, 29, 100, 50, 10},
-{30, 30, 100, 50, 10},
-{31, 31, 100, 50, 10},
-{32, 32, 100, 50, 10},
-{33, 33, 100, 50, 10},
-{34, 34, 100, 50, 10},
-{35, 35, 100, 50, 10},
-{36, 36, 100, 50, 10},
-{37, 37, 100, 50, 10},
-{38, 38, 100, 50, 10},
-{39, 39, 100, 50, 10},
-{40, 40, 100, 50, 10},
-{41, 41, 100, 50, 10},
-{42, 42, 100, 50, 10},
-{43, 43, 100, 50, 10},
-{44, 44, 100, 50, 10},
-{45, 45, 100, 50, 10},
-{46, 46, 100, 50, 10},
-{47, 47, 100, 50, 10},
-{48, 48, 100, 50, 10},
-{49, 49, 100, 50, 10},
-{50, 50, 100, 50, 10},
-{51, 51, 100, 51, 10},
-{52, 52, 100, 52, 10},
-{53, 53, 100, 53, 10},
-{54, 54, 100, 54, 10},
-{55, 55, 100, 55, 10},
-{56, 56, 100, 56, 10},
-{57, 57, 100, 57, 10},
-{58, 58, 100, 58, 10},
-{59, 59, 100, 59, 10},
-{60, 60, 100, 60, 10},
-{61, 61, 100, 61, 10},
-{62, 62, 100, 62, 10},
-{63, 63, 100, 63, 10},
-{64, 64, 100, 64, 10},
-{65, 65, 100, 65, 10},
-{66, 66, 100, 66, 10},
-{67, 67, 100, 67, 10},
-{68, 68, 100, 68, 10},
-{69, 69, 100, 69, 10},
-{70, 70, 100, 70, 10},
-{71, 71, 100, 71, 10},
-{72, 72, 100, 72, 10},
-{73, 73, 100, 73, 10},
-{74, 74, 100, 74, 10},
-{75, 75, 100, 75, 10},
-{76, 76, 100, 76, 10},
-{77, 77, 100, 77, 10},
-{78, 78, 100, 78, 10},
-{79, 79, 100, 79, 10},
-{80, 80, 100, 80, 10},
-{81, 81, 100, 81, 10},
-{82, 82, 100, 82, 10},
-{83, 83, 100, 83, 10},
-{84, 84, 100, 84, 10},
-{85, 85, 100, 85, 10},
-{86, 86, 100, 86, 10},
-{87, 87, 100, 87, 10},
-{88, 88, 100, 88, 10},
-{89, 89, 100, 89, 10},
-{90, 90, 100, 90, 10},
-{91, 91, 100, 91, 9},
-{92, 92, 100, 92, 8},
-{93, 93, 100, 93, 7},
-{94, 94, 100, 94, 6},
-{95, 95, 100, 95, 5},
-{96, 96, 100, 96, 4},
-{97, 97, 100, 97, 3},
-{98, 98, 100, 98, 2},
-{99, 99, 100, 99, 1},
-{100, 10, 100, 50, 10},
-{101, 10, 100, 50, 10},
-{102, 10, 100, 50, 10},
-{103, 10, 100, 50, 10},
-{104, 10, 100, 50, 10},
-{105, 10, 100, 50, 10},
-{106, 10, 100, 50, 10},
-{107, 10, 100, 50, 10},
-{108, 10, 100, 50, 10},
-{109, 10, 100, 50, 10},
-{110, 10, 100, 50, 10},
-{111, 10, 100, 50, 10},
-{112, 10, 100, 50, 10},
-{113, 10, 100, 50, 10},
-{114, 10, 100, 50, 10},
-{115, 10, 100, 50, 10},
-{116, 10, 100, 50, 10},
-{117, 10, 100, 50, 10},
-{118, 10, 100, 50, 10},
-{119, 10, 100, 50, 10},
-{120, 10, 100, 50, 10},
-{121, 10, 100, 50, 10},
-{122, 10, 100, 50, 10},
-{123, 10, 100, 50, 10},
-{124, 10, 100, 50, 10},
-};
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetMaximumValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 10, 100, 50, 10},
-{1, 10, 100, 50, 10},
-{2, 10, 100, 50, 10},
-{3, 10, 100, 50, 10},
-{4, 10, 100, 50, 10},
-{5, 10, 100, 50, 10},
-{6, 10, 100, 50, 10},
-{7, 10, 100, 50, 10},
-{8, 10, 100, 50, 10},
-{9, 10, 100, 50, 10},
-{10, 10, 100, 50, 10},
-{11, 10, 11, 10, 1},
-{12, 10, 12, 10, 2},
-{13, 10, 13, 10, 3},
-{14, 10, 14, 10, 4},
-{15, 10, 15, 10, 5},
-{16, 10, 16, 10, 6},
-{17, 10, 17, 10, 7},
-{18, 10, 18, 10, 8},
-{19, 10, 19, 10, 9},
-{20, 10, 20, 10, 10},
-{21, 10, 21, 11, 10},
-{22, 10, 22, 12, 10},
-{23, 10, 23, 13, 10},
-{24, 10, 24, 14, 10},
-{25, 10, 25, 15, 10},
-{26, 10, 26, 16, 10},
-{27, 10, 27, 17, 10},
-{28, 10, 28, 18, 10},
-{29, 10, 29, 19, 10},
-{30, 10, 30, 20, 10},
-{31, 10, 31, 21, 10},
-{32, 10, 32, 22, 10},
-{33, 10, 33, 23, 10},
-{34, 10, 34, 24, 10},
-{35, 10, 35, 25, 10},
-{36, 10, 36, 26, 10},
-{37, 10, 37, 27, 10},
-{38, 10, 38, 28, 10},
-{39, 10, 39, 29, 10},
-{40, 10, 40, 30, 10},
-{41, 10, 41, 31, 10},
-{42, 10, 42, 32, 10},
-{43, 10, 43, 33, 10},
-{44, 10, 44, 34, 10},
-{45, 10, 45, 35, 10},
-{46, 10, 46, 36, 10},
-{47, 10, 47, 37, 10},
-{48, 10, 48, 38, 10},
-{49, 10, 49, 39, 10},
-{50, 10, 50, 40, 10},
-{51, 10, 51, 41, 10},
-{52, 10, 52, 42, 10},
-{53, 10, 53, 43, 10},
-{54, 10, 54, 44, 10},
-{55, 10, 55, 45, 10},
-{56, 10, 56, 46, 10},
-{57, 10, 57, 47, 10},
-{58, 10, 58, 48, 10},
-{59, 10, 59, 49, 10},
-{60, 10, 60, 50, 10},
-{61, 10, 61, 50, 10},
-{62, 10, 62, 50, 10},
-{63, 10, 63, 50, 10},
-{64, 10, 64, 50, 10},
-{65, 10, 65, 50, 10},
-{66, 10, 66, 50, 10},
-{67, 10, 67, 50, 10},
-{68, 10, 68, 50, 10},
-{69, 10, 69, 50, 10},
-{70, 10, 70, 50, 10},
-{71, 10, 71, 50, 10},
-{72, 10, 72, 50, 10},
-{73, 10, 73, 50, 10},
-{74, 10, 74, 50, 10},
-{75, 10, 75, 50, 10},
-{76, 10, 76, 50, 10},
-{77, 10, 77, 50, 10},
-{78, 10, 78, 50, 10},
-{79, 10, 79, 50, 10},
-{80, 10, 80, 50, 10},
-{81, 10, 81, 50, 10},
-{82, 10, 82, 50, 10},
-{83, 10, 83, 50, 10},
-{84, 10, 84, 50, 10},
-{85, 10, 85, 50, 10},
-{86, 10, 86, 50, 10},
-{87, 10, 87, 50, 10},
-{88, 10, 88, 50, 10},
-{89, 10, 89, 50, 10},
-{90, 10, 90, 50, 10},
-{91, 10, 91, 50, 10},
-{92, 10, 92, 50, 10},
-{93, 10, 93, 50, 10},
-{94, 10, 94, 50, 10},
-{95, 10, 95, 50, 10},
-{96, 10, 96, 50, 10},
-{97, 10, 97, 50, 10},
-{98, 10, 98, 50, 10},
-{99, 10, 99, 50, 10},
-{100, 10, 100, 50, 10},
-{101, 10, 101, 50, 10},
-{102, 10, 102, 50, 10},
-{103, 10, 103, 50, 10},
-{104, 10, 104, 50, 10},
-{105, 10, 105, 50, 10},
-{106, 10, 106, 50, 10},
-{107, 10, 107, 50, 10},
-{108, 10, 108, 50, 10},
-{109, 10, 109, 50, 10},
-{110, 10, 110, 50, 10},
-{111, 10, 111, 50, 10},
-{112, 10, 112, 50, 10},
-{113, 10, 113, 50, 10},
-{114, 10, 114, 50, 10},
-{115, 10, 115, 50, 10},
-{116, 10, 116, 50, 10},
-{117, 10, 117, 50, 10},
-{118, 10, 118, 50, 10},
-{119, 10, 119, 50, 10},
-{120, 10, 120, 50, 10},
-{121, 10, 121, 50, 10},
-{122, 10, 122, 50, 10},
-{123, 10, 123, 50, 10},
-{124, 10, 124, 50, 10},
-};
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private void setDefaults() {
- scrollBar.setMaximum(100);
- scrollBar.setMinimum(10);
- scrollBar.setThumb(10);
- scrollBar.setSelection(50);
-}
-// this method must be private or protected so the auto-gen tool keeps it
-private int[][] getSetSelectionValues() {
-return new int[][] {
-{-15, 10, 100, 50, 10},
-{-14, 10, 100, 50, 10},
-{-13, 10, 100, 50, 10},
-{-12, 10, 100, 50, 10},
-{-11, 10, 100, 50, 10},
-{-10, 10, 100, 50, 10},
-{-9, 10, 100, 50, 10},
-{-8, 10, 100, 50, 10},
-{-7, 10, 100, 50, 10},
-{-6, 10, 100, 50, 10},
-{-5, 10, 100, 50, 10},
-{-4, 10, 100, 50, 10},
-{-3, 10, 100, 50, 10},
-{-2, 10, 100, 50, 10},
-{-1, 10, 100, 50, 10},
-{0, 10, 100, 10, 10},
-{1, 10, 100, 10, 10},
-{2, 10, 100, 10, 10},
-{3, 10, 100, 10, 10},
-{4, 10, 100, 10, 10},
-{5, 10, 100, 10, 10},
-{6, 10, 100, 10, 10},
-{7, 10, 100, 10, 10},
-{8, 10, 100, 10, 10},
-{9, 10, 100, 10, 10},
-{10, 10, 100, 10, 10},
-{11, 10, 100, 11, 10},
-{12, 10, 100, 12, 10},
-{13, 10, 100, 13, 10},
-{14, 10, 100, 14, 10},
-{15, 10, 100, 15, 10},
-{16, 10, 100, 16, 10},
-{17, 10, 100, 17, 10},
-{18, 10, 100, 18, 10},
-{19, 10, 100, 19, 10},
-{20, 10, 100, 20, 10},
-{21, 10, 100, 21, 10},
-{22, 10, 100, 22, 10},
-{23, 10, 100, 23, 10},
-{24, 10, 100, 24, 10},
-{25, 10, 100, 25, 10},
-{26, 10, 100, 26, 10},
-{27, 10, 100, 27, 10},
-{28, 10, 100, 28, 10},
-{29, 10, 100, 29, 10},
-{30, 10, 100, 30, 10},
-{31, 10, 100, 31, 10},
-{32, 10, 100, 32, 10},
-{33, 10, 100, 33, 10},
-{34, 10, 100, 34, 10},
-{35, 10, 100, 35, 10},
-{36, 10, 100, 36, 10},
-{37, 10, 100, 37, 10},
-{38, 10, 100, 38, 10},
-{39, 10, 100, 39, 10},
-{40, 10, 100, 40, 10},
-{41, 10, 100, 41, 10},
-{42, 10, 100, 42, 10},
-{43, 10, 100, 43, 10},
-{44, 10, 100, 44, 10},
-{45, 10, 100, 45, 10},
-{46, 10, 100, 46, 10},
-{47, 10, 100, 47, 10},
-{48, 10, 100, 48, 10},
-{49, 10, 100, 49, 10},
-{50, 10, 100, 50, 10},
-{51, 10, 100, 51, 10},
-{52, 10, 100, 52, 10},
-{53, 10, 100, 53, 10},
-{54, 10, 100, 54, 10},
-{55, 10, 100, 55, 10},
-{56, 10, 100, 56, 10},
-{57, 10, 100, 57, 10},
-{58, 10, 100, 58, 10},
-{59, 10, 100, 59, 10},
-{60, 10, 100, 60, 10},
-{61, 10, 100, 61, 10},
-{62, 10, 100, 62, 10},
-{63, 10, 100, 63, 10},
-{64, 10, 100, 64, 10},
-{65, 10, 100, 65, 10},
-{66, 10, 100, 66, 10},
-{67, 10, 100, 67, 10},
-{68, 10, 100, 68, 10},
-{69, 10, 100, 69, 10},
-{70, 10, 100, 70, 10},
-{71, 10, 100, 71, 10},
-{72, 10, 100, 72, 10},
-{73, 10, 100, 73, 10},
-{74, 10, 100, 74, 10},
-{75, 10, 100, 75, 10},
-{76, 10, 100, 76, 10},
-{77, 10, 100, 77, 10},
-{78, 10, 100, 78, 10},
-{79, 10, 100, 79, 10},
-{80, 10, 100, 80, 10},
-{81, 10, 100, 81, 10},
-{82, 10, 100, 82, 10},
-{83, 10, 100, 83, 10},
-{84, 10, 100, 84, 10},
-{85, 10, 100, 85, 10},
-{86, 10, 100, 86, 10},
-{87, 10, 100, 87, 10},
-{88, 10, 100, 88, 10},
-{89, 10, 100, 89, 10},
-{90, 10, 100, 90, 10},
-{91, 10, 100, 90, 10},
-{92, 10, 100, 90, 10},
-{93, 10, 100, 90, 10},
-{94, 10, 100, 90, 10},
-{95, 10, 100, 90, 10},
-{96, 10, 100, 90, 10},
-{97, 10, 100, 90, 10},
-{98, 10, 100, 90, 10},
-{99, 10, 100, 90, 10},
-{100, 10, 100, 90, 10},
-{101, 10, 100, 90, 10},
-{102, 10, 100, 90, 10},
-{103, 10, 100, 90, 10},
-{104, 10, 100, 90, 10},
-{105, 10, 100, 90, 10},
-{106, 10, 100, 90, 10},
-{107, 10, 100, 90, 10},
-{108, 10, 100, 90, 10},
-{109, 10, 100, 90, 10},
-{110, 10, 100, 90, 10},
-{111, 10, 100, 90, 10},
-{112, 10, 100, 90, 10},
-{113, 10, 100, 90, 10},
-{114, 10, 100, 90, 10},
-{115, 10, 100, 90, 10},
-{116, 10, 100, 90, 10},
-{117, 10, 100, 90, 10},
-{118, 10, 100, 90, 10},
-{119, 10, 100, 90, 10},
-{120, 10, 100, 90, 10},
-{121, 10, 100, 90, 10},
-{122, 10, 100, 90, 10},
-{123, 10, 100, 90, 10},
-{124, 10, 100, 90, 10},
-};
-}
-
-public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_getDisplay() {
- warnUnimpl("Test test_getDisplay not written");
-}
-
-public void test_getEnabled() {
- warnUnimpl("Test test_getEnabled not written");
-}
-
-public void test_getIncrement() {
- warnUnimpl("Test test_getIncrement not written");
-}
-
-public void test_getMaximum() {
- warnUnimpl("Test test_getMaximum not written");
-}
-
-public void test_getMinimum() {
- warnUnimpl("Test test_getMinimum not written");
-}
-
-public void test_getPageIncrement() {
- warnUnimpl("Test test_getPageIncrement not written");
-}
-
-public void test_getParent() {
- warnUnimpl("Test test_getParent not written");
-}
-
-public void test_getSelection() {
- warnUnimpl("Test test_getSelection not written");
-}
-
-public void test_getSize() {
- warnUnimpl("Test test_getSize not written");
-}
-
-public void test_getThumb() {
- warnUnimpl("Test test_getThumb not written");
-}
-
-public void test_getVisible() {
- warnUnimpl("Test test_getVisible not written");
-}
-
-public void test_isEnabled() {
- warnUnimpl("Test test_isEnabled not written");
-}
-
-public void test_isVisible() {
- warnUnimpl("Test test_isVisible not written");
-}
-
-public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() {
- warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written");
-}
-
-public void test_setEnabledZ() {
- warnUnimpl("Test test_setEnabledZ not written");
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the up/down (or right/left) arrows
- * are pressed to the argument, which must be at least
- * one.
- */
-public void test_setIncrementI() {
- int[] cases = {1, 10, 10000};
- for (int i=0; i < cases.length; i++)
- {
- scrollBar.setIncrement(cases[i]);
- assertEquals(cases[i], scrollBar.getIncrement());
- }
-
- scrollBar.setIncrement(25);
- scrollBar.setIncrement(0); // setting to 0 fails silently
- assertEquals(25, scrollBar.getIncrement());
-}
-
-/**
- * Sets the maximum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- */
-public void test_setMaximumI(){
- int [][] testValues = getSetMaximumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- scrollBar.setMaximum(intArray[0]);
- report("setMaximum", intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]);
- }
-}
-
-/**
- * Sets the minimum value which the receiver will allow
- * to be the argument which must be greater than or
- * equal to zero.
- */
-public void test_setMinimumI(){
- int [][] testValues = getSetMinimumValues();
-
- for (int i = 0; i < testValues.length; i++) {
- int[] intArray = testValues[i];
- setDefaults();
- scrollBar.setMinimum(intArray[0]);
- report("setMinimum", intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]);
- }
-}
-
-/**
- * Sets the amount that the receiver's value will be
- * modified by when the page increment/decrement areas
- * are selected to the argument, which must be at least
- * one.
- */
-public void test_setPageIncrementI(){
- int[] cases = {1, 10, 10000};
- for (int i=0; iAbout This Content
-
-License
-Contributions
-
-