Source Code Cross Referenced for TargetErrorDialog.java in  » IDE-Eclipse » Eclipse-plug-in-development » org » eclipse » pde » internal » ui » editor » target » 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 » Eclipse plug in development » org.eclipse.pde.internal.ui.editor.target 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2005, 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.pde.internal.ui.editor.target;
011:
012:        import org.eclipse.jface.dialogs.IDialogConstants;
013:        import org.eclipse.jface.dialogs.MessageDialog;
014:        import org.eclipse.jface.viewers.ITreeContentProvider;
015:        import org.eclipse.jface.viewers.LabelProvider;
016:        import org.eclipse.pde.internal.core.ifeature.IFeaturePlugin;
017:        import org.eclipse.pde.internal.ui.PDEPlugin;
018:        import org.eclipse.pde.internal.ui.PDEPluginImages;
019:        import org.eclipse.pde.internal.ui.PDEUIMessages;
020:        import org.eclipse.pde.internal.ui.elements.DefaultContentProvider;
021:        import org.eclipse.pde.internal.ui.parts.TreeMessageDialog;
022:        import org.eclipse.swt.graphics.Image;
023:        import org.eclipse.swt.widgets.Shell;
024:
025:        public class TargetErrorDialog extends TreeMessageDialog {
026:
027:            private static LabelProvider fLabelProvider;
028:
029:            private static class TreeNode {
030:                Object[] fChildren;
031:                boolean fFeature;
032:
033:                protected TreeNode(Object[] children, boolean feature) {
034:                    fChildren = children;
035:                    fFeature = feature;
036:                }
037:
038:                protected Object[] getChildren() {
039:                    return fChildren;
040:                }
041:
042:                protected boolean isFeatureBased() {
043:                    return fFeature;
044:                }
045:
046:                public String toString() {
047:                    return fFeature ? PDEUIMessages.TargetPluginsTab_features
048:                            : PDEUIMessages.TargetPluginsTab_plugins;
049:                }
050:            }
051:
052:            protected static class ErrorDialogContentProvider extends
053:                    DefaultContentProvider implements  ITreeContentProvider {
054:                TreeNode fPlugins, fFeatures;
055:
056:                ErrorDialogContentProvider(TreeNode features, TreeNode plugins) {
057:                    fFeatures = features;
058:                    fPlugins = plugins;
059:                }
060:
061:                public Object[] getChildren(Object parentElement) {
062:                    if (parentElement instanceof  TreeNode)
063:                        return ((TreeNode) parentElement).getChildren();
064:                    return null;
065:                }
066:
067:                public Object getParent(Object element) {
068:                    return null;
069:                }
070:
071:                public boolean hasChildren(Object element) {
072:                    return element instanceof  TreeNode;
073:                }
074:
075:                public Object[] getElements(Object inputElement) {
076:                    if (fFeatures != null && fPlugins != null)
077:                        return new Object[] { fFeatures, fPlugins };
078:                    else if (fFeatures != null)
079:                        return new Object[] { fFeatures };
080:                    else
081:                        return new Object[] { fPlugins };
082:                }
083:            }
084:
085:            private TargetErrorDialog(Shell parentShell, String dialogTitle,
086:                    Image dialogTitleImage, String dialogMessage,
087:                    int dialogImageType, String[] dialogButtonLabels,
088:                    int defaultIndex) {
089:                super (parentShell, dialogTitle, dialogTitleImage,
090:                        dialogMessage, dialogImageType, dialogButtonLabels,
091:                        defaultIndex);
092:            }
093:
094:            public static void showDialog(Shell parentShell, Object[] features,
095:                    Object[] plugins) {
096:                TreeMessageDialog dialog = new TargetErrorDialog(parentShell,
097:                        PDEUIMessages.TargetErrorDialog_title, null,
098:                        PDEUIMessages.TargetErrorDialog_description,
099:                        MessageDialog.WARNING,
100:                        new String[] { IDialogConstants.OK_LABEL }, 0);
101:                TreeNode featureNode = (features.length > 0) ? new TreeNode(
102:                        features, true) : null;
103:                TreeNode pluginNode = (plugins.length > 0) ? new TreeNode(
104:                        plugins, false) : null;
105:                dialog.setContentProvider(new ErrorDialogContentProvider(
106:                        featureNode, pluginNode));
107:                dialog.setLabelProvider(getLabelProvider());
108:                dialog.setInput(new Object());
109:                dialog.open();
110:            }
111:
112:            protected static LabelProvider getLabelProvider() {
113:                if (fLabelProvider == null) {
114:                    fLabelProvider = new LabelProvider() {
115:
116:                        public Image getImage(Object obj) {
117:                            if (obj instanceof  TreeNode) {
118:                                if (((TreeNode) obj).isFeatureBased())
119:                                    return PDEPlugin
120:                                            .getDefault()
121:                                            .getLabelProvider()
122:                                            .get(
123:                                                    PDEPluginImages.DESC_FEATURE_OBJ,
124:                                                    0);
125:                                return PDEPlugin
126:                                        .getDefault()
127:                                        .getLabelProvider()
128:                                        .get(PDEPluginImages.DESC_PLUGIN_OBJ, 0);
129:                            }
130:                            if (obj instanceof  IFeaturePlugin) {
131:                                IFeaturePlugin plugin = (IFeaturePlugin) obj;
132:                                if (plugin.isFragment())
133:                                    return PDEPlugin
134:                                            .getDefault()
135:                                            .getLabelProvider()
136:                                            .get(
137:                                                    PDEPluginImages.DESC_FRAGMENT_OBJ,
138:                                                    0);
139:                                return PDEPlugin
140:                                        .getDefault()
141:                                        .getLabelProvider()
142:                                        .get(PDEPluginImages.DESC_PLUGIN_OBJ, 0);
143:                            }
144:                            return PDEPlugin.getDefault().getLabelProvider()
145:                                    .getImage(obj);
146:                        }
147:
148:                        public String getText(Object obj) {
149:                            return PDEPlugin.getDefault().getLabelProvider()
150:                                    .getText(obj);
151:                        }
152:                    };
153:                }
154:                return fLabelProvider;
155:            }
156:
157:        }
www.___j___av_a__2__s___.___c_om___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.