1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 07:05:24 +02:00

[238158] Can create duplicate filters

This commit is contained in:
David McKnight 2008-07-11 16:09:05 +00:00
parent df7def8369
commit 22ab47928b
3 changed files with 80 additions and 6 deletions

View file

@ -12,13 +12,25 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
* David McKnight (IBM) - [238158] Can create duplicate filters
********************************************************************************/
package org.eclipse.rse.internal.files.ui.actions;
import java.util.Iterator;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
import org.eclipse.rse.core.filters.ISystemFilterPoolWrapperInformation;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.SubSystem;
import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
import org.eclipse.rse.files.ui.widgets.SystemFileFilterStringEditPane;
import org.eclipse.rse.internal.subsystems.files.core.SystemFileResources;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConfiguration;
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFile;
import org.eclipse.rse.ui.ISystemIconConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.filters.actions.SystemNewFilterAction;
@ -35,6 +47,7 @@ public class SystemNewFileFilterAction
extends SystemNewFilterAction
{
//private RemoteFileSubSystemConfiguration inputSubsystemConfiguration;
private SubSystem _selectedSubSystem;
/**
* Constructor
@ -79,4 +92,42 @@ public class SystemNewFileFilterAction
wizard.setPage1Description(SystemFileResources.RESID_NEWFILEFILTER_PAGE1_DESCRIPTION);
wizard.setFilterStringEditPane(new SystemFileFilterStringEditPane(wizard.getShell()));
}
public void run()
{
if (_selectedSubSystem != null){
setAllowFilterPoolSelection(_selectedSubSystem.getFilterPoolReferenceManager().getReferencedSystemFilterPools());
}
else {
// disallow filter pool select (because this is from a filter pool)
setAllowFilterPoolSelection((ISystemFilterPool[])null);
setAllowFilterPoolSelection((ISystemFilterPoolWrapperInformation)null);
callbackConfigurator = null;
callbackConfiguratorCalled = false;
}
super.run();
}
/**
* Called when the selection changes in the systems view. This determines
* the input object for the command and whether to enable or disable
* the action.
*
* @param selection the current seleciton
* @return whether to enable or disable the action
*/
public boolean updateSelection(IStructuredSelection selection)
{
_selectedSubSystem = null;
Iterator e = selection.iterator();
Object selected = e.next();
if (selected != null && selected instanceof SubSystem)
{
_selectedSubSystem = (SubSystem) selected;
}
return super.updateSelection(selection);
}
}

View file

@ -12,7 +12,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David McKnight (IBM) - [238158] Can create duplicate filters
*******************************************************************************/
package org.eclipse.rse.internal.files.ui.actions;
@ -21,7 +21,9 @@ import java.util.Iterator;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
import org.eclipse.rse.core.subsystems.SubSystem;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFile;
@ -53,9 +55,14 @@ public class SystemNewFileFilterFromFolderAction extends SystemNewFileFilterActi
public void run()
{
IRemoteFileSubSystem fileSubsystem = _selected.getParentRemoteFileSubSystem();
//ISubSystemConfiguration config = fileSubsystem.getSubSystemConfiguration();
ISystemFilterPool filterPool = fileSubsystem.getFilterPoolReferenceManager().getDefaultSystemFilterPoolManager().getFirstDefaultSystemFilterPool();
setParentFilterPool(filterPool);
ISystemFilterPool defaultFilterPool = ((SubSystem)fileSubsystem).getConnectionPrivateFilterPool(true);
if (defaultFilterPool == null){
ISystemFilterPoolManager mgr = fileSubsystem.getFilterPoolReferenceManager().getDefaultSystemFilterPoolManager();
defaultFilterPool = mgr.getFirstDefaultSystemFilterPool();
}
setParentFilterPool(defaultFilterPool);
setAllowFilterPoolSelection(fileSubsystem.getFilterPoolReferenceManager().getReferencedSystemFilterPools());
super.run();
}

View file

@ -20,6 +20,7 @@
* David Dykstal (IBM) - [217556] remove service subsystem types
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
* David Dykstal (IBM) - [168976][api] move ISystemNewConnectionWizardPage from core to UI
* David McKnight (IBM) - [238158] Can create duplicate filters
********************************************************************************/
package org.eclipse.rse.ui.view;
@ -433,7 +434,12 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
// if not showing filter pools, we have to add a "new filter" action here...
if (!showFilterPools)
{
IAction[] newFilterActions = getNewFilterPoolFilterActions(menu, selection, shell, menuGroup, config, null);
ISystemFilterPool defaultPool = null;
if (selectedSubSystem != null){
defaultPool = ((SubSystem)selectedSubSystem).getConnectionPrivateFilterPool(true);
}
IAction[] newFilterActions = getNewFilterPoolFilterActions(menu, selection, shell, menuGroup, config, defaultPool);
if ((newFilterActions != null) && (newFilterActions.length > 0))
{
// pre-scan for legacy
@ -585,8 +591,18 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
ISystemProfile activeProfile = selectedSubSystem.getHost().getSystemProfile();
for (int idx = 0; idx < activeProfiles.length; idx++)
{
ISystemFilterPool defaultPool = getDefaultSystemFilterPool(config, activeProfiles[idx]);
//ISystemFilterPool defaultPool = getDefaultSystemFilterPool(config, activeProfiles[idx]);
// bug 238158 - now the default pool will be the connection private one
ISystemFilterPool defaultPool = null;
if (selectedSubSystem != null){
defaultPool = ((SubSystem)selectedSubSystem).getConnectionPrivateFilterPool(true);
}
else {
defaultPool = getDefaultSystemFilterPool(config, activeProfiles[idx]);
}
if (defaultPool != null)
{
poolWrapperInfo.addWrapper(activeProfiles[idx].getName(), defaultPool, (activeProfiles[idx] == activeProfile)); // display name, pool to wrap, whether to preselect