diff options
author | Mengxin Zhu | 2013-01-23 09:33:09 +0000 |
---|---|---|
committer | Mengxin Zhu | 2013-01-24 04:55:04 +0000 |
commit | c32f1112f9b3d28bd3208ddb11c54ef2010b5eac (patch) | |
tree | 8fe1161c14a7dcb3fec486f626bc8db960dc7385 | |
parent | 1e9fc23cc6a9c2ba694cb8e32aacd8460bb64645 (diff) | |
download | rt.equinox.p2-c32f1112f9b3d28bd3208ddb11c54ef2010b5eac.tar.gz rt.equinox.p2-c32f1112f9b3d28bd3208ddb11c54ef2010b5eac.tar.xz rt.equinox.p2-c32f1112f9b3d28bd3208ddb11c54ef2010b5eac.zip |
Bug 398655 - [import/export] Browse button does not open file chooserv20130124-045504
3 files changed, 53 insertions, 6 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/AbstractPage.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/AbstractPage.java index 9c60a00aa..787afb824 100644 --- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/AbstractPage.java +++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/AbstractPage.java @@ -59,6 +59,7 @@ public abstract class AbstractPage extends WizardPage implements Listener { protected P2ImportExport importexportService = null; protected CheckboxTreeViewer viewer = null; protected Exception finishException; + protected boolean entryChanged = false; protected static IProfileRegistry profileRegistry = null; static IProvisioningAgent agent = null; @@ -306,13 +307,53 @@ public abstract class AbstractPage extends WizardPage implements Listener { restoreWidgetValues(); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); destinationNameField.setLayoutData(data); - destinationNameField.addListener(SWT.FocusOut, this); - destinationNameField.addListener(SWT.FocusIn, new Listener() { + destinationNameField.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + handleDestinationChanged(getDestinationValue()); + } + }); + destinationNameField.addKeyListener(new KeyListener() { + + /* + * @see KeyListener.keyPressed + */ + public void keyPressed(KeyEvent e) { + if (e.character == SWT.CR) { + entryChanged = false; + handleDestinationChanged(getDestinationValue()); + } + } - public void handleEvent(Event event) { - destinationNameField.clearSelection(); + public void keyReleased(KeyEvent e) { + // do nothing + } + }); + destinationNameField.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + entryChanged = true; } }); + destinationNameField.addFocusListener(new FocusListener() { + /* + * @see FocusListener.focusGained(FocusEvent) + */ + public void focusGained(FocusEvent e) { + //Do nothing when getting focus + } + + /* + * @see FocusListener.focusLost(FocusEvent) + */ + public void focusLost(FocusEvent e) { + //Clear the flag to prevent constant update + if (entryChanged) { + entryChanged = false; + handleDestinationChanged(getDestinationValue()); + } + + } + }); + destinationBrowseButton = new Button(composite, SWT.PUSH); destinationBrowseButton.setText(Messages.Page_BUTTON_BROWSER); destinationBrowseButton.addListener(SWT.Selection, this); @@ -588,8 +629,7 @@ public abstract class AbstractPage extends WizardPage implements Listener { if (source == destinationBrowseButton) { handleDestinationBrowseButtonPressed(); - } else - handleDestinationChanged(getDestinationValue()); + } updatePageCompletion(); } diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportPage.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportPage.java index 7f08a673b..661f2b52f 100755 --- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportPage.java +++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportPage.java @@ -36,6 +36,7 @@ public class ExportPage extends AbstractPage { label.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); if (getSelfProfile() == null) { label.setText(Messages.ExportPage_ERROR_CONFIG); + setPageComplete(false); } else { label.setText(Messages.ExportPage_Label); @@ -147,4 +148,9 @@ public class ExportPage extends AbstractPage { protected int getBrowseDialogStyle() { return SWT.SAVE; } + + @Override + protected void handleDestinationChanged(String newDestination) { + updatePageCompletion(); + } } diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java index ad546c086..5796aafa4 100644 --- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java +++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java @@ -296,6 +296,7 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage }
} else
viewer.setInput(null);
+ updatePageCompletion();
}
private boolean hasEntriesWithoutRepo() {
|