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 213157
Collapse All | Expand All

(-)a/j2me.cdc.platform/src/org/netbeans/modules/j2me/cdc/platform/CDCInstallImpl.java (-8 / +4 lines)
Lines 48-53 Link Here
48
48
49
import org.netbeans.modules.j2me.cdc.platform.spi.CDCPlatformDetector;
49
import org.netbeans.modules.j2me.cdc.platform.spi.CDCPlatformDetector;
50
import org.netbeans.modules.j2me.cdc.platform.wizard.CDCWizardIterator;
50
import org.netbeans.modules.j2me.cdc.platform.wizard.CDCWizardIterator;
51
import org.netbeans.spi.java.platform.PlatformInstall;
52
import org.netbeans.spi.java.platform.PlatformInstallRegistration;
51
import org.openide.WizardDescriptor;
53
import org.openide.WizardDescriptor;
52
import org.openide.filesystems.FileObject;
54
import org.openide.filesystems.FileObject;
53
import org.openide.util.Lookup;
55
import org.openide.util.Lookup;
Lines 58-74 Link Here
58
 *
60
 *
59
 * @author Svatopluk Dedic
61
 * @author Svatopluk Dedic
60
 */
62
 */
61
class CDCInstallImpl extends org.netbeans.spi.java.platform.PlatformInstall {
63
@PlatformInstallRegistration(position=400)
64
public class CDCInstallImpl extends PlatformInstall {
62
65
63
    private CDCPlatformDetector detector;
66
    private CDCPlatformDetector detector;
64
67
65
    CDCInstallImpl() {
66
    }
67
    
68
    static CDCInstallImpl create() {
69
        return new CDCInstallImpl();
70
    }
71
    
72
    /**
68
    /**
73
     * Performs a quick & dirty check whether there's a JRE installed.
69
     * Performs a quick & dirty check whether there's a JRE installed.
74
     * The method looks into the folder for something, which - depending on 
70
     * The method looks into the folder for something, which - depending on 
(-)a/j2me.cdc.platform/src/org/netbeans/modules/j2me/cdc/platform/resources/layer.xml (-11 lines)
Lines 46-62 Link Here
46
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
46
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
47
47
48
<filesystem>
48
<filesystem>
49
    <folder name="org-netbeans-api-java">
50
        <folder name="platform">
51
            <folder name="installers">
52
                <file name="semc_cdc1.instance">
53
                    <attr name="instanceOf" stringvalue="org.netbeans.spi.java.platform.GeneralPlatformInstall,org.netbeans.spi.java.platform.PlatformInstall"/>
54
                    <attr name="instanceCreate" methodvalue="org.netbeans.modules.j2me.cdc.platform.CDCInstallImpl.create"/>
55
                    <attr name="position" intvalue="400"/>
56
                </file>
57
            </folder>
58
        </folder>
59
    </folder>
60
    <folder name="Templates">
49
    <folder name="Templates">
61
        <folder name="Services">
50
        <folder name="Services">
62
            <folder name="Platforms">
51
            <folder name="Platforms">
(-)a/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/J2SEInstallImpl.java (-8 / +4 lines)
Lines 52-57 Link Here
52
52
53
import java.io.IOException;
53
import java.io.IOException;
54
import java.util.Collections;
54
import java.util.Collections;
55
import org.netbeans.spi.java.platform.PlatformInstall;
56
import org.netbeans.spi.java.platform.PlatformInstallRegistration;
55
57
56
import org.openide.WizardDescriptor;
58
import org.openide.WizardDescriptor;
57
59
Lines 60-73 Link Here
60
 *
62
 *
61
 * @author Svatopluk Dedic
63
 * @author Svatopluk Dedic
62
 */
64
 */
63
class J2SEInstallImpl extends org.netbeans.spi.java.platform.PlatformInstall {
65
@PlatformInstallRegistration(position=100)
64
66
public class J2SEInstallImpl extends PlatformInstall {
65
    J2SEInstallImpl() {
66
    }
67
    
68
    static J2SEInstallImpl create() {        
69
        return new J2SEInstallImpl();
70
    }
71
    
67
    
72
    /**
68
    /**
73
     * Performs a quick & dirty check whether there's a JRE installed.
69
     * Performs a quick & dirty check whether there's a JRE installed.
(-)a/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/resources/layer.xml (-12 lines)
Lines 56-73 Link Here
56
        </folder>
56
        </folder>
57
    </folder>
57
    </folder>
58
58
59
    <folder name="org-netbeans-api-java">
60
        <folder name="platform">
61
            <folder name="installers">
62
                <file name=".default.instance">
63
                    <attr name="instanceOf" stringvalue="org.netbeans.spi.java.platform.GeneralPlatformInstall,org.netbeans.spi.java.platform.PlatformInstall"/>
64
                    <attr name="instanceCreate" methodvalue="org.netbeans.modules.java.j2seplatform.J2SEInstallImpl.create"/>
65
                    <attr name="position" intvalue="100"/>
66
                </file>
67
            </folder>
68
        </folder>
69
    </folder>
70
71
    <folder name="Loaders">
59
    <folder name="Loaders">
72
        <folder name="application">
60
        <folder name="application">
73
            <folder name="x-java-archive">
61
            <folder name="x-java-archive">
(-)a/java.platform/src/org/netbeans/modules/java/platform/InstallerRegistry.java (-1 / +2 lines)
Lines 63-69 Link Here
63
 */
63
 */
64
public class InstallerRegistry {
64
public class InstallerRegistry {
65
    
65
    
66
    private static final String INSTALLER_REGISTRY_FOLDER = "org-netbeans-api-java/platform/installers"; // NOI18N    
66
    public static final String INSTALLER_REGISTRY_FOLDER = "org-netbeans-api-java/platform/installers"; // NOI18N
67
    private static Reference<InstallerRegistry> defaultInstance = new WeakReference<InstallerRegistry>(null);
67
    private static Reference<InstallerRegistry> defaultInstance = new WeakReference<InstallerRegistry>(null);
68
    private static final Logger LOG = Logger.getLogger(InstallerRegistry.class.getName());
68
    private static final Logger LOG = Logger.getLogger(InstallerRegistry.class.getName());
69
    
69
    
Lines 102-107 Link Here
102
            return platformInstalls;
102
            return platformInstalls;
103
        }
103
        }
104
        else {
104
        else {
105
            this.lookup.lookupAll(GeneralPlatformInstall.class); // MISL bug? otherwise ordering is wrong
105
            this.lookup.lookupAll(CustomPlatformInstall.class);
106
            this.lookup.lookupAll(CustomPlatformInstall.class);
106
            this.lookup.lookupAll(PlatformInstall.class);
107
            this.lookup.lookupAll(PlatformInstall.class);
107
            final List<GeneralPlatformInstall> installs =
108
            final List<GeneralPlatformInstall> installs =
(-)a/java.platform/src/org/netbeans/spi/java/platform/PlatformInstallRegistration.java (+57 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.spi.java.platform;
44
45
import java.lang.annotation.ElementType;
46
import java.lang.annotation.Retention;
47
import java.lang.annotation.RetentionPolicy;
48
import java.lang.annotation.Target;
49
import org.netbeans.modules.java.platform.InstallerRegistry;
50
import org.openide.util.lookup.NamedServiceDefinition;
51
52
@NamedServiceDefinition(path=InstallerRegistry.INSTALLER_REGISTRY_FOLDER, serviceType={GeneralPlatformInstall.class, PlatformInstall.class, CustomPlatformInstall.class})
53
@Retention(RetentionPolicy.SOURCE)
54
@Target(ElementType.TYPE)
55
public @interface PlatformInstallRegistration {
56
    int position() default Integer.MAX_VALUE;
57
}
(-)a/java.platform/test/unit/src/org/netbeans/modules/java/platform/PlatformInstallTest.java (-2 / +1 lines)
Lines 66-73 Link Here
66
    }
66
    }
67
67
68
    public void testLookup () {
68
    public void testLookup () {
69
        final String INSTALLER_REGISTRY_FOLDER = "org-netbeans-api-java/platform/installers"; // NOI18N
69
        final Lookup lkp = Lookups.forPath(InstallerRegistry.INSTALLER_REGISTRY_FOLDER);
70
        final Lookup lkp = Lookups.forPath(INSTALLER_REGISTRY_FOLDER);
71
        
70
        
72
        lkp.lookupAll(GeneralPlatformInstall.class);
71
        lkp.lookupAll(GeneralPlatformInstall.class);
73
        assertEquals(0,lkp.lookupAll(CustomPlatformInstall.class).size());
72
        assertEquals(0,lkp.lookupAll(CustomPlatformInstall.class).size());
(-)a/mobility.cldcplatform/src/org/netbeans/modules/mobility/cldcplatform/customwizard/Installer.java (-8 / +2 lines)
Lines 46-67 Link Here
46
import org.openide.util.NbBundle;
46
import org.openide.util.NbBundle;
47
import org.openide.WizardDescriptor;
47
import org.openide.WizardDescriptor;
48
import org.netbeans.spi.java.platform.CustomPlatformInstall;
48
import org.netbeans.spi.java.platform.CustomPlatformInstall;
49
import org.netbeans.spi.java.platform.PlatformInstallRegistration;
49
50
50
/**
51
/**
51
 * Installer factory for standard UEI Emulator
52
 * Installer factory for standard UEI Emulator
52
 *
53
 *
53
 * @author Adam Sotona
54
 * @author Adam Sotona
54
 */
55
 */
56
@PlatformInstallRegistration(position=300)
55
public class Installer extends CustomPlatformInstall {
57
public class Installer extends CustomPlatformInstall {
56
    
58
    
57
    static Installer create() {
58
        return new Installer();
59
    }
60
    
61
    private Installer() {
62
        //to avoid instantiation
63
    }
64
    
65
    public WizardDescriptor.InstantiatingIterator createIterator() {
59
    public WizardDescriptor.InstantiatingIterator createIterator() {
66
        return InstallerIterator.getDefault();
60
        return InstallerIterator.getDefault();
67
    }
61
    }
(-)a/mobility.cldcplatform/src/org/netbeans/modules/mobility/cldcplatform/resources/layer.xml (-17 lines)
Lines 44-66 Link Here
44
made subject to such option by the copyright holder.
44
made subject to such option by the copyright holder.
45
--><!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
45
--><!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
46
<filesystem>
46
<filesystem>
47
    <folder name="org-netbeans-api-java">
48
        <folder name="platform">
49
            <folder name="installers">
50
                <file name="j2me_platforms.instance">
51
                    <attr name="instanceOf" stringvalue="org.netbeans.spi.java.platform.GeneralPlatformInstall,org.netbeans.spi.java.platform.CustomPlatformInstall"/>
52
                    <attr name="instanceCreate" methodvalue="org.netbeans.modules.mobility.cldcplatform.wizard.Installer.create"/>
53
                    <attr name="position" intvalue="200"/>
54
                </file>
55
                <file name="j2me_custom_platform.instance">
56
                    <attr name="instanceOf" stringvalue="org.netbeans.spi.java.platform.GeneralPlatformInstall,org.netbeans.spi.java.platform.CustomPlatformInstall"/>
57
                    <attr name="instanceCreate" methodvalue="org.netbeans.modules.mobility.cldcplatform.customwizard.Installer.create"/>
58
                    <attr name="position" intvalue="300"/>
59
                </file>
60
            </folder>
61
        </folder>
62
    </folder>
63
64
    <folder name="Templates">
47
    <folder name="Templates">
65
        <folder name="Services">
48
        <folder name="Services">
66
            <folder name="Platforms">
49
            <folder name="Platforms">
(-)a/mobility.cldcplatform/src/org/netbeans/modules/mobility/cldcplatform/wizard/Installer.java (-4 / +2 lines)
Lines 46-63 Link Here
46
import org.openide.util.NbBundle;
46
import org.openide.util.NbBundle;
47
import org.openide.WizardDescriptor;
47
import org.openide.WizardDescriptor;
48
import org.netbeans.spi.java.platform.CustomPlatformInstall;
48
import org.netbeans.spi.java.platform.CustomPlatformInstall;
49
import org.netbeans.spi.java.platform.PlatformInstallRegistration;
49
50
50
/**
51
/**
51
 * Installer factory for standard UEI Emulator
52
 * Installer factory for standard UEI Emulator
52
 *
53
 *
53
 * @author Adam Sotona
54
 * @author Adam Sotona
54
 */
55
 */
56
@PlatformInstallRegistration(position=200)
55
public class Installer extends CustomPlatformInstall {
57
public class Installer extends CustomPlatformInstall {
56
    
58
    
57
    static Installer create() {
58
        return new Installer();
59
    }
60
    
61
    public WizardDescriptor.InstantiatingIterator createIterator() {
59
    public WizardDescriptor.InstantiatingIterator createIterator() {
62
        return InstallerIterator.getDefault();
60
        return InstallerIterator.getDefault();
63
    }
61
    }

Return to bug 213157