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


001:        /*******************************************************************************
002:         * Copyright (c) 2005, 2007 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.core.product;
011:
012:        import java.io.PrintWriter;
013:        import java.util.HashMap;
014:        import java.util.Map;
015:
016:        import org.eclipse.pde.internal.core.iproduct.ILauncherInfo;
017:        import org.eclipse.pde.internal.core.iproduct.IProductModel;
018:        import org.w3c.dom.Element;
019:        import org.w3c.dom.Node;
020:        import org.w3c.dom.NodeList;
021:
022:        public class LauncherInfo extends ProductObject implements 
023:                ILauncherInfo {
024:
025:            private static final long serialVersionUID = 1L;
026:            private boolean fUseIcoFile;
027:            private Map fIcons = new HashMap();
028:            private String fLauncherName;
029:
030:            public LauncherInfo(IProductModel model) {
031:                super (model);
032:            }
033:
034:            public String getLauncherName() {
035:                return fLauncherName;
036:            }
037:
038:            public void setLauncherName(String name) {
039:                String old = fLauncherName;
040:                fLauncherName = name;
041:                if (isEditable())
042:                    firePropertyChanged(P_LAUNCHER, old, fLauncherName);
043:            }
044:
045:            public void setIconPath(String iconId, String path) {
046:                if (path == null)
047:                    path = ""; //$NON-NLS-1$
048:                String old = (String) fIcons.get(iconId);
049:                fIcons.put(iconId, path);
050:                if (isEditable())
051:                    firePropertyChanged(iconId, old, path);
052:            }
053:
054:            public String getIconPath(String iconId) {
055:                return (String) fIcons.get(iconId);
056:            }
057:
058:            public boolean usesWinIcoFile() {
059:                return fUseIcoFile;
060:            }
061:
062:            public void setUseWinIcoFile(boolean use) {
063:                boolean old = fUseIcoFile;
064:                fUseIcoFile = use;
065:                if (isEditable())
066:                    firePropertyChanged(P_USE_ICO, Boolean.toString(old),
067:                            Boolean.toString(fUseIcoFile));
068:            }
069:
070:            public void parse(Node node) {
071:                if (node.getNodeType() == Node.ELEMENT_NODE) {
072:                    fLauncherName = ((Element) node).getAttribute("name"); //$NON-NLS-1$
073:                    NodeList children = node.getChildNodes();
074:                    for (int i = 0; i < children.getLength(); i++) {
075:                        Node child = children.item(i);
076:                        if (child.getNodeType() == Node.ELEMENT_NODE) {
077:                            String name = child.getNodeName();
078:                            if (name.equals("linux")) { //$NON-NLS-1$
079:                                parseLinux((Element) child);
080:                            } else if (name.equals("macosx")) { //$NON-NLS-1$
081:                                parseMac((Element) child);
082:                            } else if (name.equals("solaris")) { //$NON-NLS-1$
083:                                parseSolaris((Element) child);
084:                            } else if (name.equals("win")) { //$NON-NLS-1$
085:                                parseWin((Element) child);
086:                            }
087:                        }
088:                    }
089:                }
090:            }
091:
092:            private void parseWin(Element element) {
093:                fUseIcoFile = "true".equals(element.getAttribute(P_USE_ICO)); //$NON-NLS-1$
094:                NodeList children = element.getChildNodes();
095:                for (int i = 0; i < children.getLength(); i++) {
096:                    if (children.item(i).getNodeType() == Node.ELEMENT_NODE) {
097:                        Element child = (Element) children.item(i);
098:                        String name = child.getNodeName();
099:                        if (name.equals("ico")) { //$NON-NLS-1$
100:                            fIcons.put(P_ICO_PATH, child.getAttribute("path")); //$NON-NLS-1$
101:                        } else if (name.equals("bmp")) { //$NON-NLS-1$
102:                            fIcons.put(WIN32_16_HIGH, child
103:                                    .getAttribute(WIN32_16_HIGH));
104:                            fIcons.put(WIN32_16_LOW, child
105:                                    .getAttribute(WIN32_16_LOW));
106:                            fIcons.put(WIN32_32_HIGH, child
107:                                    .getAttribute(WIN32_32_HIGH));
108:                            fIcons.put(WIN32_32_LOW, child
109:                                    .getAttribute(WIN32_32_LOW));
110:                            fIcons.put(WIN32_48_HIGH, child
111:                                    .getAttribute(WIN32_48_HIGH));
112:                            fIcons.put(WIN32_48_LOW, child
113:                                    .getAttribute(WIN32_48_LOW));
114:                        }
115:                    }
116:                }
117:            }
118:
119:            private void parseSolaris(Element element) {
120:                fIcons.put(SOLARIS_LARGE, element.getAttribute(SOLARIS_LARGE));
121:                fIcons
122:                        .put(SOLARIS_MEDIUM, element
123:                                .getAttribute(SOLARIS_MEDIUM));
124:                fIcons.put(SOLARIS_SMALL, element.getAttribute(SOLARIS_SMALL));
125:                fIcons.put(SOLARIS_TINY, element.getAttribute(SOLARIS_TINY));
126:            }
127:
128:            private void parseMac(Element element) {
129:                fIcons.put(MACOSX_ICON, element.getAttribute("icon")); //$NON-NLS-1$
130:            }
131:
132:            private void parseLinux(Element element) {
133:                fIcons.put(LINUX_ICON, element.getAttribute("icon")); //$NON-NLS-1$
134:            }
135:
136:            public void write(String indent, PrintWriter writer) {
137:                writer.print(indent + "<launcher"); //$NON-NLS-1$
138:                if (fLauncherName != null && fLauncherName.length() > 0)
139:                    writer.print(" name=\"" + fLauncherName + "\""); //$NON-NLS-1$ //$NON-NLS-2$
140:                writer.println(">"); //$NON-NLS-1$
141:
142:                writeLinux(indent + "   ", writer); //$NON-NLS-1$
143:                writeMac(indent + "   ", writer); //$NON-NLS-1$
144:                writeSolaris(indent + "   ", writer); //$NON-NLS-1$
145:                writerWin(indent + "   ", writer); //$NON-NLS-1$
146:                writer.println(indent + "</launcher>"); //$NON-NLS-1$
147:            }
148:
149:            private void writerWin(String indent, PrintWriter writer) {
150:                writer
151:                        .println(indent
152:                                + "<win " + P_USE_ICO + "=\"" + Boolean.toString(fUseIcoFile) + "\">"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
153:                String path = (String) fIcons.get(P_ICO_PATH);
154:                if (path != null && path.length() > 0)
155:                    writer
156:                            .println(indent
157:                                    + "   <ico path=\"" + getWritableString(path) + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$
158:                writer.print(indent + "   <bmp"); //$NON-NLS-1$
159:                writeIcon(indent + "   ", WIN32_16_HIGH, writer); //$NON-NLS-1$
160:                writeIcon(indent + "   ", WIN32_16_LOW, writer); //$NON-NLS-1$
161:                writeIcon(indent + "   ", WIN32_32_HIGH, writer); //$NON-NLS-1$
162:                writeIcon(indent + "   ", WIN32_32_LOW, writer); //$NON-NLS-1$
163:                writeIcon(indent + "   ", WIN32_48_HIGH, writer); //$NON-NLS-1$
164:                writeIcon(indent + "   ", WIN32_48_LOW, writer); //$NON-NLS-1$
165:                writer.println("/>"); //$NON-NLS-1$
166:                writer.println(indent + "</win>"); //$NON-NLS-1$
167:            }
168:
169:            private void writeSolaris(String indent, PrintWriter writer) {
170:                writer.print(indent + "<solaris"); //$NON-NLS-1$
171:                writeIcon(indent + "   ", SOLARIS_LARGE, writer); //$NON-NLS-1$
172:                writeIcon(indent + "   ", SOLARIS_MEDIUM, writer); //$NON-NLS-1$
173:                writeIcon(indent + "   ", SOLARIS_SMALL, writer); //$NON-NLS-1$
174:                writeIcon(indent + "   ", SOLARIS_TINY, writer); //$NON-NLS-1$
175:                writer.println("/>"); //$NON-NLS-1$
176:            }
177:
178:            private void writeIcon(String indent, String iconId,
179:                    PrintWriter writer) {
180:                String icon = (String) fIcons.get(iconId);
181:                if (icon != null && icon.length() > 0) {
182:                    writer.println();
183:                    writer
184:                            .print(indent
185:                                    + "   " + iconId + "=\"" + getWritableString(icon) + "\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
186:                }
187:
188:            }
189:
190:            private void writeMac(String indent, PrintWriter writer) {
191:                String icon = (String) fIcons.get(MACOSX_ICON);
192:                if (icon != null && icon.length() > 0)
193:                    writer
194:                            .println(indent
195:                                    + "<macosx icon=\"" + getWritableString(icon) + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ 
196:            }
197:
198:            private void writeLinux(String indent, PrintWriter writer) {
199:                String icon = (String) fIcons.get(LINUX_ICON);
200:                if (icon != null && icon.length() > 0)
201:                    writer
202:                            .println(indent
203:                                    + "<linux icon=\"" + getWritableString(icon) + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ 
204:            }
205:
206:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.