Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNitin Dahyabhai2020-03-21 14:01:21 +0000
committerNitin Dahyabhai2020-03-21 15:24:28 +0000
commit663810c7472802b28d8768237a1d21a5e6a5e882 (patch)
treeab3c908914d4246764c60e049677d749447064a7
parentfe82c296f157100680a7a16c120de19c4645f87d (diff)
downloadwebtools.sourceediting-663810c7472802b28d8768237a1d21a5e6a5e882.tar.gz
webtools.sourceediting-663810c7472802b28d8768237a1d21a5e6a5e882.tar.xz
webtools.sourceediting-663810c7472802b28d8768237a1d21a5e6a5e882.zip
[559897] Make the XML catalog entries in the preference page filterable
Signed-off-by: Nitin Dahyabhai <thatnitind@gmail.com>
-rwxr-xr-xxml/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF2
-rwxr-xr-x[-rw-r--r--]xml/bundles/org.eclipse.wst.xml.ui/pom.xml2
-rw-r--r--xml/bundles/org.eclipse.wst.xml.ui/src-catalog/org/eclipse/wst/xml/ui/internal/catalog/XMLCatalogEntriesView.java44
-rw-r--r--xml/bundles/org.eclipse.wst.xml.ui/src-catalog/org/eclipse/wst/xml/ui/internal/catalog/XMLCatalogTreeViewerBuilder.java (renamed from xml/bundles/org.eclipse.wst.xml.ui/src-catalog/org/eclipse/wst/xml/ui/internal/catalog/XMLCatalogTreeViewer.java)37
-rwxr-xr-xxml/bundles/org.eclipse.wst.xsd.ui/META-INF/MANIFEST.MF4
-rw-r--r--xml/bundles/org.eclipse.wst.xsd.ui/pom.xml2
-rw-r--r--xml/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SelectFromCatalogDialog.java9
-rw-r--r--xml/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDRefactorGroupActionDelegate.java1
8 files changed, 57 insertions, 44 deletions
diff --git a/xml/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF b/xml/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF
index bc75bf132f..cb2a0135a9 100755
--- a/xml/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF
+++ b/xml/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.xml.ui; singleton:=true
-Bundle-Version: 1.2.300.qualifier
+Bundle-Version: 1.2.400.qualifier
Bundle-Activator: org.eclipse.wst.xml.ui.internal.XMLUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/xml/bundles/org.eclipse.wst.xml.ui/pom.xml b/xml/bundles/org.eclipse.wst.xml.ui/pom.xml
index 889d46b6e3..e01cda20da 100644..100755
--- a/xml/bundles/org.eclipse.wst.xml.ui/pom.xml
+++ b/xml/bundles/org.eclipse.wst.xml.ui/pom.xml
@@ -21,7 +21,7 @@
<groupId>org.eclipse.webtools.sourceediting</groupId>
<artifactId>org.eclipse.wst.xml.ui</artifactId>
- <version>1.2.300-SNAPSHOT</version>
+ <version>1.2.400-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>
diff --git a/xml/bundles/org.eclipse.wst.xml.ui/src-catalog/org/eclipse/wst/xml/ui/internal/catalog/XMLCatalogEntriesView.java b/xml/bundles/org.eclipse.wst.xml.ui/src-catalog/org/eclipse/wst/xml/ui/internal/catalog/XMLCatalogEntriesView.java
index b67ccdc754..27e45e671a 100644
--- a/xml/bundles/org.eclipse.wst.xml.ui/src-catalog/org/eclipse/wst/xml/ui/internal/catalog/XMLCatalogEntriesView.java
+++ b/xml/bundles/org.eclipse.wst.xml.ui/src-catalog/org/eclipse/wst/xml/ui/internal/catalog/XMLCatalogEntriesView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2011 IBM Corporation and others.
+ * Copyright (c) 2002, 2020 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -21,7 +21,7 @@ import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -47,7 +47,7 @@ public class XMLCatalogEntriesView extends Composite {
protected Button editButton;
protected Button deleteButton;
protected Button clearCacheButton;
- protected XMLCatalogTreeViewer tableViewer;
+ protected TreeViewer catalogViewer;
protected ICatalog workingUserCatalog;
protected ICatalog systemCatalog;
@@ -62,26 +62,26 @@ public class XMLCatalogEntriesView extends Composite {
gridLayout.numColumns = 2;
this.setLayout(gridLayout);
- tableViewer = createTableViewer(this);
- tableViewer.setInput("dummy"); //$NON-NLS-1$
+ catalogViewer = createTableViewer(this);
+ catalogViewer.setInput("dummy"); //$NON-NLS-1$
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202692
// specifically set size of tree before expanding it
- Point initialSize = tableViewer.getTree().computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point initialSize = catalogViewer.getTree().computeSize(SWT.DEFAULT, SWT.DEFAULT);
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.widthHint = initialSize.x;
gridData.heightHint = initialSize.y;
- tableViewer.getControl().setLayoutData(gridData);
+ catalogViewer.getControl().setLayoutData(gridData);
- tableViewer.expandToLevel(2);
- tableViewer.reveal(XMLCatalogTreeViewer.USER_SPECIFIED_ENTRIES_OBJECT);
+ catalogViewer.expandToLevel(2);
+ catalogViewer.reveal(XMLCatalogTreeViewerBuilder.USER_SPECIFIED_ENTRIES_OBJECT);
ISelectionChangedListener listener = new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
updateWidgetEnabledState();
}
};
- tableViewer.addSelectionChangedListener(listener);
+ catalogViewer.addSelectionChangedListener(listener);
createButtons(this);
}
@@ -99,13 +99,13 @@ public class XMLCatalogEntriesView extends Composite {
return uri;
}
- protected XMLCatalogTreeViewer createTableViewer(Composite parent) {
+ protected TreeViewer createTableViewer(Composite parent) {
String headings[] = new String[2];
headings[0] = XMLCatalogMessages.UI_LABEL_KEY;
headings[1] = XMLCatalogMessages.UI_LABEL_URI;
- XMLCatalogTreeViewer theTableViewer = new XMLCatalogTreeViewer(parent, workingUserCatalog, systemCatalog);
- return theTableViewer;
+ TreeViewer viewer = new XMLCatalogTreeViewerBuilder(parent, workingUserCatalog, systemCatalog).create();
+ return viewer;
}
protected void createButtons(Composite parent) {
@@ -200,7 +200,7 @@ public class XMLCatalogEntriesView extends Composite {
}
public void refresh() {
- tableViewer.refresh();// XMLCatalogTreeViewer.USER_SPECIFIED_ENTRIES_OBJECT);
+ catalogViewer.refresh();// XMLCatalogTreeViewer.USER_SPECIFIED_ENTRIES_OBJECT);
}
protected EditCatalogEntryDialog invokeDialog(String title, ICatalogElement entry, ICatalog catalog) {
@@ -226,13 +226,13 @@ public class XMLCatalogEntriesView extends Composite {
ICatalogElement element = dialog.getCatalogElement();
if (dialog.getReturnCode() == Window.OK) {
workingUserCatalog.addCatalogElement(element);
- tableViewer.setSelection(new StructuredSelection(element), true);
- tableViewer.refresh();
+ catalogViewer.setSelection(new StructuredSelection(element), true);
+ catalogViewer.refresh();
}
}
protected void performEdit() {
- ISelection selection = tableViewer.getSelection();
+ ISelection selection = catalogViewer.getSelection();
Object selectedObject = (selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null;
if (selectedObject instanceof ICatalogElement) {
@@ -248,7 +248,7 @@ public class XMLCatalogEntriesView extends Composite {
// update the new mapping
//
workingUserCatalog.addCatalogElement(newEntry);
- tableViewer.setSelection(new StructuredSelection(newEntry));
+ catalogViewer.setSelection(new StructuredSelection(newEntry));
}
}
}
@@ -258,7 +258,7 @@ public class XMLCatalogEntriesView extends Composite {
}
protected void performDelete() {
- ISelection selection = tableViewer.getSelection();
+ ISelection selection = catalogViewer.getSelection();
if(selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = (IStructuredSelection)selection;
Iterator iterator = structuredSelection.iterator();
@@ -274,7 +274,7 @@ public class XMLCatalogEntriesView extends Composite {
protected void updateWidgetEnabledState() {
boolean isEditable = false;
- ISelection selection = tableViewer.getSelection();
+ ISelection selection = catalogViewer.getSelection();
boolean multipleSelection = false;
if(selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = (IStructuredSelection)selection;
@@ -316,8 +316,8 @@ public class XMLCatalogEntriesView extends Composite {
updateWidgetEnabledState();
}
- public Viewer getViewer() {
- return tableViewer;
+ public TreeViewer getViewer() {
+ return catalogViewer;
}
diff --git a/xml/bundles/org.eclipse.wst.xml.ui/src-catalog/org/eclipse/wst/xml/ui/internal/catalog/XMLCatalogTreeViewer.java b/xml/bundles/org.eclipse.wst.xml.ui/src-catalog/org/eclipse/wst/xml/ui/internal/catalog/XMLCatalogTreeViewerBuilder.java
index 506908dbe2..7f0f7740ce 100644
--- a/xml/bundles/org.eclipse.wst.xml.ui/src-catalog/org/eclipse/wst/xml/ui/internal/catalog/XMLCatalogTreeViewer.java
+++ b/xml/bundles/org.eclipse.wst.xml.ui/src-catalog/org/eclipse/wst/xml/ui/internal/catalog/XMLCatalogTreeViewerBuilder.java
@@ -14,7 +14,6 @@
*******************************************************************************/
package org.eclipse.wst.xml.ui.internal.catalog;
-import com.ibm.icu.text.Collator;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
@@ -34,6 +33,8 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IEditorRegistry;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.FilteredTree;
+import org.eclipse.ui.dialogs.PatternFilter;
import org.eclipse.wst.common.uriresolver.internal.util.URIHelper;
import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog;
import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogElement;
@@ -43,8 +44,10 @@ import org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog;
import org.eclipse.wst.xml.core.internal.catalog.provisional.IRewriteEntry;
import org.eclipse.wst.xml.core.internal.catalog.provisional.ISuffixEntry;
+import com.ibm.icu.text.Collator;
+
-public class XMLCatalogTreeViewer extends TreeViewer {
+public class XMLCatalogTreeViewerBuilder extends Object {
protected static Image xmlCatalogImage = ImageFactory.INSTANCE.getImage("icons/obj16/xmlcatalog_obj.gif"); //$NON-NLS-1$
protected static Image errorImage = ImageFactory.INSTANCE.getImage("icons/ovr16/error-overlay.gif"); //$NON-NLS-1$
protected static Image entryImage = ImageFactory.INSTANCE.getImage("icons/obj16/entry_obj.png"); //$NON-NLS-1$
@@ -58,21 +61,31 @@ public class XMLCatalogTreeViewer extends TreeViewer {
protected ICatalog fWorkingUserCatalog;
protected ICatalog fSystemCatalog;
+ private Composite fParent = null;
+ private FilteredTree fTree = null;
+ private TreeViewer fTreeViewer = null;
+
public static String USER_SPECIFIED_ENTRIES_OBJECT = XMLCatalogMessages.UI_LABEL_USER_SPECIFIED_ENTRIES;
public static String PLUGIN_SPECIFIED_ENTRIES_OBJECT = XMLCatalogMessages.UI_LABEL_PLUGIN_SPECIFIED_ENTRIES;
- public XMLCatalogTreeViewer(Composite parent, ICatalog workingUserCatalog, ICatalog systemCatalog) {
- super(parent, SWT.MULTI | SWT.BORDER);
- this.fWorkingUserCatalog = workingUserCatalog;
- this.fSystemCatalog = systemCatalog;
-
- setContentProvider(new CatalogEntryContentProvider());
- setLabelProvider(new CatalogEntryLabelProvider());
+ XMLCatalogTreeViewerBuilder(Composite parent, ICatalog workingUserCatalog, ICatalog systemCatalog) {
+ fParent = parent;
+ fWorkingUserCatalog = workingUserCatalog;
+ fSystemCatalog = systemCatalog;
+ }
+
+ public TreeViewer create() {
+ fTree = new FilteredTree(fParent, SWT.MULTI, new PatternFilter(), true, false);
+ fTreeViewer = fTree.getViewer();
+
+ fTreeViewer.setContentProvider(new CatalogEntryContentProvider());
+ fTreeViewer.setLabelProvider(new CatalogEntryLabelProvider());
+ return fTreeViewer;
}
public void setFilterExtensions(String[] extensions) {
- resetFilters();
- addFilter(new XMLCatalogTableViewerFilter(extensions));
+ fTreeViewer.resetFilters();
+ fTreeViewer.addFilter(new XMLCatalogTableViewerFilter(extensions));
}
public class CatalogEntryLabelProvider extends LabelProvider {
@@ -294,7 +307,7 @@ public class XMLCatalogTreeViewer extends TreeViewer {
}
}
}
- else if (element.equals(XMLCatalogTreeViewer.PLUGIN_SPECIFIED_ENTRIES_OBJECT) || element.equals(XMLCatalogTreeViewer.USER_SPECIFIED_ENTRIES_OBJECT)) {
+ else if (element.equals(XMLCatalogTreeViewerBuilder.PLUGIN_SPECIFIED_ENTRIES_OBJECT) || element.equals(XMLCatalogTreeViewerBuilder.USER_SPECIFIED_ENTRIES_OBJECT)) {
return true;
}
return result;
diff --git a/xml/bundles/org.eclipse.wst.xsd.ui/META-INF/MANIFEST.MF b/xml/bundles/org.eclipse.wst.xsd.ui/META-INF/MANIFEST.MF
index 3ab307ab44..f23b3f3eb4 100755
--- a/xml/bundles/org.eclipse.wst.xsd.ui/META-INF/MANIFEST.MF
+++ b/xml/bundles/org.eclipse.wst.xsd.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %_UI_PLUGIN_NAME
Bundle-SymbolicName: org.eclipse.wst.xsd.ui; singleton:=true
-Bundle-Version: 1.3.300.qualifier
+Bundle-Version: 1.3.400.qualifier
Bundle-Activator: org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
@@ -65,7 +65,7 @@ Require-Bundle: org.eclipse.ui.views.properties.tabbed;bundle-version="[3.8.0,4.
org.eclipse.wst.sse.core;bundle-version="[1.2.0,1.3.0)",
org.eclipse.wst.common.core;bundle-version="[1.2.0,2.0.0)",
org.eclipse.wst.xml.core;bundle-version="[1.2.0,1.3.0)",
- org.eclipse.wst.xml.ui;bundle-version="[1.2.300,2.0.0)",
+ org.eclipse.wst.xml.ui;bundle-version="[1.2.400,2.0.0)",
org.eclipse.wst.common.ui;bundle-version="[1.1.500,1.2.0)",
org.eclipse.jface.text;bundle-version="[3.13.0,4.0.0)",
org.eclipse.gef;bundle-version="[3.11.0,4.0.0)",
diff --git a/xml/bundles/org.eclipse.wst.xsd.ui/pom.xml b/xml/bundles/org.eclipse.wst.xsd.ui/pom.xml
index a4706e3950..e38a42e133 100644
--- a/xml/bundles/org.eclipse.wst.xsd.ui/pom.xml
+++ b/xml/bundles/org.eclipse.wst.xsd.ui/pom.xml
@@ -21,7 +21,7 @@
<groupId>org.eclipse.webtools.sourceediting</groupId>
<artifactId>org.eclipse.wst.xsd.ui</artifactId>
- <version>1.3.300-SNAPSHOT</version>
+ <version>1.3.400-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<!-- added this "constraint" for bug 458962 -->
diff --git a/xml/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SelectFromCatalogDialog.java b/xml/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SelectFromCatalogDialog.java
index d89463be6b..a4bc2e995f 100644
--- a/xml/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SelectFromCatalogDialog.java
+++ b/xml/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SelectFromCatalogDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
+ * Copyright (c) 2006, 2020 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -17,6 +17,7 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
@@ -34,7 +35,7 @@ import org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog;
import org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogEntriesView;
import org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogEntryDetailsView;
import org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogMessages;
-import org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogTreeViewer;
+import org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogTreeViewerBuilder;
public class SelectFromCatalogDialog extends Dialog
{
@@ -122,7 +123,7 @@ public class SelectFromCatalogDialog extends Dialog
// Only XML Schema entry is selectable
catalogEntriesView.setLayoutData(gridData);
- XMLCatalogTreeViewer catalogTreeViewer = ((XMLCatalogTreeViewer) catalogEntriesView.getViewer());
+ StructuredViewer catalogTreeViewer = catalogEntriesView.getViewer();
catalogTreeViewer.resetFilters();
catalogTreeViewer.addFilter(new XMLCatalogTableViewerFilter(new String[] { ".xsd" }));
@@ -158,7 +159,7 @@ public class SelectFromCatalogDialog extends Dialog
}
}
}
- else if (element.equals(XMLCatalogTreeViewer.PLUGIN_SPECIFIED_ENTRIES_OBJECT) || element.equals(XMLCatalogTreeViewer.USER_SPECIFIED_ENTRIES_OBJECT))
+ else if (element.equals(XMLCatalogTreeViewerBuilder.PLUGIN_SPECIFIED_ENTRIES_OBJECT) || element.equals(XMLCatalogTreeViewerBuilder.USER_SPECIFIED_ENTRIES_OBJECT))
{
return true;
}
diff --git a/xml/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDRefactorGroupActionDelegate.java b/xml/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDRefactorGroupActionDelegate.java
index 034c150e31..ec6508a3f2 100644
--- a/xml/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDRefactorGroupActionDelegate.java
+++ b/xml/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDRefactorGroupActionDelegate.java
@@ -18,7 +18,6 @@ import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.wst.xsd.ui.internal.editor.ISelectionMapper;
-import org.eclipse.wst.xsd.ui.internal.refactor.actions.XSDRefactorActionGroup;
import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactorActionGroup;
import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactorGroupActionDelegate;
import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactorGroupSubMenu;

Back to the top