Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfbecker2011-02-21 16:24:22 -0500
committerfbecker2011-02-21 16:24:22 -0500
commit07f35f2703b04a99fb7c79e7bc02ca4e31bbb9dc (patch)
treeea2ede5460b20c149722e33ed204f1d351dc362e
parent11d4eb6572a54e9f5d8507c38b53f1c4916fc4d8 (diff)
downloadorg.eclipse.mylyn.tasks-07f35f2703b04a99fb7c79e7bc02ca4e31bbb9dc.tar.gz
org.eclipse.mylyn.tasks-07f35f2703b04a99fb7c79e7bc02ca4e31bbb9dc.tar.xz
org.eclipse.mylyn.tasks-07f35f2703b04a99fb7c79e7bc02ca4e31bbb9dc.zip
ASSIGNED - bug 265348: query dialog created outside of Desktop
https://bugs.eclipse.org/bugs/show_bug.cgi?id=265348
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java61
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java18
2 files changed, 16 insertions, 63 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java
index 976799304..4d49a2699 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java
@@ -33,7 +33,6 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.DialogSettings;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.IMessageProvider;
@@ -71,7 +70,6 @@ import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -285,9 +283,6 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L
"notregexp", "lessthan", "greaterthan", "anywords", "allwords", "nowords", "changedbefore", "changedafter", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
"changedfrom", "changedto", "changedby", "matches" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- // dialog store id constants
- private final static String DIALOG_BOUNDS_KEY = "ResizableDialogBounds"; //$NON-NLS-1$
-
private final static String REGEXP_CHART_EXPR = "(field|type|value)([0-9]+)-([0-9]+)-([0-9]+)"; //$NON-NLS-1$
private static final Pattern PATTERN_CHART_EXPR = Pattern.compile(REGEXP_CHART_EXPR, Pattern.CASE_INSENSITIVE);
@@ -296,14 +291,6 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L
private static final Pattern PATTERN_CHART_NEGATE = Pattern.compile(REGEXP_CHART_NEGATE, Pattern.CASE_INSENSITIVE);
- private static final String X = "x"; //$NON-NLS-1$
-
- private static final String Y = "y"; //$NON-NLS-1$
-
- private static final String WIDTH = "width"; //$NON-NLS-1$
-
- private static final String HEIGHT = "height"; //$NON-NLS-1$
-
private IRepositoryQuery originalQuery = null;
protected boolean restoring = false;
@@ -706,7 +693,6 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L
setControl(control);
PlatformUI.getWorkbench().getHelpSystem().setHelp(control, BugzillaUiPlugin.SEARCH_PAGE_CONTEXT);
- restoreBounds();
}
private void createButtons(Composite control) {
@@ -2322,49 +2308,6 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L
// settings.put(STORE_REPO_ID, repositoryCombo.getText());
}
- private void saveBounds(Rectangle bounds) {
- if (inSearchContainer()) {
- return;
- }
-
- IDialogSettings settings = getDialogSettings();
- IDialogSettings dialogBounds = settings.getSection(DIALOG_BOUNDS_KEY);
- if (dialogBounds == null) {
- dialogBounds = new DialogSettings(DIALOG_BOUNDS_KEY);
- settings.addSection(dialogBounds);
- }
- dialogBounds.put(X, bounds.x);
- dialogBounds.put(Y, bounds.y);
- dialogBounds.put(WIDTH, bounds.width);
- dialogBounds.put(HEIGHT, bounds.height);
- }
-
- private void restoreBounds() {
- if (inSearchContainer()) {
- return;
- }
-
- IDialogSettings settings = getDialogSettings();
- IDialogSettings dialogBounds = settings.getSection(DIALOG_BOUNDS_KEY);
- Shell shell = getShell();
- if (shell != null) {
- Rectangle bounds = shell.getBounds();
-
- if (bounds != null && dialogBounds != null) {
- try {
- bounds.x = dialogBounds.getInt(X);
- bounds.y = dialogBounds.getInt(Y);
- bounds.height = dialogBounds.getInt(HEIGHT);
- bounds.width = dialogBounds.getInt(WIDTH);
- shell.setBounds(bounds);
- } catch (NumberFormatException e) {
- // silently ignored
- }
- }
- }
-
- }
-
/* Testing hook to see if any products are present */
public int getProductCount() throws Exception {
return product.getItemCount();
@@ -2500,10 +2443,6 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L
public void applyTo(IRepositoryQuery query) {
query.setUrl(getQueryURL(getTaskRepository(), getQueryParameters()));
query.setSummary(getQueryTitle());
- Shell shell = getShell();
- if (shell != null) {
- saveBounds(shell.getBounds());
- }
}
@Override
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java
index 0aafd3fea..716fc7a92 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java
@@ -44,6 +44,7 @@ import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -677,7 +678,7 @@ public class TasksUiInternal {
* @return - true if dialog was opened successfully and not canceled, false otherwise
* @since 3.0
*/
- public static boolean openEditQueryDialog(AbstractRepositoryConnectorUi connectorUi, IRepositoryQuery query) {
+ public static boolean openEditQueryDialog(AbstractRepositoryConnectorUi connectorUi, final IRepositoryQuery query) {
try {
TaskRepository repository = TasksUi.getRepositoryManager().getRepository(query.getConnectorKind(),
query.getRepositoryUrl());
@@ -689,7 +690,20 @@ public class TasksUiInternal {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
if (wizard != null && shell != null && !shell.isDisposed()) {
- WizardDialog dialog = new WizardDialog(shell, wizard);
+ WizardDialog dialog = new WizardDialog(shell, wizard) {
+ private static final String DIALOG_SETTINGS = "EditQueryWizardWizard"; //$NON-NLS-1$
+
+ @Override
+ protected IDialogSettings getDialogBoundsSettings() {
+ IDialogSettings settings = TasksUiPlugin.getDefault().getDialogSettings();
+ String settingsSectionId = DIALOG_SETTINGS + '.' + query.getRepositoryUrl();
+ IDialogSettings section = settings.getSection(settingsSectionId);
+ if (section == null) {
+ section = settings.addNewSection(settingsSectionId);
+ }
+ return section;
+ }
+ };
dialog.create();
dialog.setBlockOnOpen(true);
if (dialog.open() == Window.CANCEL) {

Back to the top