Source Code Cross Referenced for JarRefactoringDialog.java in  » IDE-Eclipse » jdt » org » eclipse » jdt » internal » ui » jarpackager » 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.jarpackager 
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.jdt.internal.ui.jarpackager;
011:
012:        import java.util.HashSet;
013:        import java.util.Set;
014:
015:        import org.eclipse.core.runtime.Assert;
016:
017:        import org.eclipse.core.resources.IProject;
018:        import org.eclipse.core.resources.IWorkspaceRoot;
019:        import org.eclipse.core.resources.ResourcesPlugin;
020:
021:        import org.eclipse.swt.SWT;
022:        import org.eclipse.swt.layout.GridData;
023:        import org.eclipse.swt.layout.GridLayout;
024:        import org.eclipse.swt.widgets.Button;
025:        import org.eclipse.swt.widgets.Composite;
026:        import org.eclipse.swt.widgets.Control;
027:        import org.eclipse.swt.widgets.Label;
028:        import org.eclipse.swt.widgets.Shell;
029:
030:        import org.eclipse.jface.dialogs.Dialog;
031:        import org.eclipse.jface.dialogs.IDialogConstants;
032:        import org.eclipse.jface.dialogs.IDialogSettings;
033:        import org.eclipse.jface.dialogs.TrayDialog;
034:
035:        import org.eclipse.ui.PlatformUI;
036:
037:        import org.eclipse.ltk.core.refactoring.RefactoringDescriptorProxy;
038:        import org.eclipse.ltk.core.refactoring.history.RefactoringHistory;
039:        import org.eclipse.ltk.ui.refactoring.RefactoringUI;
040:        import org.eclipse.ltk.ui.refactoring.history.ISortableRefactoringHistoryControl;
041:        import org.eclipse.ltk.ui.refactoring.history.RefactoringHistoryControlConfiguration;
042:
043:        import org.eclipse.jdt.ui.jarpackager.JarPackageData;
044:
045:        import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
046:
047:        /**
048:         * Dialog to configure the refactorings to export.
049:         * 
050:         * @since 3.2
051:         */
052:        public final class JarRefactoringDialog extends TrayDialog {
053:
054:            /** The sort dialog setting */
055:            private static final String SETTING_SORT = "org.eclipse.jdt.ui.jar.export.sortRefactorings"; //$NON-NLS-1$
056:
057:            /** The jar package data */
058:            private final JarPackageData fData;
059:
060:            /** The export structural button */
061:            private Button fExportStructural = null;
062:
063:            /** The refactoring history */
064:            private final RefactoringHistory fHistory;
065:
066:            /** The refactoring history control */
067:            private ISortableRefactoringHistoryControl fHistoryControl = null;
068:
069:            /** The dialog settings */
070:            private final IDialogSettings fSettings;
071:
072:            /**
073:             * Creates a new jar refactoring dialog.
074:             * 
075:             * @param shell
076:             *            the parent shell
077:             * @param settings
078:             *            the dialog settings, or <code>null</code>
079:             * @param data
080:             *            the jar package data
081:             * @param history
082:             *            the refactoring history
083:             */
084:            public JarRefactoringDialog(final Shell shell,
085:                    final IDialogSettings settings, final JarPackageData data,
086:                    final RefactoringHistory history) {
087:                super (shell);
088:                Assert.isNotNull(data);
089:                Assert.isNotNull(history);
090:                setShellStyle(getShellStyle() | SWT.RESIZE);
091:                fSettings = settings;
092:                fData = data;
093:                fHistory = history;
094:            }
095:
096:            /**
097:             * {@inheritDoc}
098:             */
099:            protected void buttonPressed(final int buttonId) {
100:                if (buttonId == IDialogConstants.OK_ID) {
101:                    fData.setRefactoringAware(true);
102:                    final RefactoringDescriptorProxy[] descriptors = fHistoryControl
103:                            .getCheckedDescriptors();
104:                    Set set = new HashSet();
105:                    IWorkspaceRoot root = ResourcesPlugin.getWorkspace()
106:                            .getRoot();
107:                    for (int index = 0; index < descriptors.length; index++) {
108:                        final String project = descriptors[index].getProject();
109:                        if (project != null && !"".equals(project)) //$NON-NLS-1$
110:                            set.add(root.getProject(project));
111:                    }
112:                    fData.setRefactoringProjects((IProject[]) set
113:                            .toArray(new IProject[set.size()]));
114:                    fData.setRefactoringDescriptors(descriptors);
115:                    fData.setExportStructuralOnly(fExportStructural
116:                            .getSelection());
117:                    final IDialogSettings settings = fSettings;
118:                    if (settings != null)
119:                        settings.put(SETTING_SORT, fHistoryControl
120:                                .isSortByProjects());
121:                }
122:                super .buttonPressed(buttonId);
123:            }
124:
125:            /**
126:             * {@inheritDoc}
127:             */
128:            protected void configureShell(final Shell shell) {
129:                super .configureShell(shell);
130:                shell
131:                        .setText(JarPackagerMessages.JarRefactoringDialog_dialog_title);
132:                PlatformUI.getWorkbench().getHelpSystem().setHelp(shell,
133:                        IJavaHelpContextIds.JARPACKAGER_REFACTORING_DIALOG);
134:            }
135:
136:            /**
137:             * {@inheritDoc}
138:             */
139:            public void create() {
140:                super .create();
141:                getButton(OK).setEnabled(!fHistory.isEmpty());
142:            }
143:
144:            /**
145:             * {@inheritDoc}
146:             */
147:            protected Control createDialogArea(final Composite parent) {
148:                final Composite container = (Composite) super 
149:                        .createDialogArea(parent);
150:                initializeDialogUnits(container);
151:                final Composite composite = new Composite(container, SWT.NULL);
152:                final GridLayout layout = new GridLayout();
153:                layout.marginHeight = 0;
154:                layout.marginWidth = 0;
155:                composite.setLayout(layout);
156:                composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
157:                        | GridData.FILL_VERTICAL));
158:                final RefactoringHistoryControlConfiguration configuration = new RefactoringHistoryControlConfiguration(
159:                        null, true, true) {
160:
161:                    public final String getWorkspaceCaption() {
162:                        return JarPackagerMessages.JarRefactoringDialog_workspace_caption;
163:                    }
164:                };
165:                fHistoryControl = (ISortableRefactoringHistoryControl) RefactoringUI
166:                        .createSortableRefactoringHistoryControl(composite,
167:                                configuration);
168:                fHistoryControl.createControl();
169:                boolean sortProjects = true;
170:                final IDialogSettings settings = fSettings;
171:                if (settings != null)
172:                    sortProjects = settings.getBoolean(SETTING_SORT);
173:                if (sortProjects)
174:                    fHistoryControl.sortByProjects();
175:                else
176:                    fHistoryControl.sortByDate();
177:                GridData data = new GridData(GridData.FILL_HORIZONTAL
178:                        | GridData.FILL_VERTICAL);
179:                data.heightHint = convertHeightInCharsToPixels(32);
180:                data.widthHint = convertWidthInCharsToPixels(72);
181:                fHistoryControl.getControl().setLayoutData(data);
182:                fHistoryControl.setInput(fHistory);
183:                fHistoryControl.setCheckedDescriptors(fData
184:                        .getRefactoringDescriptors());
185:                createPlainLabel(composite,
186:                        JarPackagerMessages.JarPackageWizardPage_options_label);
187:                createOptionsGroup(composite);
188:                Dialog.applyDialogFont(parent);
189:                return composite;
190:            }
191:
192:            /**
193:             * Create the export option group.
194:             * 
195:             * @param parent
196:             *            the parent composite
197:             */
198:            protected void createOptionsGroup(Composite parent) {
199:                Composite optionsGroup = new Composite(parent, SWT.NONE);
200:                GridLayout layout = new GridLayout();
201:                layout.marginHeight = 0;
202:                optionsGroup.setLayout(layout);
203:
204:                fExportStructural = new Button(optionsGroup, SWT.CHECK
205:                        | SWT.LEFT);
206:                fExportStructural
207:                        .setText(JarPackagerMessages.JarRefactoringDialog_export_structural);
208:                fExportStructural.setSelection(fData.isExportStructuralOnly());
209:            }
210:
211:            /**
212:             * Creates a new label.
213:             * 
214:             * @param parent
215:             *            the parent control
216:             * @param text
217:             *            the label text
218:             * @return the new label control
219:             */
220:            protected Label createPlainLabel(Composite parent, String text) {
221:                Label label = new Label(parent, SWT.NONE);
222:                label.setText(text);
223:                label.setFont(parent.getFont());
224:                GridData data = new GridData();
225:                data.verticalAlignment = GridData.FILL;
226:                data.horizontalAlignment = GridData.FILL;
227:                label.setLayoutData(data);
228:                return label;
229:            }
230:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.