2011/08/05 - Jakarta Cactus has been retired.
For more information, please explore the Attic.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.cactus.eclipse.webapp.internal.ui;
22
23 import org.apache.cactus.eclipse.webapp.internal.Webapp;
24 import org.eclipse.core.resources.IProject;
25 import org.eclipse.core.runtime.CoreException;
26 import org.eclipse.core.runtime.IAdaptable;
27 import org.eclipse.jdt.core.IJavaProject;
28 import org.eclipse.jdt.core.JavaCore;
29 import org.eclipse.jface.preference.PreferencePage;
30 import org.eclipse.swt.widgets.Composite;
31 import org.eclipse.swt.widgets.Control;
32 import org.eclipse.ui.IWorkbench;
33 import org.eclipse.ui.IWorkbenchPreferencePage;
34 import org.eclipse.ui.dialogs.PropertyPage;
35 import org.eclipse.ui.internal.dialogs.WorkbenchPreferencePage;
36
37
38
39
40
41
42
43 public class WebAppPropertyPage extends PropertyPage
44 {
45
46
47
48 private WebAppConfigurationBlock webAppConfigurationBlock;
49
50
51
52
53 private Webapp webapp;
54
55
56
57
58
59 protected final Control createContents(final Composite theParent)
60 {
61 IJavaProject javaProject = JavaCore.create(getProject());
62 webapp = new Webapp(javaProject);
63 webapp.init();
64
65
66
67
68
69
70
71 webAppConfigurationBlock =
72 new WebAppConfigurationBlock(
73 getShell(),
74 javaProject,
75 webapp.getOutput(),
76 webapp.getDir(),
77 webapp.getClasspath());
78 return webAppConfigurationBlock.createContents(theParent);
79 }
80
81
82
83
84 public final boolean performOk()
85 {
86 webapp.setOutput(webAppConfigurationBlock.getOutput());
87 webapp.setDir(webAppConfigurationBlock.getWebappDir());
88 webapp.setClasspath(webAppConfigurationBlock.getWebappClasspath());
89 try
90 {
91 webapp.persist();
92 }
93 catch (CoreException e)
94 {
95
96 System.err.println(e.getStackTrace());
97 e.printStackTrace();
98 return false;
99 }
100 return true;
101 }
102
103
104
105
106 public final void performDefaults()
107 {
108 super.performDefaults();
109 webapp.loadDefaultValues();
110 webAppConfigurationBlock.update(
111 webapp.getOutput(),
112 webapp.getDir(),
113 webapp.getClasspath());
114 webAppConfigurationBlock.refresh();
115 }
116
117
118
119
120
121 private IProject getProject()
122 {
123
124 IAdaptable adaptable = getElement();
125 IProject elem = (IProject) adaptable.getAdapter(IProject.class);
126 return elem;
127
128
129 }
130
131 public void init(IWorkbench arg0) {
132
133 setPreferenceStore(WebappPlugin.getDefault().getPreferenceStore());
134
135
136 }
137 }