Source Code Cross Referenced for ConfigProblemsDialog.java in  » Net » Terracotta » org » terracotta » dso » dialogs » 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 » Net » Terracotta » org.terracotta.dso.dialogs 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
003:         * notice. All rights reserved.
004:         */
005:        package org.terracotta.dso.dialogs;
006:
007:        import org.eclipse.core.resources.IFile;
008:        import org.eclipse.core.resources.IMarker;
009:        import org.eclipse.core.resources.IProject;
010:        import org.eclipse.core.resources.IResource;
011:        import org.eclipse.core.runtime.CoreException;
012:        import org.eclipse.jface.dialogs.IDialogConstants;
013:        import org.eclipse.jface.dialogs.MessageDialog;
014:        import org.eclipse.jface.resource.ImageDescriptor;
015:        import org.eclipse.jface.resource.JFaceResources;
016:        import org.eclipse.swt.SWT;
017:        import org.eclipse.swt.events.SelectionAdapter;
018:        import org.eclipse.swt.events.SelectionEvent;
019:        import org.eclipse.swt.graphics.Image;
020:        import org.eclipse.swt.layout.GridData;
021:        import org.eclipse.swt.layout.GridLayout;
022:        import org.eclipse.swt.widgets.Button;
023:        import org.eclipse.swt.widgets.Composite;
024:        import org.eclipse.swt.widgets.Control;
025:        import org.eclipse.swt.widgets.Shell;
026:        import org.eclipse.swt.widgets.Table;
027:        import org.eclipse.swt.widgets.TableColumn;
028:        import org.eclipse.swt.widgets.TableItem;
029:        import org.eclipse.ui.PlatformUI;
030:        import org.terracotta.dso.TcPlugin;
031:        import org.terracotta.dso.editors.ConfigurationEditor;
032:        import org.terracotta.ui.util.SWTUtil;
033:
034:        public class ConfigProblemsDialog extends MessageDialog {
035:
036:            private final Shell fParentShell;
037:            private final IProject fProject;
038:            private Table fTable;
039:            private Button fDisableConfigWarningsButton;
040:
041:            private static String DISABLE_CONFIG_WARNINGS_MSG = "Always proceed even if there are config problems";
042:
043:            private static String TITLE = "Terracotta";
044:            private static String MSG = "The are problems with the Terracotta configuration. Continue?";
045:
046:            private static Image ERROR_IMG = getSharedImage("IMG_OBJS_ERROR_PATH");
047:            private static Image WARNING_IMG = getSharedImage("IMG_OBJS_WARNING_PATH");
048:            private static Image INFO_IMG = getSharedImage("IMG_OBJS_INFO_PATH");
049:
050:            public ConfigProblemsDialog(Shell shell, IProject project) {
051:                super (shell, TITLE, null, MSG, MessageDialog.NONE,
052:                        new String[] { IDialogConstants.OK_LABEL,
053:                                IDialogConstants.CANCEL_LABEL }, 0);
054:                setShellStyle(getShellStyle() | SWT.RESIZE);
055:                fProject = project;
056:                fParentShell = shell;
057:            }
058:
059:            protected void configureShell(Shell shell) {
060:                super .configureShell(shell);
061:                if (fParentShell != null) {
062:                    SWTUtil.placeDialogInCenter(fParentShell, shell);
063:                }
064:            }
065:
066:            protected Control createDialogArea(Composite parent) {
067:                parent.setLayout(new GridLayout());
068:                return super .createDialogArea(parent);
069:            }
070:
071:            protected Control createCustomArea(Composite parent) {
072:                Composite comp = new Composite(parent, SWT.NONE);
073:                comp.setLayout(new GridLayout());
074:                comp.setLayoutData(new GridData(GridData.FILL_BOTH));
075:
076:                fTable = new Table(comp, SWT.BORDER | SWT.V_SCROLL | SWT.SINGLE
077:                        | SWT.FULL_SELECTION);
078:                fTable.addSelectionListener(new SelectionAdapter() {
079:                    public void widgetSelected(SelectionEvent e) {
080:                        try {
081:                            ConfigurationEditor configEditor = TcPlugin
082:                                    .getDefault().openConfigurationEditor(
083:                                            fProject);
084:                            TableItem item = fTable.getSelection()[0];
085:                            configEditor.gotoMarker((IMarker) item.getData());
086:                        } catch (Exception ex) {
087:                            ex.printStackTrace();
088:                        }
089:                    }
090:                });
091:                fTable.setHeaderVisible(true);
092:                fTable.setLinesVisible(true);
093:
094:                TableColumn fieldCol = new TableColumn(fTable, SWT.NONE);
095:                fieldCol.setResizable(true);
096:                fieldCol.setText("Description");
097:                fieldCol.pack();
098:
099:                TableColumn nameCol = new TableColumn(fTable, SWT.NONE);
100:                nameCol.setResizable(true);
101:                nameCol.setText("Location");
102:                nameCol.pack();
103:
104:                SWTUtil.makeTableColumnsResizeWeightedWidth(comp, fTable,
105:                        new int[] { 5, 1 });
106:                GridData gridData = new GridData(GridData.FILL_BOTH);
107:                gridData.heightHint = SWTUtil.tableRowsToPixels(fTable, 5);
108:                gridData.widthHint = SWTUtil.textColumnsToPixels(fTable, 120);
109:                fTable.setLayoutData(gridData);
110:
111:                IFile configFile = TcPlugin.getDefault().getConfigurationFile(
112:                        fProject);
113:                IMarker[] markers = null;
114:                try {
115:                    markers = configFile.findMarkers(
116:                            "org.eclipse.core.resources.problemmarker", true,
117:                            IResource.DEPTH_ZERO);
118:                } catch (CoreException ce) {
119:                    ce.printStackTrace();
120:                }
121:                if (markers != null && markers.length > 0) {
122:                    for (IMarker marker : markers) {
123:                        TableItem item = new TableItem(fTable, SWT.NONE);
124:                        item.setData(marker);
125:                        item.setImage(getImage(marker));
126:                        item.setText(new String[] {
127:                                marker.getAttribute(IMarker.MESSAGE, ""),
128:                                "line "
129:                                        + marker.getAttribute(
130:                                                IMarker.LINE_NUMBER, 0) });
131:                    }
132:                }
133:
134:                fDisableConfigWarningsButton = new Button(comp, SWT.CHECK);
135:                fDisableConfigWarningsButton.setLayoutData(new GridData());
136:                fDisableConfigWarningsButton
137:                        .setText(DISABLE_CONFIG_WARNINGS_MSG);
138:                fDisableConfigWarningsButton.setSelection(!TcPlugin
139:                        .getDefault().getWarnConfigProblemsOption(fProject));
140:                fDisableConfigWarningsButton
141:                        .addSelectionListener(new SelectionAdapter() {
142:                            public void widgetSelected(SelectionEvent e) {
143:                                boolean disableWarn = fDisableConfigWarningsButton
144:                                        .getSelection();
145:                                TcPlugin.getDefault()
146:                                        .setWarnConfigProblemsOption(fProject,
147:                                                !disableWarn);
148:                            }
149:                        });
150:
151:                return parent;
152:            }
153:
154:            private static Image getImage(IMarker marker) {
155:                switch (marker.getAttribute(IMarker.SEVERITY, 0)) {
156:                case IMarker.SEVERITY_ERROR:
157:                    return ERROR_IMG;
158:                case IMarker.SEVERITY_WARNING:
159:                    return WARNING_IMG;
160:                case IMarker.SEVERITY_INFO:
161:                    return INFO_IMG;
162:                default:
163:                    return null;
164:                }
165:            }
166:
167:            private static Image getSharedImage(String symbolicName) {
168:                ImageDescriptor imageDesc = PlatformUI.getWorkbench()
169:                        .getSharedImages().getImageDescriptor(symbolicName);
170:                if (imageDesc != null) {
171:                    return JFaceResources.getResources()
172:                            .createImageWithDefault(imageDesc);
173:                }
174:                return null;
175:            }
176:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.