Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 158575 Details for
Bug 109045
[outline] Hide comments in XML outline
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch to add the User Defined pattern Filter for sse and different Named Filters for content types
109045.patch (text/plain), 39.32 KB, created by
Sarika Sinha
on 2010-02-09 06:26:04 EST
(
hide
)
Description:
Patch to add the User Defined pattern Filter for sse and different Named Filters for content types
Filename:
MIME Type:
Creator:
Sarika Sinha
Created:
2010-02-09 06:26:04 EST
Size:
39.32 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jst.jsp.ui >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.jst.jsp.ui/plugin.properties,v >retrieving revision 1.26 >diff -u -r1.26 plugin.properties >--- plugin.properties 16 Nov 2009 20:21:19 -0000 1.26 >+++ plugin.properties 9 Feb 2010 11:19:08 -0000 >@@ -104,3 +104,9 @@ > ## > Java_Element_hyperlink=Java Element > Taglib_hyperlink=Tag Library Descriptor >+ >+HideImportDeclaration.label=Import Directive >+HideImportDeclaration.description=Hides Import Directives >+ >+HideFontStyle.label=Font Style >+HideFontStyle.description=Hides Font Style Tags >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.jst.jsp.ui/plugin.xml,v >retrieving revision 1.93 >diff -u -r1.93 plugin.xml >--- plugin.xml 3 Dec 2009 02:44:10 -0000 1.93 >+++ plugin.xml 9 Feb 2010 11:19:13 -0000 >@@ -1071,4 +1071,24 @@ > </contentTypeIdentifier> > </inserter> > </extension> >+ >+ <extension >+ point="org.eclipse.jdt.ui.javaElementFilters"> >+ <filter >+ targetId="org.eclipse.jst.jsp.ui.OutlinePage" >+ name="%HideImportDeclaration.label" >+ enabled="false" >+ description="%HideImportDeclaration.description" >+ class="org.eclipse.jdt.internal.ui.filters.ImportDeclarationFilter" >+ id="org.eclipse.jst.jsp.ui.filters.ImportDeclarationFilter"> >+ </filter> >+ <filter >+ targetId="org.eclipse.jst.jsp.ui.OutlinePage" >+ name="%HideFontStyle.label" >+ enabled="false" >+ description="%HideFontStyle.description" >+ class="org.eclipse.wst.html.ui.views.contentoutline.HTMLFontStyleFilter" >+ id="org.eclipse.jst.jsp.ui.views.contentoutline.HTMLFontStyleFilter"> >+ </filter> >+ </extension> > </plugin> >Index: src/org/eclipse/jst/jsp/ui/views/contentoutline/JSPContentOutlineConfiguration.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/views/contentoutline/JSPContentOutlineConfiguration.java,v >retrieving revision 1.5 >diff -u -r1.5 JSPContentOutlineConfiguration.java >--- src/org/eclipse/jst/jsp/ui/views/contentoutline/JSPContentOutlineConfiguration.java 5 Dec 2005 19:36:32 -0000 1.5 >+++ src/org/eclipse/jst/jsp/ui/views/contentoutline/JSPContentOutlineConfiguration.java 9 Feb 2010 11:19:13 -0000 >@@ -31,13 +31,14 @@ > // be used > // private StructuredContentOutlineConfiguration fEmbeddedConfiguration = > // null; >- >+ private final String OUTLINE_FILTER_PREF = "org.eclipse.jst.jsp.ui.OutlinePage"; //$NON-NLS-1$ > /** > * Create new instance of JSPContentOutlineConfiguration > */ > public JSPContentOutlineConfiguration() { > // Must have empty constructor to createExecutableExtension > super(); >+ super.setOutlineFilterTarget(OUTLINE_FILTER_PREF); > } > > /* >#P org.eclipse.wst.html.ui >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.html.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.38 >diff -u -r1.38 MANIFEST.MF >--- META-INF/MANIFEST.MF 19 Jan 2010 20:00:55 -0000 1.38 >+++ META-INF/MANIFEST.MF 9 Feb 2010 11:19:23 -0000 >@@ -46,6 +46,7 @@ > org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)", > org.eclipse.wst.validation;bundle-version="[1.2.100,1.3.0)", > org.eclipse.wst.common.project.facet.core;bundle-version="[1.4.0,2.0.0)";resolution:=optional, >- org.eclipse.wst.common.modulecore;bundle-version="[1.2.0,2.0.0)";resolution:=optional >+ org.eclipse.wst.common.modulecore;bundle-version="[1.2.0,2.0.0)";resolution:=optional, >+ org.eclipse.jdt.ui;bundle-version="[3.6.0,4.0.0)" > Bundle-ActivationPolicy: lazy > Bundle-RequiredExecutionEnvironment: J2SE-1.4 >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.html.ui/plugin.properties,v >retrieving revision 1.30 >diff -u -r1.30 plugin.properties >--- plugin.properties 16 Nov 2009 20:21:23 -0000 1.30 >+++ plugin.properties 9 Feb 2010 11:19:19 -0000 >@@ -76,3 +76,8 @@ > hyperlink.target.script.name=HTML Client Script > hyperlink.target.eventhandler.name=HTML Event Handlers > >+HideImportDeclaration.label=Import Directive >+HideImportDeclaration.description=Hides Import Directives >+ >+HideFontStyle.label=Font Style >+HideFontStyle.description=Hides Font Style Tags >\ No newline at end of file >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.html.ui/plugin.xml,v >retrieving revision 1.91 >diff -u -r1.91 plugin.xml >--- plugin.xml 16 Dec 2009 17:53:23 -0000 1.91 >+++ plugin.xml 9 Feb 2010 11:19:23 -0000 >@@ -637,4 +637,25 @@ > </inserter> > </extension> > >+ <extension >+ point="org.eclipse.jdt.ui.javaElementFilters"> >+ <filter >+ targetId="org.eclipse.wst.html.ui.OutlinePage" >+ name="%HideImportDeclaration.label" >+ enabled="false" >+ description="%HideImportDeclaration.description" >+ class="org.eclipse.jdt.internal.ui.filters.ImportDeclarationFilter" >+ id="org.eclipse.html.ui.filters.ImportDeclarationFilter"> >+ </filter> >+ <filter >+ targetId="org.eclipse.wst.html.ui.OutlinePage" >+ name="%HideFontStyle.label" >+ enabled="false" >+ description="%HideFontStyle.description" >+ class="org.eclipse.wst.html.ui.views.contentoutline.HTMLFontStyleFilter" >+ id="org.eclipse.wst.html.ui.views.contentoutline.HTMLFontStyleFilter"> >+ </filter> >+ >+ </extension> >+ > </plugin> >Index: src/org/eclipse/wst/html/ui/views/contentoutline/HTMLContentOutlineConfiguration.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/views/contentoutline/HTMLContentOutlineConfiguration.java,v >retrieving revision 1.8 >diff -u -r1.8 HTMLContentOutlineConfiguration.java >--- src/org/eclipse/wst/html/ui/views/contentoutline/HTMLContentOutlineConfiguration.java 5 Dec 2005 19:32:39 -0000 1.8 >+++ src/org/eclipse/wst/html/ui/views/contentoutline/HTMLContentOutlineConfiguration.java 9 Feb 2010 11:19:23 -0000 >@@ -25,13 +25,15 @@ > * @since 1.0 > */ > public class HTMLContentOutlineConfiguration extends XMLContentOutlineConfiguration { >- >+ private final String OUTLINE_FILTER_PREF = "org.eclipse.wst.html.ui.OutlinePage"; //$NON-NLS-1$ > /** > * Create new instance of HTMLContentOutlineConfiguration > */ > public HTMLContentOutlineConfiguration() { > // Must have empty constructor to createExecutableExtension > super(); >+ super.setOutlineFilterTarget(OUTLINE_FILTER_PREF); >+ > } > > protected XMLNodeActionManager createNodeActionManager(TreeViewer treeViewer) { >Index: src/org/eclipse/wst/html/ui/views/contentoutline/HTMLFontStyleFilter.java >=================================================================== >RCS file: src/org/eclipse/wst/html/ui/views/contentoutline/HTMLFontStyleFilter.java >diff -N src/org/eclipse/wst/html/ui/views/contentoutline/HTMLFontStyleFilter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/html/ui/views/contentoutline/HTMLFontStyleFilter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,36 @@ >+package org.eclipse.wst.html.ui.views.contentoutline; >+ >+import java.util.ArrayList; >+ >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.jface.viewers.ViewerFilter; >+import org.eclipse.wst.html.core.internal.document.ElementStyleImpl; >+import org.eclipse.wst.html.core.internal.provisional.HTML40Namespace; >+ >+public class HTMLFontStyleFilter extends ViewerFilter { >+ final static ArrayList fontStyles = new ArrayList(9); >+ static { >+ >+ fontStyles.add(HTML40Namespace.ElementName.TT.toLowerCase()); >+ fontStyles.add(HTML40Namespace.ElementName.I.toLowerCase()); >+ fontStyles.add(HTML40Namespace.ElementName.B.toLowerCase()); >+ fontStyles.add(HTML40Namespace.ElementName.P.toLowerCase()); >+ fontStyles.add(HTML40Namespace.ElementName.S.toLowerCase()); >+ fontStyles.add(HTML40Namespace.ElementName.STRIKE.toLowerCase()); >+ fontStyles.add(HTML40Namespace.ElementName.BIG.toLowerCase()); >+ fontStyles.add(HTML40Namespace.ElementName.SMALL.toLowerCase()); >+ fontStyles.add(HTML40Namespace.ElementName.U.toLowerCase()); >+ } >+ >+ public boolean select(Viewer viewer, Object parentElement, Object element) { >+ if (element instanceof ElementStyleImpl){ >+ ElementStyleImpl elemImpl = (ElementStyleImpl)element; >+ String nodeName = elemImpl.getNodeName().toLowerCase(); >+ if (fontStyles.contains(nodeName)){ >+ return false; >+ } >+ } >+ return true; >+ } >+ >+} >#P org.eclipse.wst.sse.ui >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.sse.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.42 >diff -u -r1.42 MANIFEST.MF >--- META-INF/MANIFEST.MF 19 Jan 2010 20:01:03 -0000 1.42 >+++ META-INF/MANIFEST.MF 9 Feb 2010 11:19:33 -0000 >@@ -61,7 +61,9 @@ > org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)", > org.eclipse.wst.validation;bundle-version="[1.2.100,1.3.0)", > org.eclipse.emf.common;bundle-version="[2.4.0,3.0.0)", >- org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)" >+ org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)", >+ org.eclipse.jdt.ui;bundle-version="[3.6.0,4.0.0)", >+ org.eclipse.jdt.core;bundle-version="[3.6.0,4.0.0)" > Bundle-ActivationPolicy: lazy > Eclipse-LazyStart: true > Bundle-RequiredExecutionEnvironment: J2SE-1.4 >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.sse.ui/plugin.properties,v >retrieving revision 1.29 >diff -u -r1.29 plugin.properties >--- plugin.properties 8 Dec 2009 21:07:09 -0000 1.29 >+++ plugin.properties 9 Feb 2010 11:19:31 -0000 >@@ -105,3 +105,11 @@ > Colors.content_assist_proposals_foreground=Content Assist Proposals Foreground > Colors.content_assist_parameters_background=Content Assist Parameters Background > Colors.content_assist_parameters_foreground=Content Assist Parameters Foreground >+ >+#Filter Support >+ >+HideImportDeclaration.label= Import declarations >+HideImportDeclaration.description= Hides all import declarations >+ >+ >+elementFiltersName=SSE Element Filters >\ No newline at end of file >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.sse.ui/plugin.xml,v >retrieving revision 1.67 >diff -u -r1.67 plugin.xml >--- plugin.xml 4 Feb 2010 21:17:11 -0000 1.67 >+++ plugin.xml 9 Feb 2010 11:19:33 -0000 >@@ -766,5 +766,7 @@ > </colorDefinition> > </extension> > >+ >+ > </plugin> > >Index: src/org/eclipse/wst/sse/ui/internal/SSEUIMessages.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIMessages.java,v >retrieving revision 1.24 >diff -u -r1.24 SSEUIMessages.java >--- src/org/eclipse/wst/sse/ui/internal/SSEUIMessages.java 30 Oct 2009 19:38:17 -0000 1.24 >+++ src/org/eclipse/wst/sse/ui/internal/SSEUIMessages.java 9 Feb 2010 11:19:34 -0000 >@@ -184,6 +184,7 @@ > public static String ShowPropertiesAction_0; > public static String ContentOutlineConfiguration_0; > public static String ContentOutlineConfiguration_1; >+ public static String ContentOutlineConfiguration_2; > public static String AbstractOpenOn_0; > public static String FormatActionDelegate_jobName; > public static String FormatActionDelegate_errorStatusMessage; >Index: src/org/eclipse/wst/sse/ui/internal/SSEUIPluginResources.properties >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIPluginResources.properties,v >retrieving revision 1.28 >diff -u -r1.28 SSEUIPluginResources.properties >--- src/org/eclipse/wst/sse/ui/internal/SSEUIPluginResources.properties 30 Oct 2009 19:38:17 -0000 1.28 >+++ src/org/eclipse/wst/sse/ui/internal/SSEUIPluginResources.properties 9 Feb 2010 11:19:35 -0000 >@@ -158,6 +158,7 @@ > ShowPropertiesAction_0=P&roperties > ContentOutlineConfiguration_0=Collapse All > ContentOutlineConfiguration_1=Link with Editor >+ContentOutlineConfiguration_2=Filters > AbstractOpenOn_0=Current text selection does not resolve to a file > FormatActionDelegate_jobName=Formatting... > FormatActionDelegate_errorStatusMessage=Exceptions occurred while formatting documents >Index: src/org/eclipse/wst/sse/ui/views/contentoutline/ContentOutlineConfiguration.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/views/contentoutline/ContentOutlineConfiguration.java,v >retrieving revision 1.16 >diff -u -r1.16 ContentOutlineConfiguration.java >--- src/org/eclipse/wst/sse/ui/views/contentoutline/ContentOutlineConfiguration.java 10 Apr 2007 20:06:19 -0000 1.16 >+++ src/org/eclipse/wst/sse/ui/views/contentoutline/ContentOutlineConfiguration.java 9 Feb 2010 11:19:37 -0000 >@@ -86,6 +86,9 @@ > private IContributionItem[] fMenuContributions = null; > private IContributionItem[] fToolbarContributions = null; > private final String OUTLINE_LINK_PREF = "outline-link-editor"; //$NON-NLS-1$ >+ private final String OUTLINE_FILTER_PREF = "org.eclipse.wst.sse.ui.OutlinePage"; //$NON-NLS-1$ >+ >+ private String fOutlineFilterPref = OUTLINE_FILTER_PREF; //$NON-NLS-1$ > ImageDescriptor SYNCED_D = EditorPluginImageHelper.getInstance().getImageDescriptor(EditorPluginImages.IMG_DLCL_SYNCED); > ImageDescriptor SYNCED_E = EditorPluginImageHelper.getInstance().getImageDescriptor(EditorPluginImages.IMG_ELCL_SYNCED); > >@@ -107,7 +110,9 @@ > */ > protected IContributionItem[] createMenuContributions(TreeViewer viewer) { > IContributionItem toggleLinkItem = new PropertyChangeUpdateActionContributionItem(new ToggleLinkAction(getPreferenceStore(), OUTLINE_LINK_PREF)); >- IContributionItem[] items = new IContributionItem[]{toggleLinkItem}; >+ IContributionItem filterItem = new CustomFilterActionContributionItem(new CustomFilterAction(getPreferenceStore(),fOutlineFilterPref, viewer),fOutlineFilterPref, getPreferenceStore(), viewer ); >+ >+ IContributionItem[] items = new IContributionItem[]{toggleLinkItem, filterItem}; > return items; > } > >@@ -313,4 +318,12 @@ > fMenuContributions = null; > } > } >+ >+ // added >+ >+ public void setOutlineFilterTarget(String targetId){ >+ fOutlineFilterPref = targetId; >+ } >+ >+ > } >Index: src/org/eclipse/wst/sse/ui/views/contentoutline/CustomFilterAction.java >=================================================================== >RCS file: src/org/eclipse/wst/sse/ui/views/contentoutline/CustomFilterAction.java >diff -N src/org/eclipse/wst/sse/ui/views/contentoutline/CustomFilterAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/sse/ui/views/contentoutline/CustomFilterAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,368 @@ >+package org.eclipse.wst.sse.ui.views.contentoutline; >+ >+ /******************************************************************************* >+ * Copyright (c) 2001, 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+ >+ >+import java.util.ArrayList; >+import java.util.HashMap; >+import java.util.HashSet; >+import java.util.Iterator; >+import java.util.Map; >+ >+import org.eclipse.core.runtime.Assert; >+import org.eclipse.jdt.internal.ui.JavaPlugin; >+import org.eclipse.jdt.internal.ui.filters.CustomFiltersDialog; >+import org.eclipse.jdt.internal.ui.filters.FilterDescriptor; >+import org.eclipse.jdt.internal.ui.filters.NamePatternFilter; >+import org.eclipse.jdt.internal.ui.util.StringMatcher; >+import org.eclipse.jface.preference.IPreferenceStore; >+import org.eclipse.jface.viewers.StructuredViewer; >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.jface.viewers.ViewerFilter; >+import org.eclipse.jface.window.Window; >+import org.eclipse.wst.sse.ui.internal.SSEUIMessages; >+import org.eclipse.wst.sse.ui.internal.contentoutline.PropertyChangeUpdateAction; >+import org.w3c.dom.Node; >+ >+ /** >+ * Action group to add the filter action to a view part's tool bar >+ * menu. >+ * <p> >+ * This class may be instantiated; it is not intended to be subclassed. >+ * </p> >+ * >+ * @since 2.0 >+ * >+ * @noextend This class is not intended to be subclassed by clients. >+ */ >+ public class CustomFilterAction extends PropertyChangeUpdateAction { >+ >+ >+ private static final String SEPARATOR= ","; //$NON-NLS-1$ >+ private final String TAG_USER_DEFINED_PATTERNS_ENABLED= "userDefinedPatternsEnabled"; //$NON-NLS-1$ >+ private final String TAG_USER_DEFINED_PATTERNS= "userDefinedPatterns"; //$NON-NLS-1$ >+ >+ >+ private static class FilterItem { >+ boolean enabled; >+ boolean previouslyEnabled; >+ FilterDescriptor descriptor; >+ String id; >+ >+ private ViewerFilter filterInstance= null; >+ >+ public FilterItem(FilterDescriptor descriptor) { >+ this.descriptor= descriptor; >+ this.id= descriptor.getId(); >+ this.previouslyEnabled= false; >+ this.enabled= descriptor.isEnabled(); >+ } >+ >+ public ViewerFilter getFilterInstance() { >+ if (filterInstance == null) { >+ filterInstance= descriptor.createViewerFilter(); >+ } >+ return filterInstance; >+ >+ } >+ } >+ >+ >+ private final StructuredViewer fViewer; >+ private final SSENamePatternFilter fPatternFilter; >+ >+ private boolean fUserDefinedPatternsEnabled; >+ private String[] fUserDefinedPatterns; >+ >+ private String[] fPreviousPatterns; >+ >+ private final Map fFilterItems; >+ >+ >+ >+ private final String fTargetId; >+ private IPreferenceStore fStore; >+ >+ >+ /** >+ * Creates a new <code>CustomFilterAction</code>. >+ * >+ * @param store the preference Store >+ * @param ownerId the id of this action group's owner >+ * @param viewer the viewer to be filtered >+ */ >+ public CustomFilterAction(IPreferenceStore store,String ownerId, StructuredViewer viewer) { >+ super(SSEUIMessages.ContentOutlineConfiguration_2, store, ownerId, store.getBoolean(ownerId)); //$NON-NLS-1$ >+ Assert.isNotNull(ownerId); >+ Assert.isNotNull(viewer); >+ fStore = store; >+ fTargetId= ownerId; >+ fViewer= viewer; >+ fPatternFilter= new SSENamePatternFilter(); >+ >+ fUserDefinedPatterns= new String[0]; >+ fUserDefinedPatternsEnabled= false; >+ fPreviousPatterns= new String[0]; >+ >+ fFilterItems= new HashMap(); >+ FilterDescriptor[] filterDescriptors= FilterDescriptor.getFilterDescriptors(fTargetId); >+ for (int i= 0; i < filterDescriptors.length; i++) { >+ FilterItem item= new FilterItem(filterDescriptors[i]); >+ Object existing= fFilterItems.put(item.id, item); >+ if (existing != null) { >+ JavaPlugin.logErrorMessage("WARNING: Duplicate id for extension-point \"org.eclipse.wst.sse.ui.sseElementFilters\" in " + ownerId); //$NON-NLS-1$ >+ } >+ } >+ >+ initializeWithViewDefaults(); >+ >+ updateViewerFilters(); >+ >+ } >+ >+ public void update() { >+ openDialog(); >+ } >+ >+ >+ >+ /* >+ * @see org.eclipse.jface.action.IContributionItem#isDynamic() >+ */ >+ public boolean isDynamic() { >+ return true; >+ } >+ /** >+ * Returns a list of currently enabled filters. The filter >+ * is identified by its id. >+ * <p> >+ * This method is for internal use only and should not >+ * be called by clients outside of JDT/UI. >+ * </p> >+ * >+ * @return a list of currently enabled filters >+ * >+ * @since 3.1 >+ * >+ * @noreference This method is not intended to be referenced by clients. >+ */ >+ public String[] internalGetEnabledFilterIds() { >+ ArrayList enabledFilterIds= new ArrayList(); >+ for (Iterator iterator= fFilterItems.values().iterator(); iterator.hasNext();) { >+ FilterItem item= (FilterItem) iterator.next(); >+ if (item.enabled) { >+ enabledFilterIds.add(item.id); >+ } >+ } >+ return (String[])enabledFilterIds.toArray(new String[enabledFilterIds.size()]); >+ } >+ >+ private void setEnabledFilterIds(String[] enabledIds) { >+ // set all to false >+ fUserDefinedPatternsEnabled= false; >+ for (Iterator iterator= fFilterItems.values().iterator(); iterator.hasNext();) { >+ FilterItem item= (FilterItem) iterator.next(); >+ item.enabled= false; >+ } >+ // set enabled to true >+ for (int i= 0; i < enabledIds.length; i++) { >+ FilterItem item= (FilterItem) fFilterItems.get(enabledIds[i]); >+ if (item != null) { >+ item.enabled= true; >+ } >+ if (fPatternFilter.getClass().getName().equals(enabledIds[i])) >+ fUserDefinedPatternsEnabled= true; >+ } >+ } >+ >+ private void setUserDefinedPatterns(String[] patterns) { >+ fUserDefinedPatterns= patterns; >+ } >+ >+ >+ private boolean areUserDefinedPatternsEnabled() { >+ return fUserDefinedPatternsEnabled; >+ } >+ >+ private void setUserDefinedPatternsEnabled(boolean state) { >+ fUserDefinedPatternsEnabled= state; >+ } >+ >+ >+ // ---------- viewer filter handling ---------- >+ >+ private boolean updateViewerFilters() { >+ ViewerFilter[] installedFilters= fViewer.getFilters(); >+ ArrayList viewerFilters= new ArrayList(installedFilters.length); >+ >+ HashSet patterns= new HashSet(); >+ >+ boolean hasChange= false; >+ boolean patternChange= false; >+ >+ for (Iterator iterator= fFilterItems.values().iterator(); iterator.hasNext();) { >+ FilterItem item= (FilterItem) iterator.next(); >+ if (item.descriptor.isCustomFilter()) { >+ if (item.enabled != item.previouslyEnabled) { >+ hasChange = true; >+ } >+ if (item.enabled){ >+ ViewerFilter filter= item.getFilterInstance(); // only create when changed >+ if (filter != null) { >+ viewerFilters.add(filter); >+ } >+ } >+ } else if (item.descriptor.isPatternFilter()) { >+ if (item.enabled) { >+ patterns.add(item.descriptor.getPattern()); >+ } >+ patternChange |= (item.enabled != item.previouslyEnabled); >+ } >+ item.previouslyEnabled= item.enabled; >+ } >+ >+ if (areUserDefinedPatternsEnabled()) { >+ for (int i= 0; i < fUserDefinedPatterns.length; i++) { >+ patterns.add(fUserDefinedPatterns[i]); >+ } >+ } >+ if (!patternChange) { // no pattern change so far, test if the user patterns made a difference >+ patternChange= hasChanges(patterns, fPreviousPatterns); >+ } >+ >+ fPreviousPatterns= (String[]) patterns.toArray(new String[patterns.size()]); >+ if (patternChange) { >+ fPatternFilter.setPatterns(fPreviousPatterns); >+ if (patterns.isEmpty()) { >+ viewerFilters.remove(fPatternFilter); >+ } else if (!viewerFilters.contains(fPatternFilter)) { >+ boolean contains = false; >+ for (int i=0; i< viewerFilters.size();i++){ >+ if (viewerFilters.get(i) instanceof SSENamePatternFilter){ >+ SSENamePatternFilter filter = (SSENamePatternFilter)viewerFilters.get(i); >+ String[] a1 =filter.getPatterns(); >+ String[] a2 =fPatternFilter.getPatterns(); >+ if (a1[0].equals(a2[0])) >+ contains= true; >+ else { >+ viewerFilters.remove(i); >+ } >+ break; >+ } >+ } >+ if (!contains) >+ viewerFilters.add(fPatternFilter); >+ } >+ hasChange= true; >+ } >+ if (hasChange) { >+ fViewer.setFilters((ViewerFilter[]) viewerFilters.toArray(new ViewerFilter[viewerFilters.size()])); // will refresh >+ } >+ return hasChange; >+ } >+ >+ private boolean hasChanges(HashSet patterns, String[] oldPatterns) { >+ HashSet copy= (HashSet) patterns.clone(); >+ for (int i= 0; i < oldPatterns.length; i++) { >+ boolean found= copy.remove(oldPatterns[i]); >+ if (!found) >+ return true; >+ } >+ return !copy.isEmpty(); >+ } >+ >+ // ---------- view kind/defaults persistency ---------- >+ >+ private void initializeWithViewDefaults() { >+ // get default values for view >+ >+ >+ fUserDefinedPatternsEnabled= fStore.getBoolean(getPreferenceKey(TAG_USER_DEFINED_PATTERNS_ENABLED)); >+ setUserDefinedPatterns(CustomFiltersDialog.convertFromString(fStore.getString(getPreferenceKey(TAG_USER_DEFINED_PATTERNS)), SEPARATOR)); >+ >+ for (Iterator iterator= fFilterItems.values().iterator(); iterator.hasNext();) { >+ FilterItem item= (FilterItem) iterator.next(); >+ String id= item.id; >+ // set default to value from plugin contributions (fixes https://bugs.eclipse.org/bugs/show_bug.cgi?id=73991 ): >+ fStore.setDefault(id, item.descriptor.isEnabled()); >+ item.enabled= fStore.getBoolean(id); >+ } >+ >+ } >+ >+ private void storeViewDefaults() { >+ // get default values for view >+ >+ fStore.setValue(getPreferenceKey(TAG_USER_DEFINED_PATTERNS_ENABLED), fUserDefinedPatternsEnabled); >+ fStore.setValue(getPreferenceKey(TAG_USER_DEFINED_PATTERNS), CustomFiltersDialog.convertToString(fUserDefinedPatterns ,SEPARATOR)); >+ >+ boolean fFilterSelected = false; >+ for (Iterator iterator= fFilterItems.values().iterator(); iterator.hasNext();) { >+ FilterItem item= (FilterItem) iterator.next(); >+ fStore.setValue(item.id, item.enabled); >+ if (item.enabled) >+ fFilterSelected = true; >+ } >+ >+ fStore.setValue(fTargetId, fUserDefinedPatternsEnabled || fFilterSelected); >+ >+ } >+ >+ private String getPreferenceKey(String tag) { >+ return "CustomFiltersActionGroup." + fTargetId + '.' + tag; //$NON-NLS-1$ >+ } >+ >+ >+ private void openDialog() { >+ CustomFiltersDialog dialog= new CustomFiltersDialog( >+ fViewer.getControl().getShell(), >+ fTargetId, >+ areUserDefinedPatternsEnabled(), >+ fUserDefinedPatterns, >+ internalGetEnabledFilterIds()); >+ >+ if (dialog.open() == Window.OK) { >+ setEnabledFilterIds(dialog.getEnabledFilterIds()); >+ setUserDefinedPatternsEnabled(dialog.areUserDefinedPatternsEnabled()); >+ setUserDefinedPatterns(dialog.getUserDefinedPatterns()); >+ storeViewDefaults(); >+ >+ updateViewerFilters(); >+ } >+ else { >+ storeViewDefaults(); >+ } >+ } >+ >+ >+ public class SSENamePatternFilter extends NamePatternFilter{ >+ public boolean select(Viewer viewer, Object parentElement, Object element) { >+ if (getPatterns().length == 0) { >+ return true; >+ } >+ String matchName= null; >+ if (element instanceof Node){ >+ matchName =((Node)element).getNodeName(); >+ } >+ if (matchName != null && matchName.length() > 0) { >+ String[] fPatterns = getPatterns(); >+ for (int i = 0; i < fPatterns.length; i++) { >+ if (new StringMatcher(fPatterns[i], true, false).match(matchName)) >+ return false; >+ } >+ return true; >+ } >+ return true; >+ } >+ } >+ } >+ >Index: src/org/eclipse/wst/sse/ui/views/contentoutline/CustomFilterActionContributionItem.java >=================================================================== >RCS file: src/org/eclipse/wst/sse/ui/views/contentoutline/CustomFilterActionContributionItem.java >diff -N src/org/eclipse/wst/sse/ui/views/contentoutline/CustomFilterActionContributionItem.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/sse/ui/views/contentoutline/CustomFilterActionContributionItem.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,84 @@ >+/******************************************************************************* >+ * Copyright (c) 2001, 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ * >+ *******************************************************************************/ >+package org.eclipse.wst.sse.ui.views.contentoutline; >+ >+import org.eclipse.jface.action.Action; >+import org.eclipse.jface.action.ActionContributionItem; >+import org.eclipse.jface.preference.IPreferenceStore; >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.swt.events.MenuEvent; >+import org.eclipse.swt.events.MenuListener; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.SelectionListener; >+import org.eclipse.swt.widgets.Menu; >+import org.eclipse.swt.widgets.MenuItem; >+import org.eclipse.ui.texteditor.IUpdate; >+ >+/** >+ * A listener on the given action's PreferenceStore. It calls .update() on the >+ * action when the given key changes value. >+ */ >+public class CustomFilterActionContributionItem extends ActionContributionItem { >+ >+ >+ >+ private String fProperty = null; >+ private IPreferenceStore fStore; >+ //private MenuItem filterMenuItem = null; >+ private int idx; >+ >+ public CustomFilterActionContributionItem(Action action, String preference, IPreferenceStore store, Viewer viewer) { >+ super(action); >+ fProperty = preference; >+ fStore = store; >+ } >+ >+ /* >+ * Overrides method from ContributionItem. >+ */ >+ public void fill(Menu menu, int index) { >+ >+ super.fill(menu, index); >+ idx = index; >+ MenuItem filterMenuItem = menu.getItem(index); >+ >+ menu.addMenuListener(new MenuListener() { >+ >+ public void menuShown(MenuEvent e) { >+ Object obj =e.getSource(); >+ if (obj instanceof Menu){ >+ Menu menu = (Menu)obj; >+ menu.getItem(idx).setSelection(fStore.getBoolean(fProperty)); >+ } >+ } >+ >+ public void menuHidden(MenuEvent e) { >+ >+ } >+ }); >+ >+ filterMenuItem.addSelectionListener(new SelectionListener() { >+ >+ public void widgetSelected(SelectionEvent e) { >+ ((IUpdate) getAction()).update(); >+ >+ } >+ >+ public void widgetDefaultSelected(SelectionEvent e) { >+ >+ } >+ }); >+ >+ } >+ >+ >+} >Index: src/org/eclipse/wst/sse/ui/views/contentoutline/SSEPackageDeclarationFilter.java >=================================================================== >RCS file: src/org/eclipse/wst/sse/ui/views/contentoutline/SSEPackageDeclarationFilter.java >diff -N src/org/eclipse/wst/sse/ui/views/contentoutline/SSEPackageDeclarationFilter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/sse/ui/views/contentoutline/SSEPackageDeclarationFilter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,31 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.wst.sse.ui.views.contentoutline; >+ >+ >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.jface.viewers.ViewerFilter; >+ >+import org.eclipse.jdt.core.IPackageDeclaration; >+ >+ >+/** >+ * Filters package declarations >+ */ >+public class SSEPackageDeclarationFilter extends ViewerFilter { >+ >+ /* >+ * @see ViewerFilter >+ */ >+ public boolean select(Viewer viewer, Object parent, Object element) { >+ return !(element instanceof IPackageDeclaration); >+ } >+} >#P org.eclipse.wst.xml.ui >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/plugin.properties,v >retrieving revision 1.44 >diff -u -r1.44 plugin.properties >--- plugin.properties 16 Nov 2009 20:21:30 -0000 1.44 >+++ plugin.properties 9 Feb 2010 11:19:46 -0000 >@@ -137,4 +137,14 @@ > # Menu contributions > command.toggle.comment.mnemonic=T > command.add.block.comment.mnemonic=A >-command.remove.block.comment.mnemonic=R >\ No newline at end of file >+command.remove.block.comment.mnemonic=R >+ >+ >+HideComments.label=Comments >+HideComments.description=Hides Comments >+ >+HideProcessingInstruction.label=Processing Instructions >+HideProcessingInstruction.description=Hides Processing Instructions >+ >+HideCDATASection.label=CDATA >+HideCDATASection.description=Hides CDATA Section Tags >\ No newline at end of file >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/plugin.xml,v >retrieving revision 1.110 >diff -u -r1.110 plugin.xml >--- plugin.xml 3 Dec 2009 02:44:03 -0000 1.110 >+++ plugin.xml 9 Feb 2010 11:20:08 -0000 >@@ -1661,5 +1661,35 @@ > </contentTypeIdentifier> > </inserter> > </extension> >+ >+ >+ <extension >+ point="org.eclipse.jdt.ui.javaElementFilters"> >+ >+ <filter >+ targetId="org.eclipse.wst.xml.ui.OutlinePage" >+ name="%HideComments.label" >+ enabled="false" >+ description="%HideComments.description" >+ class="org.eclipse.wst.xml.ui.internal.contentoutline.XMLCommentFilter" >+ id="org.eclipse.wst.xml.ui.internal.contentoutline.XMLCommentFilter"> >+ </filter> >+ <filter >+ targetId="org.eclipse.wst.xml.ui.OutlinePage" >+ name="%HideProcessingInstruction.label" >+ enabled="false" >+ description="%HideProcessingInstruction.description" >+ class="org.eclipse.wst.xml.ui.internal.contentoutline.XMLProcessingInstructionFilter" >+ id="org.eclipse.wst.xml.ui.internal.contentoutline.XMLProcessingInstructionFilter"> >+ </filter> >+ <filter >+ targetId="org.eclipse.wst.xml.ui.OutlinePage" >+ name="%HideCDATASection.label" >+ enabled="false" >+ description="%HideCDATASection.description" >+ class="org.eclipse.wst.xml.ui.internal.contentoutline.XMLCDATASectionFilter" >+ id="org.eclipse.wst.xml.ui.internal.contentoutline.XMLCDATASectionFilter"> >+ </filter> >+ </extension> > > </plugin> >Index: src/org/eclipse/wst/xml/ui/internal/contentoutline/XMLCDATASectionFilter.java >=================================================================== >RCS file: src/org/eclipse/wst/xml/ui/internal/contentoutline/XMLCDATASectionFilter.java >diff -N src/org/eclipse/wst/xml/ui/internal/contentoutline/XMLCDATASectionFilter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/ui/internal/contentoutline/XMLCDATASectionFilter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+package org.eclipse.wst.xml.ui.internal.contentoutline; >+ >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.jface.viewers.ViewerFilter; >+import org.eclipse.wst.xml.core.internal.document.CDATASectionImpl; >+ >+public class XMLCDATASectionFilter extends ViewerFilter { >+ >+ public boolean select(Viewer viewer, Object parent, Object element) { >+ if (element instanceof CDATASectionImpl){ >+ return false; >+ } >+ return true; >+ } >+ >+} >Index: src/org/eclipse/wst/xml/ui/internal/contentoutline/XMLCommentFilter.java >=================================================================== >RCS file: src/org/eclipse/wst/xml/ui/internal/contentoutline/XMLCommentFilter.java >diff -N src/org/eclipse/wst/xml/ui/internal/contentoutline/XMLCommentFilter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/ui/internal/contentoutline/XMLCommentFilter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,33 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.wst.xml.ui.internal.contentoutline; >+ >+ >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.jface.viewers.ViewerFilter; >+import org.eclipse.wst.xml.core.internal.document.CommentImpl; >+ >+ >+/** >+ * Filters package declarations >+ */ >+public class XMLCommentFilter extends ViewerFilter { >+ >+ /* >+ * @see ViewerFilter >+ */ >+ public boolean select(Viewer viewer, Object parent, Object element) { >+ if (element instanceof CommentImpl){ >+ return false; >+ } >+ return true; >+ } >+} >Index: src/org/eclipse/wst/xml/ui/internal/contentoutline/XMLProcessingInstructionFilter.java >=================================================================== >RCS file: src/org/eclipse/wst/xml/ui/internal/contentoutline/XMLProcessingInstructionFilter.java >diff -N src/org/eclipse/wst/xml/ui/internal/contentoutline/XMLProcessingInstructionFilter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/ui/internal/contentoutline/XMLProcessingInstructionFilter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+package org.eclipse.wst.xml.ui.internal.contentoutline; >+ >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.jface.viewers.ViewerFilter; >+import org.eclipse.wst.xml.core.internal.document.ProcessingInstructionImpl; >+ >+public class XMLProcessingInstructionFilter extends ViewerFilter { >+ >+ public boolean select(Viewer viewer, Object parent, Object element) { >+ if (element instanceof ProcessingInstructionImpl){ >+ return false; >+ } >+ return true; >+ } >+ >+} >Index: src/org/eclipse/wst/xml/ui/views/contentoutline/XMLContentOutlineConfiguration.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/views/contentoutline/XMLContentOutlineConfiguration.java,v >retrieving revision 1.30 >diff -u -r1.30 XMLContentOutlineConfiguration.java >--- src/org/eclipse/wst/xml/ui/views/contentoutline/XMLContentOutlineConfiguration.java 13 Oct 2008 23:42:32 -0000 1.30 >+++ src/org/eclipse/wst/xml/ui/views/contentoutline/XMLContentOutlineConfiguration.java 9 Feb 2010 11:20:17 -0000 >@@ -266,6 +266,7 @@ > * Preference key for Show Attributes > */ > private final String OUTLINE_SHOW_ATTRIBUTE_PREF = "outline-show-attribute"; //$NON-NLS-1$ >+ private final String OUTLINE_FILTER_PREF = "org.eclipse.wst.xml.ui.OutlinePage"; //$NON-NLS-1$ > > /** > * Create new instance of XMLContentOutlineConfiguration >@@ -304,6 +305,7 @@ > store.setDefault(XMLUIPreferenceNames.OUTLINE_BEHAVIOR.NOTATION_NODE, "11, true"); > if (store.getDefaultString(XMLUIPreferenceNames.OUTLINE_BEHAVIOR.TEXT_NODE).length() == 0) > store.setDefault(XMLUIPreferenceNames.OUTLINE_BEHAVIOR.TEXT_NODE, "12, false"); >+ super.setOutlineFilterTarget(OUTLINE_FILTER_PREF); > } > > /*
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 109045
:
158575
|
158676
|
159755
|
172315
|
182837
|
183247
|
183248