[184028] [hotbug] Cannot associate a Node Filter with a dynamically added category
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/ExtensionsSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/ExtensionsSection.java
index 226afad..1fad510 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/ExtensionsSection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/ExtensionsSection.java
@@ -250,7 +250,7 @@
/**
* This filter is to be used by the dialog invoked when addButton is pressed
*/
- private class AddExtensionsComponentDialogFilter extends ViewerFilter
+ protected class AddExtensionsComponentDialogFilter extends ViewerFilter
{
private Object input;
private AddExtensionsComponentDialog dialog;
@@ -270,6 +270,13 @@
// here we obtain the node filter that was registered for the applicable namespace
// notied
NodeFilter filter = XSDEditorPlugin.getPlugin().getNodeCustomizationRegistry().getNodeFilter(spec.getNamespaceURI());
+
+ if (filter == null)
+ {
+ // Check if a node filter has been specified, if so, then use it
+ filter = spec.getNodeFilter();
+ }
+
if (filter instanceof ExtensionItemFilter)
{
ExtensionItemFilter extensionItemFilter = (ExtensionItemFilter)filter;
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddExtensionsComponentDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddExtensionsComponentDialog.java
index 0978f7f..392d760 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddExtensionsComponentDialog.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddExtensionsComponentDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -774,4 +774,11 @@
{
return super.close();
}
+
+ protected void enableButtons(boolean value)
+ {
+ editButton.setEnabled(value);
+ addButton.setEnabled(value);
+ removeButton.setEnabled(value);
+ }
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SpecificationForExtensionsSchema.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SpecificationForExtensionsSchema.java
index e68e220..8b4a9a5 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SpecificationForExtensionsSchema.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SpecificationForExtensionsSchema.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,6 +15,7 @@
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.wst.xsd.ui.internal.common.commands.ExtensibleAddExtensionCommand;
import org.eclipse.wst.xsd.ui.internal.common.commands.ExtensibleRemoveExtensionNodeCommand;
+import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeFilter;
public class SpecificationForExtensionsSchema
{
@@ -26,6 +27,8 @@
private boolean isDefaultSchema = false;
private ExtensibleAddExtensionCommand addCommand;
private ExtensibleRemoveExtensionNodeCommand removeCommand;
+ private NodeFilter nodeFilter;
+ private String classification;
/**
* Either the workspace-relative path of the xsd file or the namespace
@@ -174,4 +177,43 @@
public void setFromCatalog(boolean fromCatalog) {
this.fromCatalog = fromCatalog;
}
+
+ /**
+ * There is no support for setting this via the extension point defined in the plugin.xml
+ * This allows extenders to provide a filter for a category that has been added
+ * dynamically (programmatically)
+ * @param nodeFilter
+ */
+ public void setNodeFilter(NodeFilter nodeFilter)
+ {
+ this.nodeFilter = nodeFilter;
+ }
+
+ /**
+ * Get the node filter
+ * @return NodeFilter
+ */
+ public NodeFilter getNodeFilter()
+ {
+ return nodeFilter;
+ }
+
+ /**
+ * There is no support for setting this via the extension point defined in the plugin.xml
+ * This allows extenders to group categories into groups or classificationss
+ * @param classification
+ */
+ public void setClassification(String classification)
+ {
+ this.classification = classification;
+ }
+
+ /**
+ * Get the classification
+ * @return String
+ */
+ public String getClassification()
+ {
+ return classification;
+ }
}