diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemAbstractAPIProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemAbstractAPIProvider.java
index 956557bd13e..5ffac46393b 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemAbstractAPIProvider.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemAbstractAPIProvider.java
@@ -12,16 +12,19 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
+ * Tobias Schwarz (Wind River) - [173267] "empty list" should not be displayed
********************************************************************************/
package org.eclipse.rse.internal.ui.view;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.ISystemMessageObject;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.model.SystemMessageObject;
import org.eclipse.rse.ui.ISystemMessages;
+import org.eclipse.rse.ui.ISystemPreferencesConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
@@ -45,11 +48,15 @@ public abstract class SystemAbstractAPIProvider
protected ISystemRegistry sr;
protected Object[] emptyList = new Object[0];
- protected Object[] msgList = new Object[1];
+ protected Object[] msgList = new Object[1];
+ /**
+ * @deprecated Use {@link #checkForEmptyList(Object[], Object, boolean)} instead.
+ */
protected SystemMessageObject nullObject = null;
protected SystemMessageObject canceledObject = null;
protected SystemMessageObject errorObject = null;
+ private Preferences fPrefStore = null;
/**
* Constructor
@@ -104,17 +111,51 @@ public abstract class SystemAbstractAPIProvider
return viewer;
}
- private void initMsgObjects()
- {
- nullObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_EMPTY),ISystemMessageObject.MSGTYPE_EMPTY, null);
- canceledObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_LIST_CANCELLED),ISystemMessageObject.MSGTYPE_CANCEL, null);
- errorObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_FAILED),ISystemMessageObject.MSGTYPE_ERROR, null);
- }
-
+ protected final void initMsgObjects()
+ {
+ nullObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_EMPTY),ISystemMessageObject.MSGTYPE_EMPTY, null);
+ canceledObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_LIST_CANCELLED),ISystemMessageObject.MSGTYPE_CANCEL, null);
+ errorObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_FAILED),ISystemMessageObject.MSGTYPE_ERROR, null);
+ }
+
+ /**
+ * Callable by subclasses. Do not override
+ * In getChildren, return checkForEmptyList(children, parent, true/false)<.samp>
+ * versus your array directly. This method checks for a null array which is
+ * not allowed and replaces it with an empty array.
+ * If true is passed then it returns the "Empty list" message object if the array is null or empty
+ *
+ * @param children The list of children.
+ * @param parent The parent for the children.
+ * @param returnNullMsg true
if an "Empty List" message should be returned.
+ * @return The list of children, a list with the "Empty List" message object or an empty list.
+ */
+ protected Object[] checkForEmptyList(Object[] children, Object parent, boolean returnNullMsg) {
+ if ((children == null) || (children.length == 0)) {
+ if (fPrefStore == null) {
+ fPrefStore = RSEUIPlugin.getDefault().getPluginPreferences();
+ }
+ if (!returnNullMsg
+ || (fPrefStore != null && !fPrefStore
+ .getBoolean(ISystemPreferencesConstants.SHOW_EMPTY_LISTS))) {
+ return emptyList;
+ } else {
+ return new Object[] {
+ new SystemMessageObject(
+ RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_EMPTY),
+ ISystemMessageObject.MSGTYPE_EMPTY,
+ parent)};
+ }
+ }
+ return children;
+ }
+
/**
* In getChildren, return checkForNull(children, true/false) vs your array directly.
* This method checks for a null array which not allow and replaces it with an empty array.
* If true is passed then it returns the "Empty list" message object if the array is null or empty
+ *
+ * @deprecated Use {@link #checkForEmptyList(Object[], Object, boolean)} instead.
*/
protected Object[] checkForNull(Object[] children, boolean returnNullMsg)
{
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java
index 4f251249c66..9af78797788 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java
@@ -15,6 +15,7 @@
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
+ * Tobias Schwarz (Wind River) - [173267] "empty list" should not be displayed
********************************************************************************/
package org.eclipse.rse.internal.ui.view;
@@ -364,7 +365,7 @@ public class SystemSelectRemoteObjectAPIProviderImpl
children = resolveFilterString(subsystem, filterString);
}
- return checkForNull(children, true);
+ return checkForEmptyList(children, null, true);
}
/**
@@ -401,10 +402,11 @@ public class SystemSelectRemoteObjectAPIProviderImpl
{
Object[] children = null;
ISubSystem[] subsystems = getSubSystems(selectedConnection);
+ ISubSystem subsystem = null;
if ((subsystems != null) && (subsystems.length > 0))
{
- ISubSystem subsystem = subsystems[0]; // always just use first. Hopefully never a problem!
+ subsystem = subsystems[0]; // always just use first. Hopefully never a problem!
if (subsystems.length > 1)
SystemBasePlugin.logWarning(this.getClass().getName() + ": More than one subsystem meeting criteria. SSFID = "+subsystemConfigurationId+", SSFCat = "+subsystemConfigurationCategory); //$NON-NLS-1$ //$NON-NLS-2$
@@ -457,7 +459,7 @@ public class SystemSelectRemoteObjectAPIProviderImpl
}
}
- return checkForNull(children, true);
+ return checkForEmptyList(children, subsystem, true);
}
}
@@ -539,7 +541,7 @@ public class SystemSelectRemoteObjectAPIProviderImpl
multiConnections = ((conns!=null) && (conns.length>1)); // 50167pc
}
- return checkForNull(children, false);
+ return checkForEmptyList(children, null, false);
}
/**
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTestFilterStringAPIProviderImpl.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTestFilterStringAPIProviderImpl.java
index d8cb9f51708..c948bda75be 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTestFilterStringAPIProviderImpl.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTestFilterStringAPIProviderImpl.java
@@ -12,16 +12,13 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
+ * Tobias Schwarz (Wind River) - [173267] "empty list" should not be displayed
********************************************************************************/
package org.eclipse.rse.internal.ui.view;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemMessageObject;
-import org.eclipse.rse.core.model.SystemMessageObject;
import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.rse.ui.view.ISystemViewInputProvider;
@@ -51,13 +48,6 @@ public class SystemTestFilterStringAPIProviderImpl
this.filterString = filterString;
}
- private void initMsgObjects()
- {
- nullObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_EMPTY),ISystemMessageObject.MSGTYPE_EMPTY, null);
- canceledObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_LIST_CANCELLED),ISystemMessageObject.MSGTYPE_CANCEL, null);
- errorObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_FAILED),ISystemMessageObject.MSGTYPE_ERROR, null);
- }
-
/**
* Change the input subsystem
*/
@@ -88,25 +78,13 @@ public class SystemTestFilterStringAPIProviderImpl
try
{
children = subsystem.resolveFilterString(filterString, new NullProgressMonitor());
- if ((children == null) || (children.length==0))
- {
- if (nullObject == null)
- initMsgObjects();
- msgList[0] = nullObject;
- children = msgList;
- }
+ children = checkForEmptyList(children, null, true);
} catch (InterruptedException exc)
{
- if (canceledObject == null)
- initMsgObjects();
- msgList[0] = canceledObject;
- children = msgList;
+ children = getCancelledMessageObject();
} catch (Exception exc)
{
- if (errorObject == null)
- initMsgObjects();
- msgList[0] = errorObject;
- children = msgList;
+ children = getFailedMessageObject();
SystemBasePlugin.logError("Error in SystemTestFilterStringAPIProviderImpl#getSystemViewRoots()",exc); //$NON-NLS-1$
}
return children;
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilterStrings.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilterStrings.java
index c2d795beac5..a376fd8c478 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilterStrings.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilterStrings.java
@@ -12,6 +12,7 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
+ * Tobias Schwarz (Wind River) - [173267] "empty list" should not be displayed
********************************************************************************/
package org.eclipse.rse.internal.ui.view;
@@ -138,12 +139,7 @@ public class SystemViewAPIProviderForFilterStrings
try
{
children = ss.resolveFilterString(filterStringReference.getString(), new NullProgressMonitor());
- if ((children == null) || (children.length==0))
- {
- children = new SystemMessageObject[1];
- children[0] = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_EMPTY),
- ISystemMessageObject.MSGTYPE_EMPTY, element);
- }
+ children = checkForEmptyList(children, element, true);
}
catch (InterruptedException exc)
{
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilters.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilters.java
index 4cd6e875b67..5060afc477a 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilters.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilters.java
@@ -15,6 +15,7 @@
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
+ * Tobias Schwarz (Wind River) - [173267] "empty list" should not be displayed
********************************************************************************/
package org.eclipse.rse.internal.ui.view;
@@ -212,13 +213,7 @@ public class SystemViewAPIProviderForFilters
SystemBasePlugin.logError("Exception resolving filters' strings ",exc); //$NON-NLS-1$
} // message already issued
- if ((children == null) || (children.length==0))
- {
- children = new SystemMessageObject[1];
- children[0] = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_EMPTY),
- ISystemMessageObject.MSGTYPE_EMPTY, element);
- }
- return children;
+ return checkForEmptyList(children, element, true);
}
}
}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterAdapter.java
index a7aaea07098..9f99ac6f9f9 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterAdapter.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterAdapter.java
@@ -16,6 +16,7 @@
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
+ * Tobias Schwarz (Wind River) - [173267] "empty list" should not be displayed
********************************************************************************/
package org.eclipse.rse.internal.ui.view;
@@ -53,6 +54,7 @@ import org.eclipse.rse.ui.validators.ValidatorFilterName;
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
import org.eclipse.rse.ui.view.ISystemPropertyConstants;
import org.eclipse.rse.ui.view.ISystemViewInputProvider;
+import org.eclipse.rse.ui.view.SystemAdapterHelpers;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IActionFilter;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
@@ -197,7 +199,7 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter
if (filter.isTransient())
{
if (filter.isPromptable())
- return checkForNull(processPromptingFilter(filter), true);
+ return checkForEmptyList(processPromptingFilter(filter), element, true);
Object[] children = null;
SystemFilterSimple simpleFilter = (SystemFilterSimple)filter;
@@ -232,7 +234,7 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter
}
// otherwise, get children and then cache
else {
- children = checkForNull(ss.resolveFilterStrings(filterStrings, monitor), true);
+ children = checkForEmptyList(ss.resolveFilterStrings(filterStrings, monitor), element, true);
if (ss.getSubSystemConfiguration().supportsFilterCaching()) {
simpleFilter.setContents(SystemChildrenContentsType.getInstance(), children);
@@ -245,7 +247,7 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter
for (int idx=0; (match==null) && (idxCallable by subclasses. Do not override
+ * In getChildren, return checkForEmptyList(children, parent, true/false)<.samp>
+ * versus your array directly. This method checks for a null array which is
+ * not allowed and replaces it with an empty array.
+ * If true is passed then it returns the "Empty list" message object if the array is null or empty
+ *
+ * @param children The list of children.
+ * @param parent The parent for the children.
+ * @param returnNullMsg true
if an "Empty List" message should be returned.
+ * @return The list of children, a list with the "Empty List" message object or an empty list.
+ */
+ protected Object[] checkForEmptyList(Object[] children, Object parent, boolean returnNullMsg) {
+ if ((children == null) || (children.length == 0)) {
+ if (fPrefStore == null) {
+ fPrefStore = RSEUIPlugin.getDefault().getPluginPreferences();
+ }
+ if (!returnNullMsg
+ || (fPrefStore != null && !fPrefStore
+ .getBoolean(ISystemPreferencesConstants.SHOW_EMPTY_LISTS))) {
+ return emptyList;
+ } else {
+ return new Object[] {
+ new SystemMessageObject(
+ RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_EMPTY),
+ ISystemMessageObject.MSGTYPE_EMPTY,
+ parent)};
+ }
+ }
+ return children;
+ }
+
/**
* Callable by subclasses. Do not override
- * In getChildren, return checkForNull(children, true/false)<.samp> versus your array directly.
+ * In getChildren, return checkForNull(children, true/false) versus your array directly.
* This method checks for a null array which is not allowed and replaces it with an empty array.
* If true is passed then it returns the "Empty list" message object if the array is null or empty
+ *
+ * @deprecated Use {@link #checkForEmptyList(Object[], Object, boolean)} instead.
*/
protected Object[] checkForNull(Object[] children, boolean returnNullMsg)
{
@@ -1847,7 +1887,7 @@ public abstract class AbstractSystemViewAdapter implements ISystemViewElementAda
/**
* Callable by subclasses. Do not override
- * Return the "Operation cancelled by user" msg as an object array so can be used to answer getChildren()
+ * Return the "Operation canceled by user" msg as an object array so can be used to answer getChildren()
*/
protected final Object[] getCancelledMessageObject()
{
@@ -1870,6 +1910,8 @@ public abstract class AbstractSystemViewAdapter implements ISystemViewElementAda
/**
* Callable by subclasses. Do not override
* Return the "Empty list" msg as an object array so can be used to answer getChildren()
+ *
+ * @deprecated Use {@link #checkForEmptyList(Object[], Object, boolean)} instead.
*/
protected final Object[] getEmptyMessageObject()
{