Source Code Cross Referenced for CommonFilterDescriptor.java in  » IDE-Eclipse » ui » org » eclipse » ui » internal » navigator » filters » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Eclipse » ui » org.eclipse.ui.internal.navigator.filters 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2006 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         ******************************************************************************/package org.eclipse.ui.internal.navigator.filters;
011:
012:        import org.eclipse.core.expressions.Expression;
013:        import org.eclipse.core.runtime.CoreException;
014:        import org.eclipse.core.runtime.IConfigurationElement;
015:        import org.eclipse.core.runtime.IStatus;
016:        import org.eclipse.jface.viewers.ViewerFilter;
017:        import org.eclipse.ui.internal.navigator.CustomAndExpression;
018:        import org.eclipse.ui.internal.navigator.NavigatorPlugin;
019:        import org.eclipse.ui.internal.navigator.extensions.INavigatorContentExtPtConstants;
020:        import org.eclipse.ui.navigator.ICommonFilterDescriptor;
021:
022:        /**
023:         * 
024:         * Describes a <b>commonFilter</b> element under a
025:         * <b>org.eclipse.ui.navigator.navigatorContent</b> extension.
026:         * 
027:         * @since 3.2
028:         * 
029:         */
030:        public class CommonFilterDescriptor implements  ICommonFilterDescriptor,
031:                INavigatorContentExtPtConstants {
032:
033:            private IConfigurationElement element;
034:
035:            private Expression filterExpression;
036:
037:            private String id;
038:
039:            protected CommonFilterDescriptor(IConfigurationElement anElement) {
040:
041:                element = anElement;
042:                init();
043:            }
044:
045:            private void init() {
046:                id = element.getAttribute(ATT_ID);
047:                if (id == null) {
048:                    id = ""; //$NON-NLS-1$
049:                }
050:                IConfigurationElement[] children = element
051:                        .getChildren(TAG_FILTER_EXPRESSION);
052:                if (children.length == 1) {
053:                    filterExpression = new CustomAndExpression(children[0]);
054:                }
055:            }
056:
057:            /**
058:             * 
059:             * @return An identifier used to determine whether the filter is visible.
060:             *         May not be unique.
061:             */
062:            public String getId() {
063:                return id;
064:            }
065:
066:            /**
067:             * 
068:             * @return A translated name to identify the filter
069:             */
070:            public String getName() {
071:                return element.getAttribute(ATT_NAME);
072:            }
073:
074:            /**
075:             * 
076:             * @return A translated description to explain to the user what the defined
077:             *         filter will hide from the view.
078:             */
079:            public String getDescription() {
080:                return element.getAttribute(ATT_DESCRIPTION);
081:            }
082:
083:            /**
084:             * 
085:             * @return Indicates the filter should be in an "Active" state by default.
086:             */
087:            public boolean isActiveByDefault() {
088:                return Boolean.valueOf(
089:                        element.getAttribute(ATT_ACTIVE_BY_DEFAULT))
090:                        .booleanValue();
091:            }
092:
093:            /**
094:             * 
095:             * @return An instance of the ViewerFilter defined by the extension. Callers
096:             *         of this method are responsible for managing the instantiated
097:             *         filter.
098:             */
099:            public ViewerFilter createFilter() {
100:                try {
101:
102:                    if (filterExpression != null) {
103:
104:                        if (element.getAttribute(ATT_CLASS) != null) {
105:                            NavigatorPlugin
106:                                    .log(
107:                                            IStatus.WARNING,
108:                                            0,
109:                                            "A \"commonFilter\" was specified in " + //$NON-NLS-1$
110:                                                    element
111:                                                            .getDeclaringExtension()
112:                                                            .getNamespaceIdentifier()
113:                                                    + " which specifies a \"class\" attribute and an Core Expression.\n" + //$NON-NLS-1$
114:                                                    "Only the Core Expression will be respected.", //$NON-NLS-1$
115:                                            null);
116:                        }
117:
118:                        return new CoreExpressionFilter(filterExpression);
119:                    }
120:
121:                    return (ViewerFilter) element
122:                            .createExecutableExtension(ATT_CLASS);
123:                } catch (RuntimeException re) {
124:                    NavigatorPlugin.logError(0, re.getMessage(), re);
125:                } catch (CoreException e) {
126:                    NavigatorPlugin.logError(0, e.getMessage(), e);
127:                }
128:
129:                return SkeletonViewerFilter.INSTANCE;
130:            }
131:
132:            /*
133:             * (non-Javadoc)
134:             * 
135:             * @see java.lang.Object#toString()
136:             */
137:            public String toString() {
138:                return "CommonFilterDescriptor[" + getName() + " (" + getId() + ")]"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
139:            }
140:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.