Lines 59-64
Link Here
|
59 |
*/ |
59 |
*/ |
60 |
public class PlatformUiSupport { |
60 |
public class PlatformUiSupport { |
61 |
|
61 |
|
|
|
62 |
private static final SpecificationVersion JDK_5 = new SpecificationVersion ("1.5"); //NOI18N |
62 |
|
63 |
|
63 |
private PlatformUiSupport() { |
64 |
private PlatformUiSupport() { |
64 |
} |
65 |
} |
Lines 98-103
Link Here
|
98 |
//null means active broken (unresolved) platform, no need to do anything |
99 |
//null means active broken (unresolved) platform, no need to do anything |
99 |
if (platform != null) { |
100 |
if (platform != null) { |
100 |
SpecificationVersion jdk13 = new SpecificationVersion ("1.3"); //NOI18N |
101 |
SpecificationVersion jdk13 = new SpecificationVersion ("1.3"); //NOI18N |
|
|
102 |
SpecificationVersion jdk16 = new SpecificationVersion ("1.6"); //NOI18N |
101 |
String platformAntName = (String) platform.getProperties().get("platform.ant.name"); //NOI18N |
103 |
String platformAntName = (String) platform.getProperties().get("platform.ant.name"); //NOI18N |
102 |
assert platformAntName != null; |
104 |
assert platformAntName != null; |
103 |
props.put(J2SEProjectProperties.JAVA_PLATFORM, platformAntName); |
105 |
props.put(J2SEProjectProperties.JAVA_PLATFORM, platformAntName); |
Lines 149-155
Link Here
|
149 |
sourceLevel = ((SourceLevelKey)sourceLevelKey).getSourceLevel(); |
151 |
sourceLevel = ((SourceLevelKey)sourceLevelKey).getSourceLevel(); |
150 |
} |
152 |
} |
151 |
String javacSource = sourceLevel.toString(); |
153 |
String javacSource = sourceLevel.toString(); |
152 |
String javacTarget = jdk13.compareTo(sourceLevel)>=0 ? "1.1" : javacSource; //NOI18N |
154 |
String javacTarget = javacSource; |
|
|
155 |
|
156 |
//Issue #116490 |
157 |
// Customizer value | -source | -targer |
158 |
// JDK 1.2 1.2 1.1 |
159 |
// JDK 1.3 1.3 1.3 |
160 |
// JDK 1.4 1.4 1.4 |
161 |
// JDK 5 1.5 1.5 |
162 |
// JDK 6 1.5 1.6 |
163 |
// JDK 7 1.7 1.7 - should bring a new language features |
164 |
if (jdk13.compareTo(sourceLevel)>=0) { |
165 |
javacTarget = "1.1"; //NOI18N |
166 |
} |
167 |
else if (jdk16.equals(sourceLevel)) { |
168 |
javacSource = "1.5"; //NOI18N |
169 |
} |
170 |
|
153 |
if (!javacSource.equals(props.getProperty(J2SEProjectProperties.JAVAC_SOURCE))) { |
171 |
if (!javacSource.equals(props.getProperty(J2SEProjectProperties.JAVAC_SOURCE))) { |
154 |
props.setProperty (J2SEProjectProperties.JAVAC_SOURCE, javacSource); |
172 |
props.setProperty (J2SEProjectProperties.JAVAC_SOURCE, javacSource); |
155 |
} |
173 |
} |
Lines 304-319
Link Here
|
304 |
return this.sourceLevel.compareTo(otherKey.sourceLevel); |
322 |
return this.sourceLevel.compareTo(otherKey.sourceLevel); |
305 |
} |
323 |
} |
306 |
|
324 |
|
307 |
public /*@Override*/ boolean equals (final Object other) { |
325 |
public @Override boolean equals (final Object other) { |
308 |
return (other instanceof SourceLevelKey) && |
326 |
return (other instanceof SourceLevelKey) && |
309 |
((SourceLevelKey)other).sourceLevel.equals(this.sourceLevel); |
327 |
((SourceLevelKey)other).sourceLevel.equals(this.sourceLevel); |
310 |
} |
328 |
} |
311 |
|
329 |
|
312 |
public /*@Override*/ int hashCode () { |
330 |
public @Override int hashCode () { |
313 |
return this.sourceLevel.hashCode(); |
331 |
return this.sourceLevel.hashCode(); |
314 |
} |
332 |
} |
315 |
|
333 |
|
316 |
public /*@Override*/ String toString () { |
334 |
public @Override String toString () { |
317 |
StringBuffer buffer = new StringBuffer (); |
335 |
StringBuffer buffer = new StringBuffer (); |
318 |
if (this.broken) { |
336 |
if (this.broken) { |
319 |
buffer.append("Broken: "); //NOI18N |
337 |
buffer.append("Broken: "); //NOI18N |
Lines 322-327
Link Here
|
322 |
return buffer.toString(); |
340 |
return buffer.toString(); |
323 |
} |
341 |
} |
324 |
|
342 |
|
|
|
343 |
public String getDisplayName () { |
344 |
String _tmp = sourceLevel.toString(); |
345 |
if (JDK_5.compareTo(sourceLevel)<=0) { |
346 |
int index = _tmp.indexOf('.'); //NOI18N |
347 |
if (index > 0 && index + 1 < _tmp.length()) { |
348 |
int index2 = _tmp.indexOf('.', index+1); //NOI18N |
349 |
if (index2 < 0) { |
350 |
_tmp = _tmp.substring(index+1); |
351 |
} |
352 |
} |
353 |
} |
354 |
return NbBundle.getMessage(PlatformUiSupport.class, "LBL_JDK",_tmp); |
355 |
} |
356 |
|
325 |
} |
357 |
} |
326 |
|
358 |
|
327 |
private static class PlatformComboBoxModel extends AbstractListModel implements ComboBoxModel, PropertyChangeListener { |
359 |
private static class PlatformComboBoxModel extends AbstractListModel implements ComboBoxModel, PropertyChangeListener { |
Lines 599-608
Link Here
|
599 |
SourceLevelKey key = (SourceLevelKey) value; |
631 |
SourceLevelKey key = (SourceLevelKey) value; |
600 |
if (key.isBroken()) { |
632 |
if (key.isBroken()) { |
601 |
message = "<html><font color=\"#A40000\">" + //NOI18N |
633 |
message = "<html><font color=\"#A40000\">" + //NOI18N |
602 |
NbBundle.getMessage(PlatformUiSupport.class,"TXT_InvalidSourceLevel",key.getSourceLevel().toString()); |
634 |
NbBundle.getMessage(PlatformUiSupport.class,"TXT_InvalidSourceLevel",key.getDisplayName()); |
603 |
} |
635 |
} |
604 |
else { |
636 |
else { |
605 |
message = key.getSourceLevel().toString(); |
637 |
message = key.getDisplayName(); |
606 |
} |
638 |
} |
607 |
} |
639 |
} |
608 |
return this.delegate.getListCellRendererComponent(list, message, index, isSelected, cellHasFocus); |
640 |
return this.delegate.getListCellRendererComponent(list, message, index, isSelected, cellHasFocus); |