Bug 134401 Bug in JFace Window JavaDoc
Eclipse: 3.2 M5 Class: org.eclipse.jface.window.Window In text below "getContents()" should be used instead of "getControl()". /** * Creates and returns this window's contents. Subclasses may attach any * number of children to the parent. As a convenience, the return value of * this method will be remembered and returned by subsequent calls to * getControl(). Subclasses may modify the parent's layout if they overload * getLayout() to return null. * * <p> * It is common practise to create and return a single composite that * contains the entire window contents. * </p> * * <p> * The default implementation of this framework method creates an instance * of <code>Composite</code>. Subclasses may override. * </p> * * @param parent * the parent composite for the controls in this window. The type * of layout used is determined by getLayout() * * @return the control that will be returned by subsequent calls to * getControl() */ protected Control createContents(Composite parent) { // by default, just create a composite return new Composite(parent, SWT.NONE); }
bundles/org.eclipse.jface/src/org/eclipse/jface/window/Window.java
*            point to find (display coordinates)
	 * @param toFind
	 *            point to find (display coordinates)
	 * @return the montor closest to the given point
	 */
	private static Monitor getClosestMonitor(Display toSearch, Point toFind) {
		int closest = Integer.MAX_VALUE;
		Monitor[] monitors = toSearch.getMonitors();
		Monitor result = monitors[0];
		for (int idx = 0; idx < monitors.length; idx++) {
			Monitor current = monitors[idx];
			Rectangle clientArea = current.getClientArea();
			if (clientArea.contains(toFind)) {
				return current;
			}
			int distance = Geometry.distanceSquared(Geometry
					.centerPoint(clientArea), toFind);
			if (distance < closest) {
				closest = distance;
				result = current;
			}
		}
		return result;
	}
	/**
	 * Given the desired position of the window, this method returns an adjusted
	 * position such that the window is no larger than its monitor, and does not
	 * extend beyond the edge of the monitor. This is used for computing the
	 * initial window position, and subclasses can use this as a utility method
	 * if they want to limit the region in which the window may be moved.