View | Details | Raw Unified | Return to bug 118934 | Differences between
and this patch

Collapse All | Expand All

(-)search/org/eclipse/search/internal/ui/util/ExtendedDialogWindow.java (-2 / +2 lines)
Lines 28-37 Link Here
28
import org.eclipse.swt.widgets.Shell;
28
import org.eclipse.swt.widgets.Shell;
29
29
30
import org.eclipse.jface.dialogs.ControlEnableState;
30
import org.eclipse.jface.dialogs.ControlEnableState;
31
import org.eclipse.jface.dialogs.Dialog;
32
import org.eclipse.jface.dialogs.IDialogConstants;
31
import org.eclipse.jface.dialogs.IDialogConstants;
33
import org.eclipse.jface.dialogs.MessageDialog;
32
import org.eclipse.jface.dialogs.MessageDialog;
34
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
33
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
34
import org.eclipse.jface.dialogs.TrayDialog;
35
import org.eclipse.jface.operation.IRunnableContext;
35
import org.eclipse.jface.operation.IRunnableContext;
36
import org.eclipse.jface.operation.IRunnableWithProgress;
36
import org.eclipse.jface.operation.IRunnableWithProgress;
37
import org.eclipse.jface.operation.ModalContext;
37
import org.eclipse.jface.operation.ModalContext;
Lines 41-47 Link Here
41
import org.eclipse.search.internal.ui.SearchMessages;
41
import org.eclipse.search.internal.ui.SearchMessages;
42
42
43
43
44
public abstract class ExtendedDialogWindow extends Dialog implements IRunnableContext {
44
public abstract class ExtendedDialogWindow extends TrayDialog implements IRunnableContext {
45
	
45
	
46
	private Control fContents;
46
	private Control fContents;
47
	private Button fCancelButton;
47
	private Button fCancelButton;
(-)src/org/eclipse/ui/views/markers/internal/TableSortDialog.java (-2 / +2 lines)
Lines 15-22 Link Here
15
import java.util.Arrays;
15
import java.util.Arrays;
16
import java.util.Comparator;
16
import java.util.Comparator;
17
17
18
import org.eclipse.jface.dialogs.Dialog;
19
import org.eclipse.jface.dialogs.IDialogConstants;
18
import org.eclipse.jface.dialogs.IDialogConstants;
19
import org.eclipse.jface.dialogs.TrayDialog;
20
import org.eclipse.jface.window.IShellProvider;
20
import org.eclipse.jface.window.IShellProvider;
21
import org.eclipse.osgi.util.NLS;
21
import org.eclipse.osgi.util.NLS;
22
import org.eclipse.swt.SWT;
22
import org.eclipse.swt.SWT;
Lines 35-41 Link Here
35
 * The TableSortDialog is the dialog that allows sort order to
35
 * The TableSortDialog is the dialog that allows sort order to
36
 * be selected.
36
 * be selected.
37
 */
37
 */
38
public class TableSortDialog extends Dialog {
38
public class TableSortDialog extends TrayDialog {
39
39
40
    private TableSorter sorter;
40
    private TableSorter sorter;
41
41
(-)src/org/eclipse/ui/views/markers/internal/DialogMarkerProperties.java (-2 / +2 lines)
Lines 24-32 Link Here
24
import org.eclipse.core.runtime.IPath;
24
import org.eclipse.core.runtime.IPath;
25
import org.eclipse.core.runtime.IProgressMonitor;
25
import org.eclipse.core.runtime.IProgressMonitor;
26
import org.eclipse.core.runtime.IStatus;
26
import org.eclipse.core.runtime.IStatus;
27
import org.eclipse.jface.dialogs.Dialog;
28
import org.eclipse.jface.dialogs.ErrorDialog;
27
import org.eclipse.jface.dialogs.ErrorDialog;
29
import org.eclipse.jface.dialogs.IDialogConstants;
28
import org.eclipse.jface.dialogs.IDialogConstants;
29
import org.eclipse.jface.dialogs.TrayDialog;
30
import org.eclipse.jface.operation.IRunnableWithProgress;
30
import org.eclipse.jface.operation.IRunnableWithProgress;
31
import org.eclipse.osgi.util.NLS;
31
import org.eclipse.osgi.util.NLS;
32
import org.eclipse.swt.SWT;
32
import org.eclipse.swt.SWT;
Lines 47-53 Link Here
47
/**
47
/**
48
 * Shows the properties of a new or existing marker
48
 * Shows the properties of a new or existing marker
49
 */
49
 */
50
class DialogMarkerProperties extends Dialog {
50
class DialogMarkerProperties extends TrayDialog {
51
51
52
    /**
52
    /**
53
     * The marker being shown, or <code>null</code> for a new marker
53
     * The marker being shown, or <code>null</code> for a new marker
(-)src/org/eclipse/ui/views/markers/internal/DialogMarkerFilter.java (-2 / +2 lines)
Lines 16-26 Link Here
16
import java.util.HashMap;
16
import java.util.HashMap;
17
import java.util.List;
17
import java.util.List;
18
18
19
import org.eclipse.jface.dialogs.Dialog;
20
import org.eclipse.jface.dialogs.ErrorDialog;
19
import org.eclipse.jface.dialogs.ErrorDialog;
21
import org.eclipse.jface.dialogs.IDialogConstants;
20
import org.eclipse.jface.dialogs.IDialogConstants;
22
import org.eclipse.jface.dialogs.IInputValidator;
21
import org.eclipse.jface.dialogs.IInputValidator;
23
import org.eclipse.jface.dialogs.InputDialog;
22
import org.eclipse.jface.dialogs.InputDialog;
23
import org.eclipse.jface.dialogs.TrayDialog;
24
import org.eclipse.jface.viewers.CheckStateChangedEvent;
24
import org.eclipse.jface.viewers.CheckStateChangedEvent;
25
import org.eclipse.jface.viewers.CheckboxTableViewer;
25
import org.eclipse.jface.viewers.CheckboxTableViewer;
26
import org.eclipse.jface.viewers.CheckboxTreeViewer;
26
import org.eclipse.jface.viewers.CheckboxTreeViewer;
Lines 65-71 Link Here
65
 * org.eclipse.ui.views.MarkerFilter object. Not intended to be subclassed or
65
 * org.eclipse.ui.views.MarkerFilter object. Not intended to be subclassed or
66
 * instantiated by clients.
66
 * instantiated by clients.
67
 */
67
 */
68
public abstract class DialogMarkerFilter extends Dialog {
68
public abstract class DialogMarkerFilter extends TrayDialog {
69
	/**
69
	/**
70
	 * button IDs
70
	 * button IDs
71
	 */
71
	 */
(-)src/org/eclipse/ui/views/tasklist/FiltersDialog.java (-2 / +2 lines)
Lines 17-24 Link Here
17
import java.util.Comparator;
17
import java.util.Comparator;
18
18
19
import org.eclipse.core.resources.IMarker;
19
import org.eclipse.core.resources.IMarker;
20
import org.eclipse.jface.dialogs.Dialog;
21
import org.eclipse.jface.dialogs.IDialogConstants;
20
import org.eclipse.jface.dialogs.IDialogConstants;
21
import org.eclipse.jface.dialogs.TrayDialog;
22
import org.eclipse.jface.viewers.AbstractTreeViewer;
22
import org.eclipse.jface.viewers.AbstractTreeViewer;
23
import org.eclipse.jface.viewers.CheckStateChangedEvent;
23
import org.eclipse.jface.viewers.CheckStateChangedEvent;
24
import org.eclipse.jface.viewers.CheckboxTreeViewer;
24
import org.eclipse.jface.viewers.CheckboxTreeViewer;
Lines 52-58 Link Here
52
import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
52
import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
53
import org.eclipse.ui.internal.views.tasklist.TaskListMessages;
53
import org.eclipse.ui.internal.views.tasklist.TaskListMessages;
54
54
55
class FiltersDialog extends Dialog {
55
class FiltersDialog extends TrayDialog {
56
    /**
56
    /**
57
     * ID for the Reset button
57
     * ID for the Reset button
58
     */
58
     */
(-)src/org/eclipse/jface/preference/PreferenceDialog.java (-2 / +2 lines)
Lines 18-24 Link Here
18
import org.eclipse.core.runtime.IStatus;
18
import org.eclipse.core.runtime.IStatus;
19
import org.eclipse.core.runtime.ListenerList;
19
import org.eclipse.core.runtime.ListenerList;
20
import org.eclipse.core.runtime.Status;
20
import org.eclipse.core.runtime.Status;
21
import org.eclipse.jface.dialogs.Dialog;
22
import org.eclipse.jface.dialogs.DialogMessageArea;
21
import org.eclipse.jface.dialogs.DialogMessageArea;
23
import org.eclipse.jface.dialogs.IDialogConstants;
22
import org.eclipse.jface.dialogs.IDialogConstants;
24
import org.eclipse.jface.dialogs.IMessageProvider;
23
import org.eclipse.jface.dialogs.IMessageProvider;
Lines 26-31 Link Here
26
import org.eclipse.jface.dialogs.IPageChangedListener;
25
import org.eclipse.jface.dialogs.IPageChangedListener;
27
import org.eclipse.jface.dialogs.MessageDialog;
26
import org.eclipse.jface.dialogs.MessageDialog;
28
import org.eclipse.jface.dialogs.PageChangedEvent;
27
import org.eclipse.jface.dialogs.PageChangedEvent;
28
import org.eclipse.jface.dialogs.TrayDialog;
29
import org.eclipse.jface.resource.ImageDescriptor;
29
import org.eclipse.jface.resource.ImageDescriptor;
30
import org.eclipse.jface.resource.ImageRegistry;
30
import org.eclipse.jface.resource.ImageRegistry;
31
import org.eclipse.jface.resource.JFaceResources;
31
import org.eclipse.jface.resource.JFaceResources;
Lines 77-83 Link Here
77
 * dialog; when a node is selected, the corresponding page is shown on the right
77
 * dialog; when a node is selected, the corresponding page is shown on the right
78
 * hand side.
78
 * hand side.
79
 */
79
 */
80
public class PreferenceDialog extends Dialog implements IPreferencePageContainer, IPageChangeProvider {
80
public class PreferenceDialog extends TrayDialog implements IPreferencePageContainer, IPageChangeProvider {
81
	/**
81
	/**
82
	 * Layout for the page container.
82
	 * Layout for the page container.
83
	 *  
83
	 *  
(-)src/org/eclipse/jface/dialogs/TitleAreaDialog.java (-11 / +8 lines)
Lines 41-47 Link Here
41
 * <p>
41
 * <p>
42
 * This dialog class may be subclassed.
42
 * This dialog class may be subclassed.
43
 */
43
 */
44
public class TitleAreaDialog extends Dialog {
44
public class TitleAreaDialog extends TrayDialog {
45
    /**
45
    /**
46
     * Image registry key for error message image.
46
     * Image registry key for error message image.
47
     */
47
     */
Lines 133-154 Link Here
133
     * @see Dialog.createContents(Composite)
133
     * @see Dialog.createContents(Composite)
134
     */
134
     */
135
    protected Control createContents(Composite parent) {
135
    protected Control createContents(Composite parent) {
136
    	Composite contents = new Composite(parent, SWT.NONE);
137
        contents.setLayout(new FormLayout());
138
        contents.setLayoutData(new GridData(GridData.FILL_BOTH));
136
        // initialize the dialog units
139
        // initialize the dialog units
137
        initializeDialogUnits(parent);
140
        initializeDialogUnits(contents);
138
        FormLayout layout = new FormLayout();
139
        parent.setLayout(layout);
140
        FormData data = new FormData();
141
        data.top = new FormAttachment(0, 0);
142
        data.bottom = new FormAttachment(100, 0);
143
        parent.setLayoutData(data);
144
        //Now create a work area for the rest of the dialog
141
        //Now create a work area for the rest of the dialog
145
        workArea = new Composite(parent, SWT.NULL);
142
        workArea = new Composite(contents, SWT.NONE);
146
        GridLayout childLayout = new GridLayout();
143
        GridLayout childLayout = new GridLayout();
147
        childLayout.marginHeight = 0;
144
        childLayout.marginHeight = 0;
148
        childLayout.marginWidth = 0;
145
        childLayout.marginWidth = 0;
149
        childLayout.verticalSpacing = 0;
146
        childLayout.verticalSpacing = 0;
150
        workArea.setLayout(childLayout);
147
        workArea.setLayout(childLayout);
151
        Control top = createTitleArea(parent);
148
        Control top = createTitleArea(contents);
152
        resetWorkAreaAttachments(top);
149
        resetWorkAreaAttachments(top);
153
        workArea.setFont(JFaceResources.getDialogFont());
150
        workArea.setFont(JFaceResources.getDialogFont());
154
        // initialize the dialog units
151
        // initialize the dialog units
Lines 156-162 Link Here
156
        // create the dialog area and button bar
153
        // create the dialog area and button bar
157
        dialogArea = createDialogArea(workArea);
154
        dialogArea = createDialogArea(workArea);
158
        buttonBar = createButtonBar(workArea);
155
        buttonBar = createButtonBar(workArea);
159
        return parent;
156
        return contents;
160
    }
157
    }
161
158
162
    /**
159
    /**
(-)src/org/eclipse/jface/dialogs/TrayDialog.java (+166 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jface.dialogs;
12
13
import org.eclipse.jface.window.IShellProvider;
14
import org.eclipse.swt.SWT;
15
import org.eclipse.swt.graphics.Rectangle;
16
import org.eclipse.swt.layout.GridData;
17
import org.eclipse.swt.layout.GridLayout;
18
import org.eclipse.swt.widgets.Control;
19
import org.eclipse.swt.widgets.Label;
20
import org.eclipse.swt.widgets.Layout;
21
import org.eclipse.swt.widgets.Shell;
22
23
/**
24
 * A <code>TrayDialog</code> is a specialized <code>Dialog</code> that can contain
25
 * a tray on its side. The tray's content is provided as an <code>AbstractDialogTray
26
 * </code>.
27
 * <p>
28
 * It is recommended to subclass this class instead of <code>Dialog</code> in all
29
 * cases except where the dialog should never show a tray. For example, dialogs
30
 * which are very short, simple, and quick to dismiss (e.g. a message dialog with
31
 * an OK button) should subclass <code>Dialog</code>.
32
 * </p>
33
 * <p>
34
 * Note: Trays are not supported on dialogs that use a custom layout on the <code>
35
 * Shell</code> by overriding <code>Window#getLayout()</code>.
36
 * </p>
37
 * 
38
 * @see org.eclipse.jface.dialogs.AbstractDialogTray
39
 * @see org.eclipse.jface.window.Window#getLayout()
40
 * @since 3.2
41
 */
42
public class TrayDialog extends Dialog {
43
44
	/*
45
	 * The dialog's tray contents.
46
	 */
47
	private Control trayControl;
48
	
49
	/*
50
	 * The vertical separator that separates the dialogs content from the tray.
51
	 */
52
	private Label separator;
53
54
	/**
55
	 * Creates a tray dialog instance. Note that the window will have no visual
56
	 * representation (no widgets) until it is told to open.
57
	 * 
58
	 * @param parentShell the parent shell, or <code>null</code> to create a top-level
59
	 *            shell
60
	 */
61
	protected TrayDialog(Shell shell) {
62
		super(shell);
63
	}
64
	
65
	/**
66
	 * Creates a tray dialog with the given parent.
67
	 * 
68
	 * @param parentShell object that returns the current parent shell
69
	 */
70
	protected TrayDialog(IShellProvider parentShell) {
71
		super(parentShell);
72
	}
73
74
	/**
75
	 * Closes this dialog's tray, disposing its widgets.
76
	 * 
77
	 * @throws IllegalStateException if the tray was not open
78
	 */
79
	public void closeTray() throws IllegalStateException {
80
		if (!isTrayOpen()) {
81
			throw new IllegalStateException("Tray was not open"); //$NON-NLS-1$
82
		}
83
		int trayWidth = trayControl.getSize().x + separator.getSize().x;
84
		Shell shell = getShell();
85
		trayControl.dispose();
86
		trayControl = null;
87
		separator.dispose();
88
		Rectangle bounds = shell.getBounds();
89
		shell.setBounds(bounds.x + ((getDefaultOrientation() == SWT.RIGHT_TO_LEFT) ? trayWidth : 0), bounds.y, bounds.width - trayWidth, bounds.height);
90
	}
91
	
92
	/**
93
	 * The tray dialog's default layout is a modified version of the default
94
	 * <code>Window</code> layout that can accomodate a tray, however it still
95
	 * conforms to the description of the <code>Window</code> default layout.
96
	 * <p>
97
	 * Note: Trays may not be supported with all custom layouts. To avoid problems,
98
	 * use a single outer <code>Composite</code> for your tray, and set your custom
99
	 * layout on that <code>Composite</code>.
100
	 * </p>
101
	 * 
102
	 * @see org.eclipse.jface.window.Window#getLayout()
103
	 * @return a newly created Layout or null if no layout should be attached
104
	 */
105
	protected Layout getLayout() {
106
		GridLayout layout = new GridLayout(3, false);
107
		layout.marginHeight = 0;
108
		layout.marginWidth = 0;
109
		layout.horizontalSpacing = 0;
110
		return layout;
111
	}
112
	
113
	/**
114
	 * Returns whether or not this dialog's tray is currently open.
115
	 * 
116
	 * @return whether the dialog's tray is currently open
117
	 */
118
	public boolean isTrayOpen() {
119
		return (trayControl != null);
120
	}
121
	
122
	/**
123
	 * Constructs the tray's widgets and displays the tray in this dialog. The
124
	 * dialog's size will be adjusted to accomodate the tray.
125
	 * 
126
	 * @param tray the tray to show in this dialog
127
	 * @throws IllegalStateException if the dialog already has a tray open
128
	 * @throws UnsupportedOperationException if the dialog does not support trays,
129
	 *            for example if it uses a custom layout.
130
	 */
131
	public void openTray(AbstractDialogTray tray) throws IllegalStateException, UnsupportedOperationException {
132
		if (tray == null) {
133
			throw new NullPointerException("Tray was null"); //$NON-NLS-1$
134
		}
135
		if (isTrayOpen()) {
136
			throw new IllegalStateException("Tray was already open"); //$NON-NLS-1$
137
		}
138
		if (!isCompatibleLayout(getShell().getLayout())) {
139
			throw new UnsupportedOperationException("Trays not supported with custom layouts"); //$NON-NLS-1$
140
		}
141
		Shell shell = getShell();
142
		Rectangle clientArea = shell.getClientArea();
143
		separator = new Label(shell, SWT.SEPARATOR | SWT.VERTICAL);
144
		separator.setLayoutData(new GridData(GridData.FILL_VERTICAL));
145
		trayControl = tray.createContents(shell);
146
		GridData data = new GridData(GridData.FILL_VERTICAL);
147
		data.widthHint = trayControl.computeSize(SWT.DEFAULT, clientArea.height).x;
148
		trayControl.setLayoutData(data);
149
		int trayWidth = separator.computeSize(SWT.DEFAULT, clientArea.height).x + data.widthHint;
150
		Rectangle bounds = shell.getBounds();
151
		shell.setBounds(bounds.x - ((getDefaultOrientation() == SWT.RIGHT_TO_LEFT) ? trayWidth : 0), bounds.y, bounds.width + trayWidth, bounds.height);
152
	}
153
	
154
	/*
155
	 * Returns whether or not the given layout can support the addition of a tray.
156
	 */
157
	private boolean isCompatibleLayout(Layout layout) {
158
		if (layout != null && layout instanceof GridLayout) {
159
			GridLayout grid = (GridLayout)layout;
160
			return !grid.makeColumnsEqualWidth && (grid.horizontalSpacing == 0) &&
161
					(grid.marginWidth == 0) && (grid.marginHeight == 0) &&
162
					(grid.horizontalSpacing == 0) && (grid.numColumns == 3);
163
		}
164
		return false;
165
	}
166
}
(-)src/org/eclipse/jface/dialogs/AbstractDialogTray.java (+40 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jface.dialogs;
12
13
import org.eclipse.swt.widgets.Composite;
14
import org.eclipse.swt.widgets.Control;
15
16
/**
17
 * <p>
18
 * This class is the abstract superclass of all dialog trays. A tray can be opened
19
 * in any <code>TrayDialog</code>.
20
 * </p>
21
 * 
22
 * @see org.eclipse.jface.dialogs.TrayDialog
23
 * @since 3.2
24
 */
25
public abstract class AbstractDialogTray {
26
27
	/**
28
	 * Creates the contents (widgets) that will be contained in the tray.
29
	 * <p>
30
	 * Tray implementions must not set a layout on the parent composite, or assume
31
	 * a particular layout on the parent. The tray dialog will allocate space
32
	 * according to the natural size of the tray, and will fill the tray area with the
33
	 * tray's contents.
34
	 * </p>
35
	 * 
36
	 * @param parent the composite that will contain the tray
37
	 * @return the contents of the tray, as a <code>Control</code>
38
	 */
39
	protected abstract Control createContents(Composite parent);
40
}
(-)src/org/eclipse/help/ui/internal/DefaultHelpUI.java (-37 / +19 lines)
Lines 11-17 Link Here
11
11
12
import java.net.URL;
12
import java.net.URL;
13
13
14
import org.eclipse.core.runtime.Platform;
15
import org.eclipse.core.runtime.Preferences;
14
import org.eclipse.core.runtime.Preferences;
16
import org.eclipse.help.IContext;
15
import org.eclipse.help.IContext;
17
import org.eclipse.help.browser.IBrowser;
16
import org.eclipse.help.browser.IBrowser;
Lines 20-33 Link Here
20
import org.eclipse.help.internal.base.IHelpBaseConstants;
19
import org.eclipse.help.internal.base.IHelpBaseConstants;
21
import org.eclipse.help.ui.internal.util.ErrorUtil;
20
import org.eclipse.help.ui.internal.util.ErrorUtil;
22
import org.eclipse.help.ui.internal.views.ContextHelpPart;
21
import org.eclipse.help.ui.internal.views.ContextHelpPart;
23
import org.eclipse.help.ui.internal.views.ContextHelpWindow;
22
import org.eclipse.help.ui.internal.views.ContextHelpTray;
24
import org.eclipse.help.ui.internal.views.HelpView;
23
import org.eclipse.help.ui.internal.views.HelpView;
25
import org.eclipse.jface.dialogs.MessageDialog;
24
import org.eclipse.jface.dialogs.MessageDialog;
25
import org.eclipse.jface.dialogs.TrayDialog;
26
import org.eclipse.jface.window.Window;
26
import org.eclipse.jface.window.Window;
27
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.SWT;
28
import org.eclipse.swt.events.DisposeEvent;
29
import org.eclipse.swt.events.DisposeListener;
30
import org.eclipse.swt.graphics.Rectangle;
31
import org.eclipse.swt.widgets.Control;
28
import org.eclipse.swt.widgets.Control;
32
import org.eclipse.swt.widgets.Display;
29
import org.eclipse.swt.widgets.Display;
33
import org.eclipse.swt.widgets.Shell;
30
import org.eclipse.swt.widgets.Shell;
Lines 55-61 Link Here
55
public class DefaultHelpUI extends AbstractHelpUI {
52
public class DefaultHelpUI extends AbstractHelpUI {
56
53
57
	private ContextHelpDialog f1Dialog = null;
54
	private ContextHelpDialog f1Dialog = null;
58
	private ContextHelpWindow f1Window = null;
59
	private static DefaultHelpUI instance;
55
	private static DefaultHelpUI instance;
60
56
61
	private static final String HELP_VIEW_ID = "org.eclipse.help.ui.HelpView"; //$NON-NLS-1$
57
	private static final String HELP_VIEW_ID = "org.eclipse.help.ui.HelpView"; //$NON-NLS-1$
Lines 162-168 Link Here
162
					Object data = activeShell.getData();
158
					Object data = activeShell.getData();
163
					if (data instanceof Window) {
159
					if (data instanceof Window) {
164
						IContext context = ContextHelpPart.findHelpContext(c);
160
						IContext context = ContextHelpPart.findHelpContext(c);
165
						displayContextAsHelpPane(activeShell, context);
161
						displayContextAsHelpTray(activeShell, context);
166
						return;
162
						return;
167
					}
163
					}
168
				}
164
				}
Lines 199-205 Link Here
199
				if (activeShell != null) {
195
				if (activeShell != null) {
200
					Object data = activeShell.getData();
196
					Object data = activeShell.getData();
201
					if (data instanceof Window) {
197
					if (data instanceof Window) {
202
						displayContextAsHelpPane(activeShell, null);
198
						displayContextAsHelpTray(activeShell, null);
203
						return;
199
						return;
204
					}
200
					}
205
				}
201
				}
Lines 277-283 Link Here
277
		if (activeShell != null) {
273
		if (activeShell != null) {
278
			Object data = activeShell.getData();
274
			Object data = activeShell.getData();
279
			if (data instanceof Window && (!dinfopop || noInfopop)) {
275
			if (data instanceof Window && (!dinfopop || noInfopop)) {
280
				displayContextAsHelpPane(activeShell, context);
276
				displayContextAsHelpTray(activeShell, context);
281
				return;
277
				return;
282
			}
278
			}
283
		}
279
		}
Lines 322-357 Link Here
322
		f1Dialog.open();
318
		f1Dialog.open();
323
	}
319
	}
324
320
325
	private void displayContextAsHelpPane(Shell activeShell, IContext context) {
321
	private void displayContextAsHelpTray(Shell activeShell, IContext context) {
326
		Control c = activeShell.getDisplay().getFocusControl();
322
		Control controlInFocus = activeShell.getDisplay().getFocusControl();
327
		if (f1Window != null) {
323
		Object data = activeShell.getData();
328
			Shell parentShell = activeShell;
324
		if (data != null && data instanceof TrayDialog) {
329
			if (activeShell.getData() instanceof ContextHelpWindow)
325
			TrayDialog dialog = (TrayDialog)data;
330
				parentShell = (Shell) activeShell.getParent();
326
			if (!dialog.isTrayOpen()) {
331
			if (f1Window.getShell().getParent().equals(parentShell)) {
327
				ContextHelpTray helpTray = new ContextHelpTray();
332
				f1Window.update(context, c);
328
				dialog.openTray(helpTray);
333
				return;
329
				if (context != null) {
330
					helpTray.update(context, controlInFocus);
331
				}
332
				else {
333
					helpTray.showSearch();
334
				}
334
			}
335
			}
335
		}
336
		}
336
		Rectangle pbounds = activeShell.getBounds();
337
		f1Window = new ContextHelpWindow(activeShell);
338
		f1Window.create();
339
		Shell helpShell = f1Window.getShell();
340
		helpShell.setText(Messages.DefaultHelpUI_wtitle);
341
		helpShell.setSize(300, pbounds.height);
342
		if (context != null)
343
			f1Window.update(context, c);
344
		else
345
			f1Window.showSearch();
346
		if (!Platform.getWS().equals(Platform.WS_GTK))
347
			f1Window.dock(true);
348
		helpShell.addDisposeListener(new DisposeListener() {
349
350
			public void widgetDisposed(DisposeEvent e) {
351
				f1Window = null;
352
			}
353
		});
354
		helpShell.open();
355
	}
337
	}
356
338
357
	/**
339
	/**
(-)src/org/eclipse/help/ui/internal/views/ContextHelpWindow.java (-396 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sebastian Davids <sdavids@gmx.de> - bug 93374
11
 *******************************************************************************/
12
package org.eclipse.help.ui.internal.views;
13
14
import org.eclipse.core.runtime.Platform;
15
import org.eclipse.help.IContext;
16
import org.eclipse.help.ui.internal.IHelpUIConstants;
17
import org.eclipse.help.ui.internal.Messages;
18
import org.eclipse.jface.action.ToolBarManager;
19
import org.eclipse.jface.dialogs.IDialogPage;
20
import org.eclipse.jface.dialogs.IPageChangeProvider;
21
import org.eclipse.jface.dialogs.IPageChangedListener;
22
import org.eclipse.jface.dialogs.PageChangedEvent;
23
import org.eclipse.jface.window.Window;
24
import org.eclipse.swt.SWT;
25
import org.eclipse.swt.events.ControlEvent;
26
import org.eclipse.swt.events.ControlListener;
27
import org.eclipse.swt.graphics.Rectangle;
28
import org.eclipse.swt.layout.GridData;
29
import org.eclipse.swt.layout.GridLayout;
30
import org.eclipse.swt.widgets.Composite;
31
import org.eclipse.swt.widgets.Control;
32
import org.eclipse.swt.widgets.Display;
33
import org.eclipse.swt.widgets.Event;
34
import org.eclipse.swt.widgets.Label;
35
import org.eclipse.swt.widgets.Listener;
36
import org.eclipse.swt.widgets.Shell;
37
import org.eclipse.swt.widgets.TabFolder;
38
import org.eclipse.swt.widgets.TabItem;
39
import org.eclipse.ui.PlatformUI;
40
import org.eclipse.ui.forms.HyperlinkGroup;
41
import org.eclipse.ui.forms.widgets.FormToolkit;
42
43
public class ContextHelpWindow extends Window implements IPageChangedListener {
44
	private ReusableHelpPart helpPart;
45
46
	private static final int DOCK_MARGIN = 10;
47
48
	private static final int CLIP_ALLOWANCE = 5;
49
50
	private FormToolkit toolkit;
51
52
	private Listener listener;
53
54
	private ControlListener parentListener;
55
56
	private Rectangle savedPbounds;
57
58
	private Rectangle savedBounds;
59
60
	private boolean parentResizeBlocked = false;
61
62
	public ContextHelpWindow(Shell parent) {
63
		super(parent);
64
		setShellStyle(SWT.CLOSE | SWT.RESIZE);
65
		if (!Platform.getWS().equals(Platform.WS_GTK)) {
66
			parentListener = new ControlListener() {
67
				public void controlMoved(ControlEvent e) {
68
					maintainRelativePosition();
69
				}
70
71
				public void controlResized(ControlEvent e) {
72
					onParentWindowResize();
73
				}
74
			};
75
			listener = new Listener() {
76
				public void handleEvent(Event e) {
77
					switch (e.type) {
78
					case SWT.FocusIn:
79
					case SWT.Selection:
80
						update((Control) e.widget);
81
						break;
82
					case SWT.Move:
83
						if (onWindowMove())
84
							e.doit = false;
85
						break;
86
					case SWT.Resize:
87
						onWindowResize();
88
						break;
89
					}
90
				}
91
			};
92
		}
93
	}
94
	
95
	public void showSearch() {
96
		helpPart.showPage(IHelpUIConstants.HV_FSEARCH_PAGE, true);
97
	}
98
99
	private void maintainRelativePosition() {
100
		if (savedPbounds == null || isDocked())
101
			dock(true);
102
		else {
103
			Rectangle pbounds = getShell().getParent().getBounds();
104
			Rectangle bounds = getShell().getBounds();
105
			int deltaX = pbounds.x - savedPbounds.x;
106
			int deltaY = pbounds.y - savedPbounds.y;
107
			int newX = bounds.x + deltaX;
108
			int newY = bounds.y + deltaY;
109
			boolean doDock = false;
110
			Rectangle dbounds = getShell().getDisplay().getBounds();
111
			if (newX > dbounds.width - bounds.width) {
112
				newX = dbounds.width - bounds.width;
113
				if (pbounds.x + pbounds.width > newX)
114
					doDock = true;
115
			} else if (newX < 0)
116
				doDock = true;
117
			if (newY > dbounds.height - bounds.height) {
118
				newY = dbounds.height - bounds.height;
119
			} else if (newY < 0)
120
				newY = 0;
121
			if (doDock) {
122
				dock(true);
123
				return;
124
			}
125
			getShell().setLocation(newX, newY);
126
			savedPbounds = pbounds;
127
			savedBounds = getShell().getBounds();
128
		}
129
	}
130
131
	protected Control createContents(Composite parent) {
132
		toolkit = new FormToolkit(parent.getDisplay());
133
		toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(
134
				HyperlinkGroup.UNDERLINE_HOVER);
135
		toolkit.getColors().initializeSectionToolBarColors();
136
		Composite container = new Composite(parent, SWT.NULL);
137
		GridLayout layout = new GridLayout();
138
		layout.marginWidth = layout.marginHeight = 0;
139
		layout.verticalSpacing = 0;
140
		container.setLayout(layout);
141
142
		GridData gd;
143
		ToolBarManager tbm = new ToolBarManager(SWT.FLAT);
144
		tbm.createControl(container);
145
		gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
146
		gd.grabExcessHorizontalSpace = true;
147
		tbm.getControl().setLayoutData(gd);
148
		Label separator = new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL);
149
		gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
150
		gd.heightHint = 1;
151
		separator.setLayoutData(gd);
152
		helpPart = new ReusableHelpPart(PlatformUI.getWorkbench()
153
				.getProgressService());
154
		helpPart.init(null, tbm, null, null);
155
		helpPart.setDefaultContextHelpText(Messages.HelpView_defaultText); //		
156
		helpPart.createControl(container, toolkit);
157
		helpPart.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
158
		if (!Platform.getWS().equals(Platform.WS_GTK)) 
159
			hookListeners();
160
		helpPart.showPage(IHelpUIConstants.HV_CONTEXT_HELP_PAGE);
161
		container.setLayoutData(new GridData(GridData.FILL_BOTH));
162
		return container;
163
	}
164
165
	private void hookListeners() {
166
		Shell shell = getShell();
167
		shell.addListener(SWT.Move, listener);
168
		shell.addListener(SWT.Resize, listener);
169
		hookPageChangeListener(shell.getParent(), listener);
170
		shell.getParent().addControlListener(parentListener);
171
	}
172
173
	private void unhookListeners() {
174
		Shell shell = getShell();
175
		shell.getParent().removeControlListener(parentListener);
176
		unhookPageChangeListener(shell.getParent(), listener);
177
		shell.removeListener(SWT.Move, listener);
178
		shell.removeListener(SWT.Resize, listener);
179
	}
180
181
	private void hookPageChangeListener(Composite parent, Listener listener) {
182
		Object data = parent.getData();
183
		if (data instanceof IPageChangeProvider) {
184
			((IPageChangeProvider) data).addPageChangedListener(this);
185
		}
186
	}
187
188
	private void unhookPageChangeListener(Composite parent, Listener listener) {
189
		Object data = parent.getData();
190
		if (data instanceof IPageChangeProvider) {
191
			((IPageChangeProvider) data).removePageChangedListener(this);
192
		}
193
	}
194
195
	public void dock(boolean changeSides) {
196
		getShell().setBounds(computeDockedBounds(changeSides));
197
	}
198
199
	public Rectangle computeDockedBounds(boolean changeSides) {
200
		Display d = getShell().getDisplay();
201
		Rectangle dbounds = d.getBounds();
202
		Rectangle pbounds = getShell().getParent().getBounds();
203
204
		int leftMargin = pbounds.x;
205
		int rightMargin = dbounds.width - pbounds.x - pbounds.width;
206
		int centeredLeftMargin = dbounds.width / 2 - pbounds.width / 2;
207
		boolean rightParent = leftMargin > centeredLeftMargin;
208
		int currentX = getShell().getLocation().x;
209
		int newSize = getShell().getSize().x;
210
		boolean leftOK = newSize <= leftMargin + CLIP_ALLOWANCE;
211
		boolean rightOK = newSize <= rightMargin + CLIP_ALLOWANCE;
212
		int x;
213
		// first try to keep the same side
214
		if (currentX < pbounds.x && leftOK && (!changeSides || !rightParent)) {
215
			x = pbounds.x - newSize;
216
		} else if (currentX > pbounds.x && rightOK
217
				&& (!changeSides || rightParent)) {
218
			x = pbounds.x + pbounds.width;
219
		}
220
		// must switch side
221
		else if (changeSides) {
222
			if (rightOK)
223
				x = pbounds.x + pbounds.width;
224
			else if (leftOK)
225
				x = pbounds.x - newSize;
226
			else {
227
				// pick the margin that has more space, reduce size
228
				if (leftMargin > rightMargin) {
229
					newSize = leftMargin;
230
					x = pbounds.x - newSize;
231
				} else {
232
					newSize = rightMargin;
233
					x = dbounds.width - newSize;
234
				}
235
			}
236
		} else {
237
			if (currentX < pbounds.x) {
238
				newSize = leftMargin;
239
				x = pbounds.x - newSize;
240
			} else {
241
				newSize = rightMargin;
242
				x = dbounds.width - newSize;
243
			}
244
		}
245
		savedPbounds = pbounds;
246
		savedBounds = getShell().getBounds();
247
		return new Rectangle(x, pbounds.y, newSize, pbounds.height);
248
	}
249
250
	private boolean onWindowMove() {
251
		if (savedBounds == null) {
252
			savedBounds = getShell().getBounds();
253
			savedPbounds = getShell().getParent().getBounds();
254
			return false;
255
		}
256
		Rectangle bounds = getShell().getBounds();
257
		Rectangle pbounds = getShell().getParent().getBounds();
258
		if (bounds.y != savedBounds.y) {
259
			// vertical move
260
			if (bounds.y + bounds.height == savedBounds.y + savedBounds.height) {
261
				// upper edge resize
262
				if (isDocked()) {
263
					savedBounds = bounds;
264
					savedPbounds = pbounds;
265
					return false;
266
				}
267
			}
268
		}
269
		boolean doDock = false;
270
271
		if (bounds.x < pbounds.x) {
272
			// left
273
			int deltaX = bounds.x - savedBounds.x;
274
			if (deltaX > 0 || bounds.x + bounds.width > pbounds.x) {
275
				// moving closer - check for dock snap
276
				int distance = pbounds.x - bounds.x - bounds.width;
277
				if (Math.abs(distance) <= DOCK_MARGIN)
278
					doDock = true;
279
			}
280
		} else {
281
			// right
282
			int deltaX = bounds.x - savedBounds.x;
283
			if (deltaX < 0 || bounds.x < pbounds.x + pbounds.width) {
284
				// moving closer - check for dock snap
285
				int distance = bounds.x - pbounds.x - pbounds.width;
286
				if (Math.abs(distance) <= DOCK_MARGIN)
287
					doDock = true;
288
			}
289
		}
290
		if (bounds.y + bounds.height < pbounds.y) // above
291
			doDock = false;
292
		if (pbounds.y + pbounds.height < bounds.y) // below
293
			doDock = false;
294
		if (doDock)
295
			dock(false);
296
		savedBounds = getShell().getBounds();
297
		savedPbounds = getShell().getParent().getBounds();
298
		return doDock;
299
	}
300
301
	private void onWindowResize() {
302
		if (isDocked()) {
303
			Rectangle bounds = getShell().getBounds();
304
			Rectangle pbounds = getShell().getParent().getBounds();
305
			if (bounds.height != savedBounds.height) {
306
				Shell parent = (Shell) getShell().getParent();
307
				if ((parent.getStyle() & SWT.RESIZE) != 0) {
308
					parentResizeBlocked = true;
309
					parent.setBounds(pbounds.x, bounds.y, pbounds.width,
310
							bounds.height);
311
					parentResizeBlocked = false;
312
				}
313
			}
314
		}
315
		savedBounds = getShell().getBounds();
316
	}
317
318
	private void onParentWindowResize() {
319
		if (!parentResizeBlocked && isDocked()) {
320
			Rectangle bounds = getShell().getBounds();
321
			Rectangle pbounds = getShell().getParent().getBounds();
322
			if (bounds.x == savedPbounds.x + savedPbounds.width) {
323
				// right
324
				if (savedPbounds.x + savedPbounds.width != pbounds.x
325
						+ pbounds.width)
326
					// right edge moved
327
					dock(false);
328
			} else {
329
			}
330
			getShell().setSize(getShell().getSize().x,
331
					getShell().getParent().getSize().y);
332
		}
333
		savedPbounds = getShell().getParent().getBounds();
334
	}
335
336
	public void update(Control c) {
337
		helpPart.update(null, c);
338
	}
339
340
	public void update(IContext context, Control c) {
341
		helpPart.showPage(IHelpUIConstants.HV_CONTEXT_HELP_PAGE);
342
		helpPart.update(context, null, c);
343
	}
344
345
	public boolean close() {
346
		if (!Platform.getWS().equals(Platform.WS_GTK)) 
347
			unhookListeners();
348
		if (super.close()) {
349
			if (toolkit != null) {
350
				toolkit.dispose();
351
				toolkit = null;
352
			}
353
			if (helpPart != null) {
354
				helpPart.dispose();
355
				helpPart = null;
356
			}
357
			return true;
358
		}
359
		return false;
360
	}
361
362
	private boolean isDocked() {
363
		if (savedPbounds == null)
364
			return false;
365
		return isDocked(savedBounds, savedPbounds);
366
	}
367
368
	private boolean isDocked(Rectangle bounds, Rectangle pbounds) {
369
		if (pbounds.height != bounds.height)
370
			return false;
371
		if (bounds.y + bounds.height < pbounds.y) // above
372
			return false;
373
		if (pbounds.y + pbounds.height < bounds.y) // below
374
			return false;
375
		return bounds.x == pbounds.x + pbounds.width
376
				|| bounds.x == pbounds.x - bounds.width;
377
	}
378
379
	public void pageChanged(PageChangedEvent event) {
380
		Object page = event.getSelectedPage();
381
		Control c = null;
382
		if (page instanceof IDialogPage) {
383
			c = ((IDialogPage) page).getControl();
384
		} else {
385
			c = getShell().getDisplay().getFocusControl();
386
			if (c instanceof TabFolder) {
387
				TabFolder folder = (TabFolder) c;
388
				TabItem[] selection = folder.getSelection();
389
				if (selection.length == 1) {
390
					c = selection[0].getControl();
391
				}
392
			}
393
		}
394
		update(null, c);
395
	}
396
}
(-)src/org/eclipse/help/ui/internal/views/ContextHelpTray.java (+141 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sebastian Davids <sdavids@gmx.de> - bug 93374
11
 *******************************************************************************/
12
package org.eclipse.help.ui.internal.views;
13
14
import org.eclipse.help.IContext;
15
import org.eclipse.help.ui.internal.HelpUIResources;
16
import org.eclipse.help.ui.internal.IHelpUIConstants;
17
import org.eclipse.help.ui.internal.Messages;
18
import org.eclipse.jface.action.Action;
19
import org.eclipse.jface.action.IAction;
20
import org.eclipse.jface.action.ToolBarManager;
21
import org.eclipse.jface.dialogs.AbstractDialogTray;
22
import org.eclipse.jface.dialogs.IDialogPage;
23
import org.eclipse.jface.dialogs.IPageChangeProvider;
24
import org.eclipse.jface.dialogs.IPageChangedListener;
25
import org.eclipse.jface.dialogs.PageChangedEvent;
26
import org.eclipse.jface.dialogs.TrayDialog;
27
import org.eclipse.swt.SWT;
28
import org.eclipse.swt.layout.GridData;
29
import org.eclipse.swt.layout.GridLayout;
30
import org.eclipse.swt.widgets.Composite;
31
import org.eclipse.swt.widgets.Control;
32
import org.eclipse.swt.widgets.Event;
33
import org.eclipse.swt.widgets.Label;
34
import org.eclipse.swt.widgets.Listener;
35
import org.eclipse.swt.widgets.Shell;
36
import org.eclipse.swt.widgets.TabFolder;
37
import org.eclipse.swt.widgets.TabItem;
38
import org.eclipse.ui.PlatformUI;
39
import org.eclipse.ui.forms.HyperlinkGroup;
40
import org.eclipse.ui.forms.widgets.FormToolkit;
41
42
public class ContextHelpTray extends AbstractDialogTray implements IPageChangedListener {
43
	
44
	private ReusableHelpPart helpPart;
45
	private FormToolkit toolkit;
46
	private Shell shell;
47
48
	protected Control createContents(Composite parent) {
49
		toolkit = new FormToolkit(parent.getDisplay());
50
		toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkGroup.UNDERLINE_HOVER);
51
		toolkit.getColors().initializeSectionToolBarColors();
52
		Composite container = new Composite(parent, SWT.NONE);
53
		GridLayout layout = new GridLayout();
54
		layout.marginWidth = layout.marginHeight = 0;
55
		layout.verticalSpacing = 0;
56
		container.setLayout(layout);
57
58
		GridData gd;
59
		ToolBarManager tbm = new ToolBarManager(SWT.FLAT);
60
		tbm.createControl(container);
61
		gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
62
		gd.grabExcessHorizontalSpace = true;
63
		tbm.getControl().setLayoutData(gd);
64
		Label separator = new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL);
65
		gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
66
		gd.heightHint = 1;
67
		separator.setLayoutData(gd);
68
		helpPart = new ReusableHelpPart(PlatformUI.getWorkbench().getProgressService());
69
		helpPart.init(null, tbm, null, null);
70
		helpPart.setDefaultContextHelpText(Messages.HelpView_defaultText);
71
		helpPart.createControl(container, toolkit);
72
		helpPart.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
73
		
74
		IAction closeTray = new Action() {
75
			public void run() {
76
				TrayDialog dialog = (TrayDialog)shell.getData();
77
				dialog.closeTray();
78
			}
79
		};
80
		closeTray.setImageDescriptor(HelpUIResources.getImageDescriptor("etool16/close.gif"));
81
		closeTray.setToolTipText("Close"); 
82
		tbm.add(closeTray);
83
		
84
		shell = parent.getShell();
85
		hookPageChangeListener(shell);
86
		helpPart.getControl().addListener(SWT.Dispose, new Listener() {
87
			public void handleEvent(Event event) {
88
				unhookPageChangeListener(shell);
89
			}
90
		});
91
		
92
		helpPart.showPage(IHelpUIConstants.HV_CONTEXT_HELP_PAGE);
93
		
94
		return container;
95
	}
96
97
	private void hookPageChangeListener(Composite parent) {
98
		Object data = parent.getData();
99
		if (data instanceof IPageChangeProvider) {
100
			((IPageChangeProvider)data).addPageChangedListener(this);
101
		}
102
	}
103
104
	public void pageChanged(PageChangedEvent event) {
105
		Object page = event.getSelectedPage();
106
		Control c = null;
107
		if (page instanceof IDialogPage) {
108
			c = ((IDialogPage) page).getControl();
109
		} else {
110
			c = shell.getDisplay().getFocusControl();
111
			if (c instanceof TabFolder) {
112
				TabFolder folder = (TabFolder) c;
113
				TabItem[] selection = folder.getSelection();
114
				if (selection.length == 1) {
115
					c = selection[0].getControl();
116
				}
117
			}
118
		}
119
		update(null, c);
120
	}
121
122
	public void showSearch() {
123
		helpPart.showPage(IHelpUIConstants.HV_FSEARCH_PAGE, true);
124
	}
125
126
	private void unhookPageChangeListener(Composite parent) {
127
		Object data = parent.getData();
128
		if (data instanceof IPageChangeProvider) {
129
			((IPageChangeProvider)data).removePageChangedListener(this);
130
		}
131
	}
132
133
	public void update(Control c) {
134
		helpPart.update(null, c);
135
	}
136
137
	public void update(IContext context, Control c) {
138
		helpPart.showPage(IHelpUIConstants.HV_CONTEXT_HELP_PAGE);
139
		helpPart.update(context, null, c);
140
	}
141
}
(-)icons/etool16/close.gif (+2 lines)
Added Link Here
1
GIF89a¢ØBOÝ[fÞmvè?—ì §ÿÿÿÿÿÿ!ù,4hºÜþ0>@k?!ëp!Q?â𑘠knË͙®e¬"ã+
2
–¤dÉl6;
(-)src/org/eclipse/update/internal/ui/wizards/MirrorsDialog.java (-1 / +2 lines)
Lines 13-18 Link Here
13
import org.eclipse.core.runtime.CoreException;
13
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.jface.dialogs.Dialog;
14
import org.eclipse.jface.dialogs.Dialog;
15
import org.eclipse.jface.dialogs.IDialogConstants;
15
import org.eclipse.jface.dialogs.IDialogConstants;
16
import org.eclipse.jface.dialogs.TrayDialog;
16
import org.eclipse.osgi.util.NLS;
17
import org.eclipse.osgi.util.NLS;
17
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.events.FocusAdapter;
19
import org.eclipse.swt.events.FocusAdapter;
Lines 29-35 Link Here
29
import org.eclipse.update.internal.ui.UpdateUIMessages;
30
import org.eclipse.update.internal.ui.UpdateUIMessages;
30
31
31
32
32
public class MirrorsDialog extends Dialog {
33
public class MirrorsDialog extends TrayDialog {
33
	//private ISiteWithMirrors site;
34
	//private ISiteWithMirrors site;
34
	private String siteName;
35
	private String siteName;
35
	private IURLEntry[] mirrors;
36
	private IURLEntry[] mirrors;
(-)Eclipse UI/org/eclipse/ui/internal/dialogs/ProductInfoDialog.java (-2 / +2 lines)
Lines 17-24 Link Here
17
17
18
import org.eclipse.core.runtime.IStatus;
18
import org.eclipse.core.runtime.IStatus;
19
import org.eclipse.core.runtime.Platform;
19
import org.eclipse.core.runtime.Platform;
20
import org.eclipse.jface.dialogs.Dialog;
21
import org.eclipse.jface.dialogs.ErrorDialog;
20
import org.eclipse.jface.dialogs.ErrorDialog;
21
import org.eclipse.jface.dialogs.TrayDialog;
22
import org.eclipse.jface.resource.JFaceColors;
22
import org.eclipse.jface.resource.JFaceColors;
23
import org.eclipse.osgi.util.NLS;
23
import org.eclipse.osgi.util.NLS;
24
import org.eclipse.swt.SWT;
24
import org.eclipse.swt.SWT;
Lines 47-53 Link Here
47
 * Abstract superclass of about dialogs 
47
 * Abstract superclass of about dialogs 
48
 */
48
 */
49
49
50
public abstract class ProductInfoDialog extends Dialog {
50
public abstract class ProductInfoDialog extends TrayDialog {
51
    private static final String ATT_HTTP = "http://"; //$NON-NLS-1$
51
    private static final String ATT_HTTP = "http://"; //$NON-NLS-1$
52
52
53
    private AboutItem item;
53
    private AboutItem item;
(-)Eclipse UI/org/eclipse/ui/internal/dialogs/CustomizePerspectiveDialog.java (-2 / +2 lines)
Lines 30-36 Link Here
30
import org.eclipse.jface.action.MenuManager;
30
import org.eclipse.jface.action.MenuManager;
31
import org.eclipse.jface.action.StatusLineManager;
31
import org.eclipse.jface.action.StatusLineManager;
32
import org.eclipse.jface.action.ToolBarContributionItem;
32
import org.eclipse.jface.action.ToolBarContributionItem;
33
import org.eclipse.jface.dialogs.Dialog;
33
import org.eclipse.jface.dialogs.TrayDialog;
34
import org.eclipse.jface.resource.ImageDescriptor;
34
import org.eclipse.jface.resource.ImageDescriptor;
35
import org.eclipse.jface.viewers.AbstractTreeViewer;
35
import org.eclipse.jface.viewers.AbstractTreeViewer;
36
import org.eclipse.jface.viewers.ArrayContentProvider;
36
import org.eclipse.jface.viewers.ArrayContentProvider;
Lines 124-130 Link Here
124
124
125
// @issue add class doc
125
// @issue add class doc
126
// @issue need to break this not to show menu specific page
126
// @issue need to break this not to show menu specific page
127
public class CustomizePerspectiveDialog extends Dialog {
127
public class CustomizePerspectiveDialog extends TrayDialog {
128
    private Perspective perspective;
128
    private Perspective perspective;
129
129
130
    WorkbenchWindow window;
130
    WorkbenchWindow window;
(-)Eclipse UI/org/eclipse/ui/activities/ActivityCategoryPreferencePage.java (-2 / +2 lines)
Lines 19-26 Link Here
19
19
20
import org.eclipse.core.runtime.IConfigurationElement;
20
import org.eclipse.core.runtime.IConfigurationElement;
21
import org.eclipse.core.runtime.IExecutableExtension;
21
import org.eclipse.core.runtime.IExecutableExtension;
22
import org.eclipse.jface.dialogs.Dialog;
23
import org.eclipse.jface.dialogs.IDialogConstants;
22
import org.eclipse.jface.dialogs.IDialogConstants;
23
import org.eclipse.jface.dialogs.TrayDialog;
24
import org.eclipse.jface.preference.PreferencePage;
24
import org.eclipse.jface.preference.PreferencePage;
25
import org.eclipse.jface.resource.DeviceResourceException;
25
import org.eclipse.jface.resource.DeviceResourceException;
26
import org.eclipse.jface.resource.ImageDescriptor;
26
import org.eclipse.jface.resource.ImageDescriptor;
Lines 116-122 Link Here
116
     */    
116
     */    
117
    public static final String ACTIVITY_PROMPT_BUTTON_TOOLTIP = "activityPromptButtonTooltip"; //$NON-NLS-1$
117
    public static final String ACTIVITY_PROMPT_BUTTON_TOOLTIP = "activityPromptButtonTooltip"; //$NON-NLS-1$
118
    
118
    
119
    private class AdvancedDialog extends Dialog {
119
    private class AdvancedDialog extends TrayDialog {
120
120
121
        ActivityEnabler enabler;
121
        ActivityEnabler enabler;
122
        /**
122
        /**
(-)Eclipse UI/org/eclipse/ui/dialogs/SelectionDialog.java (-2 / +2 lines)
Lines 13-20 Link Here
13
import java.util.ArrayList;
13
import java.util.ArrayList;
14
import java.util.List;
14
import java.util.List;
15
15
16
import org.eclipse.jface.dialogs.Dialog;
17
import org.eclipse.jface.dialogs.IDialogConstants;
16
import org.eclipse.jface.dialogs.IDialogConstants;
17
import org.eclipse.jface.dialogs.TrayDialog;
18
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.SWT;
19
import org.eclipse.swt.widgets.Button;
19
import org.eclipse.swt.widgets.Button;
20
import org.eclipse.swt.widgets.Composite;
20
import org.eclipse.swt.widgets.Composite;
Lines 30-36 Link Here
30
 * Clients may subclass this dialog to inherit its selection facilities.
30
 * Clients may subclass this dialog to inherit its selection facilities.
31
 * </p>
31
 * </p>
32
 */
32
 */
33
public abstract class SelectionDialog extends Dialog {
33
public abstract class SelectionDialog extends TrayDialog {
34
    // the final collection of selected elements, or null if this dialog was
34
    // the final collection of selected elements, or null if this dialog was
35
    // canceled
35
    // canceled
36
    private Object[] result;
36
    private Object[] result;

Return to bug 118934