Source Code Cross Referenced for JarImportWizardAction.java in  » IDE-Eclipse » jdt » org » eclipse » jdt » internal » ui » actions » 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 » jdt » org.eclipse.jdt.internal.ui.actions 
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.jdt.internal.ui.actions;
011:
012:        import org.eclipse.jface.action.Action;
013:        import org.eclipse.jface.action.IAction;
014:        import org.eclipse.jface.viewers.ISelection;
015:        import org.eclipse.jface.viewers.ISelectionChangedListener;
016:        import org.eclipse.jface.viewers.IStructuredSelection;
017:        import org.eclipse.jface.viewers.SelectionChangedEvent;
018:        import org.eclipse.jface.wizard.WizardDialog;
019:
020:        import org.eclipse.ui.IImportWizard;
021:        import org.eclipse.ui.IObjectActionDelegate;
022:        import org.eclipse.ui.IWorkbenchPart;
023:        import org.eclipse.ui.IWorkbenchWindow;
024:        import org.eclipse.ui.PlatformUI;
025:
026:        import org.eclipse.jdt.core.IClasspathEntry;
027:        import org.eclipse.jdt.core.IPackageFragmentRoot;
028:        import org.eclipse.jdt.core.JavaModelException;
029:
030:        import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
031:        import org.eclipse.jdt.internal.ui.JavaPlugin;
032:        import org.eclipse.jdt.internal.ui.jarimport.JarImportWizard;
033:
034:        /**
035:         * Combined action and action delegate for the jar import action.
036:         * 
037:         * @since 3.2
038:         */
039:        public class JarImportWizardAction extends Action implements 
040:                IObjectActionDelegate, ISelectionChangedListener {
041:
042:            /** The wizard height */
043:            public static final int SIZING_WIZARD_HEIGHT = 520;
044:
045:            /** The wizard width */
046:            public static final int SIZING_WIZARD_WIDTH = 470;
047:
048:            /** The structured selection, or <code>null</code> */
049:            private IStructuredSelection fSelection = null;
050:
051:            /** The active workbench part, or <code>null</code> */
052:            private IWorkbenchPart fWorkbenchPart = null;
053:
054:            /**
055:             * {@inheritDoc}
056:             */
057:            public void run() {
058:                run(this );
059:            }
060:
061:            /**
062:             * {@inheritDoc}
063:             */
064:            public void run(final IAction action) {
065:                if (fWorkbenchPart == null || fSelection == null)
066:                    return;
067:                final IImportWizard wizard = new JarImportWizard(false);
068:                final IWorkbenchWindow window = fWorkbenchPart.getSite()
069:                        .getWorkbenchWindow();
070:                wizard.init(window.getWorkbench(), fSelection);
071:                final WizardDialog dialog = new WizardDialog(window.getShell(),
072:                        wizard);
073:                dialog.create();
074:                dialog.getShell().setSize(
075:                        Math.max(SIZING_WIZARD_WIDTH, dialog.getShell()
076:                                .getSize().x), SIZING_WIZARD_HEIGHT);
077:                PlatformUI.getWorkbench().getHelpSystem().setHelp(
078:                        dialog.getShell(),
079:                        IJavaHelpContextIds.JARIMPORT_WIZARD_PAGE);
080:                dialog.open();
081:            }
082:
083:            /**
084:             * {@inheritDoc}
085:             */
086:            public void selectionChanged(final IAction action,
087:                    final ISelection selection) {
088:                fSelection = null;
089:                if (selection instanceof  IStructuredSelection) {
090:                    final IStructuredSelection structured = (IStructuredSelection) selection;
091:                    if (structured.size() == 1) {
092:                        final Object element = structured.getFirstElement();
093:                        if (element instanceof  IPackageFragmentRoot) {
094:                            final IPackageFragmentRoot root = (IPackageFragmentRoot) element;
095:                            try {
096:                                final IClasspathEntry entry = root
097:                                        .getRawClasspathEntry();
098:                                if (entry != null) {
099:                                    if (JarImportWizard
100:                                            .isValidClassPathEntry(entry)
101:                                            && JarImportWizard
102:                                                    .isValidJavaProject(root
103:                                                            .getJavaProject()))
104:                                        fSelection = structured;
105:                                }
106:                            } catch (JavaModelException exception) {
107:                                JavaPlugin.log(exception);
108:                            }
109:                        }
110:                    }
111:                }
112:                action.setEnabled(fSelection != null);
113:            }
114:
115:            /**
116:             * {@inheritDoc}
117:             */
118:            public void selectionChanged(final SelectionChangedEvent event) {
119:                selectionChanged(this , event.getSelection());
120:            }
121:
122:            /**
123:             * {@inheritDoc}
124:             */
125:            public void setActivePart(final IAction action,
126:                    final IWorkbenchPart part) {
127:                fWorkbenchPart = part;
128:            }
129:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.