This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 198834
Collapse All | Expand All

(-)a/java.platform/apichanges.xml (+16 lines)
Lines 107-112 Link Here
107
    <!-- ACTUAL CHANGES BEGIN HERE: -->
107
    <!-- ACTUAL CHANGES BEGIN HERE: -->
108
108
109
    <changes>
109
    <changes>
110
        
111
        <change id="Specification.displayName">
112
            <api name="general"/>
113
            <summary>Added <code>Specification.getDisplayName</code> returning
114
            the user friendly name of the platform specification.</summary>
115
            <version major="1" minor="26"/>
116
            <date day="12" month="6" year="2012"/>
117
            <author login="tzezula"/>
118
            <compatibility addition="yes"/>                
119
            <description>
120
                Added <code>Specification.getDisplayName</code> returning
121
            the user friendly name of the platform specification.
122
            </description>
123
            <class package="org.netbeans.api.java.platform" name="Specification"/>
124
            <issue number="198834"/>
125
        </change>
110
126
111
        <change id="JavaPlatformManager.defaultPlatform">
127
        <change id="JavaPlatformManager.defaultPlatform">
112
            <api name="general"/>
128
            <api name="general"/>
(-)a/java.platform/manifest.mf (-1 / +1 lines)
Lines 1-6 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.java.platform/1
2
OpenIDE-Module: org.netbeans.modules.java.platform/1
3
OpenIDE-Module-Specification-Version: 1.25
3
OpenIDE-Module-Specification-Version: 1.26
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/platform/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/platform/Bundle.properties
5
OpenIDE-Module-Layer: org/netbeans/modules/java/platform/resources/layer.xml
5
OpenIDE-Module-Layer: org/netbeans/modules/java/platform/resources/layer.xml
6
AutoUpdate-Show-In-Client: false
6
AutoUpdate-Show-In-Client: false
(-)a/java.platform/nbproject/project.xml (+9 lines)
Lines 50-55 Link Here
50
            <code-name-base>org.netbeans.modules.java.platform</code-name-base>
50
            <code-name-base>org.netbeans.modules.java.platform</code-name-base>
51
            <module-dependencies>
51
            <module-dependencies>
52
                <dependency>
52
                <dependency>
53
                    <code-name-base>org.netbeans.api.annotations.common</code-name-base>
54
                    <build-prerequisite/>
55
                    <compile-dependency/>
56
                    <run-dependency>
57
                        <release-version>1</release-version>
58
                        <specification-version>1.14</specification-version>
59
                    </run-dependency>
60
                </dependency>
61
                <dependency>
53
                    <code-name-base>org.netbeans.api.java</code-name-base>
62
                    <code-name-base>org.netbeans.api.java</code-name-base>
54
                    <build-prerequisite/>
63
                    <build-prerequisite/>
55
                    <compile-dependency/>
64
                    <compile-dependency/>
(-)a/java.platform/src/org/netbeans/api/java/platform/Specification.java (-6 / +65 lines)
Lines 44-58 Link Here
44
44
45
package org.netbeans.api.java.platform;
45
package org.netbeans.api.java.platform;
46
46
47
import java.util.Locale;
48
import org.netbeans.api.annotations.common.NonNull;
49
import org.netbeans.api.annotations.common.NullAllowed;
47
import org.openide.modules.SpecificationVersion;
50
import org.openide.modules.SpecificationVersion;
51
import org.openide.util.Parameters;
48
52
49
/** Specification of the Java SDK
53
/** Specification of the Java SDK
50
 */
54
 */
51
public final class Specification {
55
public final class Specification {
52
56
53
    private String name;
57
    private final String name;
54
    private SpecificationVersion version;
58
    private final SpecificationVersion version;
55
    private Profile[] profiles;
59
    private final Profile[] profiles;
60
    private final String displayName;
56
61
57
62
58
    /**
63
    /**
Lines 60-67 Link Here
60
     * @param name of the specification e.g J2SE
65
     * @param name of the specification e.g J2SE
61
     * @param version of the specification e.g. 1.4
66
     * @param version of the specification e.g. 1.4
62
     */
67
     */
63
    public Specification (String name, SpecificationVersion version) {
68
    public Specification (@NonNull String name, @NonNull SpecificationVersion version) {
64
        this (name, version, null);
69
        this (name, version, null, null);
70
    }
71
    
72
    /**
73
     * Creates new SDK Specification
74
     * @param name of the specification e.g J2SE
75
     * @param version of the specification e.g. 1.4
76
     * @param displayName the display name of the Java SDK e.g. "Java SE".
77
     * @since 1.26
78
     */
79
    public Specification (
80
        @NonNull final String name,
81
        @NonNull final SpecificationVersion version,
82
        @NullAllowed final String displayName) {
83
        this (name, version, displayName, null);
65
    }
84
    }
66
85
67
    /**
86
    /**
Lines 70-78 Link Here
70
     * @param version of the specification e.g. 1.4
89
     * @param version of the specification e.g. 1.4
71
     * @param profiles of the Java SDK
90
     * @param profiles of the Java SDK
72
     */
91
     */
73
    public Specification (String name, SpecificationVersion version, Profile[] profiles) {
92
    public Specification (
93
        @NonNull final String name,
94
        @NonNull final SpecificationVersion version,
95
        @NullAllowed final Profile[] profiles) {
96
        this(name, version, null, profiles);
97
    }
98
    
99
    /**
100
     * Creates new SDK Specification
101
     * @param name of the specification e.g J2SE
102
     * @param version of the specification e.g. 1.4
103
     * @param displayName the display name of the Java SDK e.g. "Java SE".
104
     * @param profiles of the Java SDK
105
     * @since 1.26
106
     */
107
    public Specification (
108
        @NonNull final String name,
109
        @NonNull final SpecificationVersion version,
110
        @NullAllowed final String displayName,
111
        @NullAllowed final Profile[] profiles) {
112
        Parameters.notNull("name", name);   //NOI18N
113
        Parameters.notNull("version", version);   //NOI18N
74
        this.name = name;
114
        this.name = name;
75
        this.version = version;
115
        this.version = version;
116
        this.displayName = displayName;
76
        this.profiles = profiles;
117
        this.profiles = profiles;
77
    }
118
    }
78
119
Lines 99-105 Link Here
99
    public final Profile[] getProfiles () {
140
    public final Profile[] getProfiles () {
100
        return this.profiles;
141
        return this.profiles;
101
    }
142
    }
143
    
144
    /**
145
     * Returns the display name of the Java SDK.
146
     * While the {@link Specification#getName()} is used as a system name
147
     * the {@link Specification#getDisplayName()} is used while presenting the
148
     * Java SDK to the user.
149
     * @return the user friendly name, e.g. "Java SE" for "j2se" SDK.
150
     * @since 1.26
151
     */
152
    @NonNull
153
    public String getDisplayName() {
154
        return displayName != null ?
155
            displayName:
156
            getName().toUpperCase(Locale.ENGLISH);
157
    }
102
158
159
    @Override
103
    public int hashCode () {
160
    public int hashCode () {
104
        int hc = 0;
161
        int hc = 0;
105
        if (this.name != null)
162
        if (this.name != null)
Lines 109-114 Link Here
109
        return hc;
166
        return hc;
110
    }
167
    }
111
168
169
    @Override
112
    public boolean equals (Object other) {
170
    public boolean equals (Object other) {
113
        if (other instanceof Specification) {
171
        if (other instanceof Specification) {
114
            Specification os = (Specification) other;
172
            Specification os = (Specification) other;
Lines 126-131 Link Here
126
            return false;
184
            return false;
127
    }
185
    }
128
186
187
    @Override
129
    public String toString () {
188
    public String toString () {
130
        String str = this.name == null ? "" : this.name + " "; // NOI18N
189
        String str = this.name == null ? "" : this.name + " "; // NOI18N
131
        str += this.version == null ? "" : this.version + " "; // NOI18N
190
        str += this.version == null ? "" : this.version + " "; // NOI18N

Return to bug 198834