mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 12:35:22 +02:00
[235197][api] Unusable wizard after cancelling on first page
This commit is contained in:
parent
9e2fc1d12d
commit
9f90db5b93
5 changed files with 222 additions and 144 deletions
|
@ -17,6 +17,7 @@
|
||||||
* Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
|
* Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
|
||||||
* Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
|
* Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
|
||||||
* Uwe Stieber (Wind River) - [189426] System File/Folder Dialogs - New Connection Not Added to Drop Down
|
* Uwe Stieber (Wind River) - [189426] System File/Folder Dialogs - New Connection Not Added to Drop Down
|
||||||
|
* Martin Oberhuber (Wind River) - [235197][api] Unusable wizard after cancelling on first page
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.ui.wizards.newconnection;
|
package org.eclipse.rse.ui.wizards.newconnection;
|
||||||
|
@ -66,6 +67,7 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS
|
||||||
// @see #setConnectionContext(IHost)
|
// @see #setConnectionContext(IHost)
|
||||||
private IHost connectionContext;
|
private IHost connectionContext;
|
||||||
|
|
||||||
|
private RSENewConnectionWizardRegistry wizardRegistry;
|
||||||
private IWizard selectedWizard;
|
private IWizard selectedWizard;
|
||||||
private IRSESystemType selectedSystemType;
|
private IRSESystemType selectedSystemType;
|
||||||
private boolean selectedWizardCanFinishEarly;
|
private boolean selectedWizardCanFinishEarly;
|
||||||
|
@ -92,9 +94,10 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS
|
||||||
if (settings.getSection(sectionName) == null) settings.addNewSection(sectionName);
|
if (settings.getSection(sectionName) == null) settings.addNewSection(sectionName);
|
||||||
setDialogSettings(settings.getSection(sectionName));
|
setDialogSettings(settings.getSection(sectionName));
|
||||||
|
|
||||||
|
wizardRegistry = new RSENewConnectionWizardRegistry();
|
||||||
selectedContext = null;
|
selectedContext = null;
|
||||||
selectedWizard = null;
|
selectedWizard = null;
|
||||||
mainPage = new RSENewConnectionWizardSelectionPage();
|
mainPage = new RSENewConnectionWizardSelectionPage(wizardRegistry);
|
||||||
initializedWizards.clear();
|
initializedWizards.clear();
|
||||||
selectionChangedListener.clear();
|
selectionChangedListener.clear();
|
||||||
}
|
}
|
||||||
|
@ -286,7 +289,9 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS
|
||||||
if (selectedWizard instanceof ISelectionChangedListener) removeSelectionChangedListener((ISelectionChangedListener)selectedWizard);
|
if (selectedWizard instanceof ISelectionChangedListener) removeSelectionChangedListener((ISelectionChangedListener)selectedWizard);
|
||||||
|
|
||||||
// Check if a wizard is registered for the selected system type
|
// Check if a wizard is registered for the selected system type
|
||||||
IRSENewConnectionWizardDescriptor descriptor = getSelection() != null ? RSENewConnectionWizardRegistry.getInstance().getWizardForSelection((IStructuredSelection)getSelection()) : null;
|
IRSENewConnectionWizardDescriptor descriptor = getSelection() != null ?
|
||||||
|
wizardRegistry.getWizardForSelection((IStructuredSelection) getSelection())
|
||||||
|
: null;
|
||||||
if (descriptor != null) {
|
if (descriptor != null) {
|
||||||
selectedWizard = descriptor.getWizard();
|
selectedWizard = descriptor.getWizard();
|
||||||
selectedWizardCanFinishEarly = descriptor.canFinishEarly();
|
selectedWizardCanFinishEarly = descriptor.canFinishEarly();
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
* Javier Montalvo Orus (Symbian) - [174992] default wizard hides special ones
|
* Javier Montalvo Orus (Symbian) - [174992] default wizard hides special ones
|
||||||
* David McKnight (IBM) - [216252] MessageFormat.format -> NLS.bind
|
* David McKnight (IBM) - [216252] MessageFormat.format -> NLS.bind
|
||||||
* Martin Oberhuber (Wind River) - [235148] get rid of dead code for caching
|
* Martin Oberhuber (Wind River) - [235148] get rid of dead code for caching
|
||||||
|
* Martin Oberhuber (Wind River) - [235197][api] Unusable wizard after cancelling on first page
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.ui.wizards.newconnection;
|
package org.eclipse.rse.ui.wizards.newconnection;
|
||||||
|
|
||||||
|
@ -27,8 +28,14 @@ import org.eclipse.rse.ui.wizards.registries.RSEAbstractWizardRegistry;
|
||||||
/**
|
/**
|
||||||
* RSE New connection wizard registry implementation.
|
* RSE New connection wizard registry implementation.
|
||||||
*
|
*
|
||||||
|
* Gives access to the new connection wizards contributed by users, by looking
|
||||||
|
* up and creating wizard instances based on search criteria like system type or
|
||||||
|
* wizard id. Clients should create a new wizard registry instance for each UI
|
||||||
|
* "session" using the registry. For instance, an invocation of the new
|
||||||
|
* connection wizard (which delegates to sub-wizards) should always create a new
|
||||||
|
* registry instance.
|
||||||
|
*
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
|
||||||
*/
|
*/
|
||||||
public class RSENewConnectionWizardRegistry extends RSEAbstractWizardRegistry {
|
public class RSENewConnectionWizardRegistry extends RSEAbstractWizardRegistry {
|
||||||
|
|
||||||
|
@ -40,7 +47,16 @@ public class RSENewConnectionWizardRegistry extends RSEAbstractWizardRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the parser instance.
|
* Return the global new connection wizard registry instance. Note that
|
||||||
|
* using a global registry is problematic because sub-wizard state (and thus
|
||||||
|
* wizard instances) should not be re-used between separate invocations of a
|
||||||
|
* wizard by the user.
|
||||||
|
*
|
||||||
|
* @deprecated Instantiate a wizard registry yourself using
|
||||||
|
* {@link #RSENewConnectionWizardRegistry()} in order to control
|
||||||
|
* the lifetime of your wizard registry. Lifetime should be
|
||||||
|
* limited to the time a wizard is active. Each new wizard
|
||||||
|
* invocation should create a new wizard registry.
|
||||||
*/
|
*/
|
||||||
public static RSENewConnectionWizardRegistry getInstance() {
|
public static RSENewConnectionWizardRegistry getInstance() {
|
||||||
return LazyInstanceHolder.instance;
|
return LazyInstanceHolder.instance;
|
||||||
|
@ -48,8 +64,10 @@ public class RSENewConnectionWizardRegistry extends RSEAbstractWizardRegistry {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @since org.eclipse.rse.ui 3.0
|
||||||
*/
|
*/
|
||||||
protected RSENewConnectionWizardRegistry() {
|
public RSENewConnectionWizardRegistry() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* Uwe Stieber (Wind River) - initial API and implementation.
|
* Uwe Stieber (Wind River) - initial API and implementation.
|
||||||
* Martin Oberhuber (Wind River) - [186779] Fix IRSESystemType.getAdapter()
|
* Martin Oberhuber (Wind River) - [186779] Fix IRSESystemType.getAdapter()
|
||||||
* Uwe Stieber (Wind River) - [209193] RSE new connection wizard shows empty categories if typing something into the filter
|
* Uwe Stieber (Wind River) - [209193] RSE new connection wizard shows empty categories if typing something into the filter
|
||||||
|
* Martin Oberhuber (Wind River) - [235197][api] Unusable wizard after cancelling on first page
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.ui.wizards.newconnection;
|
package org.eclipse.rse.ui.wizards.newconnection;
|
||||||
|
@ -73,6 +74,7 @@ public class RSENewConnectionWizardSelectionPage extends WizardPage {
|
||||||
|
|
||||||
private IRSESystemType[] restrictedSystemTypes;
|
private IRSESystemType[] restrictedSystemTypes;
|
||||||
|
|
||||||
|
private RSENewConnectionWizardRegistry wizardRegistry;
|
||||||
private FilteredTree filteredTree;
|
private FilteredTree filteredTree;
|
||||||
private PatternFilter filteredTreeFilter;
|
private PatternFilter filteredTreeFilter;
|
||||||
private ViewerFilter filteredTreeWizardStateFilter;
|
private ViewerFilter filteredTreeWizardStateFilter;
|
||||||
|
@ -138,11 +140,24 @@ public class RSENewConnectionWizardSelectionPage extends WizardPage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
* @since org.eclipse.rse.ui 3.0
|
||||||
*/
|
*/
|
||||||
public RSENewConnectionWizardSelectionPage() {
|
public RSENewConnectionWizardSelectionPage(RSENewConnectionWizardRegistry wizardRegistry) {
|
||||||
super("RSENewConnectionWizardSelectionPage"); //$NON-NLS-1$
|
super("RSENewConnectionWizardSelectionPage"); //$NON-NLS-1$
|
||||||
setTitle(getDefaultTitle());
|
setTitle(getDefaultTitle());
|
||||||
setDescription(getDefaultDescription());
|
setDescription(getDefaultDescription());
|
||||||
|
this.wizardRegistry = wizardRegistry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @deprecated Use
|
||||||
|
* {@link #RSENewConnectionWizardSelectionPage(RSENewConnectionWizardRegistry)}
|
||||||
|
* to control the lifetime of the wizard registry
|
||||||
|
*/
|
||||||
|
public RSENewConnectionWizardSelectionPage() {
|
||||||
|
this(RSENewConnectionWizardRegistry.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -235,7 +250,7 @@ public class RSENewConnectionWizardSelectionPage extends WizardPage {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
filteredTreeDataManager = new RSENewConnectionWizardSelectionTreeDataManager();
|
filteredTreeDataManager = new RSENewConnectionWizardSelectionTreeDataManager(wizardRegistry);
|
||||||
treeViewer.setInput(filteredTreeDataManager);
|
treeViewer.setInput(filteredTreeDataManager);
|
||||||
|
|
||||||
// apply the standard dialog font
|
// apply the standard dialog font
|
||||||
|
@ -338,7 +353,7 @@ public class RSENewConnectionWizardSelectionPage extends WizardPage {
|
||||||
for (int i = 0; i < expandedCategories.length; i++) {
|
for (int i = 0; i < expandedCategories.length; i++) {
|
||||||
String categoryId = expandedCategories[i];
|
String categoryId = expandedCategories[i];
|
||||||
if (categoryId != null && !"".equals(categoryId.trim())) { //$NON-NLS-1$
|
if (categoryId != null && !"".equals(categoryId.trim())) { //$NON-NLS-1$
|
||||||
IRSEWizardRegistryElement registryElement = RSENewConnectionWizardRegistry.getInstance().findElementById(categoryId);
|
IRSEWizardRegistryElement registryElement = wizardRegistry.findElementById(categoryId);
|
||||||
if (registryElement instanceof IRSEWizardCategory) {
|
if (registryElement instanceof IRSEWizardCategory) {
|
||||||
RSEWizardSelectionTreeElement treeElement = filteredTreeDataManager.getTreeElementForCategory((IRSEWizardCategory)registryElement);
|
RSEWizardSelectionTreeElement treeElement = filteredTreeDataManager.getTreeElementForCategory((IRSEWizardCategory)registryElement);
|
||||||
if (treeElement != null) expanded.add(treeElement);
|
if (treeElement != null) expanded.add(treeElement);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Uwe Stieber (Wind River) - initial API and implementation.
|
* Uwe Stieber (Wind River) - initial API and implementation.
|
||||||
* Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
|
* Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
|
||||||
|
* Martin Oberhuber (Wind River) - [235197][api] Unusable wizard after cancelling on first page
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.ui.wizards.newconnection;
|
package org.eclipse.rse.ui.wizards.newconnection;
|
||||||
|
|
||||||
|
@ -37,9 +38,21 @@ public class RSENewConnectionWizardSelectionTreeDataManager extends RSEAbstractW
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
* @since org.eclipse.rse.ui 3.0
|
||||||
|
*/
|
||||||
|
public RSENewConnectionWizardSelectionTreeDataManager(RSENewConnectionWizardRegistry wizardRegistry) {
|
||||||
|
super(wizardRegistry);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @deprecated Use
|
||||||
|
* {@link #RSENewConnectionWizardSelectionTreeDataManager(RSENewConnectionWizardRegistry)}
|
||||||
|
* to control the lifetime of the wizard registry
|
||||||
*/
|
*/
|
||||||
public RSENewConnectionWizardSelectionTreeDataManager() {
|
public RSENewConnectionWizardSelectionTreeDataManager() {
|
||||||
super();
|
this(RSENewConnectionWizardRegistry.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,7 +97,7 @@ public class RSENewConnectionWizardSelectionTreeDataManager extends RSEAbstractW
|
||||||
for (int i = 0; i < systemTypes.length; i++) {
|
for (int i = 0; i < systemTypes.length; i++) {
|
||||||
IRSESystemType systemType = systemTypes[i];
|
IRSESystemType systemType = systemTypes[i];
|
||||||
// for the system type, lookup the corresponding wizard descriptor
|
// for the system type, lookup the corresponding wizard descriptor
|
||||||
IRSENewConnectionWizardDescriptor descriptor = RSENewConnectionWizardRegistry.getInstance().getWizardForSystemType(systemType);
|
IRSENewConnectionWizardDescriptor descriptor = ((RSENewConnectionWizardRegistry)getWizardRegistry()).getWizardForSystemType(systemType);
|
||||||
if (descriptor == null) {
|
if (descriptor == null) {
|
||||||
// a system type without even the default RSE new connection wizard associated
|
// a system type without even the default RSE new connection wizard associated
|
||||||
// is bad and should never happen. Drop a warning and skip the system type.
|
// is bad and should never happen. Drop a warning and skip the system type.
|
||||||
|
@ -112,7 +125,7 @@ public class RSENewConnectionWizardSelectionTreeDataManager extends RSEAbstractW
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the category. If failing, the wizard will end up as root element
|
// get the category. If failing, the wizard will end up as root element
|
||||||
IRSEWizardRegistryElement candidate = RSENewConnectionWizardRegistry.getInstance().findElementById(categoryId);
|
IRSEWizardRegistryElement candidate = getWizardRegistry().findElementById(categoryId);
|
||||||
if (!(candidate instanceof IRSEWizardCategory)) {
|
if (!(candidate instanceof IRSEWizardCategory)) {
|
||||||
rootElement.add(wizardElement);
|
rootElement.add(wizardElement);
|
||||||
continue;
|
continue;
|
||||||
|
@ -139,7 +152,7 @@ public class RSENewConnectionWizardSelectionTreeDataManager extends RSEAbstractW
|
||||||
}
|
}
|
||||||
|
|
||||||
while (parentCategoryId != null) {
|
while (parentCategoryId != null) {
|
||||||
candidate = RSENewConnectionWizardRegistry.getInstance().findElementById(parentCategoryId);
|
candidate = getWizardRegistry().findElementById(parentCategoryId);
|
||||||
if (!(candidate instanceof IRSEWizardCategory)) {
|
if (!(candidate instanceof IRSEWizardCategory)) {
|
||||||
rootElement.add(categoryElement);
|
rootElement.add(categoryElement);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Uwe Stieber (Wind River) - initial API and implementation.
|
* Uwe Stieber (Wind River) - initial API and implementation.
|
||||||
|
* Martin Oberhuber (Wind River) - [235197][api] Unusable wizard after cancelling on first page
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.ui.wizards.registries;
|
package org.eclipse.rse.ui.wizards.registries;
|
||||||
|
|
||||||
|
@ -19,17 +20,43 @@ import java.util.Set;
|
||||||
*/
|
*/
|
||||||
public abstract class RSEAbstractWizardSelectionTreeDataManager {
|
public abstract class RSEAbstractWizardSelectionTreeDataManager {
|
||||||
private final Set rootElement = new HashSet();
|
private final Set rootElement = new HashSet();
|
||||||
|
private RSEAbstractWizardRegistry wizardRegistry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
* @since org.eclipse.rse.ui 3.0
|
||||||
*/
|
*/
|
||||||
public RSEAbstractWizardSelectionTreeDataManager() {
|
public RSEAbstractWizardSelectionTreeDataManager(RSEAbstractWizardRegistry wizardRegistry) {
|
||||||
|
this.wizardRegistry = wizardRegistry;
|
||||||
rootElement.clear();
|
rootElement.clear();
|
||||||
|
|
||||||
// start the initialization of the data tree.
|
// start the initialization of the data tree.
|
||||||
initialize(rootElement);
|
initialize(rootElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @deprecated Use
|
||||||
|
* {@link #RSEAbstractWizardSelectionTreeDataManager(RSEAbstractWizardRegistry)}
|
||||||
|
* to control the lifetime of the wizard registry
|
||||||
|
*/
|
||||||
|
public RSEAbstractWizardSelectionTreeDataManager() {
|
||||||
|
this(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the currently active wizard registry, which allows looking up
|
||||||
|
* wizard instances by various search keys. The wizard registry is valid as
|
||||||
|
* long as a particular wizard is open.
|
||||||
|
*
|
||||||
|
* @return the current wizard registry
|
||||||
|
* @since org.eclipse.rse.ui 3.0
|
||||||
|
*/
|
||||||
|
protected RSEAbstractWizardRegistry getWizardRegistry() {
|
||||||
|
return wizardRegistry;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the children of this wizard selection tree element.
|
* Returns the children of this wizard selection tree element.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue