diff options
author | Nitin Dahyabhai | 2019-04-21 02:02:34 +0000 |
---|---|---|
committer | Nitin Dahyabhai | 2019-04-21 05:26:20 +0000 |
commit | 44a79685c3cc8546700fb4542f36e24e231c0065 (patch) | |
tree | 5df010d935a125db27b424462d5f3b35122795c8 | |
parent | fe6d03fa6ca31c9e5ebeba67b32f14d14335657d (diff) | |
download | webtools.sourceediting-44a79685c3cc8546700fb4542f36e24e231c0065.tar.gz webtools.sourceediting-44a79685c3cc8546700fb4542f36e24e231c0065.tar.xz webtools.sourceediting-44a79685c3cc8546700fb4542f36e24e231c0065.zip |
[314480] Provide a richer quick outline
The Outline view will now "pull up" text contents and show them similar
to how attributes are shown. The quick outline now allows cycling
between showing and filtering on node names as before and showing
attributes in the style of the outline view and filtering on just
those values.
49 files changed, 661 insertions, 291 deletions
diff --git a/core/bundles/org.eclipse.wst.sse.ui/META-INF/MANIFEST.MF b/core/bundles/org.eclipse.wst.sse.ui/META-INF/MANIFEST.MF index 75a0d2d4fe..b8242b4a1d 100755 --- a/core/bundles/org.eclipse.wst.sse.ui/META-INF/MANIFEST.MF +++ b/core/bundles/org.eclipse.wst.sse.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.wst.sse.ui; singleton:=true -Bundle-Version: 1.5.100.qualifier +Bundle-Version: 1.6.0.qualifier Bundle-Activator: org.eclipse.wst.sse.ui.internal.SSEUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -64,6 +64,7 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.14.0,4.0.0)", org.eclipse.wst.sse.core;bundle-version="[1.2.0,1.3.0)", org.eclipse.core.runtime;bundle-version="[3.14.0,4.0.0)", org.eclipse.core.resources;bundle-version="[3.13.0,4.0.0)", + org.eclipse.core.commands;bundle-version="[3.9.0,4.0.0)", org.eclipse.wst.validation;bundle-version="[1.2.700,1.3.0)", org.eclipse.emf.common;bundle-version="[2.14.0,3.0.0)", org.eclipse.core.expressions;bundle-version="[3.6.0,4.0.0)" diff --git a/core/bundles/org.eclipse.wst.sse.ui/pom.xml b/core/bundles/org.eclipse.wst.sse.ui/pom.xml index 273a08b3b8..e2ee61b8b8 100644 --- a/core/bundles/org.eclipse.wst.sse.ui/pom.xml +++ b/core/bundles/org.eclipse.wst.sse.ui/pom.xml @@ -21,7 +21,7 @@ <groupId>org.eclipse.webtools.sourceediting</groupId> <artifactId>org.eclipse.wst.sse.ui</artifactId> - <version>1.5.100-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> <build> diff --git a/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIPluginResources.properties b/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIPluginResources.properties index 17fad3b4c0..47b44e4dfc 100644 --- a/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIPluginResources.properties +++ b/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIPluginResources.properties @@ -214,8 +214,8 @@ TaskTagPreferenceTab_30=detection encountered errors TaskTagPreferenceTab_31=&Enable searching for Task Tags TaskTagPreferencePage_32=&Clean and redetect Tasks TaskTagPreferenceTab_33=Ta&gs in comments indicating Tasks: -TaskTagExclusionTab_01=&Filters -TaskTagExclusionTab_02=Sca&n the selected Content Types: +TaskTagExclusionTab_01=Sca&nners +TaskTagExclusionTab_02=Use the selected scanners: TaskTagExclusionTab_03=Affected Content T&ypes: PropertyPreferencePage_01=Project Specific Configuration @@ -450,4 +450,4 @@ CodeAssistAdvancedConfigurationBlock_separate_table_category_column_title=Conten Validation_Title=Validation Settings Changed Validation_Workspace=The validation settings have changed. A full validation is required for changes to take effect. Validate now? Validation_Project=The validation settings have changed. A validation of the project is required for changes to take effect. Validate the project now? -Validation_jobName=Validating...
\ No newline at end of file +Validation_jobName=Validating... diff --git a/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/filter/OutlineNamePatternFilter.java b/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/filter/OutlineNamePatternFilter.java index 12a12e03d8..f1fd1a6b75 100644 --- a/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/filter/OutlineNamePatternFilter.java +++ b/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/filter/OutlineNamePatternFilter.java @@ -17,6 +17,7 @@ import org.eclipse.jface.viewers.IBaseLabelProvider; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.wst.sse.ui.quickoutline.StringMatcher; /** * The NamePatternFilter selects the elements which diff --git a/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/quickoutline/QuickOutlinePopupDialog.java b/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/quickoutline/QuickOutlinePopupDialog.java index a1c2390cca..03408d2ef4 100644 --- a/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/quickoutline/QuickOutlinePopupDialog.java +++ b/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/quickoutline/QuickOutlinePopupDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2017 IBM Corporation and others. + * Copyright (c) 2010, 2019 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 @@ -13,6 +13,9 @@ package org.eclipse.wst.sse.ui.internal.quickoutline; import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.bindings.TriggerSequence; +import org.eclipse.jface.bindings.keys.KeySequence; +import org.eclipse.jface.bindings.keys.SWTKeySupport; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.dialogs.PopupDialog; @@ -25,10 +28,13 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.KeyListener; import org.eclipse.swt.events.ModifyEvent; @@ -54,13 +60,16 @@ import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.commands.ICommand; +import org.eclipse.ui.keys.IBindingService; import org.eclipse.ui.texteditor.ITextEditor; import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion; import org.eclipse.wst.sse.ui.IContentSelectionProvider; import org.eclipse.wst.sse.ui.internal.SSEUIPlugin; -import org.eclipse.wst.sse.ui.internal.filter.StringMatcher; import org.eclipse.wst.sse.ui.quickoutline.AbstractQuickOutlineConfiguration; +import org.eclipse.wst.sse.ui.quickoutline.StringMatcher; +import org.eclipse.wst.sse.ui.quickoutline.StringPatternFilter; /** * Popup dialog that contains the filtering input and the outline @@ -92,12 +101,30 @@ public class QuickOutlinePopupDialog extends PopupDialog implements IInformation private StringPatternFilter fFilter; + /** + * Support for cycling using the original command's invocation trigger + * (key binding or otherwise), taken from + * {@link org.eclipse.jdt.internal.ui.text.JavaOutlineInformationControl} + */ + private KeyAdapter fKeyAdapter; + private ICommand fInvokingCommand; + private TriggerSequence[] fInvokingCommandKeySequences; + private AbstractQuickOutlineConfiguration fFirstConfiguration; + private AbstractQuickOutlineConfiguration fConfiguration; + public QuickOutlinePopupDialog(Shell parent, int shellStyle, IStructuredModel model, AbstractQuickOutlineConfiguration configuration) { super(parent, shellStyle, true, true, true, true, true, null, null); + fConfiguration = fFirstConfiguration = configuration; fContentProvider = configuration.getContentProvider(); fLabelProvider = configuration.getLabelProvider(); fSelectionProvider = configuration.getContentSelectionProvider(); + fFilter = configuration.getFilter(); fModel = model; + + fInvokingCommand = PlatformUI.getWorkbench().getCommandSupport().getCommandManager().getCommand(DIALOG_SECTION); + + updateStatusText(); + create(); } @@ -106,12 +133,12 @@ public class QuickOutlinePopupDialog extends PopupDialog implements IInformation addListeners(fTreeViewer.getTree()); installFilter(); + return fTreeViewer.getControl(); } protected Control createTitleControl(Composite parent) { createFilterText(parent); - return fFilterText; } @@ -152,16 +179,12 @@ public class QuickOutlinePopupDialog extends PopupDialog implements IInformation // do nothing } }); - } - - protected void installFilter() { - fFilter = new StringPatternFilter(); - fTreeViewer.addFilter(fFilter); + fFilterText.addKeyListener(getKeyAdapter()); fFilterText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String text = ((Text) e.widget).getText(); int length = text.length(); - if (length > 0 && text.charAt(length -1 ) != '*') { + if (length > 0 && text.charAt(length - 1) != '*') { text = text + '*'; } setMatcherString(text, true); @@ -169,17 +192,33 @@ public class QuickOutlinePopupDialog extends PopupDialog implements IInformation }); } + protected void installFilter() { + ViewerFilter[] filters = fTreeViewer.getFilters(); + for (int i = 0; i < filters.length; i++) { + if (filters[i] instanceof StringPatternFilter) { + fTreeViewer.removeFilter(filters[i]); + } + } + fTreeViewer.addFilter(fFilter); + } + protected void setMatcherString(String pattern, boolean update) { fFilter.updatePattern(pattern); if (update) stringMatcherUpdated(); } + /** * The string matcher has been modified. The default implementation * refreshes the view and selects the first matched element */ protected void stringMatcherUpdated() { // refresh viewer to re-filter + /* + * there's an unsolved problem that happens when you have a filter + * pattern that matches a different configuration--switching + * configurations does not reveal the matching tree item + */ fTreeViewer.getControl().setRedraw(false); fTreeViewer.refresh(); fTreeViewer.expandAll(); @@ -252,6 +291,44 @@ public class QuickOutlinePopupDialog extends PopupDialog implements IInformation return editor; } + final protected ICommand getInvokingCommand() { + return fInvokingCommand; + } + + final protected TriggerSequence[] getInvokingCommandKeySequences() { + if (fInvokingCommandKeySequences == null) { + if (getInvokingCommand() != null) { + IBindingService bindingService = PlatformUI.getWorkbench().getAdapter(IBindingService.class); + fInvokingCommandKeySequences = bindingService.getActiveBindingsFor(getInvokingCommand().getId()); + return fInvokingCommandKeySequences; + } + } + return fInvokingCommandKeySequences; + } + + private KeyAdapter getKeyAdapter() { + if (fKeyAdapter == null) { + fKeyAdapter= new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + int accelerator = SWTKeySupport.convertEventToUnmodifiedAccelerator(e); + KeySequence keySequence = KeySequence.getInstance(SWTKeySupport.convertAcceleratorToKeyStroke(accelerator)); + TriggerSequence[] sequences= getInvokingCommandKeySequences(); + if (sequences == null) + return; + for (int i= 0; i < sequences.length; i++) { + if (sequences[i].equals(keySequence)) { + e.doit= false; + showNextConfiguration(); + return; + } + } + } + }; + } + return fKeyAdapter; + } + private Object getSelectedElement() { if (fTreeViewer == null) return null; @@ -426,6 +503,24 @@ public class QuickOutlinePopupDialog extends PopupDialog implements IInformation } } + protected void showNextConfiguration() { + AbstractQuickOutlineConfiguration nextConfiguration = fConfiguration.getNextConfiguration(); + if (nextConfiguration == null) { + nextConfiguration = fFirstConfiguration; + } + if (fConfiguration != nextConfiguration) { + fTreeViewer.setContentProvider(fContentProvider = nextConfiguration.getContentProvider()); + fTreeViewer.setLabelProvider(fLabelProvider = nextConfiguration.getLabelProvider()); + fSelectionProvider = nextConfiguration.getContentSelectionProvider(); + fFilter = nextConfiguration.getFilter(); + installFilter(); + fConfiguration = nextConfiguration; + fTreeViewer.refresh(true); + setMatcherString(fFilterText.getText(), true); + updateStatusText(); + } + } + public void widgetDisposed(DisposeEvent e) { fTreeViewer = null; fFilterText = null; @@ -437,4 +532,17 @@ public class QuickOutlinePopupDialog extends PopupDialog implements IInformation super.fillDialogMenu(dialogMenu); } + protected void updateStatusText() { + AbstractQuickOutlineConfiguration nextConfiguration = fConfiguration.getNextConfiguration(); + if (nextConfiguration == null) { + nextConfiguration = fFirstConfiguration; + } + if (fConfiguration != nextConfiguration && nextConfiguration.getShowMessage() != null) { + TriggerSequence[] sequences = getInvokingCommandKeySequences(); + if (sequences != null && sequences.length > 0) { + String keySequence = sequences[0].format(); + setInfoText(NLS.bind(nextConfiguration.getShowMessage(), keySequence)); + } + } + } } diff --git a/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/spelling/SpellcheckStrategy.java b/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/spelling/SpellcheckStrategy.java index 5f678b63b6..8801906876 100644 --- a/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/spelling/SpellcheckStrategy.java +++ b/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/spelling/SpellcheckStrategy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2018 IBM Corporation and others. + * Copyright (c) 2006, 2019 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 @@ -79,7 +79,7 @@ public class SpellcheckStrategy extends StructuredTextReconcilingStrategy { } private class SpellingProblemCollector implements ISpellingProblemCollector { - List annotations = new ArrayList(); + List<Annotation> annotations = new ArrayList<>(); public void accept(SpellingProblem problem) { if (isInterestingProblem(problem)) { @@ -106,7 +106,7 @@ public class SpellcheckStrategy extends StructuredTextReconcilingStrategy { } Annotation[] getAnnotations() { - return (Annotation[]) annotations.toArray(new Annotation[annotations.size()]); + return annotations.toArray(new Annotation[annotations.size()]); } } @@ -151,7 +151,7 @@ public class SpellcheckStrategy extends StructuredTextReconcilingStrategy { /** * Inherit spelling region rules */ - List contexts = new ArrayList(); + List<String> contexts = new ArrayList<>(); IContentType testType = contentType; final String[] ignoredDefinitions = ExtendedConfigurationBuilder.getInstance().getDefinitions("ignorebasetypes", testType.getId()); //$NON-NLS-1$ // Look for ignorebasetypes on spellingregions @@ -168,7 +168,7 @@ public class SpellcheckStrategy extends StructuredTextReconcilingStrategy { } testType = !ignoreBaseTypes ? testType.getBaseType() : null; } - fSupportedTextRegionContexts = (String[]) contexts.toArray(new String[contexts.size()]); + fSupportedTextRegionContexts = contexts.toArray(new String[contexts.size()]); fSpellCheckPreferenceListener = new SpellCheckPreferenceListener(); } @@ -182,11 +182,11 @@ public class SpellcheckStrategy extends StructuredTextReconcilingStrategy { } private TemporaryAnnotation[] getSpellingAnnotationsToRemove(IRegion region) { - List toRemove = new ArrayList(); + List<Annotation> toRemove = new ArrayList<>(); IAnnotationModel annotationModel = getAnnotationModel(); // can be null when closing the editor if (annotationModel != null) { - Iterator i = null; + Iterator<Annotation> i = null; boolean annotationOverlaps = false; if (annotationModel instanceof IAnnotationModelExtension2) { i = ((IAnnotationModelExtension2) annotationModel).getAnnotationIterator(region.getOffset(), region.getLength(), true, true); @@ -217,7 +217,7 @@ public class SpellcheckStrategy extends StructuredTextReconcilingStrategy { } } - return (TemporaryAnnotation[]) toRemove.toArray(new TemporaryAnnotation[toRemove.size()]); + return toRemove.toArray(new TemporaryAnnotation[toRemove.size()]); } /** @@ -350,7 +350,7 @@ public class SpellcheckStrategy extends StructuredTextReconcilingStrategy { if (annotationModel instanceof IAnnotationModelExtension) { IAnnotationModelExtension modelExtension = (IAnnotationModelExtension) annotationModel; - Map annotationsToAddMap = new HashMap(); + Map<Annotation,Position> annotationsToAddMap = new HashMap<>(); for (int i = 0; i < annotationsToAdd.length; i++) { annotationsToAddMap.put(annotationsToAdd[i], ((TemporaryAnnotation) annotationsToAdd[i]).getPosition()); } diff --git a/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/quickoutline/AbstractQuickOutlineConfiguration.java b/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/quickoutline/AbstractQuickOutlineConfiguration.java index bcb31a4513..c21e8f41ab 100644 --- a/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/quickoutline/AbstractQuickOutlineConfiguration.java +++ b/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/quickoutline/AbstractQuickOutlineConfiguration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 2019 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 @@ -46,4 +46,31 @@ public abstract class AbstractQuickOutlineConfiguration { public IContentSelectionProvider getContentSelectionProvider() { return null; } + + /** + * @return The filter that will apply the contents of the filter text box + * to what is shown by this configuration. + */ + public StringPatternFilter getFilter() { + return new StringPatternFilter(); + } + + /** + * @return the next configuration for the quick outline to cycle through, + * or <code>null</code> when the original contributed + * configuration should be shown next, or there are no others. + */ + public AbstractQuickOutlineConfiguration getNextConfiguration() { + return null; + } + + /** + * @return The string to show the user indicating what this configuration + * will do when active with an open placeholder for the trigger + * key binding, e.g. "Press ''{0}'' to filter on these things", + * or <code>null<.code> if it will not be shown. + */ + public String getShowMessage() { + return null; + } } diff --git a/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/filter/StringMatcher.java b/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/quickoutline/StringMatcher.java index 94b6d728e5..f158d7433a 100644 --- a/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/filter/StringMatcher.java +++ b/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/quickoutline/StringMatcher.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 IBM Corporation and others. + * Copyright (c) 2011, 2019 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 @@ -10,9 +10,10 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.wst.sse.ui.internal.filter; +package org.eclipse.wst.sse.ui.quickoutline; -import java.util.Vector; +import java.util.ArrayList; +import java.util.List; /** * A string pattern matcher. Supports '*' and '?' wildcards. @@ -29,7 +30,6 @@ public class StringMatcher { /* boundary value beyond which we don't need to search in the text */ protected int fBound= 0; - protected static final char fSingleWildCard= '\u0000'; public static class Position { @@ -241,7 +241,7 @@ public class StringMatcher { } } - Vector temp= new Vector(); + List<String> temp= new ArrayList<String>(); int pos= 0; StringBuffer buf= new StringBuffer(); @@ -266,7 +266,7 @@ public class StringMatcher { case '*': if (buf.length() > 0) { /* new segment */ - temp.addElement(buf.toString()); + temp.add(buf.toString()); fBound += buf.length(); buf.setLength(0); } @@ -282,12 +282,12 @@ public class StringMatcher { /* add last buffer to segment list */ if (buf.length() > 0) { - temp.addElement(buf.toString()); + temp.add(buf.toString()); fBound += buf.length(); } fSegments= new String[temp.size()]; - temp.copyInto(fSegments); + temp.toArray(fSegments); } /** * @param text a string which contains no wildcard diff --git a/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/quickoutline/StringPatternFilter.java b/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/quickoutline/StringPatternFilter.java index aef4060176..c74ed7df9f 100644 --- a/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/quickoutline/StringPatternFilter.java +++ b/core/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/quickoutline/StringPatternFilter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2011 IBM Corporation and others. + * Copyright (c) 2010, 2019 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 @@ -10,7 +10,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.wst.sse.ui.internal.quickoutline; +package org.eclipse.wst.sse.ui.quickoutline; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ITreeContentProvider; @@ -18,7 +18,7 @@ import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.osgi.util.TextProcessor; -import org.eclipse.wst.sse.ui.internal.filter.StringMatcher; +import org.eclipse.wst.sse.ui.internal.quickoutline.QuickOutlinePopupDialog; /** * Default Viewer Filter to be used by the {@link QuickOutlinePopupDialog} @@ -28,7 +28,7 @@ import org.eclipse.wst.sse.ui.internal.filter.StringMatcher; */ public class StringPatternFilter extends ViewerFilter { - private StringMatcher fStringMatcher; + protected StringMatcher fStringMatcher; /* * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) @@ -39,7 +39,7 @@ public class StringPatternFilter extends ViewerFilter { return true; TreeViewer treeViewer = (TreeViewer) viewer; - String matchName = ((ILabelProvider) treeViewer.getLabelProvider()).getText(element); + String matchName = getMatchLabel(element, treeViewer); matchName = TextProcessor.deprocess(matchName); if (matchName != null && matcher.match(matchName)) return true; @@ -47,6 +47,10 @@ public class StringPatternFilter extends ViewerFilter { return hasUnfilteredChild(treeViewer, element); } + protected String getMatchLabel(Object element, TreeViewer treeViewer) { + return ((ILabelProvider) treeViewer.getLabelProvider()).getText(element); + } + private boolean hasUnfilteredChild(TreeViewer viewer, Object element) { Object[] children= ((ITreeContentProvider) viewer.getContentProvider()).getChildren(element); for (int i= 0; i < children.length; i++) diff --git a/json/bundles/org.eclipse.wst.json.bower.ui/META-INF/MANIFEST.MF b/json/bundles/org.eclipse.wst.json.bower.ui/META-INF/MANIFEST.MF index ec5d727518..0a9a0230f7 100755 --- a/json/bundles/org.eclipse.wst.json.bower.ui/META-INF/MANIFEST.MF +++ b/json/bundles/org.eclipse.wst.json.bower.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.wst.json.bower.ui;singleton:=true -Bundle-Version: 1.0.100.qualifier +Bundle-Version: 1.0.200.qualifier Bundle-Activator: org.eclipse.wst.json.bower.ui.internal.BowerUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.wst.sse.core, com.ibm.icu, org.eclipse.core.resources, - org.eclipse.wst.sse.ui;bundle-version="[1.5.0,1.6.0)", + org.eclipse.wst.sse.ui;bundle-version="[1.5.0,2.0.0)", org.eclipse.jface, org.eclipse.ui, org.eclipse.jface.text, diff --git a/json/bundles/org.eclipse.wst.json.bower.ui/pom.xml b/json/bundles/org.eclipse.wst.json.bower.ui/pom.xml index 5322b040a6..cf1f6f3875 100644 --- a/json/bundles/org.eclipse.wst.json.bower.ui/pom.xml +++ b/json/bundles/org.eclipse.wst.json.bower.ui/pom.xml @@ -21,6 +21,6 @@ <groupId>org.eclipse.webtools.sourceediting</groupId> <artifactId>org.eclipse.wst.json.bower.ui</artifactId> - <version>1.0.100-SNAPSHOT</version> + <version>1.0.200-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/json/bundles/org.eclipse.wst.json.eslint.ui/META-INF/MANIFEST.MF b/json/bundles/org.eclipse.wst.json.eslint.ui/META-INF/MANIFEST.MF index c93df88576..6777a7f8fd 100755 --- a/json/bundles/org.eclipse.wst.json.eslint.ui/META-INF/MANIFEST.MF +++ b/json/bundles/org.eclipse.wst.json.eslint.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.wst.json.eslint.ui;singleton:=true -Bundle-Version: 1.0.100.qualifier +Bundle-Version: 1.0.200.qualifier Bundle-Activator: org.eclipse.wst.json.eslint.ui.internal.ESLintUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.wst.sse.core, com.ibm.icu, org.eclipse.core.resources, - org.eclipse.wst.sse.ui;bundle-version="[1.5.0,1.6.0)", + org.eclipse.wst.sse.ui;bundle-version="[1.5.0,2.0.0)", org.eclipse.jface, org.eclipse.ui, org.eclipse.jface.text, diff --git a/json/bundles/org.eclipse.wst.json.eslint.ui/pom.xml b/json/bundles/org.eclipse.wst.json.eslint.ui/pom.xml index b05c0095a3..03c2d4a339 100644 --- a/json/bundles/org.eclipse.wst.json.eslint.ui/pom.xml +++ b/json/bundles/org.eclipse.wst.json.eslint.ui/pom.xml @@ -21,6 +21,6 @@ <groupId>org.eclipse.webtools.sourceediting</groupId> <artifactId>org.eclipse.wst.json.eslint.ui</artifactId> - <version>1.0.100-SNAPSHOT</version> + <version>1.0.200-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/json/bundles/org.eclipse.wst.json.jshint.ui/META-INF/MANIFEST.MF b/json/bundles/org.eclipse.wst.json.jshint.ui/META-INF/MANIFEST.MF index 2592969614..dc631b24dd 100755 --- a/json/bundles/org.eclipse.wst.json.jshint.ui/META-INF/MANIFEST.MF +++ b/json/bundles/org.eclipse.wst.json.jshint.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.wst.json.jshint.ui;singleton:=true -Bundle-Version: 1.0.100.qualifier +Bundle-Version: 1.0.200.qualifier Bundle-Activator: org.eclipse.wst.json.jshint.ui.internal.JSHintUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.wst.sse.core, com.ibm.icu, org.eclipse.core.resources, - org.eclipse.wst.sse.ui;bundle-version="[1.5.0,1.6.0)", + org.eclipse.wst.sse.ui;bundle-version="[1.5.0,2.0.0)", org.eclipse.jface, org.eclipse.ui, org.eclipse.jface.text, diff --git a/json/bundles/org.eclipse.wst.json.jshint.ui/pom.xml b/json/bundles/org.eclipse.wst.json.jshint.ui/pom.xml index e786bd5b11..a53d610e15 100644 --- a/json/bundles/org.eclipse.wst.json.jshint.ui/pom.xml +++ b/json/bundles/org.eclipse.wst.json.jshint.ui/pom.xml @@ -21,6 +21,6 @@ <groupId>org.eclipse.webtools.sourceediting</groupId> <artifactId>org.eclipse.wst.json.jshint.ui</artifactId> - <version>1.0.100-SNAPSHOT</version> + <version>1.0.200-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/json/bundles/org.eclipse.wst.json.npm.ui/META-INF/MANIFEST.MF b/json/bundles/org.eclipse.wst.json.npm.ui/META-INF/MANIFEST.MF index 1b4ecd9faa..91652e582e 100755 --- a/json/bundles/org.eclipse.wst.json.npm.ui/META-INF/MANIFEST.MF +++ b/json/bundles/org.eclipse.wst.json.npm.ui/META-INF/MANIFEST.MF @@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.wst.sse.core, com.ibm.icu, org.eclipse.core.resources, - org.eclipse.wst.sse.ui;bundle-version="[1.5.0,1.6.0)", + org.eclipse.wst.sse.ui;bundle-version="[1.5.0,2.0.0)", org.eclipse.jface, org.eclipse.ui, org.eclipse.jface.text, diff --git a/json/bundles/org.eclipse.wst.json.ui/META-INF/MANIFEST.MF b/json/bundles/org.eclipse.wst.json.ui/META-INF/MANIFEST.MF index 10ae11b40a..47a557d479 100755 --- a/json/bundles/org.eclipse.wst.json.ui/META-INF/MANIFEST.MF +++ b/json/bundles/org.eclipse.wst.json.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.wst.json.ui;singleton:=true -Bundle-Version: 1.0.200.qualifier +Bundle-Version: 1.0.300.qualifier Bundle-Activator: org.eclipse.wst.json.ui.internal.JSONUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.wst.sse.core, com.ibm.icu, org.eclipse.core.resources, - org.eclipse.wst.sse.ui;bundle-version="[1.5.0,1.6.0)", + org.eclipse.wst.sse.ui;bundle-version="[1.5.0,2.0.0)", org.eclipse.jface, org.eclipse.ui, org.eclipse.jface.text, diff --git a/json/bundles/org.eclipse.wst.json.ui/pom.xml b/json/bundles/org.eclipse.wst.json.ui/pom.xml index f07d9c7b77..235f9b8f40 100644 --- a/json/bundles/org.eclipse.wst.json.ui/pom.xml +++ b/json/bundles/org.eclipse.wst.json.ui/pom.xml @@ -21,6 +21,6 @@ <groupId>org.eclipse.webtools.sourceediting</groupId> <artifactId>org.eclipse.wst.json.ui</artifactId> - <version>1.0.200-SNAPSHOT</version> + <version>1.0.300-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/json/features/org.eclipse.wst.json_core.feature/feature.xml b/json/features/org.eclipse.wst.json_core.feature/feature.xml index 914748c605..920cc8d5bc 100644 --- a/json/features/org.eclipse.wst.json_core.feature/feature.xml +++ b/json/features/org.eclipse.wst.json_core.feature/feature.xml @@ -15,7 +15,7 @@ <feature id="org.eclipse.wst.json_core.feature" label="%featureName" - version="1.1.4.qualifier" + version="1.1.5.qualifier" provider-name="%providerName" license-feature="org.eclipse.license" license-feature-version="2.0.0.qualifier"> diff --git a/json/features/org.eclipse.wst.json_core.feature/pom.xml b/json/features/org.eclipse.wst.json_core.feature/pom.xml index eb6383cf76..eb315673ee 100644 --- a/json/features/org.eclipse.wst.json_core.feature/pom.xml +++ b/json/features/org.eclipse.wst.json_core.feature/pom.xml @@ -21,7 +21,7 @@ <groupId>org.eclipse.webtools.sourceediting</groupId> <artifactId>org.eclipse.wst.json_core.feature</artifactId> - <version>1.1.4-SNAPSHOT</version> + <version>1.1.5-SNAPSHOT</version> <packaging>eclipse-feature</packaging> <build> diff --git a/json/features/org.eclipse.wst.json_sdk.feature/feature.xml b/json/features/org.eclipse.wst.json_sdk.feature/feature.xml index 20013e4395..03669d5ddd 100644 --- a/json/features/org.eclipse.wst.json_sdk.feature/feature.xml +++ b/json/features/org.eclipse.wst.json_sdk.feature/feature.xml @@ -15,7 +15,7 @@ <feature id="org.eclipse.wst.json_sdk.feature" label="%featureName" - version="1.1.5.qualifier" + version="1.1.6.qualifier" provider-name="%providerName" license-feature="org.eclipse.license" license-feature-version="2.0.0.qualifier"> diff --git a/json/features/org.eclipse.wst.json_sdk.feature/pom.xml b/json/features/org.eclipse.wst.json_sdk.feature/pom.xml index 360c7b2582..736a8e7697 100644 --- a/json/features/org.eclipse.wst.json_sdk.feature/pom.xml +++ b/json/features/org.eclipse.wst.json_sdk.feature/pom.xml @@ -21,6 +21,6 @@ <groupId>org.eclipse.webtools.sourceediting</groupId> <artifactId>org.eclipse.wst.json_sdk.feature</artifactId> - <version>1.1.5-SNAPSHOT</version> + <version>1.1.6-SNAPSHOT</version> <packaging>eclipse-feature</packaging> </project> diff --git a/json/features/org.eclipse.wst.json_ui.feature/feature.xml b/json/features/org.eclipse.wst.json_ui.feature/feature.xml index ae10de8ac6..ae08617de2 100644 --- a/json/features/org.eclipse.wst.json_ui.feature/feature.xml +++ b/json/features/org.eclipse.wst.json_ui.feature/feature.xml @@ -15,7 +15,7 @@ <feature id="org.eclipse.wst.json_ui.feature" label="%featureName" - version="1.1.4.qualifier" + version="1.1.5.qualifier" provider-name="%providerName" plugin="org.eclipse.wst.json.ui" license-feature="org.eclipse.license" diff --git a/json/features/org.eclipse.wst.json_ui.feature/pom.xml b/json/features/org.eclipse.wst.json_ui.feature/pom.xml index 41e24814a9..f095661a05 100644 --- a/json/features/org.eclipse.wst.json_ui.feature/pom.xml +++ b/json/features/org.eclipse.wst.json_ui.feature/pom.xml @@ -21,7 +21,7 @@ <groupId>org.eclipse.webtools.sourceediting</groupId> <artifactId>org.eclipse.wst.json_ui.feature</artifactId> - <version>1.1.4-SNAPSHOT</version> + <version>1.1.5-SNAPSHOT</version> <packaging>eclipse-feature</packaging> <build> diff --git a/web/bundles/org.eclipse.jst.jsp.ui/META-INF/MANIFEST.MF b/web/bundles/org.eclipse.jst.jsp.ui/META-INF/MANIFEST.MF index 1a68e541b2..7301a41388 100755 --- a/web/bundles/org.eclipse.jst.jsp.ui/META-INF/MANIFEST.MF +++ b/web/bundles/org.eclipse.jst.jsp.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.jst.jsp.ui; singleton:=true -Bundle-Version: 1.2.100.qualifier +Bundle-Version: 1.2.200.qualifier Bundle-Activator: org.eclipse.jst.jsp.ui.internal.JSPUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -42,7 +42,7 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.14.0,4.0.0)", org.eclipse.ui.workbench.texteditor;bundle-version="[3.10.0,4.0.0)", org.eclipse.ui;bundle-version="[3.109.0,4.0.0)", org.eclipse.ui.forms;bundle-version="[3.7.0,4.0.0]", - org.eclipse.wst.sse.ui;bundle-version="[1.5.0,1.6.0)", + org.eclipse.wst.sse.ui;bundle-version="[1.5.0,2.0.0)", org.eclipse.wst.html.ui;bundle-version="[1.1.0,1.2.0)", org.eclipse.wst.css.ui;bundle-version="[1.1.0,1.2.0)", org.eclipse.wst.xml.ui;bundle-version="[1.2.0,1.3.0)", diff --git a/web/bundles/org.eclipse.jst.jsp.ui/pom.xml b/web/bundles/org.eclipse.jst.jsp.ui/pom.xml index a693d03e12..ad0a5c7866 100644 --- a/web/bundles/org.eclipse.jst.jsp.ui/pom.xml +++ b/web/bundles/org.eclipse.jst.jsp.ui/pom.xml @@ -21,6 +21,6 @@ <groupId>org.eclipse.webtools.sourceediting</groupId> <artifactId>org.eclipse.jst.jsp.ui</artifactId> - <version>1.2.100-SNAPSHOT</version> + <version>1.2.200-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/web/bundles/org.eclipse.wst.css.core/plugin.xml b/web/bundles/org.eclipse.wst.css.core/plugin.xml index fd25eafd79..350789a052 100644 --- a/web/bundles/org.eclipse.wst.css.core/plugin.xml +++ b/web/bundles/org.eclipse.wst.css.core/plugin.xml @@ -79,7 +79,7 @@ <extension point="org.eclipse.core.contenttype.contentTypes"> <content-type file-extensions="css" - priority="high" + priority="normal" name="%CSS_Content_Type_Extension_Element.name" id="org.eclipse.wst.css.core.csssource" base-type="org.eclipse.core.runtime.text"> diff --git a/web/bundles/org.eclipse.wst.css.ui/META-INF/MANIFEST.MF b/web/bundles/org.eclipse.wst.css.ui/META-INF/MANIFEST.MF index ef20d62373..2d0947e165 100755 --- a/web/bundles/org.eclipse.wst.css.ui/META-INF/MANIFEST.MF +++ b/web/bundles/org.eclipse.wst.css.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.wst.css.ui; singleton:=true -Bundle-Version: 1.1.100.qualifier +Bundle-Version: 1.1.200.qualifier Bundle-Activator: org.eclipse.wst.css.ui.internal.CSSUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -38,7 +38,7 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.14.0,4.0.0)", org.eclipse.ui.workbench.texteditor;bundle-version="[3.10.0,4.0.0)", org.eclipse.ui;bundle-version="[3.109.0,4.0.0)", org.eclipse.wst.xml.ui;bundle-version="[1.2.0,1.3.0)", - org.eclipse.wst.sse.ui;bundle-version="[1.5.0,1.6.0)", + org.eclipse.wst.sse.ui;bundle-version="[1.5.0,2.0.0)", org.eclipse.wst.css.core;bundle-version="[1.2.0,1.3.0)", org.eclipse.wst.sse.core;bundle-version="[1.2.0,1.3.0)", org.eclipse.wst.html.core;bundle-version="[1.3.0,1.4.0)", diff --git a/web/bundles/org.eclipse.wst.css.ui/pom.xml b/web/bundles/org.eclipse.wst.css.ui/pom.xml index 49459a5633..7e37925b6c 100644 --- a/web/bundles/org.eclipse.wst.css.ui/pom.xml +++ b/web/bundles/org.eclipse.wst.css.ui/pom.xml @@ -21,6 +21,6 @@ <groupId>org.eclipse.webtools.sourceediting</groupId> <artifactId>org.eclipse.wst.css.ui</artifactId> - <version>1.1.100-SNAPSHOT</version> + <version>1.1.200-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/web/bundles/org.eclipse.wst.html.core/META-INF/MANIFEST.MF b/web/bundles/org.eclipse.wst.html.core/META-INF/MANIFEST.MF index db7e298823..c903ee2543 100644 --- a/web/bundles/org.eclipse.wst.html.core/META-INF/MANIFEST.MF +++ b/web/bundles/org.eclipse.wst.html.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.wst.html.core; singleton:=true -Bundle-Version: 1.3.0.qualifier +Bundle-Version: 1.3.100.qualifier Bundle-Activator: org.eclipse.wst.html.core.internal.HTMLCorePlugin Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/web/bundles/org.eclipse.wst.html.core/plugin.xml b/web/bundles/org.eclipse.wst.html.core/plugin.xml index df9e8d268c..dc9393b4c3 100644 --- a/web/bundles/org.eclipse.wst.html.core/plugin.xml +++ b/web/bundles/org.eclipse.wst.html.core/plugin.xml @@ -126,7 +126,7 @@ <extension point="org.eclipse.core.contenttype.contentTypes"> <content-type file-extensions="html,htm,xhtml,htpl,wml,shtml,shtm" - priority="high" + priority="normal" name="%HTML_Content_Type_Extension_Element.name" id="org.eclipse.wst.html.core.htmlsource" base-type="org.eclipse.core.runtime.text"> diff --git a/web/bundles/org.eclipse.wst.html.core/pom.xml b/web/bundles/org.eclipse.wst.html.core/pom.xml index 58ce7d6468..14d19721e5 100644 --- a/web/bundles/org.eclipse.wst.html.core/pom.xml +++ b/web/bundles/org.eclipse.wst.html.core/pom.xml @@ -21,6 +21,6 @@ <groupId>org.eclipse.webtools.sourceediting</groupId> <artifactId>org.eclipse.wst.html.core</artifactId> - <version>1.3.0-SNAPSHOT</version> + <version>1.3.100-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/JSP20ElementCollection.java b/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/JSP20ElementCollection.java index 7124adb9b3..312caf2b11 100644 --- a/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/JSP20ElementCollection.java +++ b/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/JSP20ElementCollection.java @@ -23,7 +23,7 @@ import org.eclipse.wst.xml.core.internal.contentmodel.CMGroup; import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; /** - * Factory for element declarations of JSP 1.1 and JSP 1.2. + * Factory for element declarations of JSP 2.0 */ class JSP20ElementCollection extends JSPElementCollection implements JSP20Namespace.ElementName { diff --git a/web/bundles/org.eclipse.wst.html.ui/META-INF/MANIFEST.MF b/web/bundles/org.eclipse.wst.html.ui/META-INF/MANIFEST.MF index ca14566193..12fe18523d 100755 --- a/web/bundles/org.eclipse.wst.html.ui/META-INF/MANIFEST.MF +++ b/web/bundles/org.eclipse.wst.html.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.wst.html.ui; singleton:=true -Bundle-Version: 1.1.100.qualifier +Bundle-Version: 1.1.200.qualifier Bundle-Activator: org.eclipse.wst.html.ui.internal.HTMLUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -36,7 +36,7 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.12.0,4.0.0)", org.eclipse.ui.workbench.texteditor;bundle-version="[3.10.0,4.0.0)", org.eclipse.ui.forms;bundle-version="[3.7.0,4.0.0)", org.eclipse.ui;bundle-version="[3.107.0,4.0.0)", - org.eclipse.wst.sse.ui;bundle-version="[1.5.0,1.6.0)", + org.eclipse.wst.sse.ui;bundle-version="[1.5.0,2.0.0)", org.eclipse.wst.xml.ui;bundle-version="[1.2.0,1.3.0)", org.eclipse.wst.css.ui;bundle-version="[1.1.0,1.2.0)", org.eclipse.wst.sse.core;bundle-version="[1.2.0,1.3.0)", diff --git a/web/bundles/org.eclipse.wst.html.ui/pom.xml b/web/bundles/org.eclipse.wst.html.ui/pom.xml index f7173f4f0c..6f21dc2baf 100644 --- a/web/bundles/org.eclipse.wst.html.ui/pom.xml +++ b/web/bundles/org.eclipse.wst.html.ui/pom.xml @@ -21,6 +21,6 @@ <groupId>org.eclipse.webtools.sourceediting</groupId> <artifactId>org.eclipse.wst.html.ui</artifactId> - <version>1.1.100-SNAPSHOT</version> + <version>1.1.200-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/xml/bundles/org.eclipse.wst.dtd.ui/META-INF/MANIFEST.MF b/xml/bundles/org.eclipse.wst.dtd.ui/META-INF/MANIFEST.MF index f8ab2d38d3..aa97c8ad44 100755 --- a/xml/bundles/org.eclipse.wst.dtd.ui/META-INF/MANIFEST.MF +++ b/xml/bundles/org.eclipse.wst.dtd.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.wst.dtd.ui; singleton:=true -Bundle-Version: 1.1.100.qualifier +Bundle-Version: 1.1.200.qualifier Bundle-Activator: org.eclipse.wst.dtd.ui.internal.DTDUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -31,7 +31,7 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.13.0,4.0.0)", org.eclipse.wst.common.ui;bundle-version="[1.1.500,1.2.0)", org.eclipse.wst.dtd.core;bundle-version="[1.2.0,1.3.0)", org.eclipse.wst.sse.core;bundle-version="[1.2.0,1.3.0)", - org.eclipse.wst.sse.ui;bundle-version="[1.5.0,1.6.0)", + org.eclipse.wst.sse.ui;bundle-version="[1.5.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.0,1.3.0)", org.eclipse.wst.common.uriresolver;bundle-version="[1.2.0,2.0.0)", diff --git a/xml/bundles/org.eclipse.wst.dtd.ui/pom.xml b/xml/bundles/org.eclipse.wst.dtd.ui/pom.xml index fa21163ead..f3a72d0fcd 100644 --- a/xml/bundles/org.eclipse.wst.dtd.ui/pom.xml +++ b/xml/bundles/org.eclipse.wst.dtd.ui/pom.xml @@ -21,7 +21,7 @@ <groupId>org.eclipse.webtools.sourceediting</groupId> <artifactId>org.eclipse.wst.dtd.ui</artifactId> - <version>1.1.100-SNAPSHOT</version> + <version>1.1.200-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> <!-- added this "constraint" for bug 458962 --> 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 9b9f58a9f2..bc75bf132f 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.200.qualifier +Bundle-Version: 1.2.300.qualifier Bundle-Activator: org.eclipse.wst.xml.ui.internal.XMLUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -54,7 +54,7 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.14.0,4.0.0)", org.eclipse.ui.views;bundle-version="[3.9.0,4.0.0)", org.eclipse.jface.text;bundle-version="[3.13.0,4.0.0)", org.eclipse.ui.workbench.texteditor;bundle-version="[3.10.0,4.0.0)", - org.eclipse.wst.sse.ui;bundle-version="[1.5.0,1.6.0)", + org.eclipse.wst.sse.ui;bundle-version="[1.6.0,2.0.0)", org.eclipse.wst.sse.core;bundle-version="[1.2.0,1.3.0)", org.eclipse.ui;bundle-version="[3.109.0,4.0.0)", org.eclipse.core.resources;bundle-version="[3.13.0,4.0.0)", diff --git a/xml/bundles/org.eclipse.wst.xml.ui/pom.xml b/xml/bundles/org.eclipse.wst.xml.ui/pom.xml index 71c024959d..889d46b6e3 100644 --- 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.200-SNAPSHOT</version> + <version>1.2.300-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> <build> diff --git a/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java b/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java index b623b4ec70..9bf73a3748 100644 --- a/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java +++ b/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java @@ -1,5 +1,5 @@ /********************************************************************** - * Copyright (c) 2005, 2017 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2005, 2019 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 https://www.eclipse.org/legal/epl-2.0/ @@ -350,6 +350,9 @@ public class XMLUIMessages extends NLS { public static String Tag_name_missing; public static String Whitespace_at_start; + public static String QuickOutlineShowAttributes; + public static String QuickOutlineHideAttributes; + static { // load message values from bundle file NLS.initializeMessages(BUNDLE_NAME, XMLUIMessages.class); diff --git a/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties b/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties index 7ba35a364b..64fb9a73eb 100644 --- a/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties +++ b/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties @@ -378,3 +378,5 @@ Namespace_in_pi_target=In&valid name space in PI: Tag_name_missing=Missing tag n&ame: Whitespace_at_start=Inva&lid white space at start: _ERROR_XML_ATTRIBUTE_IS_INVALID=\"{0}\" is not a valid attribute name +QuickOutlineHideAttributes=Press ''{0}'' to filter on node names +QuickOutlineShowAttributes=Press ''{0}'' to filter on identifiers and content diff --git a/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/quickoutline/AttributeShowingLabelProvider.java b/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/quickoutline/AttributeShowingLabelProvider.java new file mode 100644 index 0000000000..34c7082553 --- /dev/null +++ b/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/quickoutline/AttributeShowingLabelProvider.java @@ -0,0 +1,291 @@ +package org.eclipse.wst.xml.ui.internal.quickoutline;
+
+import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
+import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMDataType;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery;
+import org.eclipse.wst.xml.core.internal.modelquery.ModelQueryUtil;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeLabelProvider;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+public class AttributeShowingLabelProvider extends JFaceNodeLabelProvider implements IStyledLabelProvider {
+ static final String ATTR_NAME = "name";
+ static final String ATTR_ID = "id";
+ private boolean fShowAttributes;
+ /**
+ * The maximum length of an element's "pulled up" text content. Never
+ * decrease to under 4.
+ */
+ static final int MAX_ELEMENTTEXT_LENGTH = 72;
+
+ public boolean isLabelProperty(Object element, String property) {
+ return true;
+ }
+
+ protected String firstLine(String s) {
+ String truncated = s;
+ int n = 0;
+ if ((n = truncated.indexOf('\r')) >= 0) {
+ truncated = truncated.substring(0, n);
+ }
+ if ((n = truncated.indexOf('\n')) >= 0) {
+ truncated = truncated.substring(0, n);
+ }
+ return truncated;
+ }
+
+ public Node getAttributeToShow(Element element) {
+ NamedNodeMap attributes = element.getAttributes();
+ Node idTypedAttribute = null;
+ Node requiredAttribute = null;
+ boolean hasId = false;
+ boolean hasName = false;
+ Node shownAttribute = null;
+
+ // try to get content model element
+ // declaration
+ CMElementDeclaration elementDecl = null;
+ ModelQuery mq = ModelQueryUtil.getModelQuery(element.getOwnerDocument());
+ if (mq != null) {
+ elementDecl = mq.getCMElementDeclaration(element);
+ }
+ // find an attribute of type (or just named)
+ // ID
+ if (elementDecl != null) {
+ final CMNamedNodeMap attributeDeclarationMap = elementDecl.getAttributes();
+ int i = 0;
+ while (i < attributes.getLength() && idTypedAttribute == null) {
+ Node attr = attributes.item(i);
+ String attrName = attr.getNodeName();
+ CMAttributeDeclaration attrDecl = (CMAttributeDeclaration) attributeDeclarationMap.getNamedItem(attrName);
+ if (attrDecl != null) {
+ if ((attrDecl.getAttrType() != null) && (CMDataType.ID.equals(attrDecl.getAttrType().getDataTypeName()))) {
+ idTypedAttribute = attr;
+ }
+ else if ((attrDecl.getUsage() == CMAttributeDeclaration.REQUIRED) && (requiredAttribute == null)) {
+ /*
+ * as a backup, keep tabs on any required
+ * attributes
+ */
+ requiredAttribute = attr;
+ }
+ else {
+ hasId = hasId || attrName.equals(ATTR_ID);
+ hasName = hasName || attrName.equals(ATTR_NAME);
+ }
+ }
+ ++i;
+ }
+ }
+
+ /*
+ * If no suitable attribute with type "ID" was found, then prefer
+ * "id" or "name", otherwise try using a required attribute, if
+ * none, then just use the first attribute
+ */
+ if (idTypedAttribute != null) {
+ shownAttribute = idTypedAttribute;
+ }
+ else if (hasId) {
+ shownAttribute = attributes.getNamedItem(ATTR_ID);
+ }
+ else if (hasName) {
+ shownAttribute = attributes.getNamedItem(ATTR_NAME);
+ }
+ else if (requiredAttribute != null) {
+ shownAttribute = requiredAttribute;
+ }
+ if (shownAttribute == null) {
+ shownAttribute = attributes.item(0);
+ }
+
+ return shownAttribute;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ */
+ public String getText(Object o) {
+ if (fShowAttributes && o instanceof Node) {
+ Node node = (Node) o;
+ StringBuffer buffer = new StringBuffer();
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ buffer.append(super.getText(node));
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88444
+ if (node.hasAttributes()) {
+ Node shownAttribute = getAttributeToShow((Element) node);
+ if (shownAttribute != null) {
+ String attributeName = shownAttribute.getNodeName();
+ if (attributeName != null && attributeName.length() > 0) {
+ String attributeValue = shownAttribute.getNodeValue();
+ if (attributeValue != null) {
+ buffer.append(" "); //$NON-NLS-1$
+ buffer.append(attributeName);
+ // https://bugs.eclipse.org/486252
+ buffer.append("="); //$NON-NLS-1$
+ buffer.append(attributeValue);
+ }
+ }
+ }
+ }
+ else if (node instanceof IDOMElement) {
+ Node possibleText = node.getFirstChild();
+ if (possibleText != null && possibleText.getNextSibling() == null && possibleText.getNodeType() == Node.TEXT_NODE) {
+ buffer.append(" : ");
+ String truncatedFirstLine = firstLine(possibleText.getNodeValue().trim());
+ if (truncatedFirstLine.length() > MAX_ELEMENTTEXT_LENGTH) {
+ buffer.append(truncatedFirstLine.substring(0, MAX_ELEMENTTEXT_LENGTH-3));
+ buffer.append("...");
+ }
+ else {
+ buffer.append(truncatedFirstLine);
+ }
+ }
+ }
+ }
+ else {
+ buffer.append(super.getText(node));
+ }
+ return buffer.toString();
+ }
+ return super.toString();
+ }
+
+ String getIdMatchValue(Object o) {
+ if (o instanceof Node) {
+ Node node = (Node) o;
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88444
+ if (node.hasAttributes()) {
+ Node shownAttribute = getAttributeToShow((Element) node);
+ if (shownAttribute != null) {
+ String attributeName = shownAttribute.getNodeName();
+ if (attributeName != null && attributeName.length() > 0) {
+ String attributeValue = shownAttribute.getNodeValue();
+ if (attributeValue != null) {
+ return attributeValue;
+ }
+ }
+ }
+ }
+ else if (node instanceof IDOMElement) {
+ Node possibleText = node.getFirstChild();
+ if (possibleText != null && possibleText.getNextSibling() == null && possibleText.getNodeType() == Node.TEXT_NODE) {
+ String firstContentLine = firstLine(possibleText.getNodeValue().trim());
+ return firstContentLine;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.CellLabelProvider#getToolTipText(java.lang.Object)
+ */
+ public String getToolTipText(Object element) {
+ if (element instanceof Node) {
+ switch (((Node) element).getNodeType()) {
+ case Node.COMMENT_NODE :
+ case Node.CDATA_SECTION_NODE :
+ case Node.PROCESSING_INSTRUCTION_NODE :
+ case Node.TEXT_NODE : {
+ String nodeValue = ((Node) element).getNodeValue().trim();
+ return prepareText(nodeValue);
+ }
+ case Node.ELEMENT_NODE : {
+ // show the preceding comment's tooltip information
+ Node previous = ((Node) element).getPreviousSibling();
+ if (previous != null && previous.getNodeType() == Node.TEXT_NODE)
+ previous = previous.getPreviousSibling();
+ if (previous != null && previous.getNodeType() == Node.COMMENT_NODE)
+ return getToolTipText(previous);
+ }
+ }
+ }
+ return super.getToolTipText(element);
+ }
+
+ /**
+ * Remove leading indentation from each line in the give string.
+ * @param text
+ * @return
+ */
+ private String prepareText(String text) {
+ StringBuffer nodeText = new StringBuffer();
+ for (int i = 0; i < text.length(); i++) {
+ char c = text.charAt(i);
+ if (c != '\r' && c != '\n') {
+ nodeText.append(c);
+ }
+ else if (c == '\r' || c == '\n') {
+ nodeText.append('\n');
+ while (Character.isWhitespace(c) && i < text.length()) {
+ i++;
+ c = text.charAt(i);
+ }
+ nodeText.append(c);
+ }
+ }
+ return nodeText.toString();
+ }
+
+ public StyledString getStyledText(Object element) {
+ if (element instanceof Node) {
+ Node node = (Node) element;
+ StyledString styleString = new StyledString();
+ if (fShowAttributes && node.getNodeType() == Node.ELEMENT_NODE) {
+ styleString.append(super.getText(node));
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88444
+ if (node.hasAttributes()) {
+ Node shownAttribute = getAttributeToShow((Element) node);
+ if (shownAttribute != null) {
+ // display the attribute and styled value
+ String attributeName = shownAttribute.getNodeName();
+ if (attributeName != null && attributeName.length() > 0) {
+ String attributeValue = shownAttribute.getNodeValue();
+ if (attributeValue != null) {
+ StringBuffer buffer = new StringBuffer(" "); //$NON-NLS-1$
+ buffer.append(attributeName);
+ // https://bugs.eclipse.org/486252
+ buffer.append("="); //$NON-NLS-1$
+ buffer.append(attributeValue);
+ styleString.append(buffer.toString(), StyledString.DECORATIONS_STYLER);
+ }
+ }
+ }
+ }
+ else {
+ Node possibleText = node.getFirstChild();
+ if (possibleText != null && possibleText.getNextSibling() == null && possibleText.getNodeType() == Node.TEXT_NODE) {
+ styleString.append(" : ");
+ String truncatedFirstLine = firstLine(possibleText.getNodeValue().trim());
+ if (truncatedFirstLine.length() > MAX_ELEMENTTEXT_LENGTH) {
+ styleString.append(truncatedFirstLine.substring(0, MAX_ELEMENTTEXT_LENGTH-3), StyledString.DECORATIONS_STYLER);
+ styleString.append("...", StyledString.DECORATIONS_STYLER);
+ }
+ else {
+ styleString.append(truncatedFirstLine, StyledString.DECORATIONS_STYLER);
+ }
+ }
+ }
+ }
+ else {
+ styleString.append(super.getText(node));
+ }
+ return styleString;
+ }
+ return new StyledString(getText(element));
+ }
+ public void showAttributes(boolean doShow) {
+ fShowAttributes = doShow;
+ }
+}
diff --git a/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/quickoutline/XMLQuickOutlineConfiguration.java b/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/quickoutline/XMLQuickOutlineConfiguration.java index f4bbddaa0b..ddd53854aa 100644 --- a/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/quickoutline/XMLQuickOutlineConfiguration.java +++ b/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/quickoutline/XMLQuickOutlineConfiguration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 2019 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 @@ -16,30 +16,48 @@ import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.wst.sse.ui.IContentSelectionProvider; import org.eclipse.wst.sse.ui.quickoutline.AbstractQuickOutlineConfiguration; +import org.eclipse.wst.xml.ui.internal.XMLUIMessages; import org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeContentProvider; import org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeLabelProvider; public class XMLQuickOutlineConfiguration extends AbstractQuickOutlineConfiguration { + XMLQuickOutlineConfigurationForAttributes fNext = new XMLQuickOutlineConfigurationForAttributes(); - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.wst.sse.ui.IOutlineContentManager#getContentProvider() */ public ITreeContentProvider getContentProvider() { return new JFaceNodeContentProvider(); } - /* (non-Javadoc) - * @see org.eclipse.wst.sse.ui.IOutlineContentManager#getContentSelectionProvider() + /* + * (non-Javadoc) + * + * @see org.eclipse.wst.sse.ui.IOutlineContentManager# + * getContentSelectionProvider() */ public IContentSelectionProvider getContentSelectionProvider() { return new XMLContentSelectionProvider(); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.wst.sse.ui.IOutlineContentManager#getLabelProvider() */ public ILabelProvider getLabelProvider() { return new JFaceNodeLabelProvider(); } + @Override + public AbstractQuickOutlineConfiguration getNextConfiguration() { + return fNext; + } + + @Override + public String getShowMessage() { + return XMLUIMessages.QuickOutlineHideAttributes; + } } diff --git a/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/quickoutline/XMLQuickOutlineConfigurationForAttributes.java b/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/quickoutline/XMLQuickOutlineConfigurationForAttributes.java new file mode 100644 index 0000000000..d8570d93fa --- /dev/null +++ b/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/quickoutline/XMLQuickOutlineConfigurationForAttributes.java @@ -0,0 +1,112 @@ +/******************************************************************************* + * Copyright (c) 2010, 2019 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 + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.xml.ui.internal.quickoutline; + +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.wst.sse.ui.IContentSelectionProvider; +import org.eclipse.wst.sse.ui.quickoutline.AbstractQuickOutlineConfiguration; +import org.eclipse.wst.sse.ui.quickoutline.StringMatcher; +import org.eclipse.wst.sse.ui.quickoutline.StringPatternFilter; +import org.eclipse.wst.xml.ui.internal.XMLUIMessages; +import org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeContentProvider; + +public final class XMLQuickOutlineConfigurationForAttributes extends AbstractQuickOutlineConfiguration { + static class IdMatcher extends StringMatcher { + public IdMatcher(String pattern, boolean ignoreCase, boolean ignoreWildCards) { + super(pattern, ignoreCase, ignoreWildCards); + } + + @Override + public boolean match(String text) { + int valueStart; + int length = text.length(); + /* + * This is very imprecise, but there's not enough shared context + * to be smarter + */ + if ((valueStart = text.indexOf('=', 1)) > 1) { + System.out.println("Match '" + fPattern + "' to '" + text.substring(valueStart + 1) + "'"); + if (valueStart + 1 < length) + return match(text, valueStart + 1, length); + } + if ((valueStart = text.indexOf(" : ", 1)) > 1) { + System.out.println("Match '" + fPattern + "' to '" + text.substring(valueStart + 3) + "'"); + if (valueStart + 3 < length) { + return match(text, valueStart + 3, length); + } + } + return super.match(text); + } + } + AttributeShowingLabelProvider labelProvider = new AttributeShowingLabelProvider(); + + /* + * (non-Javadoc) + * + * @see org.eclipse.wst.sse.ui.IOutlineContentManager#getContentProvider() + */ + public ITreeContentProvider getContentProvider() { + return new JFaceNodeContentProvider(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.wst.sse.ui.IOutlineContentManager# + * getContentSelectionProvider() + */ + public IContentSelectionProvider getContentSelectionProvider() { + return new XMLContentSelectionProvider(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.wst.sse.ui.IOutlineContentManager#getLabelProvider() + */ + public ILabelProvider getLabelProvider() { + labelProvider.showAttributes(true); + return labelProvider; + } + + @Override + public String getShowMessage() { + return XMLUIMessages.QuickOutlineShowAttributes; + } + + @Override + public StringPatternFilter getFilter() { + return new StringPatternFilter() { + public void updatePattern(String pattern) { + if (pattern.length() == 0) { + fStringMatcher = null; + } + else { + fStringMatcher = new IdMatcher(pattern, pattern.toLowerCase().equals(pattern), false); + } + + } + + @Override + protected String getMatchLabel(Object element, TreeViewer treeViewer) { + String matchLabel = labelProvider.getIdMatchValue(element); + if (matchLabel != null) { + return matchLabel; + } + return super.getMatchLabel(element, treeViewer); + } + }; + } +} diff --git a/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/views/contentoutline/XMLContentOutlineConfiguration.java b/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/views/contentoutline/XMLContentOutlineConfiguration.java index 806b01e212..47d3758774 100644 --- a/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/views/contentoutline/XMLContentOutlineConfiguration.java +++ b/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/views/contentoutline/XMLContentOutlineConfiguration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2016 IBM Corporation and others. + * Copyright (c) 2001, 2019 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 @@ -16,31 +16,21 @@ package org.eclipse.wst.xml.ui.views.contentoutline; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; import org.eclipse.jface.viewers.IContentProvider; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StyledString; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.wst.sse.ui.internal.contentoutline.PropertyChangeUpdateAction; import org.eclipse.wst.sse.ui.internal.contentoutline.PropertyChangeUpdateActionContributionItem; import org.eclipse.wst.sse.ui.internal.editor.EditorPluginImageHelper; import org.eclipse.wst.sse.ui.internal.editor.EditorPluginImages; -import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDataType; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap; -import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery; -import org.eclipse.wst.xml.core.internal.modelquery.ModelQueryUtil; import org.eclipse.wst.xml.ui.internal.XMLUIMessages; import org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeContentProvider; -import org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeLabelProvider; import org.eclipse.wst.xml.ui.internal.preferences.XMLUIPreferenceNames; +import org.eclipse.wst.xml.ui.internal.quickoutline.AttributeShowingLabelProvider; import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; /** @@ -51,196 +41,6 @@ import org.w3c.dom.Node; * @since 1.0 */ public class XMLContentOutlineConfiguration extends AbstractXMLContentOutlineConfiguration { - static final String ATTR_NAME = "name"; - static final String ATTR_ID = "id"; - - private class AttributeShowingLabelProvider extends JFaceNodeLabelProvider implements IStyledLabelProvider { - public boolean isLabelProperty(Object element, String property) { - return true; - } - - private Node getAttributeToShow(Element element) { - NamedNodeMap attributes = element.getAttributes(); - Node idTypedAttribute = null; - Node requiredAttribute = null; - boolean hasId = false; - boolean hasName = false; - Node shownAttribute = null; - - // try to get content model element - // declaration - CMElementDeclaration elementDecl = null; - ModelQuery mq = ModelQueryUtil.getModelQuery(element.getOwnerDocument()); - if (mq != null) { - elementDecl = mq.getCMElementDeclaration(element); - } - // find an attribute of type (or just named) - // ID - if (elementDecl != null) { - final CMNamedNodeMap attributeDeclarationMap = elementDecl.getAttributes(); - int i = 0; - while (i < attributes.getLength() && idTypedAttribute == null) { - Node attr = attributes.item(i); - String attrName = attr.getNodeName(); - CMAttributeDeclaration attrDecl = (CMAttributeDeclaration) attributeDeclarationMap.getNamedItem(attrName); - if (attrDecl != null) { - if ((attrDecl.getAttrType() != null) && (CMDataType.ID.equals(attrDecl.getAttrType().getDataTypeName()))) { - idTypedAttribute = attr; - } - else if ((attrDecl.getUsage() == CMAttributeDeclaration.REQUIRED) && (requiredAttribute == null)) { - /* - * as a backup, keep tabs on any required - * attributes - */ - requiredAttribute = attr; - } - else { - hasId = hasId || attrName.equals(ATTR_ID); - hasName = hasName || attrName.equals(ATTR_NAME); - } - } - ++i; - } - } - - /* - * If no suitable attribute with type "ID" was found, then prefer - * "id" or "name", otherwise try using a required attribute, if - * none, then just use the first attribute - */ - if (idTypedAttribute != null) { - shownAttribute = idTypedAttribute; - } - else if (hasId) { - shownAttribute = attributes.getNamedItem(ATTR_ID); - } - else if (hasName) { - shownAttribute = attributes.getNamedItem(ATTR_NAME); - } - else if (requiredAttribute != null) { - shownAttribute = requiredAttribute; - } - if (shownAttribute == null) { - shownAttribute = attributes.item(0); - } - - return shownAttribute; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) - */ - public String getText(Object o) { - if (o instanceof Node) { - Node node = (Node) o; - StringBuffer buffer = new StringBuffer(super.getText(node)); - if (node.getNodeType() == Node.ELEMENT_NODE && fShowAttributes) { - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88444 - if (node.hasAttributes()) { - Node shownAttribute = getAttributeToShow((Element) node); - if (shownAttribute != null) { - String attributeName = shownAttribute.getNodeName(); - if (attributeName != null && attributeName.length() > 0) { - String attributeValue = shownAttribute.getNodeValue(); - if (attributeValue != null) { - buffer.append(" "); //$NON-NLS-1$ - buffer.append(attributeName); - // https://bugs.eclipse.org/486252 - buffer.append("="); //$NON-NLS-1$ - buffer.append(attributeValue); - } - } - } - } - } - return buffer.toString(); - } - return super.toString(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.CellLabelProvider#getToolTipText(java.lang.Object) - */ - public String getToolTipText(Object element) { - if (element instanceof Node) { - switch (((Node) element).getNodeType()) { - case Node.COMMENT_NODE : - case Node.CDATA_SECTION_NODE : - case Node.PROCESSING_INSTRUCTION_NODE : - case Node.TEXT_NODE : { - String nodeValue = ((Node) element).getNodeValue().trim(); - return prepareText(nodeValue); - } - case Node.ELEMENT_NODE : { - // show the preceding comment's tooltip information - Node previous = ((Node) element).getPreviousSibling(); - if (previous != null && previous.getNodeType() == Node.TEXT_NODE) - previous = previous.getPreviousSibling(); - if (previous != null && previous.getNodeType() == Node.COMMENT_NODE) - return getToolTipText(previous); - } - } - } - return super.getToolTipText(element); - } - - /** - * Remove leading indentation from each line in the give string. - * @param text - * @return - */ - private String prepareText(String text) { - StringBuffer nodeText = new StringBuffer(); - for (int i = 0; i < text.length(); i++) { - char c = text.charAt(i); - if (c != '\r' && c != '\n') { - nodeText.append(c); - } - else if (c == '\r' || c == '\n') { - nodeText.append('\n'); - while (Character.isWhitespace(c) && i < text.length()) { - i++; - c = text.charAt(i); - } - nodeText.append(c); - } - } - return nodeText.toString(); - } - - public StyledString getStyledText(Object element) { - if (element instanceof Node) { - Node node = (Node) element; - StyledString styleString = new StyledString(super.getText(node)); - if (node.getNodeType() == Node.ELEMENT_NODE && fShowAttributes) { - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88444 - if (node.hasAttributes()) { - Node shownAttribute = getAttributeToShow((Element) node); - if (shownAttribute != null) { - // display the attribute and styled value - String attributeName = shownAttribute.getNodeName(); - if (attributeName != null && attributeName.length() > 0) { - String attributeValue = shownAttribute.getNodeValue(); - if (attributeValue != null) { - StringBuffer buffer = new StringBuffer(" "); //$NON-NLS-1$ - buffer.append(attributeName); - // https://bugs.eclipse.org/486252 - buffer.append("="); //$NON-NLS-1$ - buffer.append(attributeValue); - styleString.append(buffer.toString(), StyledString.QUALIFIER_STYLER); - } - } - } - } - } - return styleString; - } - return new StyledString(getText(element)); - } - } - /** * Toggle action for whether or not to display element's first attribute */ @@ -267,7 +67,9 @@ public class XMLContentOutlineConfiguration extends AbstractXMLContentOutlineCon public void update() { super.update(); fShowAttributes = isChecked(); - + if (fAttributeShowingLabelProvider != null) { + fAttributeShowingLabelProvider.showAttributes(fShowAttributes); + } // notify the configuration of the change enableShowAttributes(fShowAttributes, fTreeViewer); @@ -276,7 +78,7 @@ public class XMLContentOutlineConfiguration extends AbstractXMLContentOutlineCon } } - private ILabelProvider fAttributeShowingLabelProvider; + private AttributeShowingLabelProvider fAttributeShowingLabelProvider; private IContentProvider fContentProvider = null; boolean fShowAttributes = false; @@ -410,6 +212,7 @@ public class XMLContentOutlineConfiguration extends AbstractXMLContentOutlineCon public ILabelProvider getLabelProvider(TreeViewer viewer) { if (fAttributeShowingLabelProvider == null) { fAttributeShowingLabelProvider = new AttributeShowingLabelProvider(); + fAttributeShowingLabelProvider.showAttributes(fShowAttributes); } return fAttributeShowingLabelProvider; } 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 2a579aedbd..7190f3fce9 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.200.qualifier +Bundle-Version: 1.3.300.qualifier Bundle-Activator: org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin Bundle-Vendor: %Bundle-Vendor.0 Bundle-Localization: plugin @@ -61,7 +61,7 @@ Export-Package: org.eclipse.wst.xsd.ui.internal.actions;x-internal:=true, Require-Bundle: org.eclipse.ui.views.properties.tabbed;bundle-version="[3.8.0,4.0.0)", org.eclipse.core.runtime;bundle-version="[3.14.0,4.0.0)", org.eclipse.wst.common.uriresolver;bundle-version="[1.2.300,2.0.0)", - org.eclipse.wst.sse.ui;bundle-version="[1.5.0,1.6.0)", + org.eclipse.wst.sse.ui;bundle-version="[1.5.0,2.0.0)", 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)", diff --git a/xml/bundles/org.eclipse.wst.xsd.ui/pom.xml b/xml/bundles/org.eclipse.wst.xsd.ui/pom.xml index 5e76431ec3..a4706e3950 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.200-SNAPSHOT</version> + <version>1.3.300-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> <!-- added this "constraint" for bug 458962 --> diff --git a/xml/features/org.eclipse.wst.xml_ui.feature/feature.xml b/xml/features/org.eclipse.wst.xml_ui.feature/feature.xml index da0236b693..969755389b 100644 --- a/xml/features/org.eclipse.wst.xml_ui.feature/feature.xml +++ b/xml/features/org.eclipse.wst.xml_ui.feature/feature.xml @@ -15,7 +15,7 @@ <feature id="org.eclipse.wst.xml_ui.feature" label="%featureName" - version="3.13.0.qualifier" + version="3.14.0.qualifier" provider-name="%providerName" plugin="org.eclipse.wst.xml.ui" license-feature="org.eclipse.license" diff --git a/xml/features/org.eclipse.wst.xml_ui.feature/pom.xml b/xml/features/org.eclipse.wst.xml_ui.feature/pom.xml index a4f339175c..f2107327cd 100644 --- a/xml/features/org.eclipse.wst.xml_ui.feature/pom.xml +++ b/xml/features/org.eclipse.wst.xml_ui.feature/pom.xml @@ -21,7 +21,7 @@ <groupId>org.eclipse.webtools.sourceediting</groupId> <artifactId>org.eclipse.wst.xml_ui.feature</artifactId> - <version>3.13.0-SNAPSHOT</version> + <version>3.14.0-SNAPSHOT</version> <packaging>eclipse-feature</packaging> <build> |