Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 261683
Collapse All | Expand All

(-)src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositoryQueryPage.java (+79 lines)
Lines 14-19 Link Here
14
import java.util.Set;
14
import java.util.Set;
15
15
16
import org.eclipse.core.runtime.Assert;
16
import org.eclipse.core.runtime.Assert;
17
import org.eclipse.jface.dialogs.DialogSettings;
18
import org.eclipse.jface.dialogs.IDialogSettings;
17
import org.eclipse.jface.wizard.WizardPage;
19
import org.eclipse.jface.wizard.WizardPage;
18
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
20
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
19
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
21
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
Lines 26-33 Link Here
26
import org.eclipse.mylyn.tasks.ui.TasksUi;
28
import org.eclipse.mylyn.tasks.ui.TasksUi;
27
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
29
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
28
import org.eclipse.search.ui.NewSearchUI;
30
import org.eclipse.search.ui.NewSearchUI;
31
import org.eclipse.swt.graphics.Rectangle;
29
import org.eclipse.swt.widgets.Composite;
32
import org.eclipse.swt.widgets.Composite;
30
import org.eclipse.swt.widgets.Control;
33
import org.eclipse.swt.widgets.Control;
34
import org.eclipse.swt.widgets.Shell;
35
import org.eclipse.ui.plugin.AbstractUIPlugin;
31
36
32
/**
37
/**
33
 * Extend to provide repository-specific query page to the Workbench search dialog.
38
 * Extend to provide repository-specific query page to the Workbench search dialog.
Lines 44-49 Link Here
44
49
45
	private final IRepositoryQuery query;
50
	private final IRepositoryQuery query;
46
51
52
	// dialog store id constants
53
	private final static String DIALOG_BOUNDS_KEY = "ResizableDialogBounds"; //$NON-NLS-1$
54
55
	private static final String X = "x"; //$NON-NLS-1$
56
57
	private static final String Y = "y"; //$NON-NLS-1$
58
59
	private static final String WIDTH = "width"; //$NON-NLS-1$
60
61
	private static final String HEIGHT = "height"; //$NON-NLS-1$
62
47
	public AbstractRepositoryQueryPage(String pageName, TaskRepository taskRepository, IRepositoryQuery query) {
63
	public AbstractRepositoryQueryPage(String pageName, TaskRepository taskRepository, IRepositoryQuery query) {
48
		super(pageName);
64
		super(pageName);
49
		Assert.isNotNull(taskRepository);
65
		Assert.isNotNull(taskRepository);
Lines 166-169 Link Here
166
		return taskRepository;
182
		return taskRepository;
167
	}
183
	}
168
184
185
	@Override
186
	public Shell getShell() {
187
		Shell shell = null;
188
		if (getWizard() != null && getWizard().getContainer() != null) {
189
			shell = getWizard().getContainer().getShell();
190
		}
191
		if (shell == null && getControl() != null) {
192
			shell = getControl().getShell();
193
		}
194
		return shell;
195
	}
196
197
	protected void saveBounds(AbstractUIPlugin plugin, String pageName) {
198
		Shell shell = getShell();
199
		if (shell != null) {
200
			Rectangle bounds = shell.getBounds();
201
			IDialogSettings settings = plugin.getDialogSettings();
202
			IDialogSettings pageDialogSettings = settings.getSection(pageName);
203
			if (pageDialogSettings == null) {
204
				pageDialogSettings = settings.addNewSection(pageName);
205
206
			}
207
			IDialogSettings dialogBounds = settings.getSection(DIALOG_BOUNDS_KEY);
208
			if (dialogBounds == null) {
209
				dialogBounds = new DialogSettings(DIALOG_BOUNDS_KEY);
210
				settings.addSection(dialogBounds);
211
			}
212
			dialogBounds.put(X, bounds.x);
213
			dialogBounds.put(Y, bounds.y);
214
			dialogBounds.put(WIDTH, bounds.width);
215
			dialogBounds.put(HEIGHT, bounds.height);
216
		}
217
	}
218
219
	protected void restoreBounds(AbstractUIPlugin plugin, String pageName) {
220
		Shell shell = getShell();
221
		if (shell != null) {
222
			Rectangle bounds = shell.getBounds();
223
			IDialogSettings settings = plugin.getDialogSettings();
224
			IDialogSettings pageDialogSettings = settings.getSection(pageName);
225
			if (pageDialogSettings == null) {
226
				pageDialogSettings = settings.addNewSection(pageName);
227
228
			}
229
			IDialogSettings dialogBounds = settings.getSection(DIALOG_BOUNDS_KEY);
230
			if (dialogBounds == null) {
231
				dialogBounds = new DialogSettings(DIALOG_BOUNDS_KEY);
232
				settings.addSection(dialogBounds);
233
			}
234
			if (bounds != null && dialogBounds != null) {
235
				try {
236
					bounds.x = dialogBounds.getInt(X);
237
					bounds.y = dialogBounds.getInt(Y);
238
					bounds.height = dialogBounds.getInt(HEIGHT);
239
					bounds.width = dialogBounds.getInt(WIDTH);
240
					shell.setBounds(bounds);
241
				} catch (NumberFormatException e) {
242
					// silently ignored
243
				}
244
			}
245
		}
246
	}
247
169
}
248
}
(-)src/org/eclipse/mylyn/internal/provisional/tasks/ui/wizards/AbstractRepositoryQueryPage2.java (+50 lines)
Lines 16-21 Link Here
16
import org.eclipse.core.runtime.IProgressMonitor;
16
import org.eclipse.core.runtime.IProgressMonitor;
17
import org.eclipse.core.runtime.OperationCanceledException;
17
import org.eclipse.core.runtime.OperationCanceledException;
18
import org.eclipse.jface.dialogs.Dialog;
18
import org.eclipse.jface.dialogs.Dialog;
19
import org.eclipse.jface.dialogs.DialogSettings;
20
import org.eclipse.jface.dialogs.IDialogSettings;
19
import org.eclipse.jface.dialogs.MessageDialog;
21
import org.eclipse.jface.dialogs.MessageDialog;
20
import org.eclipse.jface.layout.GridDataFactory;
22
import org.eclipse.jface.layout.GridDataFactory;
21
import org.eclipse.jface.operation.IRunnableWithProgress;
23
import org.eclipse.jface.operation.IRunnableWithProgress;
Lines 29-34 Link Here
29
import org.eclipse.swt.events.KeyListener;
31
import org.eclipse.swt.events.KeyListener;
30
import org.eclipse.swt.events.SelectionAdapter;
32
import org.eclipse.swt.events.SelectionAdapter;
31
import org.eclipse.swt.events.SelectionEvent;
33
import org.eclipse.swt.events.SelectionEvent;
34
import org.eclipse.swt.graphics.Rectangle;
32
import org.eclipse.swt.layout.FillLayout;
35
import org.eclipse.swt.layout.FillLayout;
33
import org.eclipse.swt.layout.GridData;
36
import org.eclipse.swt.layout.GridData;
34
import org.eclipse.swt.layout.GridLayout;
37
import org.eclipse.swt.layout.GridLayout;
Lines 37-44 Link Here
37
import org.eclipse.swt.widgets.Control;
40
import org.eclipse.swt.widgets.Control;
38
import org.eclipse.swt.widgets.Display;
41
import org.eclipse.swt.widgets.Display;
39
import org.eclipse.swt.widgets.Label;
42
import org.eclipse.swt.widgets.Label;
43
import org.eclipse.swt.widgets.Shell;
40
import org.eclipse.swt.widgets.Text;
44
import org.eclipse.swt.widgets.Text;
41
import org.eclipse.ui.PlatformUI;
45
import org.eclipse.ui.PlatformUI;
46
import org.eclipse.ui.plugin.AbstractUIPlugin;
42
import org.eclipse.ui.progress.IProgressService;
47
import org.eclipse.ui.progress.IProgressService;
43
48
44
/**
49
/**
Lines 57-62 Link Here
57
62
58
	private boolean needsRepositoryConfiguration = true;
63
	private boolean needsRepositoryConfiguration = true;
59
64
65
	// dialog store id constants
66
	private final static String DIALOG_BOUNDS_KEY = "ResizableDialogBounds"; //$NON-NLS-1$
67
68
	private static final String X = "x"; //$NON-NLS-1$
69
70
	private static final String Y = "y"; //$NON-NLS-1$
71
72
	private static final String WIDTH = "width"; //$NON-NLS-1$
73
74
	private static final String HEIGHT = "height"; //$NON-NLS-1$
75
60
	public AbstractRepositoryQueryPage2(String pageName, TaskRepository repository, IRepositoryQuery query) {
76
	public AbstractRepositoryQueryPage2(String pageName, TaskRepository repository, IRepositoryQuery query) {
61
		super(pageName, repository, query);
77
		super(pageName, repository, query);
62
		this.connector = TasksUi.getRepositoryConnector(getTaskRepository().getConnectorKind());
78
		this.connector = TasksUi.getRepositoryConnector(getTaskRepository().getConnectorKind());
Lines 266-269 Link Here
266
		}
282
		}
267
	}
283
	}
268
284
285
	@Override
286
	public Shell getShell() {
287
		Shell shell = null;
288
		if (getWizard() != null && getWizard().getContainer() != null) {
289
			shell = getWizard().getContainer().getShell();
290
		}
291
		if (shell == null && getControl() != null) {
292
			shell = getControl().getShell();
293
		}
294
		return shell;
295
	}
296
297
	protected void saveBounds(AbstractUIPlugin plugin, String pageName) {
298
		Shell shell = getShell();
299
		if (shell != null) {
300
			Rectangle bounds = shell.getBounds();
301
			IDialogSettings settings = plugin.getDialogSettings();
302
			IDialogSettings pageDialogSettings = settings.getSection(pageName);
303
			if (pageDialogSettings == null) {
304
				pageDialogSettings = settings.addNewSection(pageName);
305
306
			}
307
			IDialogSettings dialogBounds = settings.getSection(DIALOG_BOUNDS_KEY);
308
			if (dialogBounds == null) {
309
				dialogBounds = new DialogSettings(DIALOG_BOUNDS_KEY);
310
				settings.addSection(dialogBounds);
311
			}
312
			dialogBounds.put(X, bounds.x);
313
			dialogBounds.put(Y, bounds.y);
314
			dialogBounds.put(WIDTH, bounds.width);
315
			dialogBounds.put(HEIGHT, bounds.height);
316
		}
317
	}
318
269
}
319
}
(-)src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java (-23 / +2 lines)
Lines 1788-1812 Link Here
1788
	}
1788
	}
1789
1789
1790
	private void restoreBounds() {
1790
	private void restoreBounds() {
1791
		IDialogSettings settings = getDialogSettings();
1791
		restoreBounds(BugzillaUiPlugin.getDefault(), PAGE_NAME);
1792
		IDialogSettings dialogBounds = settings.getSection(DIALOG_BOUNDS_KEY);
1793
		Shell shell = getShell();
1794
		if (shell != null) {
1795
			Rectangle bounds = shell.getBounds();
1796
1797
			if (bounds != null && dialogBounds != null) {
1798
				try {
1799
					bounds.x = dialogBounds.getInt(X);
1800
					bounds.y = dialogBounds.getInt(Y);
1801
					bounds.height = dialogBounds.getInt(HEIGHT);
1802
					bounds.width = dialogBounds.getInt(WIDTH);
1803
					shell.setBounds(bounds);
1804
				} catch (NumberFormatException e) {
1805
					// silently ignored
1806
				}
1807
			}
1808
		}
1809
1810
	}
1792
	}
1811
1793
1812
	/* Testing hook to see if any products are present */
1794
	/* Testing hook to see if any products are present */
Lines 1943-1952 Link Here
1943
	public void applyTo(IRepositoryQuery query) {
1925
	public void applyTo(IRepositoryQuery query) {
1944
		query.setUrl(getQueryURL(getTaskRepository(), getQueryParameters()));
1926
		query.setUrl(getQueryURL(getTaskRepository(), getQueryParameters()));
1945
		query.setSummary(getQueryTitle());
1927
		query.setSummary(getQueryTitle());
1946
		Shell shell = getShell();
1928
		saveBounds(BugzillaUiPlugin.getDefault(), PAGE_NAME);
1947
		if (shell != null) {
1948
			saveBounds(shell.getBounds());
1949
		}
1950
	}
1929
	}
1951
1930
1952
}
1931
}

Return to bug 261683