1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-04 23:55:26 +02:00

[187543] use view filter to only show containers for set input dialog

This commit is contained in:
David McKnight 2007-11-26 20:11:13 +00:00
parent f4b21a4de4
commit 758b88873e
2 changed files with 31 additions and 3 deletions

View file

@ -23,6 +23,7 @@
* Kevin Doyle (IBM) - [193394] After Deleting the folder shown in Table get an error
* Kevin Doyle (IBM) - [197971] NPE when table has no input and doing commands in Systems View
* Martin Oberhuber (Wind River) - [199585] Fix NPE during testConnectionRemoval unit test
* David McKnight (IBM) - [187543] use view filter to only show containers for set input dialog
********************************************************************************/
package org.eclipse.rse.internal.ui.view;
@ -76,6 +77,7 @@ import org.eclipse.rse.internal.ui.actions.SystemCommonRenameAction;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemIconConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemActionViewerFilter;
import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.SystemWidgetHelpers;
import org.eclipse.rse.ui.actions.SystemCopyToClipboardAction;
@ -409,6 +411,12 @@ public class SystemTableViewPart extends ViewPart
{
SystemSelectAnythingDialog dlg = new SystemSelectAnythingDialog(_viewer.getShell(), SystemResources.ACTION_SELECT_INPUT_DLG);
SystemActionViewerFilter filter = new SystemActionViewerFilter();
Class[] types = {Object.class};
filter.addFilterCriterion(types, "hasChildren", "true"); //$NON-NLS-1$ //$NON-NLS-2$
dlg.setViewerFilter(filter);
Object inputObject = _viewer.getInput();
if (inputObject == null)
{

View file

@ -13,6 +13,7 @@
* Contributors:
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
* David McKnight (IBM) - [187543] added setViewerFilter() method
********************************************************************************/
package org.eclipse.rse.ui.dialogs;
@ -23,6 +24,7 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.ISystemViewInputProvider;
import org.eclipse.rse.internal.ui.view.SystemViewForm;
import org.eclipse.rse.ui.SystemActionViewerFilter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@ -35,6 +37,8 @@ public class SystemSelectAnythingDialog extends SystemPromptDialog
{
private SystemViewForm _view = null;
private Object _selected = null;
private SystemActionViewerFilter _filter = null;
public SystemSelectAnythingDialog(Shell shell, String title)
{
super(shell, title);
@ -45,7 +49,10 @@ public class SystemSelectAnythingDialog extends SystemPromptDialog
_view = new SystemViewForm(getShell(), parent, SWT.NONE, getInputProvider(), true, this);
_view.getSystemView().addSelectionChangedListener(this);
//_view.getSystemView().ref
if (_filter != null){
_view.getSystemView().addFilter(_filter);
}
return _view.getTreeControl();
}
@ -84,8 +91,21 @@ public class SystemSelectAnythingDialog extends SystemPromptDialog
{
IStructuredSelection selection = (IStructuredSelection)e.getSelection();
_selected = selection.getFirstElement();
_selected = selection.getFirstElement();
}
/**
* Use this method to limit the objects that are seen in the view of this dialog.
*
* @param filter the filter that limits the visible objects
*/
public void setViewerFilter(SystemActionViewerFilter filter)
{
_filter = filter;
if (_view != null)
{
_view.getSystemView().addFilter(filter);
}
}
}