Source Code Cross Referenced for AbstractPDELaunchConfigurationTabGroup.java in  » IDE-Eclipse » Eclipse-plug-in-development » org » eclipse » pde » ui » launcher » 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.ui.launcher 
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.ui.launcher;
011:
012:        import org.eclipse.core.runtime.CoreException;
013:        import org.eclipse.debug.core.ILaunchConfiguration;
014:        import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
015:        import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
016:        import org.eclipse.debug.ui.ILaunchConfigurationTab;
017:        import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
018:        import org.eclipse.pde.internal.core.TargetPlatformHelper;
019:        import org.eclipse.pde.internal.ui.IPDEUIConstants;
020:        import org.eclipse.pde.internal.ui.launcher.LaunchArgumentsHelper;
021:        import org.eclipse.pde.internal.ui.launcher.LaunchPluginValidator;
022:        import org.eclipse.swt.custom.BusyIndicator;
023:        import org.eclipse.swt.widgets.Display;
024:
025:        /**
026:         * An abstract class subclassed by the Eclipse application and JUnit Plug-in launch
027:         * configuration tab groups.
028:         * <p>
029:         * This class is not intended to be subclassed by clients.
030:         * </p>
031:         * @since 3.3
032:         */
033:        public abstract class AbstractPDELaunchConfigurationTabGroup extends
034:                AbstractLaunchConfigurationTabGroup {
035:
036:            /**
037:             * The tab group delegates to all tabs in the group.
038:             * Prior to the delegation, it migrates all pre-3.2 launch configurations
039:             * to make them 3.2-compliant.
040:             * 
041:             * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
042:             */
043:            public void initializeFrom(ILaunchConfiguration configuration) {
044:                final ILaunchConfiguration config = configuration;
045:                final ILaunchConfigurationTab[] tabs = getTabs();
046:                BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
047:                    public void run() {
048:                        try {
049:                            if (config instanceof  ILaunchConfigurationWorkingCopy) {
050:                                checkBackwardCompatibility((ILaunchConfigurationWorkingCopy) config);
051:                            }
052:                        } catch (CoreException e) {
053:                        }
054:                        for (int i = 0; i < tabs.length; i++) {
055:                            tabs[i].initializeFrom(config);
056:                        }
057:                    }
058:                });
059:            }
060:
061:            /**
062:             * Checks if the launch configuration is 3.2-compliant and migrates it if it's not.
063:             * 
064:             * @param wc 
065:             * 			the launch configuration to be migrated if it's not 3.2-compliant
066:             * @throws CoreException
067:             * 			a CoreException is thrown if there was an error retrieving launch 
068:             * 			configuration attributes
069:             */
070:            private void checkBackwardCompatibility(
071:                    ILaunchConfigurationWorkingCopy wc) throws CoreException {
072:                String id = wc
073:                        .getAttribute(
074:                                IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH_PROVIDER,
075:                                (String) null);
076:                if (id == null) {
077:                    wc
078:                            .setAttribute(
079:                                    IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH_PROVIDER,
080:                                    PDESourcePathProvider.ID);
081:                }
082:
083:                String value = wc.getAttribute("vmargs", (String) null); //$NON-NLS-1$
084:                if (value != null) {
085:                    wc.setAttribute("vmargs", (String) null); //$NON-NLS-1$
086:                    wc
087:                            .setAttribute(
088:                                    IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,
089:                                    value);
090:                }
091:
092:                value = wc.getAttribute("progargs", (String) null); //$NON-NLS-1$
093:                if (value != null) {
094:                    wc.setAttribute("progargs", (String) null); //$NON-NLS-1$
095:                    wc
096:                            .setAttribute(
097:                                    IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
098:                                    value);
099:                }
100:
101:                value = wc.getAttribute(
102:                        IPDELauncherConstants.LOCATION + "0", (String) null); //$NON-NLS-1$
103:                if (value != null) {
104:                    wc
105:                            .setAttribute(
106:                                    IPDELauncherConstants.LOCATION + "0", (String) null); //$NON-NLS-1$
107:                    wc.setAttribute(IPDELauncherConstants.LOCATION, value);
108:                }
109:
110:                LaunchPluginValidator.checkBackwardCompatibility(wc, false);
111:                if (wc.isDirty()) {
112:                    wc.doSave();
113:                }
114:            }
115:
116:            /**
117:             * Delegates to all tabs to set defaults.
118:             * It then sets program and VM arguments based on values on the 
119:             * <b>Plug-in Development > Target Platform > Launching Arguments</b> preference page.
120:             * 
121:             * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
122:             */
123:            public void setDefaults(
124:                    ILaunchConfigurationWorkingCopy configuration) {
125:                super .setDefaults(configuration);
126:                if (TargetPlatformHelper.usesNewApplicationModel())
127:                    configuration.setAttribute(
128:                            IPDEUIConstants.LAUNCHER_PDE_VERSION, "3.3"); //$NON-NLS-1$ 
129:                else if (TargetPlatformHelper.getTargetVersion() >= 3.2)
130:                    configuration.setAttribute(
131:                            IPDEUIConstants.LAUNCHER_PDE_VERSION, "3.2a"); //$NON-NLS-1$ 
132:
133:                configuration
134:                        .setAttribute(
135:                                IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH_PROVIDER,
136:                                PDESourcePathProvider.ID);
137:
138:                // Set Program/VM arguments with preference values
139:                String programArgs = LaunchArgumentsHelper
140:                        .getInitialProgramArguments().trim();
141:                if (programArgs.length() > 0)
142:                    configuration
143:                            .setAttribute(
144:                                    IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
145:                                    programArgs);
146:
147:                String vmArgs = LaunchArgumentsHelper.getInitialVMArguments()
148:                        .trim();
149:                if (vmArgs.length() > 0)
150:                    configuration
151:                            .setAttribute(
152:                                    IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,
153:                                    vmArgs);
154:
155:                configuration.setAttribute(
156:                        IPDEUIConstants.APPEND_ARGS_EXPLICITLY, true);
157:            }
158:
159:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.