Lines 38-45
Link Here
|
38 |
* Version 2 license, then the option applies only if the new code is |
38 |
* Version 2 license, then the option applies only if the new code is |
39 |
* made subject to such option by the copyright holder. |
39 |
* made subject to such option by the copyright holder. |
40 |
*/ |
40 |
*/ |
|
|
41 |
package org.netbeans.modules.mobility.project; |
41 |
|
42 |
|
42 |
package org.netbeans.modules.mobility.project; |
|
|
43 |
import java.beans.PropertyChangeEvent; |
43 |
import java.beans.PropertyChangeEvent; |
44 |
import java.beans.PropertyChangeListener; |
44 |
import java.beans.PropertyChangeListener; |
45 |
import java.beans.PropertyChangeSupport; |
45 |
import java.beans.PropertyChangeSupport; |
Lines 83-89
import org.netbeans.spi.mobility.project
Link Here
|
83 |
import org.netbeans.spi.mobility.project.ui.customizer.support.VisualPropertySupport; |
83 |
import org.netbeans.spi.mobility.project.ui.customizer.support.VisualPropertySupport; |
84 |
import org.netbeans.spi.project.ProjectConfiguration; |
84 |
import org.netbeans.spi.project.ProjectConfiguration; |
85 |
import org.netbeans.api.project.ui.OpenProjects; |
85 |
import org.netbeans.api.project.ui.OpenProjects; |
86 |
import org.netbeans.modules.mobility.project.classpath.J2MEProjectClassPathExtender; |
|
|
87 |
import org.netbeans.spi.project.ui.ProjectOpenedHook; |
86 |
import org.netbeans.spi.project.ui.ProjectOpenedHook; |
88 |
import org.openide.DialogDisplayer; |
87 |
import org.openide.DialogDisplayer; |
89 |
import org.openide.NotifyDescriptor; |
88 |
import org.openide.NotifyDescriptor; |
Lines 95-113
import org.openide.util.ImageUtilities;
Link Here
|
95 |
import org.openide.util.ImageUtilities; |
94 |
import org.openide.util.ImageUtilities; |
96 |
import org.openide.util.Lookup; |
95 |
import org.openide.util.Lookup; |
97 |
import org.openide.util.RequestProcessor; |
96 |
import org.openide.util.RequestProcessor; |
98 |
import org.netbeans.modules.mobility.project.ui.J2MECustomizerProvider; |
|
|
99 |
import org.netbeans.modules.mobility.project.ui.J2MEPhysicalViewProvider; |
97 |
import org.netbeans.modules.mobility.project.ui.J2MEPhysicalViewProvider; |
100 |
import org.netbeans.modules.mobility.project.queries.CompiledSourceForBinaryQuery; |
|
|
101 |
import org.netbeans.modules.mobility.project.queries.JavadocForBinaryQueryImpl; |
102 |
import org.netbeans.spi.project.AuxiliaryConfiguration; |
98 |
import org.netbeans.spi.project.AuxiliaryConfiguration; |
103 |
import org.netbeans.api.project.ProjectInformation; |
99 |
import org.netbeans.api.project.ProjectInformation; |
104 |
import org.netbeans.modules.j2me.cdc.platform.CDCPlatform; |
100 |
import org.netbeans.modules.j2me.cdc.platform.CDCPlatform; |
|
|
101 |
import org.netbeans.modules.java.api.common.SourceRoots; |
102 |
import org.netbeans.modules.java.api.common.ant.UpdateHelper; |
103 |
import org.netbeans.modules.java.api.common.queries.QuerySupport; |
105 |
import org.netbeans.modules.mobility.project.classpath.J2MEClassPathProvider; |
104 |
import org.netbeans.modules.mobility.project.classpath.J2MEClassPathProvider; |
|
|
105 |
import org.netbeans.modules.mobility.project.classpath.J2MEProjectClassPathExtender; |
106 |
import org.netbeans.modules.mobility.project.deployment.DeploymentPropertiesHandler; |
106 |
import org.netbeans.modules.mobility.project.deployment.DeploymentPropertiesHandler; |
107 |
import org.netbeans.modules.mobility.project.queries.SourceLevelQueryImpl; |
107 |
import org.netbeans.modules.mobility.project.queries.CompiledSourceForBinaryQuery; |
108 |
import org.netbeans.modules.mobility.project.queries.FileBuiltQueryImpl; |
108 |
import org.netbeans.modules.mobility.project.queries.FileBuiltQueryImpl; |
109 |
import org.netbeans.modules.mobility.project.queries.FileEncodingQueryImpl; |
109 |
import org.netbeans.modules.mobility.project.queries.FileEncodingQueryImpl; |
|
|
110 |
import org.netbeans.modules.mobility.project.queries.JavadocForBinaryQueryImpl; |
111 |
import org.netbeans.modules.mobility.project.queries.SourceLevelQueryImpl; |
110 |
import org.netbeans.modules.mobility.project.security.KeyStoreRepository; |
112 |
import org.netbeans.modules.mobility.project.security.KeyStoreRepository; |
|
|
113 |
import org.netbeans.modules.mobility.project.ui.J2MECustomizerProvider; |
111 |
import org.netbeans.modules.mobility.project.ui.customizer.J2MEProjectProperties; |
114 |
import org.netbeans.modules.mobility.project.ui.customizer.J2MEProjectProperties; |
112 |
import org.netbeans.spi.java.project.support.ui.BrokenReferencesSupport; |
115 |
import org.netbeans.spi.java.project.support.ui.BrokenReferencesSupport; |
113 |
import org.netbeans.spi.mobility.deployment.DeploymentPlugin; |
116 |
import org.netbeans.spi.mobility.deployment.DeploymentPlugin; |
Lines 117-123
import org.netbeans.spi.project.support.
Link Here
|
117 |
import org.netbeans.spi.project.support.ant.*; |
120 |
import org.netbeans.spi.project.support.ant.*; |
118 |
import org.netbeans.spi.project.ui.RecommendedTemplates; |
121 |
import org.netbeans.spi.project.ui.RecommendedTemplates; |
119 |
import org.netbeans.spi.project.ui.PrivilegedTemplates; |
122 |
import org.netbeans.spi.project.ui.PrivilegedTemplates; |
|
|
123 |
import org.netbeans.spi.project.ui.support.UILookupMergerSupport; |
124 |
import org.netbeans.spi.queries.FileEncodingQueryImplementation; |
125 |
import org.netbeans.spi.queries.SharabilityQueryImplementation; |
120 |
import org.openide.ErrorManager; |
126 |
import org.openide.ErrorManager; |
|
|
127 |
import org.openide.util.Exceptions; |
121 |
import org.openide.util.LookupEvent; |
128 |
import org.openide.util.LookupEvent; |
122 |
import org.openide.util.LookupListener; |
129 |
import org.openide.util.LookupListener; |
123 |
import org.openide.util.Mutex; |
130 |
import org.openide.util.Mutex; |
Lines 134-180
import org.w3c.dom.Node;
Link Here
|
134 |
* @author Jesse Glick, Adam Sotona, Tim Boudreau |
141 |
* @author Jesse Glick, Adam Sotona, Tim Boudreau |
135 |
*/ |
142 |
*/ |
136 |
public final class J2MEProject implements Project, AntProjectListener { |
143 |
public final class J2MEProject implements Project, AntProjectListener { |
|
|
144 |
|
137 |
final Icon J2ME_PROJECT_ICON = new ImageIcon(ImageUtilities.loadImage( |
145 |
final Icon J2ME_PROJECT_ICON = new ImageIcon(ImageUtilities.loadImage( |
138 |
"org/netbeans/modules/mobility/project/ui/resources/mobile-project.png" )); // NOI18N |
146 |
"org/netbeans/modules/mobility/project/ui/resources/mobile-project.png")); // NOI18N |
139 |
private static final URLStreamHandler COMPOSED_STREAM_HANDLER = new URLStreamHandler() { |
147 |
private static final URLStreamHandler COMPOSED_STREAM_HANDLER = new URLStreamHandler() { |
|
|
148 |
|
140 |
protected URLConnection openConnection(URL u) throws IOException { |
149 |
protected URLConnection openConnection(URL u) throws IOException { |
141 |
return new ComposedConnection(u); |
150 |
return new ComposedConnection(u); |
142 |
} |
151 |
} |
143 |
}; |
152 |
}; |
144 |
|
|
|
145 |
static final String CONFIGS_NAME = "configurations"; // NOI18N |
153 |
static final String CONFIGS_NAME = "configurations"; // NOI18N |
146 |
static final String CONFIG_NAME = "configuration"; // NOI18N |
154 |
static final String CONFIG_NAME = "configuration"; // NOI18N |
147 |
static final String CONFIGS_NS = "http://www.netbeans.org/ns/project-configurations/1"; // NOI18N |
155 |
static final String CONFIGS_NS = "http://www.netbeans.org/ns/project-configurations/1"; // NOI18N |
148 |
static final String CLASSPATH = "classpath"; // NOI18N |
156 |
static final String CLASSPATH = "classpath"; // NOI18N |
149 |
|
|
|
150 |
final AuxiliaryConfiguration aux; |
157 |
final AuxiliaryConfiguration aux; |
151 |
final AntProjectHelper helper; |
158 |
final AntProjectHelper helper; |
152 |
final GeneratedFilesHelper genFilesHelper; |
159 |
final GeneratedFilesHelper genFilesHelper; |
153 |
Lookup lookup; |
160 |
Lookup lookup; |
154 |
final MIDletsCacheHelper midletsCacheHelper; |
161 |
final MIDletsCacheHelper midletsCacheHelper; |
155 |
final ProjectConfigurationsHelper configHelper; |
162 |
final ProjectConfigurationsHelper configHelper; |
156 |
|
163 |
private final SourceRoots sourceRoots; |
|
|
164 |
private final SourceRoots testSourceRoots; |
165 |
|
166 |
//XXX This pointlessly leaks FileObjects. Cache paths instead. -Tim |
157 |
private static final Set<FileObject> roots = new HashSet<FileObject>(); |
167 |
private static final Set<FileObject> roots = new HashSet<FileObject>(); |
158 |
private static final Map<FileObject, Boolean> folders = new WeakHashMap<FileObject, Boolean>(); |
168 |
private static final Map<FileObject, Boolean> folders = new WeakHashMap<FileObject, Boolean>(); |
159 |
private final ReferenceHelper refHelper; |
169 |
private final ReferenceHelper refHelper; |
160 |
private final PropertyChangeSupport pcs; |
170 |
private final PropertyChangeSupport pcs; |
161 |
|
|
|
162 |
private TextSwitcher textSwitcher; |
171 |
private TextSwitcher textSwitcher; |
163 |
|
172 |
private final UpdateHelper updater; |
|
|
173 |
|
164 |
/* Side effect of this methosd is modification of fo - is this correct? */ |
174 |
/* Side effect of this methosd is modification of fo - is this correct? */ |
165 |
public static boolean isJ2MEFile(FileObject fo) { |
175 |
public static boolean isJ2MEFile(FileObject fo) { |
166 |
if (fo == null) return false; |
176 |
if (fo == null) { |
|
|
177 |
return false; |
178 |
} |
167 |
final FileObject archiveRoot = FileUtil.getArchiveFile(fo); |
179 |
final FileObject archiveRoot = FileUtil.getArchiveFile(fo); |
168 |
if (archiveRoot != null) { |
180 |
if (archiveRoot != null) { |
169 |
fo = archiveRoot; |
181 |
fo = archiveRoot; |
170 |
} |
182 |
} |
171 |
return isJ2MEFolder(fo.getParent()); |
183 |
return isJ2MEFolder(fo.getParent()); |
172 |
} |
184 |
} |
173 |
|
185 |
|
174 |
private static boolean isJ2MEFolder(FileObject fo) { |
186 |
private static boolean isJ2MEFolder(FileObject fo) { |
175 |
if (fo == null) return false; |
187 |
if (fo == null) { |
|
|
188 |
return false; |
189 |
} |
176 |
synchronized (roots) { |
190 |
synchronized (roots) { |
177 |
if (roots.contains(fo)) return true; |
191 |
if (roots.contains(fo)) { |
|
|
192 |
return true; |
193 |
} |
178 |
} |
194 |
} |
179 |
Boolean result; |
195 |
Boolean result; |
180 |
synchronized (folders) { |
196 |
synchronized (folders) { |
Lines 184-191
public final class J2MEProject implement
Link Here
|
184 |
FileObject xml; |
200 |
FileObject xml; |
185 |
if (fo.isFolder() && (xml = fo.getFileObject("nbproject/project.xml")) != null) { |
201 |
if (fo.isFolder() && (xml = fo.getFileObject("nbproject/project.xml")) != null) { |
186 |
result = isJ2MEProjectXML(xml); |
202 |
result = isJ2MEProjectXML(xml); |
187 |
if (result) synchronized (roots) { |
203 |
if (result) { |
188 |
roots.add(fo); |
204 |
synchronized (roots) { |
|
|
205 |
roots.add(fo); |
206 |
} |
189 |
} |
207 |
} |
190 |
} else { |
208 |
} else { |
191 |
result = isJ2MEFolder(fo.getParent()); |
209 |
result = isJ2MEFolder(fo.getParent()); |
Lines 197-211
public final class J2MEProject implement
Link Here
|
197 |
return result; |
215 |
return result; |
198 |
} |
216 |
} |
199 |
|
217 |
|
200 |
public boolean isConfigBroken (ProjectConfiguration cfg) { |
218 |
public boolean isConfigBroken(ProjectConfiguration cfg) { |
201 |
cfg = cfg == null ? configHelper.getActiveConfiguration() : cfg; |
219 |
cfg = cfg == null ? configHelper.getActiveConfiguration() : cfg; |
202 |
String[] breakableConfigProperties = getBreakableProperties (cfg); |
220 |
String[] breakableConfigProperties = getBreakableProperties(cfg); |
203 |
String[] breakableConfigPlatformProperties = getBreakablePlatformProperties (cfg); |
221 |
String[] breakableConfigPlatformProperties = getBreakablePlatformProperties(cfg); |
204 |
boolean result = BrokenReferencesSupport.isBroken( helper, refHelper, |
222 |
boolean result = BrokenReferencesSupport.isBroken(helper, refHelper, |
205 |
breakableConfigProperties, breakableConfigPlatformProperties); |
223 |
breakableConfigProperties, breakableConfigPlatformProperties); |
206 |
//also check for unresolved ant properties |
224 |
//also check for unresolved ant properties |
207 |
return result || breakableConfigProperties != null && |
225 |
return result || breakableConfigProperties != null && |
208 |
breakableConfigProperties[1] != null && |
226 |
breakableConfigProperties[1] != null && |
209 |
breakableConfigProperties[1].contains("${"); |
227 |
breakableConfigProperties[1].contains("${"); |
210 |
} |
228 |
} |
211 |
|
229 |
|
Lines 239-245
public final class J2MEProject implement
Link Here
|
239 |
if (libs == null) { |
257 |
if (libs == null) { |
240 |
libs = DefaultPropertiesDescriptor.PLATFORM_ACTIVE; |
258 |
libs = DefaultPropertiesDescriptor.PLATFORM_ACTIVE; |
241 |
} else { |
259 |
} else { |
242 |
libs = J2MEProjectProperties.CONFIG_PREFIX + |
260 |
libs = J2MEProjectProperties.CONFIG_PREFIX + |
243 |
cfg.getDisplayName() + "." + |
261 |
cfg.getDisplayName() + "." + |
244 |
DefaultPropertiesDescriptor.PLATFORM_ACTIVE; |
262 |
DefaultPropertiesDescriptor.PLATFORM_ACTIVE; |
245 |
} |
263 |
} |
Lines 248-272
public final class J2MEProject implement
Link Here
|
248 |
} |
266 |
} |
249 |
|
267 |
|
250 |
private String[] getBreakablePlatformProperties(ProjectConfiguration cfg) { |
268 |
private String[] getBreakablePlatformProperties(ProjectConfiguration cfg) { |
251 |
String s[]=new String[1]; |
269 |
String s[] = new String[1]; |
252 |
s[0]=usedActive(cfg); |
270 |
s[0] = usedActive(cfg); |
253 |
return s; |
271 |
return s; |
254 |
} |
272 |
} |
255 |
|
273 |
|
256 |
public String[] getBreakableProperties() { |
274 |
public String[] getBreakableProperties() { |
257 |
final ProjectConfiguration pc[] = configHelper.getConfigurations().toArray( |
275 |
final ProjectConfiguration pc[] = configHelper.getConfigurations().toArray( |
258 |
new ProjectConfiguration[0]); |
276 |
new ProjectConfiguration[0]); |
259 |
String s[] = new String[2*pc.length+1]; |
277 |
String s[] = new String[2 * pc.length + 1]; |
260 |
s[0] = DefaultPropertiesDescriptor.SRC_DIR; |
278 |
s[0] = DefaultPropertiesDescriptor.SRC_DIR; |
261 |
for (int i= 0; i<pc.length; i++) { |
279 |
for (int i = 0; i < pc.length; i++) { |
262 |
if (configHelper.getDefaultConfiguration().equals(pc[i])) { |
280 |
if (configHelper.getDefaultConfiguration().equals(pc[i])) { |
263 |
s[2*i+1] = DefaultPropertiesDescriptor.LIBS_CLASSPATH; |
281 |
s[2 * i + 1] = DefaultPropertiesDescriptor.LIBS_CLASSPATH; |
264 |
s[2*i+2] = DefaultPropertiesDescriptor.SIGN_KEYSTORE; |
282 |
s[2 * i + 2] = DefaultPropertiesDescriptor.SIGN_KEYSTORE; |
265 |
} else { |
283 |
} else { |
266 |
s[2*i+1] = J2MEProjectProperties.CONFIG_PREFIX + |
284 |
s[2 * i + 1] = J2MEProjectProperties.CONFIG_PREFIX + |
267 |
pc[i].getDisplayName() + "." + |
285 |
pc[i].getDisplayName() + "." + |
268 |
DefaultPropertiesDescriptor.LIBS_CLASSPATH; //NOI18N |
286 |
DefaultPropertiesDescriptor.LIBS_CLASSPATH; //NOI18N |
269 |
s[2*i+2] = J2MEProjectProperties.CONFIG_PREFIX + |
287 |
s[2 * i + 2] = J2MEProjectProperties.CONFIG_PREFIX + |
270 |
pc[i].getDisplayName() + "." + |
288 |
pc[i].getDisplayName() + "." + |
271 |
DefaultPropertiesDescriptor.SIGN_KEYSTORE; //NOI18N |
289 |
DefaultPropertiesDescriptor.SIGN_KEYSTORE; //NOI18N |
272 |
} |
290 |
} |
Lines 278-288
public final class J2MEProject implement
Link Here
|
278 |
final ProjectConfiguration pc[] = |
296 |
final ProjectConfiguration pc[] = |
279 |
configHelper.getConfigurations().toArray(new ProjectConfiguration[0]); |
297 |
configHelper.getConfigurations().toArray(new ProjectConfiguration[0]); |
280 |
String s[] = new String[pc.length]; |
298 |
String s[] = new String[pc.length]; |
281 |
for (int i= 0; i<pc.length; i++) { |
299 |
for (int i = 0; i < pc.length; i++) { |
282 |
if (configHelper.getDefaultConfiguration().equals(pc[i])) { |
300 |
if (configHelper.getDefaultConfiguration().equals(pc[i])) { |
283 |
s[i] = DefaultPropertiesDescriptor.PLATFORM_ACTIVE; |
301 |
s[i] = DefaultPropertiesDescriptor.PLATFORM_ACTIVE; |
284 |
} else { |
302 |
} else { |
285 |
s[i] = J2MEProjectProperties.CONFIG_PREFIX + |
303 |
s[i] = J2MEProjectProperties.CONFIG_PREFIX + |
286 |
pc[i].getDisplayName() + "." + |
304 |
pc[i].getDisplayName() + "." + |
287 |
DefaultPropertiesDescriptor.PLATFORM_ACTIVE; //NOI18N |
305 |
DefaultPropertiesDescriptor.PLATFORM_ACTIVE; //NOI18N |
288 |
} |
306 |
} |
Lines 317-345
public final class J2MEProject implement
Link Here
|
317 |
} |
335 |
} |
318 |
return libs; |
336 |
return libs; |
319 |
} |
337 |
} |
320 |
|
338 |
|
321 |
protected static void addRoots(final AntProjectHelper helper) { |
339 |
protected static void addRoots(AntProjectHelper helper, final SourceRoots roots) { |
322 |
final String src = helper.getStandardPropertyEvaluator().getProperty("src.dir"); //NOI18N |
340 |
for (FileObject root : roots.getRoots()) { |
323 |
if (src != null) addRoot(helper.resolveFileObject(src)); |
341 |
addRoot(root); |
|
|
342 |
} |
324 |
} |
343 |
} |
325 |
|
344 |
|
326 |
private static void addRoot(final FileObject fo) { |
345 |
private static void addRoot(final FileObject fo) { |
327 |
if (fo != null && !isJ2MEFile(fo)) { |
346 |
if (fo != null && !isJ2MEFile(fo)) { |
328 |
synchronized (roots) { |
347 |
synchronized (roots) { |
329 |
if (roots.add(fo)) |
348 |
if (roots.add(fo)) { |
330 |
RequestProcessor.getDefault().post(new Runnable() { |
349 |
RequestProcessor.getDefault().post(new Runnable() { |
|
|
350 |
|
331 |
public void run() { |
351 |
public void run() { |
332 |
final Enumeration en = fo.getChildren(true); |
352 |
final Enumeration en = fo.getChildren(true); |
333 |
while (en.hasMoreElements()) try { |
353 |
while (en.hasMoreElements()) { |
334 |
final FileObject f2 = (FileObject)en.nextElement(); |
354 |
try { |
335 |
if (f2.getExt().equals("java")) DataObject.find(f2).setValid(false); //NOI18N |
355 |
final FileObject f2 = (FileObject) en.nextElement(); |
336 |
} catch (Exception e) {} |
356 |
if (f2.getExt().equals("java")) { |
|
|
357 |
DataObject.find(f2).setValid(false); //NOI18N |
358 |
} |
359 |
} catch (Exception e) { |
360 |
} |
361 |
} |
337 |
} |
362 |
} |
338 |
}); |
363 |
}); |
|
|
364 |
} |
339 |
} |
365 |
} |
340 |
} |
366 |
} |
341 |
} |
367 |
} |
342 |
|
368 |
|
343 |
private static boolean isJ2MEProjectXML(final FileObject fo) { |
369 |
private static boolean isJ2MEProjectXML(final FileObject fo) { |
344 |
BufferedReader in = null; |
370 |
BufferedReader in = null; |
345 |
try { |
371 |
try { |
Lines 347-417
public final class J2MEProject implement
Link Here
|
347 |
in = new BufferedReader(new InputStreamReader(fo.getInputStream())); |
373 |
in = new BufferedReader(new InputStreamReader(fo.getInputStream())); |
348 |
String s; |
374 |
String s; |
349 |
while ((s = in.readLine()) != null) { |
375 |
while ((s = in.readLine()) != null) { |
350 |
if (s.indexOf("<type>"+J2MEProjectType.TYPE+"</type>") >= 0) return true; //NOI18N |
376 |
if (s.indexOf("<type>" + J2MEProjectType.TYPE + "</type>") >= 0) { |
|
|
377 |
return true; //NOI18N |
378 |
} |
351 |
} |
379 |
} |
352 |
} finally { |
380 |
} finally { |
353 |
if (in != null) in.close(); |
381 |
if (in != null) { |
|
|
382 |
in.close(); |
383 |
} |
354 |
} |
384 |
} |
355 |
} catch (IOException ioe) {} |
385 |
} catch (IOException ioe) { |
|
|
386 |
} |
356 |
return false; |
387 |
return false; |
357 |
} |
388 |
} |
358 |
|
389 |
|
359 |
J2MEProject(AntProjectHelper helper) { |
390 |
J2MEProject(AntProjectHelper helper) { |
360 |
this.helper = helper; |
391 |
this.helper = helper; |
361 |
addRoots(helper); |
|
|
362 |
aux = helper.createAuxiliaryConfiguration(); |
392 |
aux = helper.createAuxiliaryConfiguration(); |
363 |
refHelper = new ReferenceHelper(helper, aux, helper.getStandardPropertyEvaluator()); |
393 |
refHelper = new ReferenceHelper(helper, aux, helper.getStandardPropertyEvaluator()); |
364 |
configHelper = new ProjectConfigurationsHelper(helper, this); |
394 |
configHelper = new ProjectConfigurationsHelper(helper, this); |
365 |
genFilesHelper = new GeneratedFilesHelper(helper); |
395 |
genFilesHelper = new GeneratedFilesHelper(helper); |
366 |
midletsCacheHelper = new MIDletsCacheHelper(helper, configHelper); |
396 |
midletsCacheHelper = new MIDletsCacheHelper(helper, configHelper); |
367 |
helper.addAntProjectListener(new CDCMainClassHelper(helper)); |
397 |
helper.addAntProjectListener(new CDCMainClassHelper(this, helper)); |
368 |
pcs = new PropertyChangeSupport(this); |
398 |
pcs = new PropertyChangeSupport(this); |
|
|
399 |
helper.addAntProjectListener(this); |
400 |
//XXX should be possible to make these more lazy |
401 |
updater = new UpdateHelper(new Updater(this, helper, aux), helper); |
402 |
this.sourceRoots = SourceRoots.create( |
403 |
updater, |
404 |
evaluator(), |
405 |
refHelper, |
406 |
J2MEProjectType.MULTIROOT_PROJECT_CONFIGURATION_NAMESPACE, |
407 |
"source-roots", false, "src.{0}{1}.dir"); //NOI18N |
408 |
this.testSourceRoots = SourceRoots.create( |
409 |
updater, |
410 |
evaluator(), |
411 |
refHelper, |
412 |
J2MEProjectType.MULTIROOT_PROJECT_CONFIGURATION_NAMESPACE, |
413 |
"test-roots", false, "src.{0}{1}.dir"); //NOI18N |
414 |
if (sourceRoots == null) { |
415 |
throw new NullPointerException ("SourceRoots.create() returned null"); |
416 |
} |
417 |
|
418 |
assert sourceRoots != null; |
419 |
assert testSourceRoots != null; |
369 |
this.lookup = this.createLookup(aux); |
420 |
this.lookup = this.createLookup(aux); |
370 |
helper.addAntProjectListener(this); |
421 |
addRoots(helper, sourceRoots); |
371 |
} |
422 |
} |
372 |
|
423 |
|
|
|
424 |
public PropertyEvaluator evaluator() { |
425 |
return helper.getStandardPropertyEvaluator(); |
426 |
} |
427 |
|
373 |
public void hookNewProjectCreated() { |
428 |
public void hookNewProjectCreated() { |
374 |
midletsCacheHelper.refresh(); |
429 |
midletsCacheHelper.refresh(); |
375 |
} |
430 |
} |
376 |
|
431 |
|
377 |
public FileObject getProjectDirectory() { |
432 |
public FileObject getProjectDirectory() { |
378 |
return helper.getProjectDirectory(); |
433 |
return helper.getProjectDirectory(); |
379 |
} |
434 |
} |
380 |
|
435 |
|
381 |
public Lookup getLookup() { |
436 |
public Lookup getLookup() { |
382 |
return this.lookup; |
437 |
return this.lookup; |
383 |
} |
438 |
} |
384 |
|
439 |
|
385 |
public ProjectConfigurationsHelper getConfigurationHelper() { |
440 |
public ProjectConfigurationsHelper getConfigurationHelper() { |
386 |
return configHelper; |
441 |
return configHelper; |
387 |
} |
442 |
} |
388 |
|
443 |
|
389 |
private Lookup createLookup(final AuxiliaryConfiguration aux) { |
444 |
private Lookup createLookup(final AuxiliaryConfiguration aux) { |
390 |
final SourcesHelper sourcesHelper = new SourcesHelper(helper, helper.getStandardPropertyEvaluator()); |
445 |
FileEncodingQueryImplementation encodingQuery = |
391 |
sourcesHelper.addPrincipalSourceRoot("${src.dir}", NbBundle.getMessage(J2MEProject.class, "LBL_J2MEProject_Source_Packages"), null, null); //NOI18N |
446 |
QuerySupport.createFileEncodingQuery(evaluator(), |
392 |
sourcesHelper.addTypedSourceRoot("${src.dir}", JavaProjectConstants.SOURCES_TYPE_JAVA, NbBundle.getMessage(J2MEProject.class, "LBL_J2MEProject_Source_Packages"), null, null); //NOI18N |
447 |
J2MEProjectProperties.SOURCE_ENCODING); |
393 |
final SubprojectProvider spp = refHelper.createSubprojectProvider(); |
448 |
final SubprojectProvider spp = refHelper.createSubprojectProvider(); |
394 |
|
449 |
//XXX does not handle deployment.copy.target yet |
395 |
Object stdLookups[]=new Object[] { |
450 |
// helper.createSharabilityQuery(evaluator(), |
|
|
451 |
// new String[]{"${src.dir}"}, |
452 |
// new String[]{"${dist.root.dir}", |
453 |
// "${build.root.dir}", |
454 |
// "${deployment.copy.target}"}), //NOI18N |
455 |
assert sourceRoots != null; |
456 |
assert helper != null; |
457 |
assert evaluator() != null; |
458 |
assert sourceRoots != null; |
459 |
assert testSourceRoots != null; |
460 |
SharabilityQueryImplementation sharability = |
461 |
QuerySupport.createSharabilityQuery(helper, evaluator(), |
462 |
sourceRoots, testSourceRoots); |
463 |
|
464 |
Object stdLookups[] = new Object[]{ |
396 |
new Info(), |
465 |
new Info(), |
397 |
aux, |
466 |
aux, |
398 |
spp, |
467 |
spp, |
399 |
configHelper, |
468 |
configHelper, |
|
|
469 |
updater, |
470 |
encodingQuery, |
400 |
helper, |
471 |
helper, |
401 |
midletsCacheHelper, |
472 |
midletsCacheHelper, |
402 |
refHelper, |
473 |
refHelper, |
403 |
new FileBuiltQueryImpl(helper, configHelper), |
474 |
new J2MEClassPathProvider(helper, getSourceRoots(), getTestSourceRoots()), |
404 |
new J2MEActionProvider( this, helper ), |
475 |
sharability, |
|
|
476 |
new J2MESources(helper, evaluator(), sourceRoots, getTestSourceRoots()), |
477 |
UILookupMergerSupport.createProjectOpenHookMerger(new ProjectOpenedHookImpl()), |
478 |
QuerySupport.createTemplateAttributesProvider(helper, encodingQuery), |
479 |
new FileBuiltQueryImpl(this, helper, configHelper), |
480 |
new J2MEActionProvider(this, helper), |
405 |
new J2MEPhysicalViewProvider(this, helper, refHelper, configHelper), |
481 |
new J2MEPhysicalViewProvider(this, helper, refHelper, configHelper), |
406 |
new J2MECustomizerProvider( this, helper, refHelper, configHelper), |
482 |
new J2MECustomizerProvider(this, helper, refHelper, configHelper), |
407 |
new J2MEClassPathProvider(helper), |
|
|
408 |
new CompiledSourceForBinaryQuery(this, helper), |
483 |
new CompiledSourceForBinaryQuery(this, helper), |
409 |
new AntArtifactProviderImpl(), |
484 |
new AntArtifactProviderImpl(), |
410 |
new ProjectXmlSavedHookImpl(), |
485 |
new ProjectXmlSavedHookImpl(), |
411 |
new ProjectOpenedHookImpl(), |
486 |
new ProjectOpenedHookImpl(), |
412 |
new JavadocForBinaryQueryImpl(this, helper), |
487 |
new JavadocForBinaryQueryImpl(this, helper), |
413 |
helper.createSharabilityQuery(helper.getStandardPropertyEvaluator(), new String[]{"${src.dir}"}, new String[]{"${dist.root.dir}", "${build.root.dir}", "${deployment.copy.target}"}), //NOI18N |
|
|
414 |
sourcesHelper.createSources(), |
415 |
new RecommendedTemplatesImpl(), |
488 |
new RecommendedTemplatesImpl(), |
416 |
new SourceLevelQueryImpl(helper), |
489 |
new SourceLevelQueryImpl(helper), |
417 |
new J2MEProjectClassPathExtender(this, helper, refHelper, configHelper), |
490 |
new J2MEProjectClassPathExtender(this, helper, refHelper, configHelper), |
Lines 419-441
public final class J2MEProject implement
Link Here
|
419 |
new PreprocessorFileFilterImplementation(configHelper, helper), |
492 |
new PreprocessorFileFilterImplementation(configHelper, helper), |
420 |
new FileEncodingQueryImpl(helper) |
493 |
new FileEncodingQueryImpl(helper) |
421 |
}; |
494 |
}; |
422 |
ArrayList<Object> list=new ArrayList<Object>(); |
495 |
ArrayList<Object> list = new ArrayList<Object>(); |
423 |
list.addAll(Arrays.asList(stdLookups)); |
496 |
list.addAll(Arrays.asList(stdLookups)); |
424 |
for (ProjectLookupProvider provider : Lookup.getDefault().lookupAll(ProjectLookupProvider.class)) |
497 |
for (ProjectLookupProvider provider : Lookup.getDefault().lookupAll(ProjectLookupProvider.class)) { |
425 |
{ |
498 |
list.addAll(provider.createLookupElements(this, helper, refHelper, configHelper)); |
426 |
list.addAll(provider.createLookupElements(this,helper,refHelper,configHelper)); |
|
|
427 |
} |
499 |
} |
428 |
return Lookups.fixed(list.toArray()); |
500 |
return Lookups.fixed(list.toArray()); |
429 |
// return new AnalysisLookup (list.toArray()); |
|
|
430 |
} |
501 |
} |
431 |
|
502 |
|
|
|
503 |
public SourceRoots getSourceRoots() { |
504 |
return this.sourceRoots; |
505 |
} |
506 |
|
507 |
public SourceRoots getTestSourceRoots() { |
508 |
return this.testSourceRoots; |
509 |
} |
510 |
|
432 |
/** Store configured project name. */ |
511 |
/** Store configured project name. */ |
433 |
public void setName(final String name) { |
512 |
public void setName(final String name) { |
434 |
ProjectManager.mutex().writeAccess(new Mutex.Action<Object>() { |
513 |
ProjectManager.mutex().writeAccess(new Mutex.Action<Object>() { |
|
|
514 |
|
435 |
public Object run() { |
515 |
public Object run() { |
436 |
final Element data = helper.getPrimaryConfigurationData(true); |
516 |
final Element data = helper.getPrimaryConfigurationData(true); |
437 |
// XXX replace by XMLUtil when that has findElement, findText, etc. |
517 |
// XXX replace by XMLUtil when that has findElement, findText, etc. |
438 |
final NodeList nl = data.getElementsByTagNameNS(J2MEProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); |
518 |
final NodeList nl = data.getElementsByTagNameNS(J2MEProjectType.MULTIROOT_PROJECT_CONFIGURATION_NAMESPACE, "name"); |
439 |
Element nameEl; |
519 |
Element nameEl; |
440 |
if (nl.getLength() == 1) { |
520 |
if (nl.getLength() == 1) { |
441 |
nameEl = (Element) nl.item(0); |
521 |
nameEl = (Element) nl.item(0); |
Lines 444-451
public final class J2MEProject implement
Link Here
|
444 |
nameEl.removeChild(deadKids.item(0)); |
524 |
nameEl.removeChild(deadKids.item(0)); |
445 |
} |
525 |
} |
446 |
} else { |
526 |
} else { |
447 |
nameEl = data.getOwnerDocument().createElementNS(J2MEProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); |
527 |
nameEl = data.getOwnerDocument().createElementNS(J2MEProjectType.MULTIROOT_PROJECT_CONFIGURATION_NAMESPACE, "name"); |
448 |
data.insertBefore(nameEl, /* OK if null */data.getChildNodes().item(0)); |
528 |
data.insertBefore(nameEl, /* OK if null */ data.getChildNodes().item(0)); |
449 |
} |
529 |
} |
450 |
nameEl.appendChild(data.getOwnerDocument().createTextNode(name)); |
530 |
nameEl.appendChild(data.getOwnerDocument().createTextNode(name)); |
451 |
helper.putPrimaryConfigurationData(data, true); |
531 |
helper.putPrimaryConfigurationData(data, true); |
Lines 453-491
public final class J2MEProject implement
Link Here
|
453 |
} |
533 |
} |
454 |
}); |
534 |
}); |
455 |
} |
535 |
} |
456 |
|
536 |
|
457 |
public void addPropertyChangeListener(final PropertyChangeListener listener) { |
537 |
public void addPropertyChangeListener(final PropertyChangeListener listener) { |
458 |
pcs.addPropertyChangeListener(listener); |
538 |
pcs.addPropertyChangeListener(listener); |
459 |
} |
539 |
} |
460 |
|
540 |
|
461 |
public void removePropertyChangeListener(final PropertyChangeListener listener) { |
541 |
public void removePropertyChangeListener(final PropertyChangeListener listener) { |
462 |
pcs.removePropertyChangeListener(listener); |
542 |
pcs.removePropertyChangeListener(listener); |
463 |
} |
543 |
} |
464 |
|
544 |
|
465 |
public void configurationXmlChanged(final AntProjectEvent ev) { |
545 |
public void configurationXmlChanged(final AntProjectEvent ev) { |
466 |
if (ev.getPath().equals(AntProjectHelper.PROJECT_XML_PATH)) { |
546 |
if (ev.getPath().equals(AntProjectHelper.PROJECT_XML_PATH)) { |
467 |
// Could be various kinds of changes, but name & displayName might have changed. |
547 |
// Could be various kinds of changes, but name & displayName might have changed. |
468 |
final Info info = (Info)getLookup().lookup(ProjectInformation.class); |
548 |
final Info info = (Info) getLookup().lookup(ProjectInformation.class); |
469 |
info.firePropertyChange(ProjectInformation.PROP_NAME); |
549 |
info.firePropertyChange(ProjectInformation.PROP_NAME); |
470 |
info.firePropertyChange(ProjectInformation.PROP_DISPLAY_NAME); |
550 |
info.firePropertyChange(ProjectInformation.PROP_DISPLAY_NAME); |
471 |
} |
551 |
} |
472 |
} |
552 |
} |
473 |
|
553 |
|
474 |
public void propertiesChanged(@SuppressWarnings("unused") |
554 |
public void propertiesChanged(@SuppressWarnings("unused") |
475 |
final AntProjectEvent ev) { |
555 |
final AntProjectEvent ev) { |
476 |
// currently ignored |
556 |
// currently ignored |
477 |
} |
557 |
} |
478 |
|
558 |
|
479 |
|
|
|
480 |
protected void refreshPrivateProperties() throws IOException { |
559 |
protected void refreshPrivateProperties() throws IOException { |
481 |
try { |
560 |
try { |
482 |
ProjectManager.mutex().writeAccess(new Mutex.ExceptionAction<Object>() { |
561 |
ProjectManager.mutex().writeAccess(new Mutex.ExceptionAction<Object>() { |
483 |
public Object run() { |
562 |
|
|
|
563 |
public Object run() { |
484 |
boolean modified = false; |
564 |
boolean modified = false; |
485 |
EditableProperties proj = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH); |
565 |
EditableProperties proj = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH); |
486 |
EditableProperties priv = helper.getProperties(AntProjectHelper.PRIVATE_PROPERTIES_PATH); |
566 |
EditableProperties priv = helper.getProperties(AntProjectHelper.PRIVATE_PROPERTIES_PATH); |
487 |
priv.setProperty("netbeans.user", System.getProperty("netbeans.user")); //NOI18N |
567 |
priv.setProperty("netbeans.user", System.getProperty("netbeans.user")); //NOI18N |
488 |
for (ProjectPropertiesDescriptor p : Lookup.getDefault().lookup(new Lookup.Template<ProjectPropertiesDescriptor>(ProjectPropertiesDescriptor.class)).allInstances() ) { |
568 |
for (ProjectPropertiesDescriptor p : Lookup.getDefault().lookup(new Lookup.Template<ProjectPropertiesDescriptor>(ProjectPropertiesDescriptor.class)).allInstances()) { |
489 |
for (PropertyDescriptor d : p.getPropertyDescriptors()) { |
569 |
for (PropertyDescriptor d : p.getPropertyDescriptors()) { |
490 |
if (d.getDefaultValue() != null) { |
570 |
if (d.getDefaultValue() != null) { |
491 |
EditableProperties ep = d.isShared() ? proj : priv; |
571 |
EditableProperties ep = d.isShared() ? proj : priv; |
Lines 500-506
public final class J2MEProject implement
Link Here
|
500 |
if (!cfgs.isEmpty()) { |
580 |
if (!cfgs.isEmpty()) { |
501 |
modified = true; |
581 |
modified = true; |
502 |
cfgs.addAll(Arrays.asList(proj.getProperty(DefaultPropertiesDescriptor.ALL_CONFIGURATIONS).split(","))); |
582 |
cfgs.addAll(Arrays.asList(proj.getProperty(DefaultPropertiesDescriptor.ALL_CONFIGURATIONS).split(","))); |
503 |
cfgs.remove(" "); cfgs.remove(""); //NOI18N |
583 |
cfgs.remove(" "); |
|
|
584 |
cfgs.remove(""); //NOI18N |
504 |
StringBuffer sb = new StringBuffer(" "); //NOI18N |
585 |
StringBuffer sb = new StringBuffer(" "); //NOI18N |
505 |
for (String s : cfgs) { |
586 |
for (String s : cfgs) { |
506 |
sb.append(',').append(s); |
587 |
sb.append(',').append(s); |
Lines 508-514
public final class J2MEProject implement
Link Here
|
508 |
proj.setProperty(DefaultPropertiesDescriptor.ALL_CONFIGURATIONS, sb.toString()); |
589 |
proj.setProperty(DefaultPropertiesDescriptor.ALL_CONFIGURATIONS, sb.toString()); |
509 |
} |
590 |
} |
510 |
helper.putProperties(AntProjectHelper.PRIVATE_PROPERTIES_PATH, priv); |
591 |
helper.putProperties(AntProjectHelper.PRIVATE_PROPERTIES_PATH, priv); |
511 |
if (modified) helper.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, proj); |
592 |
if (modified) { |
|
|
593 |
helper.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, proj); |
594 |
} |
512 |
try { |
595 |
try { |
513 |
refHelper.addExtraBaseDirectory("netbeans.user"); //NOI18N |
596 |
refHelper.addExtraBaseDirectory("netbeans.user"); //NOI18N |
514 |
} catch (IllegalArgumentException iae) { |
597 |
} catch (IllegalArgumentException iae) { |
Lines 518-524
public final class J2MEProject implement
Link Here
|
518 |
} |
601 |
} |
519 |
}); |
602 |
}); |
520 |
} catch (MutexException e) { |
603 |
} catch (MutexException e) { |
521 |
throw (IOException)e.getException(); |
604 |
throw (IOException) e.getException(); |
522 |
} |
605 |
} |
523 |
// Probably unnecessary, but just in case: |
606 |
// Probably unnecessary, but just in case: |
524 |
try { |
607 |
try { |
Lines 527-544
public final class J2MEProject implement
Link Here
|
527 |
ErrorManager.getDefault().notify(e); |
610 |
ErrorManager.getDefault().notify(e); |
528 |
} |
611 |
} |
529 |
} |
612 |
} |
530 |
|
613 |
|
531 |
private Set<String> removeConfigurationsFromProjectXml() { |
614 |
private Set<String> removeConfigurationsFromProjectXml() { |
532 |
TreeSet<String> cfgs = new TreeSet(); |
615 |
TreeSet<String> cfgs = new TreeSet(); |
533 |
Element configs = aux.getConfigurationFragment(CONFIGS_NAME, CONFIGS_NS, true); |
616 |
Element configs = aux.getConfigurationFragment(CONFIGS_NAME, CONFIGS_NS, true); |
534 |
if (configs != null) { |
617 |
if (configs != null) { |
535 |
try { |
618 |
try { |
536 |
NodeList subEls = configs.getElementsByTagNameNS(CONFIGS_NS, CONFIG_NAME); |
619 |
NodeList subEls = configs.getElementsByTagNameNS(CONFIGS_NS, CONFIG_NAME); |
537 |
for (int i=0; i<subEls.getLength(); i++) { |
620 |
for (int i = 0; i < subEls.getLength(); i++) { |
538 |
final NodeList l = subEls.item(i).getChildNodes(); |
621 |
final NodeList l = subEls.item(i).getChildNodes(); |
539 |
for (int j = 0; j < l.getLength(); j++) { |
622 |
for (int j = 0; j < l.getLength(); j++) { |
540 |
if (l.item(j).getNodeType() == Node.TEXT_NODE) { |
623 |
if (l.item(j).getNodeType() == Node.TEXT_NODE) { |
541 |
cfgs.add(((Text)l.item(j)).getNodeValue()); |
624 |
cfgs.add(((Text) l.item(j)).getNodeValue()); |
542 |
} |
625 |
} |
543 |
} |
626 |
} |
544 |
} |
627 |
} |
Lines 550-565
public final class J2MEProject implement
Link Here
|
550 |
} |
633 |
} |
551 |
return cfgs; |
634 |
return cfgs; |
552 |
} |
635 |
} |
553 |
|
636 |
|
554 |
/** |
637 |
/** |
555 |
* Return configured project name. |
638 |
* Return configured project name. |
556 |
*/ |
639 |
*/ |
557 |
public String getName() { |
640 |
public String getName() { |
558 |
return ProjectManager.mutex().readAccess(new Mutex.Action<String>() { |
641 |
return ProjectManager.mutex().readAccess(new Mutex.Action<String>() { |
|
|
642 |
|
559 |
public String run() { |
643 |
public String run() { |
560 |
final Element data = helper.getPrimaryConfigurationData(true); |
644 |
final Element data = helper.getPrimaryConfigurationData(true); |
561 |
// XXX replace by XMLUtil when that has findElement, findText, etc. |
645 |
// XXX replace by XMLUtil when that has findElement, findText, etc. |
562 |
NodeList nl = data.getElementsByTagNameNS(J2MEProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); // NOI18N |
646 |
NodeList nl = data.getElementsByTagNameNS(J2MEProjectType.MULTIROOT_PROJECT_CONFIGURATION_NAMESPACE, "name"); // NOI18N |
|
|
647 |
if (nl.getLength() == 0) { |
648 |
nl = data.getElementsByTagNameNS(J2MEProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); |
649 |
} |
563 |
if (nl.getLength() == 1) { |
650 |
if (nl.getLength() == 1) { |
564 |
nl = nl.item(0).getChildNodes(); |
651 |
nl = nl.item(0).getChildNodes(); |
565 |
if (nl.getLength() == 1 && nl.item(0).getNodeType() == Node.TEXT_NODE) { |
652 |
if (nl.getLength() == 1 && nl.item(0).getNodeType() == Node.TEXT_NODE) { |
Lines 570-657
public final class J2MEProject implement
Link Here
|
570 |
} |
657 |
} |
571 |
}); |
658 |
}); |
572 |
} |
659 |
} |
573 |
|
660 |
|
574 |
// Private innerclasses ---------------------------------------------------- |
661 |
// Private innerclasses ---------------------------------------------------- |
575 |
|
|
|
576 |
private final class ProjectXmlSavedHookImpl extends ProjectXmlSavedHook { |
662 |
private final class ProjectXmlSavedHookImpl extends ProjectXmlSavedHook { |
577 |
|
663 |
|
578 |
ProjectXmlSavedHookImpl() { |
664 |
ProjectXmlSavedHookImpl() { |
579 |
// Just to avoid creating accessor class |
665 |
// Just to avoid creating accessor class |
580 |
} |
666 |
} |
581 |
|
667 |
|
582 |
protected void projectXmlSaved() throws IOException { |
668 |
protected void projectXmlSaved() throws IOException { |
583 |
refreshBuildScripts(false); |
669 |
refreshBuildScripts(false); |
584 |
} |
670 |
} |
585 |
|
|
|
586 |
} |
671 |
} |
587 |
|
672 |
|
588 |
private final class ProjectOpenedHookImpl extends ProjectOpenedHook implements LookupListener { |
673 |
private final class ProjectOpenedHookImpl extends ProjectOpenedHook implements LookupListener { |
589 |
|
674 |
|
590 |
private boolean skipCloseHook = false; |
675 |
private boolean skipCloseHook = false; |
591 |
private PropertyChangeListener platformListener; |
676 |
private PropertyChangeListener platformListener; |
592 |
private Lookup.Result deployments; |
677 |
private Lookup.Result deployments; |
593 |
|
678 |
|
594 |
//We need those listners to be able to check for changes on paltform bootclasspath |
679 |
//We need those listners to be able to check for changes on paltform bootclasspath |
595 |
private final class PlatformInstalledListener implements PropertyChangeListener |
680 |
private final class PlatformInstalledListener implements PropertyChangeListener { |
596 |
{ |
681 |
|
597 |
final List<JavaPlatform> knownPlatforms; |
682 |
final List<JavaPlatform> knownPlatforms; |
598 |
private final PropertyChangeListener platformChange = new PropertyChangeListener() |
683 |
private final PropertyChangeListener platformChange = new PropertyChangeListener() { |
599 |
{ |
684 |
|
600 |
public void propertyChange(PropertyChangeEvent evt) |
685 |
public void propertyChange(PropertyChangeEvent evt) { |
601 |
{ |
686 |
if (CLASSPATH.equals(evt.getPropertyName()) && evt.getSource() instanceof CDCPlatform) { |
602 |
if (CLASSPATH.equals(evt.getPropertyName()) && evt.getSource() instanceof CDCPlatform) |
687 |
CDCPlatform platform = (CDCPlatform) evt.getSource(); |
603 |
{ |
688 |
if (platform != null) { |
604 |
CDCPlatform platform = (CDCPlatform)evt.getSource(); |
689 |
List<ProjectConfiguration> configs = J2MEProject.this.getMatchingConfigs((String) platform.getProperties().get("platform.ant.name")); |
605 |
if (platform != null) |
690 |
J2MEProject.this.updateBootClassPathProperty(configs, platform); |
606 |
{ |
691 |
} |
607 |
List<ProjectConfiguration> configs = J2MEProject.this.getMatchingConfigs((String)platform.getProperties().get("platform.ant.name")); |
|
|
608 |
J2MEProject.this.updateBootClassPathProperty(configs, platform); |
609 |
} |
610 |
} |
692 |
} |
611 |
} |
693 |
} |
612 |
}; |
694 |
}; |
613 |
|
695 |
|
614 |
PlatformInstalledListener(JavaPlatform known[]) |
696 |
PlatformInstalledListener(JavaPlatform known[]) { |
615 |
{ |
697 |
knownPlatforms = new ArrayList(Arrays.asList(known)); |
616 |
knownPlatforms=new ArrayList(Arrays.asList(known)); |
|
|
617 |
|
698 |
|
618 |
for (JavaPlatform plat : knownPlatforms) |
699 |
for (JavaPlatform plat : knownPlatforms) { |
619 |
{ |
|
|
620 |
plat.addPropertyChangeListener(platformChange); |
700 |
plat.addPropertyChangeListener(platformChange); |
621 |
List<ProjectConfiguration> configs = J2MEProject.this.getMatchingConfigs(plat.getProperties().get("platform.ant.name")); |
701 |
List<ProjectConfiguration> configs = J2MEProject.this.getMatchingConfigs(plat.getProperties().get("platform.ant.name")); |
622 |
J2MEProject.this.updateBootClassPathProperty(configs, (CDCPlatform)plat); |
702 |
J2MEProject.this.updateBootClassPathProperty(configs, (CDCPlatform) plat); |
623 |
} |
703 |
} |
624 |
} |
704 |
} |
625 |
|
705 |
|
626 |
public void propertyChange(PropertyChangeEvent evt) |
706 |
public void propertyChange(PropertyChangeEvent evt) { |
627 |
{ |
707 |
if (evt.getPropertyName().equals(JavaPlatformManager.PROP_INSTALLED_PLATFORMS)) { |
628 |
if (evt.getPropertyName().equals(JavaPlatformManager.PROP_INSTALLED_PLATFORMS)) |
708 |
JavaPlatform[] known = JavaPlatformManager.getDefault().getPlatforms(null, new Specification(CDCPlatform.PLATFORM_CDC, null)); |
629 |
{ |
709 |
List<JavaPlatform> list = Arrays.asList(known); |
630 |
JavaPlatform[] known=JavaPlatformManager.getDefault().getPlatforms(null, new Specification (CDCPlatform.PLATFORM_CDC,null)); |
|
|
631 |
List<JavaPlatform> list=Arrays.asList(known); |
632 |
List<JavaPlatform> added = new ArrayList(Arrays.asList(known)); |
710 |
List<JavaPlatform> added = new ArrayList(Arrays.asList(known)); |
633 |
added.removeAll(knownPlatforms); |
711 |
added.removeAll(knownPlatforms); |
634 |
knownPlatforms.removeAll(list); |
712 |
knownPlatforms.removeAll(list); |
635 |
for (JavaPlatform platform : knownPlatforms) |
713 |
for (JavaPlatform platform : knownPlatforms) { |
636 |
{ |
|
|
637 |
platform.removePropertyChangeListener(platformChange); |
714 |
platform.removePropertyChangeListener(platformChange); |
638 |
} |
715 |
} |
639 |
for (JavaPlatform platform : added) |
716 |
for (JavaPlatform platform : added) { |
640 |
{ |
|
|
641 |
platform.addPropertyChangeListener(platformChange); |
717 |
platform.addPropertyChangeListener(platformChange); |
642 |
} |
718 |
} |
643 |
knownPlatforms.clear(); |
719 |
knownPlatforms.clear(); |
644 |
knownPlatforms.addAll(list); |
720 |
knownPlatforms.addAll(list); |
645 |
} |
721 |
} |
646 |
} |
722 |
} |
647 |
}; |
723 |
}; |
648 |
|
724 |
|
649 |
|
|
|
650 |
ProjectOpenedHookImpl() { |
725 |
ProjectOpenedHookImpl() { |
651 |
// Just to avoid creating accessor class |
726 |
// Just to avoid creating accessor class |
652 |
} |
727 |
} |
653 |
|
728 |
|
654 |
protected synchronized void projectOpened() { |
729 |
protected synchronized void projectOpened() { |
|
|
730 |
UpdateHelper updater = getLookup().lookup(UpdateHelper.class); |
731 |
assert updater != null; |
732 |
try { |
733 |
if (!updater.isCurrent()) { |
734 |
updater.requestUpdate(); |
735 |
} |
736 |
} catch (IOException ex) { |
737 |
Exceptions.printStackTrace(ex); |
738 |
} |
655 |
//inicialize deployment plugins |
739 |
//inicialize deployment plugins |
656 |
deployments = Lookup.getDefault().lookup(new Lookup.Template<DeploymentPlugin>(DeploymentPlugin.class)); |
740 |
deployments = Lookup.getDefault().lookup(new Lookup.Template<DeploymentPlugin>(DeploymentPlugin.class)); |
657 |
deployments.addLookupListener(this); |
741 |
deployments.addLookupListener(this); |
Lines 659-691
public final class J2MEProject implement
Link Here
|
659 |
//init keystore, safer than warmup |
743 |
//init keystore, safer than warmup |
660 |
KeyStoreRepository.getDefault(); |
744 |
KeyStoreRepository.getDefault(); |
661 |
// Check up on build scripts. |
745 |
// Check up on build scripts. |
662 |
addRoots(helper); |
746 |
addRoots(helper, getSourceRoots()); |
663 |
final SourcesHelper sourcesHelper = getLookup().lookup(SourcesHelper.class); |
747 |
final SourcesHelper sourcesHelper = getLookup().lookup(SourcesHelper.class); |
664 |
final String srcDir = helper.getStandardPropertyEvaluator().getProperty(DefaultPropertiesDescriptor.SRC_DIR); |
748 |
|
665 |
final FileObject srcRoot = srcDir == null ? null : helper.resolveFileObject(srcDir); |
749 |
J2MESources sources = getLookup().lookup(J2MESources.class); |
666 |
final Project other = srcRoot == null ? null : FileOwnerQuery.getOwner(srcRoot); |
750 |
Set<Project> notified = new HashSet<Project>(); |
667 |
if (other != null && !J2MEProject.this.equals(other)) { |
751 |
for (FileObject srcRoot : sources.getSourceRoots()) { |
668 |
if (Arrays.asList(OpenProjects.getDefault().getOpenProjects()).contains(other)) { |
752 |
Project other = srcRoot == null ? null : FileOwnerQuery.getOwner(srcRoot); |
669 |
final ProjectInformation pi = other.getLookup().lookup(ProjectInformation.class); |
753 |
if (other != null && !J2MEProject.this.equals(other) && !notified.contains(other)) { |
670 |
final String name = pi == null ? other.getProjectDirectory().getPath() : pi.getDisplayName(); |
754 |
if (Arrays.asList(OpenProjects.getDefault().getOpenProjects()).contains(other)) { |
671 |
if (NotifyDescriptor.OK_OPTION.equals(DialogDisplayer.getDefault().notify( |
755 |
notified.add(other); |
672 |
new NotifyDescriptor.Confirmation(NbBundle.getMessage(J2MEProject.class, "MSG_ClashingSourceRoots", J2MEProject.this.getName(), name), NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.WARNING_MESSAGE)))) { //NOI18N |
756 |
final ProjectInformation pi = other.getLookup().lookup(ProjectInformation.class); |
673 |
OpenProjects.getDefault().close(new Project[]{other}); |
757 |
final String name = pi == null ? other.getProjectDirectory().getPath() : pi.getDisplayName(); |
674 |
} else { |
758 |
if (NotifyDescriptor.OK_OPTION.equals(DialogDisplayer.getDefault().notify( |
675 |
skipCloseHook = true; |
759 |
new NotifyDescriptor.Confirmation(NbBundle.getMessage(J2MEProject.class, "MSG_ClashingSourceRoots", J2MEProject.this.getName(), name), NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.WARNING_MESSAGE)))) { //NOI18N |
676 |
OpenProjects.getDefault().close(new Project[]{J2MEProject.this}); |
760 |
OpenProjects.getDefault().close(new Project[]{other}); |
677 |
return; |
761 |
} else { |
|
|
762 |
skipCloseHook = true; |
763 |
OpenProjects.getDefault().close(new Project[]{J2MEProject.this}); |
764 |
return; |
765 |
} |
678 |
} |
766 |
} |
679 |
} |
767 |
} |
|
|
768 |
final FileObject sourceRoot = srcRoot; |
769 |
ProjectManager.mutex().postWriteRequest(new Runnable() { |
770 |
|
771 |
public void run() { |
772 |
try { |
773 |
if (sourcesHelper != null) { |
774 |
sourcesHelper.registerExternalRoots(FileOwnerQuery.EXTERNAL_ALGORITHM_TRANSIENT); |
775 |
} |
776 |
} catch (IllegalStateException ise) { |
777 |
} |
778 |
if (sourceRoot != null) { |
779 |
FileOwnerQuery.markExternalOwner(sourceRoot, J2MEProject.this, FileOwnerQuery.EXTERNAL_ALGORITHM_TRANSIENT); |
780 |
} |
781 |
} |
782 |
}); |
680 |
} |
783 |
} |
681 |
ProjectManager.mutex().postWriteRequest(new Runnable() { |
|
|
682 |
public void run() { |
683 |
try { |
684 |
if (sourcesHelper != null) sourcesHelper.registerExternalRoots(FileOwnerQuery.EXTERNAL_ALGORITHM_TRANSIENT); |
685 |
} catch (IllegalStateException ise) {} |
686 |
if (srcRoot != null) FileOwnerQuery.markExternalOwner(srcRoot, J2MEProject.this, FileOwnerQuery.EXTERNAL_ALGORITHM_TRANSIENT); |
687 |
} |
688 |
}); |
689 |
try { |
784 |
try { |
690 |
refreshBuildScripts(true); |
785 |
refreshBuildScripts(true); |
691 |
refreshPrivateProperties(); |
786 |
refreshPrivateProperties(); |
Lines 693-718
public final class J2MEProject implement
Link Here
|
693 |
} catch (IOException e) { |
788 |
} catch (IOException e) { |
694 |
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); |
789 |
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); |
695 |
} |
790 |
} |
696 |
|
791 |
|
697 |
// register project's classpaths to GlobalPathRegistry |
792 |
// register project's classpaths to GlobalPathRegistry |
698 |
final J2MEClassPathProvider cpProvider = lookup.lookup(J2MEClassPathProvider.class); |
793 |
final J2MEClassPathProvider cpProvider = lookup.lookup(J2MEClassPathProvider.class); |
699 |
assert cpProvider != null; |
794 |
assert cpProvider != null; |
700 |
GlobalPathRegistry.getDefault().register(ClassPath.BOOT, new ClassPath[] {cpProvider.getBootClassPath()}); |
795 |
GlobalPathRegistry.getDefault().register(ClassPath.BOOT, new ClassPath[]{cpProvider.getBootClassPath()}); |
701 |
GlobalPathRegistry.getDefault().register(ClassPath.SOURCE, new ClassPath[] {cpProvider.getSourcepath()}); |
796 |
GlobalPathRegistry.getDefault().register(ClassPath.SOURCE, new ClassPath[]{cpProvider.getSourcepath()}); |
702 |
GlobalPathRegistry.getDefault().register(ClassPath.COMPILE, new ClassPath[] {cpProvider.getCompileTimeClasspath()}); |
797 |
GlobalPathRegistry.getDefault().register(ClassPath.COMPILE, new ClassPath[]{cpProvider.getCompileTimeClasspath()}); |
703 |
|
798 |
|
704 |
configHelper.addPropertyChangeListener(textSwitcher = new TextSwitcher(J2MEProject.this, helper)); |
799 |
configHelper.addPropertyChangeListener(textSwitcher = new TextSwitcher(J2MEProject.this, helper)); |
705 |
|
800 |
|
706 |
final J2MEPhysicalViewProvider phvp = lookup.lookup(J2MEPhysicalViewProvider.class); |
801 |
final J2MEPhysicalViewProvider phvp = lookup.lookup(J2MEPhysicalViewProvider.class); |
707 |
if (hasBrokenLinks()) { |
802 |
if (hasBrokenLinks()) { |
708 |
BrokenReferencesSupport.showAlert(); |
803 |
BrokenReferencesSupport.showAlert(); |
709 |
} |
804 |
} |
710 |
|
805 |
|
711 |
midletsCacheHelper.refresh(); |
806 |
midletsCacheHelper.refresh(); |
712 |
} |
807 |
} |
713 |
|
808 |
|
714 |
protected synchronized void projectClosed() { |
809 |
protected synchronized void projectClosed() { |
715 |
if (skipCloseHook) return; |
810 |
if (skipCloseHook) { |
|
|
811 |
return; |
812 |
} |
716 |
//do not listen on deployments for this project |
813 |
//do not listen on deployments for this project |
717 |
deployments.removeLookupListener(this); |
814 |
deployments.removeLookupListener(this); |
718 |
|
815 |
|
Lines 722-766
public final class J2MEProject implement
Link Here
|
722 |
} catch (IOException e) { |
819 |
} catch (IOException e) { |
723 |
ErrorManager.getDefault().notify(e); |
820 |
ErrorManager.getDefault().notify(e); |
724 |
} |
821 |
} |
725 |
|
822 |
|
726 |
configHelper.removePropertyChangeListener(textSwitcher); |
823 |
configHelper.removePropertyChangeListener(textSwitcher); |
727 |
|
824 |
|
728 |
// unregister project's classpaths to GlobalPathRegistry |
825 |
// unregister project's classpaths to GlobalPathRegistry |
729 |
final J2MEClassPathProvider cpProvider = lookup.lookup(J2MEClassPathProvider.class); |
826 |
final J2MEClassPathProvider cpProvider = lookup.lookup(J2MEClassPathProvider.class); |
730 |
GlobalPathRegistry.getDefault().unregister(ClassPath.BOOT, new ClassPath[] {cpProvider.getBootClassPath()}); |
827 |
GlobalPathRegistry.getDefault().unregister(ClassPath.BOOT, new ClassPath[]{cpProvider.getBootClassPath()}); |
731 |
GlobalPathRegistry.getDefault().unregister(ClassPath.SOURCE, new ClassPath[] {cpProvider.getSourcepath()}); |
828 |
GlobalPathRegistry.getDefault().unregister(ClassPath.SOURCE, new ClassPath[]{cpProvider.getSourcepath()}); |
732 |
GlobalPathRegistry.getDefault().unregister(ClassPath.COMPILE, new ClassPath[] {cpProvider.getCompileTimeClasspath()}); |
829 |
GlobalPathRegistry.getDefault().unregister(ClassPath.COMPILE, new ClassPath[]{cpProvider.getCompileTimeClasspath()}); |
733 |
|
830 |
|
734 |
JavaPlatformManager.getDefault().removePropertyChangeListener(platformListener); |
831 |
JavaPlatformManager.getDefault().removePropertyChangeListener(platformListener); |
735 |
} |
832 |
} |
736 |
|
833 |
|
737 |
|
834 |
private void refreshBootClasspath() { |
738 |
private void refreshBootClasspath() |
835 |
|
739 |
{ |
|
|
740 |
|
741 |
JavaPlatform[] installedPlatforms = JavaPlatformManager.getDefault(). |
836 |
JavaPlatform[] installedPlatforms = JavaPlatformManager.getDefault(). |
742 |
getPlatforms(null, new Specification (CDCPlatform.PLATFORM_CDC,null)); //NOI18N |
837 |
getPlatforms(null, new Specification(CDCPlatform.PLATFORM_CDC, null)); //NOI18N |
743 |
platformListener = new PlatformInstalledListener(installedPlatforms); |
838 |
platformListener = new PlatformInstalledListener(installedPlatforms); |
744 |
JavaPlatformManager.getDefault().addPropertyChangeListener(platformListener); |
839 |
JavaPlatformManager.getDefault().addPropertyChangeListener(platformListener); |
745 |
} |
840 |
} |
746 |
|
841 |
|
747 |
public void resultChanged(final LookupEvent e) { |
842 |
public void resultChanged(final LookupEvent e) { |
748 |
final Collection<Lookup.Result> result = ((Lookup.Result) e.getSource()).allInstances(); |
843 |
final Collection<Lookup.Result> result = ((Lookup.Result) e.getSource()).allInstances(); |
749 |
RequestProcessor.getDefault().post(new Runnable() { |
844 |
RequestProcessor.getDefault().post(new Runnable() { |
|
|
845 |
|
750 |
public void run() { |
846 |
public void run() { |
751 |
DeploymentPropertiesHandler.loadDeploymentProperties(result); |
847 |
DeploymentPropertiesHandler.loadDeploymentProperties(result); |
752 |
} |
848 |
} |
753 |
}, 200); |
849 |
}, 200); |
754 |
} |
850 |
} |
755 |
} |
851 |
} |
756 |
|
852 |
|
757 |
private void refreshBuildScripts(final boolean checkForProjectXmlModified) { |
853 |
private void refreshBuildScripts(final boolean checkForProjectXmlModified) { |
758 |
RequestProcessor.getDefault().post(new Runnable() { |
854 |
RequestProcessor.getDefault().post(new Runnable() { |
|
|
855 |
|
759 |
public void run() { |
856 |
public void run() { |
760 |
final FileObject root = Repository.getDefault().getDefaultFileSystem().findResource("Buildsystem/org.netbeans.modules.kjava.j2meproject"); //NOI18N |
857 |
final FileObject root = Repository.getDefault().getDefaultFileSystem().findResource("Buildsystem/org.netbeans.modules.kjava.j2meproject"); //NOI18N |
761 |
final LinkedList<FileObject> files = new LinkedList(); |
858 |
final LinkedList<FileObject> files = new LinkedList(); |
762 |
files.addAll(Arrays.asList(root.getChildren())); |
859 |
files.addAll(Arrays.asList(root.getChildren())); |
763 |
ProjectManager.mutex().postWriteRequest(new Runnable() { |
860 |
ProjectManager.mutex().postWriteRequest(new Runnable() { |
|
|
861 |
|
764 |
public void run() { |
862 |
public void run() { |
765 |
try { |
863 |
try { |
766 |
ProjectManager.getDefault().saveProject(J2MEProject.this); |
864 |
ProjectManager.getDefault().saveProject(J2MEProject.this); |
Lines 768-791
public final class J2MEProject implement
Link Here
|
768 |
ErrorManager.getDefault().notify(ioe); |
866 |
ErrorManager.getDefault().notify(ioe); |
769 |
} |
867 |
} |
770 |
URL u = null; |
868 |
URL u = null; |
771 |
while (!files.isEmpty()) try { |
869 |
while (!files.isEmpty()) { |
772 |
FileObject fo = files.removeFirst(); |
870 |
try { |
773 |
if (fo.getExt().equals("xml") && isAuthorized(fo)) { //NOI18N |
871 |
FileObject fo = files.removeFirst(); |
774 |
u = fo.isData() ? fo.getURL() : new URL("", null, -1, fo.getPath(), COMPOSED_STREAM_HANDLER); //NOI18N |
872 |
if (fo.getExt().equals("xml") && isAuthorized(fo)) { //NOI18N |
775 |
genFilesHelper.refreshBuildScript(FileUtil.getRelativePath(root, fo), u, checkForProjectXmlModified); |
873 |
u = fo.isData() ? fo.getURL() : new URL("", null, -1, fo.getPath(), COMPOSED_STREAM_HANDLER); //NOI18N |
776 |
} else if (fo.isFolder()) { |
874 |
genFilesHelper.refreshBuildScript(FileUtil.getRelativePath(root, fo), u, checkForProjectXmlModified); |
777 |
files.addAll(Arrays.asList(fo.getChildren())); |
875 |
} else if (fo.isFolder()) { |
778 |
} |
876 |
files.addAll(Arrays.asList(fo.getChildren())); |
779 |
} catch (IOException ioe) { |
877 |
} |
780 |
ErrorManager.getDefault().notify(ioe); |
878 |
} catch (IOException ioe) { |
781 |
BufferedReader br = null; |
879 |
ErrorManager.getDefault().notify(ioe); |
782 |
if (u != null) try { |
880 |
BufferedReader br = null; |
783 |
br = new BufferedReader(new InputStreamReader(u.openStream())); |
881 |
if (u != null) { |
784 |
String s; |
882 |
try { |
785 |
while ((s = br.readLine()) != null) ErrorManager.getDefault().log(ErrorManager.ERROR, s); |
883 |
br = new BufferedReader(new InputStreamReader(u.openStream())); |
786 |
} catch (Exception e) { |
884 |
String s; |
787 |
} finally { |
885 |
while ((s = br.readLine()) != null) { |
788 |
if (br != null) try {br.close();} catch (IOException e) {} |
886 |
ErrorManager.getDefault().log(ErrorManager.ERROR, s); |
|
|
887 |
} |
888 |
} catch (Exception e) { |
889 |
} finally { |
890 |
if (br != null) { |
891 |
try { |
892 |
br.close(); |
893 |
} catch (IOException e) { |
894 |
} |
895 |
} |
896 |
} |
897 |
} |
789 |
} |
898 |
} |
790 |
} |
899 |
} |
791 |
} |
900 |
} |
Lines 793-946
public final class J2MEProject implement
Link Here
|
793 |
} |
902 |
} |
794 |
}); |
903 |
}); |
795 |
} |
904 |
} |
796 |
|
905 |
|
797 |
/** |
906 |
/** |
798 |
* Exports the main JAR as an official build product for use from other scripts. |
907 |
* Exports the main JAR as an official build product for use from other scripts. |
799 |
* The type of the artifact will be {@link AntArtifact#TYPE_JAR}. |
908 |
* The type of the artifact will be {@link AntArtifact#TYPE_JAR}. |
800 |
*/ |
909 |
*/ |
801 |
private final class AntArtifactProviderImpl implements AntArtifactProvider { |
910 |
private final class AntArtifactProviderImpl implements AntArtifactProvider { |
802 |
|
911 |
|
803 |
private AntArtifactProviderImpl() |
912 |
private AntArtifactProviderImpl() { |
804 |
{ |
|
|
805 |
// Just to avoid creating accessor class |
913 |
// Just to avoid creating accessor class |
806 |
} |
914 |
} |
807 |
|
915 |
|
808 |
public AntArtifact[] getBuildArtifacts() { |
916 |
public AntArtifact[] getBuildArtifacts() { |
809 |
final ProjectConfiguration cfgs[] = configHelper.getConfigurations().toArray(new ProjectConfiguration[0]); |
917 |
final ProjectConfiguration cfgs[] = configHelper.getConfigurations().toArray(new ProjectConfiguration[0]); |
810 |
AntArtifact art[] = new AntArtifact[cfgs.length]; |
918 |
AntArtifact art[] = new AntArtifact[cfgs.length]; |
811 |
for (int i=0; i<cfgs.length; i++) { |
919 |
for (int i = 0; i < cfgs.length; i++) { |
812 |
art[i] = new J2MEAntArtifact(configHelper.getDefaultConfiguration().equals(cfgs[i]) ? null : cfgs[i].getDisplayName()); |
920 |
art[i] = new J2MEAntArtifact(configHelper.getDefaultConfiguration().equals(cfgs[i]) ? null : cfgs[i].getDisplayName()); |
813 |
} |
921 |
} |
814 |
return art; |
922 |
return art; |
815 |
} |
923 |
} |
816 |
|
|
|
817 |
} |
924 |
} |
818 |
|
925 |
|
819 |
private class J2MEAntArtifact extends AntArtifact { |
926 |
private class J2MEAntArtifact extends AntArtifact { |
820 |
|
927 |
|
821 |
private final String configuration; |
928 |
private final String configuration; |
822 |
|
929 |
|
823 |
public J2MEAntArtifact(String configuration) { |
930 |
public J2MEAntArtifact(String configuration) { |
824 |
this.configuration = configuration;//NOI18N |
931 |
this.configuration = configuration;//NOI18N |
825 |
} |
932 |
} |
826 |
|
933 |
|
827 |
public String getCleanTargetName() { |
934 |
public String getCleanTargetName() { |
828 |
return "clean"; //NOI18N |
935 |
return "clean"; //NOI18N |
829 |
} |
936 |
} |
830 |
|
937 |
|
831 |
public File getScriptLocation() { |
938 |
public File getScriptLocation() { |
832 |
return helper.resolveFile(GeneratedFilesHelper.BUILD_XML_PATH); |
939 |
return helper.resolveFile(GeneratedFilesHelper.BUILD_XML_PATH); |
833 |
} |
940 |
} |
834 |
|
941 |
|
835 |
public String getTargetName() { |
942 |
public String getTargetName() { |
836 |
return "jar"; //NOI18N |
943 |
return "jar"; //NOI18N |
837 |
} |
944 |
} |
838 |
|
945 |
|
839 |
public String getType() { |
946 |
public String getType() { |
840 |
return JavaProjectConstants.ARTIFACT_TYPE_JAR; |
947 |
return JavaProjectConstants.ARTIFACT_TYPE_JAR; |
841 |
} |
948 |
} |
842 |
|
949 |
|
843 |
@Override |
950 |
@Override |
844 |
public Project getProject() { |
951 |
public Project getProject() { |
845 |
return J2MEProject.this; |
952 |
return J2MEProject.this; |
846 |
} |
953 |
} |
847 |
|
954 |
|
848 |
public String getID() { |
955 |
public String getID() { |
849 |
return configuration == null ? super.getID() : super.getID() + "." + configuration;//NOI18N |
956 |
return configuration == null ? super.getID() : super.getID() + "." + configuration;//NOI18N |
850 |
} |
957 |
} |
851 |
|
958 |
|
852 |
@Override |
959 |
@Override |
853 |
public URI[] getArtifactLocations() { |
960 |
public URI[] getArtifactLocations() { |
854 |
final PropertyEvaluator eval = helper.getStandardPropertyEvaluator(); |
|
|
855 |
String path = "dist/"; //NOI18N |
961 |
String path = "dist/"; //NOI18N |
856 |
if (configuration != null) path += configuration + "/"; //NOI18N |
962 |
if (configuration != null) { |
857 |
final String locationResolved = eval.evaluate(path + J2MEProjectUtils.evaluateProperty(helper, "dist.jar", configuration)); //NOI18N |
963 |
path += configuration + "/"; //NOI18N |
|
|
964 |
} |
965 |
final String locationResolved = evaluator().evaluate(path + J2MEProjectUtils.evaluateProperty(helper, "dist.jar", configuration)); //NOI18N |
858 |
if (locationResolved == null) { |
966 |
if (locationResolved == null) { |
859 |
return new URI[0]; |
967 |
return new URI[0]; |
860 |
} |
968 |
} |
861 |
return new URI[] {getScriptLocation().getParentFile().toURI().relativize(helper.resolveFile(locationResolved).toURI())}; |
969 |
return new URI[]{getScriptLocation().getParentFile().toURI().relativize(helper.resolveFile(locationResolved).toURI())}; |
862 |
} |
970 |
} |
863 |
|
971 |
|
864 |
@Override |
972 |
@Override |
865 |
public Properties getProperties() { |
973 |
public Properties getProperties() { |
866 |
final Properties p = new Properties(); |
974 |
final Properties p = new Properties(); |
867 |
p.put(DefaultPropertiesDescriptor.CONFIG_ACTIVE, configuration == null ? "" : configuration); |
975 |
p.put(DefaultPropertiesDescriptor.CONFIG_ACTIVE, configuration == null ? "" : configuration); |
868 |
return p; |
976 |
return p; |
869 |
} |
977 |
} |
870 |
|
|
|
871 |
} |
978 |
} |
|
|
979 |
|
872 |
private final class Info implements ProjectInformation { |
980 |
private final class Info implements ProjectInformation { |
873 |
|
981 |
|
874 |
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); |
982 |
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); |
875 |
|
983 |
|
876 |
Info() { |
984 |
Info() { |
877 |
// Just to avoid creating accessor class |
985 |
// Just to avoid creating accessor class |
878 |
} |
986 |
} |
879 |
|
987 |
|
880 |
void firePropertyChange(final String prop) { |
988 |
void firePropertyChange(final String prop) { |
881 |
pcs.firePropertyChange(prop, null, null); |
989 |
pcs.firePropertyChange(prop, null, null); |
882 |
} |
990 |
} |
883 |
|
991 |
|
884 |
public String getName() { |
992 |
public String getName() { |
885 |
return PropertyUtils.getUsablePropertyName(J2MEProject.this.getName()); |
993 |
return PropertyUtils.getUsablePropertyName(J2MEProject.this.getName()); |
886 |
} |
994 |
} |
887 |
|
995 |
|
888 |
public String getDisplayName() { |
996 |
public String getDisplayName() { |
889 |
return J2MEProject.this.getName(); |
997 |
return J2MEProject.this.getName(); |
890 |
} |
998 |
} |
891 |
|
999 |
|
892 |
public Icon getIcon() { |
1000 |
public Icon getIcon() { |
893 |
return J2ME_PROJECT_ICON; |
1001 |
return J2ME_PROJECT_ICON; |
894 |
} |
1002 |
} |
895 |
|
1003 |
|
896 |
public Project getProject() { |
1004 |
public Project getProject() { |
897 |
return J2MEProject.this; |
1005 |
return J2MEProject.this; |
898 |
} |
1006 |
} |
899 |
|
1007 |
|
900 |
public void addPropertyChangeListener(final PropertyChangeListener listener) { |
1008 |
public void addPropertyChangeListener(final PropertyChangeListener listener) { |
901 |
pcs.addPropertyChangeListener(listener); |
1009 |
pcs.addPropertyChangeListener(listener); |
902 |
} |
1010 |
} |
903 |
|
1011 |
|
904 |
public void removePropertyChangeListener(final PropertyChangeListener listener) { |
1012 |
public void removePropertyChangeListener(final PropertyChangeListener listener) { |
905 |
pcs.removePropertyChangeListener(listener); |
1013 |
pcs.removePropertyChangeListener(listener); |
906 |
} |
1014 |
} |
907 |
|
|
|
908 |
} |
1015 |
} |
909 |
|
1016 |
|
910 |
private static final class RecommendedTemplatesImpl implements RecommendedTemplates, PrivilegedTemplates { |
1017 |
private static final class RecommendedTemplatesImpl implements RecommendedTemplates, PrivilegedTemplates { |
911 |
|
1018 |
|
912 |
private static final String LOCATION = "RecommendedTemplates/org.netbeans.modules.kjava.j2meproject"; //NOI18N |
1019 |
private static final String LOCATION = "RecommendedTemplates/org.netbeans.modules.kjava.j2meproject"; //NOI18N |
913 |
|
1020 |
|
914 |
private RecommendedTemplatesImpl() { |
1021 |
private RecommendedTemplatesImpl() { |
915 |
} |
1022 |
} |
916 |
|
1023 |
|
917 |
public String[] getRecommendedTypes() { |
1024 |
public String[] getRecommendedTypes() { |
918 |
FileObject root = Repository.getDefault().getDefaultFileSystem().findResource(LOCATION); |
1025 |
FileObject root = Repository.getDefault().getDefaultFileSystem().findResource(LOCATION); |
919 |
HashSet<String> result = new HashSet(); |
1026 |
HashSet<String> result = new HashSet(); |
920 |
for (FileObject fo : root.getChildren()) { |
1027 |
for (FileObject fo : root.getChildren()) { |
921 |
String s = (String) fo.getAttribute("RecommendedTemplates"); //NOI18N |
1028 |
String s = (String) fo.getAttribute("RecommendedTemplates"); //NOI18N |
922 |
if (s != null) result.addAll(Arrays.asList(s.split(","))); //NOI18N |
1029 |
if (s != null) { |
|
|
1030 |
result.addAll(Arrays.asList(s.split(","))); //NOI18N |
1031 |
} |
923 |
} |
1032 |
} |
924 |
return result.toArray(new String[result.size()]); |
1033 |
return result.toArray(new String[result.size()]); |
925 |
} |
1034 |
} |
926 |
|
1035 |
|
927 |
public String[] getPrivilegedTemplates() { |
1036 |
public String[] getPrivilegedTemplates() { |
928 |
//priviledged templates are ordered by module layer |
1037 |
//priviledged templates are ordered by module layer |
929 |
DataFolder root = DataFolder.findFolder(Repository.getDefault().getDefaultFileSystem().findResource(LOCATION)); |
1038 |
DataFolder root = DataFolder.findFolder(Repository.getDefault().getDefaultFileSystem().findResource(LOCATION)); |
930 |
ArrayList<String> result = new ArrayList(); |
1039 |
ArrayList<String> result = new ArrayList(); |
931 |
for (DataObject ch : root.getChildren()) { |
1040 |
for (DataObject ch : root.getChildren()) { |
932 |
String s = (String) ch.getPrimaryFile().getAttribute("PriviledgedTemplates"); //NOI18N |
1041 |
String s = (String) ch.getPrimaryFile().getAttribute("PriviledgedTemplates"); //NOI18N |
933 |
if (s != null) result.addAll(Arrays.asList(s.split(","))); //NOI18N |
1042 |
if (s != null) { |
|
|
1043 |
result.addAll(Arrays.asList(s.split(","))); //NOI18N |
1044 |
} |
934 |
} |
1045 |
} |
935 |
return result.toArray(new String[result.size()]); |
1046 |
return result.toArray(new String[result.size()]); |
936 |
} |
1047 |
} |
937 |
|
|
|
938 |
} |
1048 |
} |
939 |
|
1049 |
|
940 |
private static final class ComposedConnection extends URLConnection { |
1050 |
private static final class ComposedConnection extends URLConnection { |
941 |
|
1051 |
|
942 |
private static WeakHashMap<URL, byte[]> cache = new WeakHashMap(); |
1052 |
private static WeakHashMap<URL, byte[]> cache = new WeakHashMap(); |
943 |
|
1053 |
|
944 |
public ComposedConnection(URL u) { |
1054 |
public ComposedConnection(URL u) { |
945 |
super(u); |
1055 |
super(u); |
946 |
} |
1056 |
} |
Lines 953-970
public final class J2MEProject implement
Link Here
|
953 |
DataObject mainParts[] = root.getChildren(); |
1063 |
DataObject mainParts[] = root.getChildren(); |
954 |
StringBuffer sb = new StringBuffer(); |
1064 |
StringBuffer sb = new StringBuffer(); |
955 |
String lastTarget = ""; //NOI18N |
1065 |
String lastTarget = ""; //NOI18N |
956 |
for (int i=0; i<mainParts.length; i++) { |
1066 |
for (int i = 0; i < mainParts.length; i++) { |
957 |
if (mainParts[i] instanceof DataFolder) { |
1067 |
if (mainParts[i] instanceof DataFolder) { |
958 |
DataObject subParts[] = ((DataFolder)mainParts[i]).getChildren(); |
1068 |
DataObject subParts[] = ((DataFolder) mainParts[i]).getChildren(); |
959 |
StringBuffer subTargets = new StringBuffer(lastTarget); |
1069 |
StringBuffer subTargets = new StringBuffer(lastTarget); |
960 |
for (int j=0; j<subParts.length; j++) { |
1070 |
for (int j = 0; j < subParts.length; j++) { |
961 |
FileObject fo = subParts[j].getPrimaryFile(); |
1071 |
FileObject fo = subParts[j].getPrimaryFile(); |
962 |
if (fo.isData() && isAuthorized(fo)) { |
1072 |
if (fo.isData() && isAuthorized(fo)) { |
963 |
String s = read(subParts[j].getPrimaryFile(), lastTarget); |
1073 |
String s = read(subParts[j].getPrimaryFile(), lastTarget); |
964 |
sb.append(s); |
1074 |
sb.append(s); |
965 |
subTargets.append(',').append(subParts[j].getName()); |
1075 |
subTargets.append(',').append(subParts[j].getName()); |
966 |
if (log) ErrorManager.getDefault().log(ErrorManager.WARNING, fo.getURL().toExternalForm() + '\n' + s + '\n'); |
1076 |
if (log) { |
967 |
} |
1077 |
ErrorManager.getDefault().log(ErrorManager.WARNING, fo.getURL().toExternalForm() + '\n' + s + '\n'); |
|
|
1078 |
} |
1079 |
} |
968 |
} |
1080 |
} |
969 |
lastTarget = subTargets.toString(); |
1081 |
lastTarget = subTargets.toString(); |
970 |
} else { |
1082 |
} else { |
Lines 973-979
public final class J2MEProject implement
Link Here
|
973 |
String s = read(fo, lastTarget); |
1085 |
String s = read(fo, lastTarget); |
974 |
sb.append(s); |
1086 |
sb.append(s); |
975 |
lastTarget = mainParts[i].getName(); |
1087 |
lastTarget = mainParts[i].getName(); |
976 |
if (log) ErrorManager.getDefault().log(ErrorManager.WARNING, fo.getURL().toExternalForm() + '\n' + s + '\n'); |
1088 |
if (log) { |
|
|
1089 |
ErrorManager.getDefault().log(ErrorManager.WARNING, fo.getURL().toExternalForm() + '\n' + s + '\n'); |
1090 |
} |
977 |
} |
1091 |
} |
978 |
} |
1092 |
} |
979 |
} |
1093 |
} |
Lines 981-995
public final class J2MEProject implement
Link Here
|
981 |
synchronized (cache) { |
1095 |
synchronized (cache) { |
982 |
cache.put(getURL(), data); |
1096 |
cache.put(getURL(), data); |
983 |
} |
1097 |
} |
984 |
if (log) ErrorManager.getDefault().log(ErrorManager.WARNING, getURL().toExternalForm() + '\n' + sb.toString() + '\n'); |
1098 |
if (log) { |
|
|
1099 |
ErrorManager.getDefault().log(ErrorManager.WARNING, getURL().toExternalForm() + '\n' + sb.toString() + '\n'); |
1100 |
} |
985 |
} |
1101 |
} |
986 |
return new ByteArrayInputStream(data); |
1102 |
return new ByteArrayInputStream(data); |
987 |
} |
1103 |
} |
988 |
|
1104 |
|
989 |
public void connect() throws IOException {} |
1105 |
public void connect() throws IOException { |
990 |
|
1106 |
} |
|
|
1107 |
|
991 |
private String read(FileObject fo, String dependencies) throws IOException { |
1108 |
private String read(FileObject fo, String dependencies) throws IOException { |
992 |
int i = (int)fo.getSize(); |
1109 |
int i = (int) fo.getSize(); |
993 |
byte buff[] = new byte[i]; |
1110 |
byte buff[] = new byte[i]; |
994 |
DataInputStream in = new DataInputStream(fo.getInputStream()); |
1111 |
DataInputStream in = new DataInputStream(fo.getInputStream()); |
995 |
try { |
1112 |
try { |
Lines 1000-1008
public final class J2MEProject implement
Link Here
|
1000 |
} |
1117 |
} |
1001 |
return new String(buff, "UTF-8").replace("__DEPENDS__", dependencies); //NOI18N |
1118 |
return new String(buff, "UTF-8").replace("__DEPENDS__", dependencies); //NOI18N |
1002 |
} |
1119 |
} |
1003 |
|
|
|
1004 |
} |
1120 |
} |
1005 |
|
1121 |
|
1006 |
// private static final Set<File> FRIENDS_JARS = collectFriendJars(); |
1122 |
// private static final Set<File> FRIENDS_JARS = collectFriendJars(); |
1007 |
// |
1123 |
// |
1008 |
// private static Set<String> getFriends() { |
1124 |
// private static Set<String> getFriends() { |
Lines 1038-1044
public final class J2MEProject implement
Link Here
|
1038 |
// } |
1154 |
// } |
1039 |
// return jars; |
1155 |
// return jars; |
1040 |
// } |
1156 |
// } |
1041 |
|
|
|
1042 |
private static boolean isAuthorized(FileObject fo) { |
1157 |
private static boolean isAuthorized(FileObject fo) { |
1043 |
// if (fo.isFolder() || FRIENDS_JARS == null) return true; |
1158 |
// if (fo.isFolder() || FRIENDS_JARS == null) return true; |
1044 |
// URL u = null; |
1159 |
// URL u = null; |
Lines 1070-1156
public final class J2MEProject implement
Link Here
|
1070 |
// } |
1185 |
// } |
1071 |
return true; |
1186 |
return true; |
1072 |
} |
1187 |
} |
1073 |
|
1188 |
|
1074 |
|
1189 |
private static String normalizePath(File path, File jdkHome, String propName) { |
1075 |
private static String normalizePath (File path, File jdkHome, String propName) { |
|
|
1076 |
String jdkLoc = jdkHome.getAbsolutePath(); |
1190 |
String jdkLoc = jdkHome.getAbsolutePath(); |
1077 |
if (!jdkLoc.endsWith(File.separator)) { |
1191 |
if (!jdkLoc.endsWith(File.separator)) { |
1078 |
jdkLoc = jdkLoc + File.separator; |
1192 |
jdkLoc = jdkLoc + File.separator; |
1079 |
} |
1193 |
} |
1080 |
String loc = path.getAbsolutePath(); |
1194 |
String loc = path.getAbsolutePath(); |
1081 |
if (loc.startsWith(jdkLoc)) { |
1195 |
if (loc.startsWith(jdkLoc)) { |
1082 |
return "${"+propName+"}"+File.separator+loc.substring(jdkLoc.length()); //NOI18N |
1196 |
return "${" + propName + "}" + File.separator + loc.substring(jdkLoc.length()); //NOI18N |
1083 |
} |
1197 |
} |
1084 |
return loc; |
1198 |
return loc; |
1085 |
} |
1199 |
} |
1086 |
|
1200 |
|
1087 |
private List<ProjectConfiguration> getMatchingConfigs(final String actualPlatformId) { |
1201 |
private List<ProjectConfiguration> getMatchingConfigs(final String actualPlatformId) { |
1088 |
List<ProjectConfiguration> configs = new ArrayList<ProjectConfiguration>(); |
1202 |
List<ProjectConfiguration> configs = new ArrayList<ProjectConfiguration>(); |
1089 |
|
1203 |
|
1090 |
for (ProjectConfiguration config : getConfigurationHelper().getConfigurations()) |
1204 |
for (ProjectConfiguration config : getConfigurationHelper().getConfigurations()) { |
1091 |
{ |
1205 |
boolean useDef = config.equals(getConfigurationHelper().getDefaultConfiguration()); |
1092 |
boolean useDef= config.equals(getConfigurationHelper().getDefaultConfiguration()); |
1206 |
String platformProp = VisualPropertySupport.translatePropertyName(config.getDisplayName(), |
1093 |
String platformProp=VisualPropertySupport.translatePropertyName(config.getDisplayName(), |
1207 |
DefaultPropertiesDescriptor.PLATFORM_ACTIVE, useDef); |
1094 |
DefaultPropertiesDescriptor.PLATFORM_ACTIVE, useDef); |
1208 |
String platformId = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH).getProperty(platformProp); |
1095 |
String platformId=helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH).getProperty(platformProp); |
1209 |
|
1096 |
|
|
|
1097 |
//platformId is null when non default config, which use default values, is queried |
1210 |
//platformId is null when non default config, which use default values, is queried |
1098 |
//This one is not important for us as the change will be/have been done using DefaultConfiguration |
1211 |
//This one is not important for us as the change will be/have been done using DefaultConfiguration |
1099 |
if (platformId != null && platformId.equals(actualPlatformId)) |
1212 |
if (platformId != null && platformId.equals(actualPlatformId)) { |
1100 |
{ |
|
|
1101 |
configs.add(config); |
1213 |
configs.add(config); |
1102 |
} |
1214 |
} |
1103 |
} |
1215 |
} |
1104 |
return configs; |
1216 |
return configs; |
1105 |
} |
1217 |
} |
1106 |
|
1218 |
|
1107 |
private void generatePlatformProperties (CDCPlatform platform,ProjectConfiguration config, String activeDevice, String activeProfile, EditableProperties props) { |
1219 |
private void generatePlatformProperties(CDCPlatform platform, ProjectConfiguration config, String activeDevice, String activeProfile, EditableProperties props) { |
1108 |
Collection<FileObject> installFolders = platform.getInstallFolders(); |
1220 |
Collection<FileObject> installFolders = platform.getInstallFolders(); |
1109 |
if (installFolders.size()>0) { |
1221 |
if (installFolders.size() > 0) { |
1110 |
File jdkHome = FileUtil.toFile (installFolders.iterator().next()); |
1222 |
File jdkHome = FileUtil.toFile(installFolders.iterator().next()); |
1111 |
StringBuffer sbootcp = new StringBuffer(); |
1223 |
StringBuffer sbootcp = new StringBuffer(); |
1112 |
ClassPath bootCP = platform.getBootstrapLibrariesForProfile(activeDevice, activeProfile); |
1224 |
ClassPath bootCP = platform.getBootstrapLibrariesForProfile(activeDevice, activeProfile); |
1113 |
for (ClassPath.Entry entry : (List<ClassPath.Entry>)bootCP.entries()) { |
1225 |
for (ClassPath.Entry entry : (List<ClassPath.Entry>) bootCP.entries()) { |
1114 |
URL url = entry.getURL(); |
1226 |
URL url = entry.getURL(); |
1115 |
if ("jar".equals(url.getProtocol())) { //NOI18N |
1227 |
if ("jar".equals(url.getProtocol())) { //NOI18N |
1116 |
url = FileUtil.getArchiveFile(url); |
1228 |
url = FileUtil.getArchiveFile(url); |
1117 |
} |
1229 |
} |
1118 |
File root = new File (URI.create(url.toExternalForm())); |
1230 |
File root = new File(URI.create(url.toExternalForm())); |
1119 |
if (sbootcp.length()>0) { |
1231 |
if (sbootcp.length() > 0) { |
1120 |
sbootcp.append(File.pathSeparator); |
1232 |
sbootcp.append(File.pathSeparator); |
1121 |
} |
1233 |
} |
1122 |
sbootcp.append(normalizePath(root, jdkHome, "platform.home")); |
1234 |
sbootcp.append(normalizePath(root, jdkHome, "platform.home")); |
1123 |
} |
1235 |
} |
1124 |
boolean useDef= config.equals(getConfigurationHelper().getDefaultConfiguration()); |
1236 |
boolean useDef = config.equals(getConfigurationHelper().getDefaultConfiguration()); |
1125 |
props.setProperty(VisualPropertySupport.translatePropertyName(config.getDisplayName(), |
1237 |
props.setProperty(VisualPropertySupport.translatePropertyName(config.getDisplayName(), |
1126 |
DefaultPropertiesDescriptor.PLATFORM_BOOTCLASSPATH,useDef),sbootcp.toString()); //NOI18N |
1238 |
DefaultPropertiesDescriptor.PLATFORM_BOOTCLASSPATH, useDef), sbootcp.toString()); //NOI18N |
1127 |
} |
1239 |
} |
1128 |
} |
1240 |
} |
1129 |
|
1241 |
|
1130 |
private void updateBootClassPathProperty(List<ProjectConfiguration> configs, CDCPlatform platform) |
1242 |
private void updateBootClassPathProperty(List<ProjectConfiguration> configs, CDCPlatform platform) { |
1131 |
{ |
1243 |
if (configs != null) { |
1132 |
if (configs != null) |
1244 |
try { |
1133 |
{ |
1245 |
EditableProperties props = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH); |
1134 |
try |
1246 |
for (ProjectConfiguration config : configs) { |
1135 |
{ |
1247 |
boolean useDef = config.equals(getConfigurationHelper().getDefaultConfiguration()); |
1136 |
EditableProperties props=helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH); |
|
|
1137 |
for (ProjectConfiguration config : configs) |
1138 |
{ |
1139 |
boolean useDef= config.equals(getConfigurationHelper().getDefaultConfiguration()); |
1140 |
generatePlatformProperties( |
1248 |
generatePlatformProperties( |
1141 |
platform, |
1249 |
platform, |
1142 |
config, |
1250 |
config, |
1143 |
props.getProperty(VisualPropertySupport.translatePropertyName(config.getDisplayName(),DefaultPropertiesDescriptor.PLATFORM_DEVICE,useDef)), |
1251 |
props.getProperty(VisualPropertySupport.translatePropertyName(config.getDisplayName(), DefaultPropertiesDescriptor.PLATFORM_DEVICE, useDef)), |
1144 |
props.getProperty(VisualPropertySupport.translatePropertyName(config.getDisplayName(),DefaultPropertiesDescriptor.PLATFORM_PROFILE,useDef)), |
1252 |
props.getProperty(VisualPropertySupport.translatePropertyName(config.getDisplayName(), DefaultPropertiesDescriptor.PLATFORM_PROFILE, useDef)), |
1145 |
props |
1253 |
props); |
1146 |
); |
|
|
1147 |
} |
1254 |
} |
1148 |
helper.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH,props); |
1255 |
helper.putProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH, props); |
1149 |
ProjectManager.getDefault().saveProject(this); |
1256 |
ProjectManager.getDefault().saveProject(this); |
1150 |
} catch (IOException ex) |
1257 |
} catch (IOException ex) { |
1151 |
{ |
|
|
1152 |
ErrorManager.getDefault().notify(ex); |
1258 |
ErrorManager.getDefault().notify(ex); |
1153 |
} |
1259 |
} |
1154 |
} |
1260 |
} |
1155 |
} |
1261 |
} |
1156 |
} |
1262 |
} |