Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 191967 Details for
Bug 310059
[api][framework] provide 'update configuration' button on query pages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch V1
patch310059V1.txt (text/plain), 35.41 KB, created by
Frank Becker
on 2011-03-27 14:56:18 EDT
(
hide
)
Description:
patch V1
Filename:
MIME Type:
Creator:
Frank Becker
Created:
2011-03-27 14:56:18 EDT
Size:
35.41 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.bugzilla.ui >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java >=================================================================== >RCS file: /cvsroot/mylyn/org.eclipse.mylyn.tasks/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java,v >retrieving revision 1.164 >diff -u -r1.164 BugzillaSearchPage.java >--- src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java 20 Mar 2011 19:16:42 -0000 1.164 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java 27 Mar 2011 18:49:11 -0000 >@@ -65,6 +65,7 @@ > import org.eclipse.mylyn.tasks.core.IRepositoryQuery; > import org.eclipse.mylyn.tasks.core.RepositoryStatus; > import org.eclipse.mylyn.tasks.core.TaskRepository; >+import org.eclipse.mylyn.tasks.ui.IQueryButtomButtons; > import org.eclipse.mylyn.tasks.ui.TasksUi; > import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage; > import org.eclipse.osgi.util.NLS; >@@ -103,7 +104,7 @@ > * @author Frank Becker > */ > @SuppressWarnings("restriction") >-public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements Listener { >+public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements Listener, IQueryButtomButtons { > > private static final int HEIGHT_ATTRIBUTE_COMBO = 30; > >@@ -356,6 +357,8 @@ > > protected String[] chartFieldValues; > >+ private Button clearFieldButton; >+ > // /** File containing saved queries */ > // protected static SavedQueryFile input; > >@@ -533,8 +536,9 @@ > control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); > > createOptionsGroup(control); >- createButtons(control); >- >+ if (inSearchContainer()) { >+ createButtons(control); >+ } > Dialog.applyDialogFont(control); > setControl(control); > >@@ -547,47 +551,13 @@ > layout.marginWidth = 0; > buttonComposite.setLayout(layout); > GridData g = new GridData(GridData.FILL_HORIZONTAL); >- Button clearButton = new Button(buttonComposite, SWT.PUSH); >- clearButton.setText(Messages.BugzillaSearchPage_ClearFields); >- clearButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); >- clearButton.addSelectionListener(new SelectionAdapter() { >+ clearFieldButton = new Button(buttonComposite, SWT.PUSH); >+ clearFieldButton.setText(Messages.BugzillaSearchPage_ClearFields); >+ clearFieldButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); >+ clearFieldButton.addSelectionListener(new SelectionAdapter() { > @Override > public void widgetSelected(SelectionEvent e) { >- product.deselectAll(); >- component.deselectAll(); >- version.deselectAll(); >- target.deselectAll(); >- status.deselectAll(); >- resolution.deselectAll(); >- severity.deselectAll(); >- priority.deselectAll(); >- hardware.deselectAll(); >- os.deselectAll(); >- summaryOperation.select(0); >- commentOperation.select(0); >- emailOperation.select(0); >- >- for (Button emailButton : emailButtons) { >- emailButton.setSelection(false); >- } >- summaryPattern.setText(""); //$NON-NLS-1$ >- commentPattern.setText(""); //$NON-NLS-1$ >- emailPattern.setText(""); //$NON-NLS-1$ >- emailOperation2.select(0); >- for (Button element : emailButtons2) { >- element.setSelection(false); >- } >- emailPattern2.setText(""); //$NON-NLS-1$ >- keywords.setText(""); //$NON-NLS-1$ >- keywordsOperation.select(0); >- whiteboardPattern.setText(""); //$NON-NLS-1$ >- whiteboardOperation.select(0); >- daysText.setText(""); //$NON-NLS-1$ >- >- charts.clear(); >- charts.add(0, new Chart()); >- recreateChartControls(); >- >+ clearFields(); > } > }); > >@@ -2553,4 +2523,68 @@ > refreshChartControls(); > Dialog.applyDialogFont(chartSection); > } >+ >+ public boolean canUpdateConfiguration() { >+ return true; >+ } >+ >+ public boolean needsUpdateConfiguration() { >+ return true; >+ } >+ >+ public void performUpdateConfiguration() { >+ if (getTaskRepository() != null) { >+ updateConfiguration(true); >+ } >+ } >+ >+ public boolean canClearFields() { >+ return true; >+ } >+ >+ public boolean needsClearFields() { >+ return true; >+ } >+ >+ public void performClearFields() { >+ clearFields(); >+ } >+ >+ private void clearFields() { >+ product.deselectAll(); >+ component.deselectAll(); >+ version.deselectAll(); >+ target.deselectAll(); >+ status.deselectAll(); >+ resolution.deselectAll(); >+ severity.deselectAll(); >+ priority.deselectAll(); >+ hardware.deselectAll(); >+ os.deselectAll(); >+ summaryOperation.select(0); >+ commentOperation.select(0); >+ emailOperation.select(0); >+ >+ for (Button emailButton : emailButtons) { >+ emailButton.setSelection(false); >+ } >+ summaryPattern.setText(""); //$NON-NLS-1$ >+ commentPattern.setText(""); //$NON-NLS-1$ >+ emailPattern.setText(""); //$NON-NLS-1$ >+ emailOperation2.select(0); >+ for (Button element : emailButtons2) { >+ element.setSelection(false); >+ } >+ emailPattern2.setText(""); //$NON-NLS-1$ >+ keywords.setText(""); //$NON-NLS-1$ >+ keywordsOperation.select(0); >+ whiteboardPattern.setText(""); //$NON-NLS-1$ >+ whiteboardOperation.select(0); >+ daysText.setText(""); //$NON-NLS-1$ >+ >+ charts.clear(); >+ charts.add(0, new Chart()); >+ recreateChartControls(); >+ } >+ > } >#P org.eclipse.mylyn.commons.ui >Index: src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/BottomButtonWizardDialog.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/BottomButtonWizardDialog.java >diff -N src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/BottomButtonWizardDialog.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/BottomButtonWizardDialog.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,123 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 Frank Becker and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Frank Becker - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.provisional.commons.ui.dialogs; >+ >+import java.lang.reflect.InvocationTargetException; >+import java.util.HashMap; >+ >+import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.jface.operation.IRunnableWithProgress; >+import org.eclipse.jface.wizard.IWizard; >+import org.eclipse.jface.wizard.WizardDialog; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Shell; >+ >+/** >+ * Wizard dialog for displaying additional button in the button bar. Based on ValidatableWizardDialog from Helen >+ * Bershadskaya >+ * >+ * @author Helen Bershadskaya >+ * @author Frank Becker >+ */ >+ >+public abstract class BottomButtonWizardDialog extends WizardDialog { >+ >+ public BottomButtonWizardDialog(Shell parentShell, IWizard newWizard) { >+ super(parentShell, newWizard); >+ } >+ >+ abstract protected void createExtraButtons(Composite composite); >+ >+ abstract protected void updateExtraButtons(); >+ >+ abstract protected boolean handleExtraButtonPressed(int buttonId); >+ >+ abstract protected HashMap<String, Boolean> saveAndSetEnabledStateMylyn(); >+ >+ abstract protected void restoreEnabledStateMylyn(HashMap<String, Boolean> savedEnabledState); >+ >+ /** >+ * Overridden so we can add a validate button to the wizard button bar, if a repository settings page requires it. >+ * Validate button is added left justified at button bar bottom (next to help image). >+ */ >+ @Override >+ protected Control createButtonBar(Composite parent) { >+ Composite composite = new Composite(parent, SWT.NONE); >+ GridLayout layout = new GridLayout(); >+ layout.numColumns = 0; // create >+ layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); >+ layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); >+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); >+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); >+ >+ composite.setLayout(layout); >+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ >+ // create help control if needed >+ if (isHelpAvailable()) { >+ createHelpControl(composite); >+ } >+ >+ createExtraButtons(composite); >+ Label filler = new Label(composite, SWT.NONE); >+ filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); >+ ((GridLayout) composite.getLayout()).numColumns++; >+ >+ super.createButtonsForButtonBar(composite); >+ >+ return composite; >+ } >+ >+ /** >+ * Overridden so we can react to the validate button being pressed. This could have been done with a straight >+ * selection listener in the creation method above, but this is more consistent with how the other buttons work in >+ * the wizard dialog. >+ * >+ * @since 3.1 >+ */ >+ @Override >+ protected void buttonPressed(int buttonId) { >+ if (!handleExtraButtonPressed(buttonId)) { >+ super.buttonPressed(buttonId); >+ } >+ } >+ >+ @Override >+ public void updateButtons() { >+ updateExtraButtons(); >+ super.updateButtons(); >+ } >+ >+ /** >+ * Overridden to be able to set proper state for our validate button >+ */ >+ @Override >+ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, >+ InterruptedException { >+ >+ HashMap<String, Boolean> savedEnabledState = null; >+ try { >+ savedEnabledState = saveAndSetEnabledStateMylyn(); >+ super.run(fork, cancelable, runnable); >+ } finally { >+ if (savedEnabledState != null) { >+ restoreEnabledStateMylyn(savedEnabledState); >+ } >+ } >+ } >+ >+} >Index: src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/ValidatableWizardDialog.java >=================================================================== >RCS file: /cvsroot/mylyn/org.eclipse.mylyn.commons/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/ValidatableWizardDialog.java,v >retrieving revision 1.3 >diff -u -r1.3 ValidatableWizardDialog.java >--- src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/ValidatableWizardDialog.java 29 Aug 2010 06:13:37 -0000 1.3 >+++ src/org/eclipse/mylyn/internal/provisional/commons/ui/dialogs/ValidatableWizardDialog.java 27 Mar 2011 18:49:12 -0000 >@@ -11,21 +11,13 @@ > > package org.eclipse.mylyn.internal.provisional.commons.ui.dialogs; > >-import java.lang.reflect.InvocationTargetException; > import java.util.HashMap; > >-import org.eclipse.jface.dialogs.IDialogConstants; >-import org.eclipse.jface.operation.IRunnableWithProgress; > import org.eclipse.jface.wizard.IWizard; > import org.eclipse.jface.wizard.WizardDialog; > import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages; >-import org.eclipse.swt.SWT; >-import org.eclipse.swt.layout.GridData; >-import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Composite; >-import org.eclipse.swt.widgets.Control; >-import org.eclipse.swt.widgets.Label; > import org.eclipse.swt.widgets.Shell; > > /** >@@ -33,7 +25,7 @@ > * > * @author Helen Bershadskaya > */ >-public class ValidatableWizardDialog extends WizardDialog { >+public class ValidatableWizardDialog extends BottomButtonWizardDialog { > > private static final String VALIDATE_BUTTON_KEY = "validate"; //$NON-NLS-1$ > >@@ -50,43 +42,47 @@ > } > > /** >- * Overridden so we can add a validate button to the wizard button bar, if a repository settings page requires it. >- * Validate button is added left justified at button bar bottom (next to help image). >+ * Modeled after WizardDialog.saveAndSetEnabledState(), but that one is private, so create our own > */ > @Override >- protected Control createButtonBar(Composite parent) { >- Composite composite = new Composite(parent, SWT.NONE); >- GridLayout layout = new GridLayout(); >- layout.numColumns = 0; // create >- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); >- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); >- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); >- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); >- >- composite.setLayout(layout); >- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >- >- // create help control if needed >- if (isHelpAvailable()) { >- createHelpControl(composite); >+ protected HashMap<String, Boolean> saveAndSetEnabledStateMylyn() { >+ HashMap<String, Boolean> savedEnabledState = null; >+ if (getShell() != null) { >+ savedEnabledState = new HashMap<String, Boolean>(); >+ if (validateServerButton != null && validateServerButton.getShell() == getShell()) { >+ savedEnabledState.put(VALIDATE_BUTTON_KEY, validateServerButton.getEnabled()); >+ validateServerButton.setEnabled(false); >+ } > } >+ return savedEnabledState; >+ } > >+ /** >+ * Modeled after WizardDialog.restoreEnabledState() and WizardDialog.restoreUIState() -- couldn't override those >+ * since they are private, so create our own. Currently only single button to work with, so don't create two >+ * separate methods >+ */ >+ @Override >+ protected void restoreEnabledStateMylyn(HashMap<String, Boolean> savedEnabledState) { >+ if (savedEnabledState != null) { >+ Boolean savedValidateEnabledState = savedEnabledState.get(VALIDATE_BUTTON_KEY); >+ if (validateServerButton != null && savedValidateEnabledState != null) { >+ validateServerButton.setEnabled(savedValidateEnabledState); >+ } >+ } >+ } >+ >+ @Override >+ protected void createExtraButtons(Composite composite) { > validateServerButton = createButton(composite, VALIDATE_BUTTON_ID, > Messages.ValidatableWizardDialog_Validate_Button_Label, false); > validateServerButton.setImage(CommonImages.getImage(CommonImages.VALIDATE)); > validateServerButton.setVisible(false); > setButtonLayoutData(validateServerButton); >- Label filler = new Label(composite, SWT.NONE); >- filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); >- ((GridLayout) composite.getLayout()).numColumns++; >- >- super.createButtonsForButtonBar(composite); >- >- return composite; > } > > @Override >- public void updateButtons() { >+ protected void updateExtraButtons() { > if (getCurrentPage() instanceof IValidatable && ((IValidatable) getCurrentPage()).needsValidation()) { > if (!validateServerButton.isVisible()) { > validateServerButton.setVisible(true); >@@ -97,71 +93,17 @@ > validateServerButton.setVisible(false); > } > } >- super.updateButtons(); > } > >- /** >- * Overridden so we can react to the validate button being pressed. This could have been done with a straight >- * selection listener in the creation method above, but this is more consistent with how the other buttons work in >- * the wizard dialog. >- * >- * @since 3.1 >- */ > @Override >- protected void buttonPressed(int buttonId) { >+ protected boolean handleExtraButtonPressed(int buttonId) { > if (buttonId == VALIDATE_BUTTON_ID) { > if (getCurrentPage() instanceof IValidatable) { > ((IValidatable) getCurrentPage()).validate(); >- } >- } else { >- super.buttonPressed(buttonId); >- } >- } >- >- /** >- * Overridden to be able to set proper state for our validate button >- */ >- @Override >- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, >- InterruptedException { >- >- HashMap<String, Boolean> savedEnabledState = null; >- try { >- savedEnabledState = saveAndSetEnabledStateInternal(); >- super.run(fork, cancelable, runnable); >- } finally { >- if (savedEnabledState != null) { >- restoreEnabledStateMylyn(savedEnabledState); >- } >- } >- } >- >- /** >- * Modeled after super.saveAndSetEnabledState(), but that one is private, so create our own >- */ >- private HashMap<String, Boolean> saveAndSetEnabledStateInternal() { >- HashMap<String, Boolean> savedEnabledState = null; >- if (getShell() != null) { >- savedEnabledState = new HashMap<String, Boolean>(); >- if (validateServerButton != null && validateServerButton.getShell() == getShell()) { >- savedEnabledState.put(VALIDATE_BUTTON_KEY, validateServerButton.getEnabled()); >- validateServerButton.setEnabled(false); >- } >- } >- return savedEnabledState; >- } >- >- /** >- * Modeled after super.restoreEnabledState() and super.restoreUIState() -- couldn't override those since they are >- * private, so create our own. Currently only single button to work with, so don't create two separate methods >- */ >- private void restoreEnabledStateMylyn(HashMap<String, Boolean> savedEnabledState) { >- if (savedEnabledState != null) { >- Boolean savedValidateEnabledState = savedEnabledState.get(VALIDATE_BUTTON_KEY); >- if (validateServerButton != null && savedValidateEnabledState != null) { >- validateServerButton.setEnabled(savedValidateEnabledState); >+ return true; > } > } >+ return false; > } > > } >#P org.eclipse.mylyn.tasks.ui >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/mylyn/org.eclipse.mylyn.tasks/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.420 >diff -u -r1.420 MANIFEST.MF >--- META-INF/MANIFEST.MF 2 Mar 2011 04:03:18 -0000 1.420 >+++ META-INF/MANIFEST.MF 27 Mar 2011 18:49:13 -0000 >@@ -2,7 +2,7 @@ > Bundle-ManifestVersion: 2 > Bundle-Name: %Bundle-Name > Bundle-SymbolicName: org.eclipse.mylyn.tasks.ui;singleton:=true >-Bundle-Version: 3.5.0.qualifier >+Bundle-Version: 3.6.0.qualifier > Bundle-Activator: org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin > Require-Bundle: org.eclipse.ui, > org.eclipse.compare, >Index: src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java >=================================================================== >RCS file: /cvsroot/mylyn/org.eclipse.mylyn.tasks/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java,v >retrieving revision 1.122 >diff -u -r1.122 TasksUiInternal.java >--- src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java 2 Mar 2011 23:13:15 -0000 1.122 >+++ src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java 27 Mar 2011 18:49:13 -0000 >@@ -57,7 +57,6 @@ > import org.eclipse.jface.viewers.TreeViewer; > import org.eclipse.jface.window.Window; > import org.eclipse.jface.wizard.IWizard; >-import org.eclipse.jface.wizard.WizardDialog; > import org.eclipse.mylyn.commons.core.CoreUtil; > import org.eclipse.mylyn.commons.core.StatusHandler; > import org.eclipse.mylyn.internal.monitor.ui.MonitorUiPlugin; >@@ -86,6 +85,7 @@ > import org.eclipse.mylyn.internal.tasks.ui.wizards.MultiRepositoryAwareWizard; > import org.eclipse.mylyn.internal.tasks.ui.wizards.NewAttachmentWizardDialog; > import org.eclipse.mylyn.internal.tasks.ui.wizards.NewTaskWizardInternal; >+import org.eclipse.mylyn.internal.tasks.ui.wizards.QueryWizardDialog; > import org.eclipse.mylyn.internal.tasks.ui.wizards.TaskAttachmentWizard; > import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector; > import org.eclipse.mylyn.tasks.core.IRepositoryElement; >@@ -691,7 +691,7 @@ > > Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); > if (wizard != null && shell != null && !shell.isDisposed()) { >- WizardDialog dialog = new WizardDialog(shell, wizard) { >+ QueryWizardDialog dialog = new QueryWizardDialog(shell, wizard) { > private static final String DIALOG_SETTINGS = "EditQueryWizardWizard"; //$NON-NLS-1$ > > @Override >Index: src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java >=================================================================== >RCS file: /cvsroot/mylyn/org.eclipse.mylyn.tasks/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java,v >retrieving revision 1.19 >diff -u -r1.19 Messages.java >--- src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java 24 Feb 2011 05:18:11 -0000 1.19 >+++ src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java 27 Mar 2011 18:49:13 -0000 >@@ -274,4 +274,8 @@ > public static String LocalRepositorySettingsPage_Configure_the_local_repository; > > public static String LocalRepositorySettingsPage_Local_Repository_Settings; >+ >+ public static String QueryWizardDialog_Clear_Fields; >+ >+ public static String QueryWizardDialog_Update_Attributes_from_Repository; > } >Index: src/org/eclipse/mylyn/internal/tasks/ui/wizards/QueryWizardDialog.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/tasks/ui/wizards/QueryWizardDialog.java >diff -N src/org/eclipse/mylyn/internal/tasks/ui/wizards/QueryWizardDialog.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/tasks/ui/wizards/QueryWizardDialog.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,135 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 Tasktop Technologies and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Tasktop Technologies - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.tasks.ui.wizards; >+ >+import java.util.HashMap; >+ >+import org.eclipse.jface.wizard.IWizard; >+import org.eclipse.mylyn.internal.provisional.commons.ui.dialogs.BottomButtonWizardDialog; >+import org.eclipse.mylyn.tasks.ui.IQueryButtomButtons; >+import org.eclipse.mylyn.tasks.ui.TasksUiImages; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Shell; >+ >+public class QueryWizardDialog extends BottomButtonWizardDialog { >+ >+ private static final String UPDATE_BUTTON_KEY = "update"; //$NON-NLS-1$ >+ >+ private static final String CLEAR_BUTTON_KEY = "clear"; //$NON-NLS-1$ >+ >+ private static final int UPDATE_BUTTON_ID = 2001; >+ >+ private static final int CLEAR_BUTTON_ID = 2002; >+ >+ private Button updateButton; >+ >+ private Button clearButton; >+ >+ public QueryWizardDialog(Shell parentShell, IWizard newWizard) { >+ super(parentShell, newWizard); >+ setHelpAvailable(false); >+ } >+ >+ @Override >+ protected void createExtraButtons(Composite composite) { >+ clearButton = createButton(composite, CLEAR_BUTTON_ID, Messages.QueryWizardDialog_Clear_Fields, false); >+ clearButton.setVisible(false); >+ setButtonLayoutData(clearButton); >+ updateButton = createButton(composite, UPDATE_BUTTON_ID, >+ Messages.QueryWizardDialog_Update_Attributes_from_Repository, false); >+ updateButton.setImage(TasksUiImages.REPOSITORY_UPDATE_CONFIGURATION.createImage()); >+ updateButton.setVisible(false); >+ setButtonLayoutData(updateButton); >+ } >+ >+ @Override >+ protected void updateExtraButtons() { >+ if (getCurrentPage() instanceof IQueryButtomButtons) { >+ if (((IQueryButtomButtons) getCurrentPage()).needsClearFields()) { >+ if (!clearButton.isVisible()) { >+ clearButton.setVisible(true); >+ } >+ clearButton.setEnabled(((IQueryButtomButtons) getCurrentPage()).canClearFields()); >+ } else { >+ if (clearButton != null && clearButton.isVisible()) { >+ clearButton.setVisible(false); >+ } >+ } >+ if (((IQueryButtomButtons) getCurrentPage()).needsUpdateConfiguration()) { >+ if (!updateButton.isVisible()) { >+ updateButton.setVisible(true); >+ } >+ updateButton.setEnabled(((IQueryButtomButtons) getCurrentPage()).canUpdateConfiguration()); >+ } else { >+ if (updateButton != null && updateButton.isVisible()) { >+ updateButton.setVisible(false); >+ } >+ } >+ } >+ } >+ >+ @Override >+ protected boolean handleExtraButtonPressed(int buttonId) { >+ if (buttonId == CLEAR_BUTTON_ID) { >+ if (getCurrentPage() instanceof IQueryButtomButtons) { >+ ((IQueryButtomButtons) getCurrentPage()).performClearFields(); >+ return true; >+ } >+ } else if (buttonId == UPDATE_BUTTON_ID) { >+ if (getCurrentPage() instanceof IQueryButtomButtons) { >+ ((IQueryButtomButtons) getCurrentPage()).performUpdateConfiguration(); >+ return true; >+ } >+ } >+ return false; >+ } >+ >+ /** >+ * Modeled after WizardDialog.saveAndSetEnabledState(), but that one is private, so create our own >+ */ >+ @Override >+ protected HashMap<String, Boolean> saveAndSetEnabledStateMylyn() { >+ HashMap<String, Boolean> savedEnabledState = null; >+ if (getShell() != null) { >+ savedEnabledState = new HashMap<String, Boolean>(); >+ if (clearButton != null && clearButton.getShell() == getShell()) { >+ savedEnabledState.put(CLEAR_BUTTON_KEY, clearButton.getEnabled()); >+ clearButton.setEnabled(false); >+ } >+ if (updateButton != null && updateButton.getShell() == getShell()) { >+ savedEnabledState.put(UPDATE_BUTTON_KEY, updateButton.getEnabled()); >+ updateButton.setEnabled(false); >+ } >+ } >+ return savedEnabledState; >+ } >+ >+ /** >+ * Modeled after WizardDialog.restoreEnabledState() and WizardDialog.restoreUIState() -- couldn't override those >+ * since they are private, so create our own. Currently only single button to work with, so don't create two >+ * separate methods >+ */ >+ @Override >+ protected void restoreEnabledStateMylyn(HashMap<String, Boolean> savedEnabledState) { >+ if (savedEnabledState != null) { >+ Boolean savedValidateEnabledState = savedEnabledState.get(CLEAR_BUTTON_KEY); >+ if (clearButton != null && savedValidateEnabledState != null) { >+ clearButton.setEnabled(savedValidateEnabledState); >+ } >+ savedValidateEnabledState = savedEnabledState.get(UPDATE_BUTTON_KEY); >+ if (updateButton != null && savedValidateEnabledState != null) { >+ updateButton.setEnabled(savedValidateEnabledState); >+ } >+ } >+ } >+} >Index: src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties >=================================================================== >RCS file: /cvsroot/mylyn/org.eclipse.mylyn.tasks/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties,v >retrieving revision 1.23 >diff -u -r1.23 messages.properties >--- src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties 10 Mar 2011 01:35:18 -0000 1.23 >+++ src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties 27 Mar 2011 18:49:14 -0000 >@@ -151,3 +151,5 @@ > > LocalRepositorySettingsPage_Configure_the_local_repository=Configure the local repository > LocalRepositorySettingsPage_Local_Repository_Settings=Local Repository Settings >+QueryWizardDialog_Clear_Fields=Clear Fields >+QueryWizardDialog_Update_Attributes_from_Repository=Update Attributes from Repository >Index: src/org/eclipse/mylyn/tasks/ui/IQueryButtomButtons.java >=================================================================== >RCS file: src/org/eclipse/mylyn/tasks/ui/IQueryButtomButtons.java >diff -N src/org/eclipse/mylyn/tasks/ui/IQueryButtomButtons.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/tasks/ui/IQueryButtomButtons.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,31 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 Tasktop Technologies and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Tasktop Technologies - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.tasks.ui; >+ >+/** >+ * @since 3.6 >+ */ >+public interface IQueryButtomButtons { >+ >+ public boolean canUpdateConfiguration(); >+ >+ public boolean needsUpdateConfiguration(); >+ >+ public void performUpdateConfiguration(); >+ >+ public boolean canClearFields(); >+ >+ public boolean needsClearFields(); >+ >+ public void performClearFields(); >+ >+} >Index: src/org/eclipse/mylyn/tasks/ui/wizards/TaskRepositoryWizardDialog.java >=================================================================== >RCS file: /cvsroot/mylyn/org.eclipse.mylyn.tasks/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskRepositoryWizardDialog.java,v >retrieving revision 1.9 >diff -u -r1.9 TaskRepositoryWizardDialog.java >--- src/org/eclipse/mylyn/tasks/ui/wizards/TaskRepositoryWizardDialog.java 26 Aug 2010 22:42:51 -0000 1.9 >+++ src/org/eclipse/mylyn/tasks/ui/wizards/TaskRepositoryWizardDialog.java 27 Mar 2011 18:49:14 -0000 >@@ -11,32 +11,26 @@ > > package org.eclipse.mylyn.tasks.ui.wizards; > >-import java.lang.reflect.InvocationTargetException; > import java.util.HashMap; > >-import org.eclipse.jface.dialogs.IDialogConstants; >-import org.eclipse.jface.operation.IRunnableWithProgress; > import org.eclipse.jface.wizard.IWizard; > import org.eclipse.jface.wizard.WizardDialog; > import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages; >+import org.eclipse.mylyn.internal.provisional.commons.ui.dialogs.BottomButtonWizardDialog; > import org.eclipse.mylyn.internal.tasks.ui.wizards.Messages; > import org.eclipse.mylyn.tasks.ui.TasksUiImages; >-import org.eclipse.swt.SWT; >-import org.eclipse.swt.layout.GridData; >-import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Composite; >-import org.eclipse.swt.widgets.Control; >-import org.eclipse.swt.widgets.Label; > import org.eclipse.swt.widgets.Shell; > > /** > * Wizard dialog for displaying repository settings page. Necessary so we can add a validate button in the button bar. > * > * @author Helen Bershadskaya >+ * @author Frank Becker > * @since 3.1 > */ >-public class TaskRepositoryWizardDialog extends WizardDialog { >+public class TaskRepositoryWizardDialog extends BottomButtonWizardDialog { > > private static final String VALIDATE_BUTTON_KEY = "validate"; //$NON-NLS-1$ > >@@ -54,45 +48,56 @@ > } > > /** >- * Overridden so we can add a validate button to the wizard button bar, if a repository settings page requires it. >- * Validate button is added left justified at button bar bottom (next to help image). >+ * Modeled after super.saveAndSetEnabledState(), but that one is private, so create our own > * >- * @since 3.1 >+ * @since 3.6 > */ > @Override >- protected Control createButtonBar(Composite parent) { >- Composite composite = new Composite(parent, SWT.NONE); >- GridLayout layout = new GridLayout(); >- layout.numColumns = 0; // create >- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); >- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); >- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); >- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); >- >- composite.setLayout(layout); >- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >- >- // create help control if needed >- if (isHelpAvailable()) { >- createHelpControl(composite); >+ protected HashMap<String, Boolean> saveAndSetEnabledStateMylyn() { >+ HashMap<String, Boolean> savedEnabledState = null; >+ if (getShell() != null) { >+ savedEnabledState = new HashMap<String, Boolean>(); >+ if (validateServerButton != null && validateServerButton.getShell() == getShell()) { >+ savedEnabledState.put(VALIDATE_BUTTON_KEY, validateServerButton.getEnabled()); >+ validateServerButton.setEnabled(false); >+ } > } >+ return savedEnabledState; >+ } > >+ /** >+ * Modeled after super.restoreEnabledState() and super.restoreUIState() -- couldn't override those since they are >+ * private, so create our own. Currently only single button to work with, so don't create two separate methods >+ * >+ * @since 3.6 >+ */ >+ @Override >+ protected void restoreEnabledStateMylyn(HashMap<String, Boolean> savedEnabledState) { >+ if (savedEnabledState != null) { >+ Boolean savedValidateEnabledState = savedEnabledState.get(VALIDATE_BUTTON_KEY); >+ if (validateServerButton != null && savedValidateEnabledState != null) { >+ validateServerButton.setEnabled(savedValidateEnabledState); >+ } >+ } >+ } >+ >+ /** >+ * @since 3.6 >+ */ >+ @Override >+ protected void createExtraButtons(Composite composite) { > validateServerButton = createButton(composite, VALIDATE_BUTTON_ID, > Messages.AbstractRepositorySettingsPage_Validate_Settings, false); > validateServerButton.setImage(CommonImages.getImage(TasksUiImages.REPOSITORY_VALIDATE)); > validateServerButton.setVisible(false); > setButtonLayoutData(validateServerButton); >- Label filler = new Label(composite, SWT.NONE); >- filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); >- ((GridLayout) composite.getLayout()).numColumns++; >- >- super.createButtonsForButtonBar(composite); >- >- return composite; > } > >+ /** >+ * @since 3.6 >+ */ > @Override >- public void updateButtons() { >+ protected void updateExtraButtons() { > if (getCurrentPage() instanceof AbstractRepositorySettingsPage > && ((AbstractRepositorySettingsPage) getCurrentPage()).needsValidation()) { > >@@ -105,70 +110,19 @@ > validateServerButton.setVisible(false); > } > } >- super.updateButtons(); > } > > /** >- * Overridden so we can react to the validate button being pressed. This could have been done with a straight >- * selection listener in the creation method above, but this is more consistent with how the other buttons work in >- * the wizard dialog. >- * >- * @since 3.1 >+ * @since 3.6 > */ > @Override >- protected void buttonPressed(int buttonId) { >+ protected boolean handleExtraButtonPressed(int buttonId) { > if (buttonId == VALIDATE_BUTTON_ID) { > if (getCurrentPage() instanceof AbstractRepositorySettingsPage) { > ((AbstractRepositorySettingsPage) getCurrentPage()).validateSettings(); >- } >- } else { >- super.buttonPressed(buttonId); >- } >- } >- >- /** >- * Overridden to be able to set proper state for our validate button >- */ >- @Override >- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, >- InterruptedException { >- >- HashMap<String, Boolean> savedEnabledState = null; >- try { >- savedEnabledState = saveAndSetEnabledStateMylyn(); >- super.run(fork, cancelable, runnable); >- } finally { >- if (savedEnabledState != null) { >- restoreEnabledStateMylyn(savedEnabledState); >- } >- } >- } >- >- /** >- * Modeled after super.saveAndSetEnabledState(), but that one is private, so create our own >- */ >- private HashMap<String, Boolean> saveAndSetEnabledStateMylyn() { >- HashMap<String, Boolean> savedEnabledState = null; >- if (getShell() != null) { >- savedEnabledState = new HashMap<String, Boolean>(); >- if (validateServerButton != null && validateServerButton.getShell() == getShell()) { >- savedEnabledState.put(VALIDATE_BUTTON_KEY, validateServerButton.getEnabled()); >- validateServerButton.setEnabled(false); >- } >- } >- return savedEnabledState; >- } >- >- /** >- * Modeled after super.restoreEnabledState() and super.restoreUIState() -- couldn't override those since they are >- * private, so create our own. Currently only single button to work with, so don't create two separate methods >- */ >- private void restoreEnabledStateMylyn(HashMap<String, Boolean> savedEnabledState) { >- if (savedEnabledState != null) { >- Boolean savedValidateEnabledState = savedEnabledState.get(VALIDATE_BUTTON_KEY); >- if (validateServerButton != null && savedValidateEnabledState != null) { >- validateServerButton.setEnabled(savedValidateEnabledState); >+ return true; > } > } >+ return false; > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
eclipse
:
review?
Actions:
View
|
Diff
Attachments on
bug 310059
: 191967 |
191968
|
200622
|
202105
|
202351
|
202352
|
203753
|
203871
|
203872
|
203873