mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 23:25:26 +02:00
[180485] [api] "Show Hidden" should be a view-only Preference and not on API level.
This commit is contained in:
parent
b9a672aedc
commit
814a8b283e
13 changed files with 159 additions and 135 deletions
|
@ -91,7 +91,7 @@ public class RSEFileStore extends FileStore implements IFileStore
|
|||
filterString.setShowFiles(true);
|
||||
filterString.setShowSubDirs(true);
|
||||
RemoteFileContext context = new RemoteFileContext(_subSystem, _remoteFile, filterString);
|
||||
children = fileServiceSubSystem.getHostFileToRemoteFileAdapter().convertToRemoteFiles(fileServiceSubSystem, context, _remoteFile, results, true);
|
||||
children = fileServiceSubSystem.getHostFileToRemoteFileAdapter().convertToRemoteFiles(fileServiceSubSystem, context, _remoteFile, results);
|
||||
}
|
||||
else {
|
||||
children = _subSystem.listFoldersAndFiles(_remoteFile, "*", monitor); //$NON-NLS-1$
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package org.eclipse.rse.internal.files.ui.view;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
|
@ -36,10 +37,13 @@ import org.eclipse.rse.internal.files.ui.actions.SystemNewFileFilterAction;
|
|||
import org.eclipse.rse.internal.files.ui.actions.SystemNewFolderAction;
|
||||
import org.eclipse.rse.internal.files.ui.resources.SystemRemoteEditManager;
|
||||
import org.eclipse.rse.internal.files.ui.wizards.SystemFileNewConnectionWizardPage;
|
||||
import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
|
||||
import org.eclipse.rse.model.ISystemRegistryUI;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConfiguration;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.actions.SystemPasteFromClipboardAction;
|
||||
import org.eclipse.rse.ui.view.IContextObject;
|
||||
import org.eclipse.rse.ui.view.SubSystemConfigurationAdapter;
|
||||
import org.eclipse.swt.dnd.Clipboard;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
@ -198,4 +202,34 @@ public class RemoteFileSubSystemConfigurationAdapter extends SubSystemConfigurat
|
|||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the preference setting for hidden files and filters out hidden files if the preference setting is to not show hidden files.
|
||||
* @see org.eclipse.rse.ui.view.SubSystemConfigurationAdapter#applyViewFilters(org.eclipse.rse.ui.view.IContextObject, java.lang.Object[])
|
||||
*/
|
||||
public Object[] applyViewFilters(IContextObject parent, Object[] children) {
|
||||
|
||||
boolean showHidden = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemFilePreferencesConstants.SHOWHIDDEN);
|
||||
|
||||
if (showHidden) {
|
||||
return children;
|
||||
}
|
||||
else {
|
||||
|
||||
ArrayList results = new ArrayList(children.length);
|
||||
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
|
||||
if (children[i] instanceof IRemoteFile) {
|
||||
IRemoteFile remoteFile = (IRemoteFile)(children[i]);
|
||||
|
||||
if (!remoteFile.isHidden()) {
|
||||
results.add(remoteFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return results.toArray();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -699,6 +699,7 @@ public class SystemViewRemoteFileAdapter
|
|||
if (hasChildren && !file.isStale())
|
||||
{
|
||||
children = file.getContents(RemoteChildrenContentsType.getInstance(), filter);
|
||||
children = filterChildren(children);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -713,13 +714,14 @@ public class SystemViewRemoteFileAdapter
|
|||
{
|
||||
children = ss.resolveFilterString(new NullProgressMonitor(), file, filter);
|
||||
}
|
||||
|
||||
if ((children == null) || (children.length == 0))
|
||||
{
|
||||
//children = new SystemMessageObject[1];
|
||||
//children[0] = new SystemMessageObject(RSEUIPlugin.getPluginMessage(MSG_EXPAND_EMPTY),
|
||||
// ISystemMessageObject.MSGTYPE_EMPTY, element);
|
||||
children = EMPTY_LIST;
|
||||
}
|
||||
else {
|
||||
children = filterChildren(children);
|
||||
}
|
||||
|
||||
}
|
||||
catch (InterruptedException exc)
|
||||
|
@ -739,6 +741,32 @@ public class SystemViewRemoteFileAdapter
|
|||
return children;
|
||||
}
|
||||
|
||||
private Object[] filterChildren(Object[] children) {
|
||||
|
||||
boolean showHidden = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemFilePreferencesConstants.SHOWHIDDEN);
|
||||
|
||||
if (showHidden) {
|
||||
return children;
|
||||
}
|
||||
else {
|
||||
|
||||
ArrayList results = new ArrayList(children.length);
|
||||
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
|
||||
if (children[i] instanceof IRemoteFile) {
|
||||
IRemoteFile remoteFile = (IRemoteFile)(children[i]);
|
||||
|
||||
if (!remoteFile.isHidden()) {
|
||||
results.add(remoteFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return results.toArray();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this object has children.
|
||||
* Since we can't predict the outcome of resolving the filter string, we return true.
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.eclipse.rse.core.model.IHost;
|
|||
import org.eclipse.rse.core.subsystems.IConnectorService;
|
||||
import org.eclipse.rse.core.subsystems.IServiceSubSystemConfiguration;
|
||||
import org.eclipse.rse.core.subsystems.RemoteChildrenContentsType;
|
||||
import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
|
||||
import org.eclipse.rse.services.clientserver.PathUtility;
|
||||
import org.eclipse.rse.services.clientserver.SystemEncodingUtil;
|
||||
import org.eclipse.rse.services.clientserver.SystemSearchString;
|
||||
|
@ -336,8 +335,7 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
|
||||
IHostFile[] results = getFilesAndFolders(monitor, parentPath, fileNameFilter);
|
||||
|
||||
boolean showHidden = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemFilePreferencesConstants.SHOWHIDDEN);
|
||||
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, parent, results, showHidden);
|
||||
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, parent, results);
|
||||
if (parent != null)
|
||||
parent.setContents(RemoteChildrenContentsType.getInstance(), fileNameFilter, farr);
|
||||
return farr;
|
||||
|
@ -375,9 +373,8 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
{
|
||||
|
||||
}
|
||||
boolean showHidden = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemFilePreferencesConstants.SHOWHIDDEN);
|
||||
|
||||
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, parent, results, showHidden);
|
||||
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, parent, results);
|
||||
|
||||
if (parent != null)
|
||||
parent.setContents(RemoteChildrenContentsType.getInstance(), fileNameFilter, farr);
|
||||
|
@ -415,8 +412,7 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
{
|
||||
}
|
||||
|
||||
boolean showHidden = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemFilePreferencesConstants.SHOWHIDDEN);
|
||||
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, parent, results, showHidden);
|
||||
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, parent, results);
|
||||
if (parent != null)
|
||||
parent.setContents(RemoteChildrenContentsType.getInstance(), fileNameFilter, farr);
|
||||
return farr;
|
||||
|
@ -434,8 +430,7 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
|
||||
}
|
||||
|
||||
boolean showHidden = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemFilePreferencesConstants.SHOWHIDDEN);
|
||||
IRemoteFile[] results = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, roots, showHidden);
|
||||
IRemoteFile[] results = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, roots);
|
||||
return results;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,6 @@ import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSyst
|
|||
|
||||
public interface IHostFileToRemoteFileAdapter
|
||||
{
|
||||
public IRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes, boolean includeHidden);
|
||||
public IRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes);
|
||||
public IRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile node);
|
||||
}
|
|
@ -606,81 +606,20 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable
|
|||
return getContents(contentsType, "*"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
private Object[] combineAndFilterHidden(Object[] set1, Object[] set2)
|
||||
private Object[] combine(Object[] set1, Object[] set2)
|
||||
{
|
||||
boolean showHidden = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemFilePreferencesConstants.SHOWHIDDEN);
|
||||
ArrayList result = new ArrayList(set1.length + set2.length);
|
||||
|
||||
for (int i = 0; i < set1.length; i++)
|
||||
{
|
||||
if (set1[1] instanceof IRemoteFile)
|
||||
{
|
||||
if (showHidden)
|
||||
{
|
||||
result.add(set1[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!((IRemoteFile)set1[i]).isHidden())
|
||||
{
|
||||
result.add(set1[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.add(set1[i]);
|
||||
}
|
||||
{
|
||||
result.add(set1[i]);
|
||||
}
|
||||
|
||||
for (int j = 0; j < set2.length; j++)
|
||||
{
|
||||
if (set2[j] instanceof IRemoteFile)
|
||||
{
|
||||
if (showHidden)
|
||||
{
|
||||
result.add(set2[j]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!((IRemoteFile)set2[j]).isHidden())
|
||||
{
|
||||
result.add(set2[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.add(set2[j]);
|
||||
}
|
||||
}
|
||||
return result.toArray(new IRemoteFile[result.size()]);
|
||||
}
|
||||
|
||||
private Object[] filterHidden(Object[] set, boolean checkInstanceOf)
|
||||
{
|
||||
boolean showHidden = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemFilePreferencesConstants.SHOWHIDDEN);
|
||||
ArrayList result = new ArrayList(set.length);
|
||||
for (int i = 0; i < set.length; i++)
|
||||
{
|
||||
if (set[i] instanceof IRemoteFile)
|
||||
{
|
||||
if (showHidden)
|
||||
{
|
||||
result.add(set[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!checkInstanceOf || set[i] instanceof IRemoteFile)
|
||||
{
|
||||
if (!((IRemoteFile)set[i]).isHidden())
|
||||
{
|
||||
result.add(set[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result.add(set2[j]);
|
||||
}
|
||||
|
||||
return result.toArray(new IRemoteFile[result.size()]);
|
||||
}
|
||||
|
||||
|
@ -732,7 +671,7 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable
|
|||
Object[] folders = getContents(RemoteFolderChildrenContentsType.getInstance(), filter);
|
||||
Object[] files = getContents(RemoteFileChildrenContentsType.getInstance(), filter);
|
||||
|
||||
return combineAndFilterHidden(folders, files);
|
||||
return combine(folders, files);
|
||||
}
|
||||
}
|
||||
else if (contentsType == RemoteFileChildrenContentsType.getInstance())
|
||||
|
@ -740,7 +679,7 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable
|
|||
if (hasContents(RemoteChildrenContentsType.getInstance()))
|
||||
{
|
||||
Object[] filesAndFolders = getContents(RemoteChildrenContentsType.getInstance());
|
||||
return filterHidden(getFiles(filesAndFolders), false);
|
||||
return filesAndFolders;
|
||||
}
|
||||
}
|
||||
else if (contentsType == RemoteFolderChildrenContentsType.getInstance())
|
||||
|
@ -748,7 +687,7 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable
|
|||
if (hasContents(RemoteChildrenContentsType.getInstance()))
|
||||
{
|
||||
Object[] filesAndFolders = getContents(RemoteChildrenContentsType.getInstance());
|
||||
return filterHidden(getFolders(filesAndFolders), false);
|
||||
return getFolders(filesAndFolders);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -766,7 +705,7 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable
|
|||
contentsType == RemoteFolderChildrenContentsType.getInstance()
|
||||
)
|
||||
{
|
||||
return filterHidden(filterResults, true);
|
||||
return filterResults;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -47,30 +47,31 @@ public class DStoreFileAdapter implements IHostFileToRemoteFileAdapter
|
|||
}
|
||||
|
||||
|
||||
public IRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes, boolean includeHidden)
|
||||
public IRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes)
|
||||
{
|
||||
registerFilePropertyChangeListener(ss);
|
||||
|
||||
List results = new ArrayList();
|
||||
|
||||
for (int i = 0; i < nodes.length; i++)
|
||||
{
|
||||
DStoreHostFile node = (DStoreHostFile)nodes[i];
|
||||
if (includeHidden || !node.isHidden())
|
||||
{
|
||||
IRemoteFile lfile = null;
|
||||
|
||||
IRemoteFile lfile = null;
|
||||
|
||||
if (node instanceof DStoreVirtualHostFile)
|
||||
{
|
||||
lfile = new DStoreVirtualFile(ss, context, parent, (DStoreVirtualHostFile) node);
|
||||
}
|
||||
else
|
||||
{
|
||||
lfile = new DStoreFile(ss, context, parent, node);
|
||||
}
|
||||
results.add(lfile);
|
||||
ss.cacheRemoteFile(lfile);
|
||||
if (node instanceof DStoreVirtualHostFile)
|
||||
{
|
||||
lfile = new DStoreVirtualFile(ss, context, parent, (DStoreVirtualHostFile) node);
|
||||
}
|
||||
else
|
||||
{
|
||||
lfile = new DStoreFile(ss, context, parent, node);
|
||||
}
|
||||
|
||||
results.add(lfile);
|
||||
ss.cacheRemoteFile(lfile);
|
||||
}
|
||||
|
||||
return (IRemoteFile[])results.toArray(new IRemoteFile[results.size()]);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,18 +31,15 @@ import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext;
|
|||
public class FTPFileAdapter implements IHostFileToRemoteFileAdapter
|
||||
{
|
||||
|
||||
public IRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes, boolean includeHidden)
|
||||
public IRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes)
|
||||
{
|
||||
List results = new ArrayList();
|
||||
for (int i = 0; i < nodes.length; i++)
|
||||
{
|
||||
FTPHostFile node = (FTPHostFile)nodes[i];
|
||||
if (includeHidden || !node.isHidden())
|
||||
{
|
||||
IRemoteFile ftpFile = new FTPRemoteFile(ss, context, parent, node);
|
||||
results.add(ftpFile);
|
||||
ss.cacheRemoteFile(ftpFile);
|
||||
}
|
||||
IRemoteFile ftpFile = new FTPRemoteFile(ss, context, parent, node);
|
||||
results.add(ftpFile);
|
||||
ss.cacheRemoteFile(ftpFile);
|
||||
}
|
||||
return (IRemoteFile[])results.toArray(new IRemoteFile[results.size()]);
|
||||
}
|
||||
|
|
|
@ -31,9 +31,7 @@ import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext;
|
|||
public class LocalFileAdapter implements IHostFileToRemoteFileAdapter
|
||||
{
|
||||
|
||||
|
||||
|
||||
public IRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes, boolean includeHidden)
|
||||
public IRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes)
|
||||
{
|
||||
if (nodes == null) return null;
|
||||
|
||||
|
@ -42,29 +40,26 @@ public class LocalFileAdapter implements IHostFileToRemoteFileAdapter
|
|||
{
|
||||
IHostFile child = nodes[i];
|
||||
|
||||
if (includeHidden || !child.isHidden())
|
||||
IRemoteFile lfile;
|
||||
|
||||
if (child instanceof LocalVirtualHostFile)
|
||||
{
|
||||
IRemoteFile lfile;
|
||||
if (child instanceof LocalVirtualHostFile)
|
||||
{
|
||||
LocalVirtualHostFile node = (LocalVirtualHostFile)child;
|
||||
lfile = new LocalVirtualFile(ss, context, node);
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalHostFile node = (LocalHostFile)child;
|
||||
lfile = new LocalFile(ss, context, parent, node);
|
||||
}
|
||||
results.add(lfile);
|
||||
ss.cacheRemoteFile(lfile);
|
||||
LocalVirtualHostFile node = (LocalVirtualHostFile)child;
|
||||
lfile = new LocalVirtualFile(ss, context, node);
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalHostFile node = (LocalHostFile)child;
|
||||
lfile = new LocalFile(ss, context, parent, node);
|
||||
}
|
||||
|
||||
results.add(lfile);
|
||||
ss.cacheRemoteFile(lfile);
|
||||
}
|
||||
|
||||
return (IRemoteFile[])results.toArray(new IRemoteFile[results.size()]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public IRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile node)
|
||||
{
|
||||
IRemoteFile file = null;
|
||||
|
|
|
@ -29,17 +29,15 @@ import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext;
|
|||
|
||||
public class SftpFileAdapter implements IHostFileToRemoteFileAdapter {
|
||||
|
||||
public IRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes, boolean includeHidden) {
|
||||
public IRemoteFile[] convertToRemoteFiles(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, IHostFile[] nodes) {
|
||||
|
||||
List results = new ArrayList();
|
||||
if (nodes!=null) {
|
||||
for (int i = 0; i < nodes.length; i++) {
|
||||
SftpHostFile node = (SftpHostFile)nodes[i];
|
||||
if (includeHidden || !node.isHidden()) {
|
||||
IRemoteFile remoteFile = new SftpRemoteFile(ss, context, parent, node);
|
||||
results.add(remoteFile);
|
||||
ss.cacheRemoteFile(remoteFile);
|
||||
}
|
||||
IRemoteFile remoteFile = new SftpRemoteFile(ss, context, parent, node);
|
||||
results.add(remoteFile);
|
||||
ss.cacheRemoteFile(remoteFile);
|
||||
}
|
||||
}
|
||||
return (IRemoteFile[])results.toArray(new IRemoteFile[results.size()]);
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.eclipse.core.resources.IResource;
|
|||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
@ -56,6 +57,7 @@ import org.eclipse.rse.ui.SystemPreferencesManager;
|
|||
import org.eclipse.rse.ui.validators.ISystemValidator;
|
||||
import org.eclipse.rse.ui.validators.ValidatorFilterName;
|
||||
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
|
||||
import org.eclipse.rse.ui.view.IContextObject;
|
||||
import org.eclipse.rse.ui.view.ISystemMementoConstants;
|
||||
import org.eclipse.rse.ui.view.ISystemPropertyConstants;
|
||||
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
|
||||
|
@ -232,8 +234,24 @@ public class SystemViewFilterReferenceAdapter
|
|||
{
|
||||
return internalGetChildren(monitor, element);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets all the children and then passes the children to the subsystem configuration adapter for filtering.
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getChildren(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.rse.ui.view.IContextObject)
|
||||
*/
|
||||
public Object[] getChildren(IProgressMonitor monitor, IContextObject element) {
|
||||
Object[] children = getChildren(monitor, element.getModelObject());
|
||||
ISubSystem subsystem = element.getSubSystem();
|
||||
ISubSystemConfiguration configuration = subsystem.getSubSystemConfiguration();
|
||||
Object adapter = Platform.getAdapterManager().getAdapter(configuration, ISubSystemConfigurationAdapter.class);
|
||||
|
||||
if (adapter instanceof ISubSystemConfigurationAdapter) {
|
||||
children = ((ISubSystemConfigurationAdapter)adapter).applyViewFilters(element, children);
|
||||
}
|
||||
|
||||
return children;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the children of the specified element. If a monitor is passed in then
|
||||
* the context is assumed to be modal and, as such, the modal version of ss.resolveFilterStrings
|
||||
|
|
|
@ -1265,4 +1265,14 @@ public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAda
|
|||
return ((SubSystemConfiguration)config).getUserIdValidator();
|
||||
}
|
||||
|
||||
/**
|
||||
* The default implementation does not filter and simply returns the children passed in.
|
||||
* Subclasses should override if they want to filter objects.
|
||||
* @param parent the parent context.
|
||||
* @param children the children to filter.
|
||||
* @return the children after filtering.
|
||||
*/
|
||||
public Object[] applyViewFilters(IContextObject parent, Object[] children) {
|
||||
return children;
|
||||
}
|
||||
}
|
|
@ -36,6 +36,7 @@ import org.eclipse.rse.ui.propertypages.ISystemSubSystemPropertyPageCoreForm;
|
|||
import org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage;
|
||||
import org.eclipse.rse.ui.propertypages.SystemFilterStringPropertyPage;
|
||||
import org.eclipse.rse.ui.validators.ISystemValidator;
|
||||
import org.eclipse.rse.ui.view.IContextObject;
|
||||
import org.eclipse.rse.ui.widgets.IServerLauncherForm;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
@ -295,4 +296,12 @@ public interface ISubSystemConfigurationAdapter
|
|||
*/
|
||||
public ISystemValidator getPortValidator(ISubSystemConfiguration confi);
|
||||
|
||||
/**
|
||||
* Filters an array of children and returns the results. The default implementation does not filter
|
||||
* and simply returns the children passed in. Subclasses should override if they want to filter objects.
|
||||
* @param parent the parent context.
|
||||
* @param children the children to filter.
|
||||
* @return the children after filtering.
|
||||
*/
|
||||
public Object[] applyViewFilters(IContextObject parent, Object[] children);
|
||||
}
|
Loading…
Add table
Reference in a new issue