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

(-)a/mobility.plugins.blackberry/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.mobility.plugins.blackberry
2
OpenIDE-Module: org.netbeans.modules.mobility.plugins.blackberry
3
OpenIDE-Module-Implementation-Version: 1
3
OpenIDE-Module-Layer: org/netbeans/modules/mobility/plugins/blackberry/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/mobility/plugins/blackberry/layer.xml
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/mobility/plugins/blackberry/Bundle.properties
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/mobility/plugins/blackberry/Bundle.properties
5
OpenIDE-Module-Specification-Version: 1.0
6
6
(-)a/mobility.plugins.blackberry/nbproject/project.properties (+1 lines)
Lines 3-5 Link Here
3
license.file=../cddl.txt
3
license.file=../cddl.txt
4
nbm.module.author=Sun Microsystems
4
nbm.module.author=Sun Microsystems
5
nbm.homepage=http://mobility.netbeans.org/
5
nbm.homepage=http://mobility.netbeans.org/
6
spec.version.base=1.0
(-)a/mobility.plugins.blackberry/src/org/netbeans/modules/mobility/plugins/blackberry/BlackBerryPlatformConfigurator.java (-9 / +89 lines)
Lines 50-55 Link Here
50
import java.io.FileReader;
50
import java.io.FileReader;
51
import java.io.IOException;
51
import java.io.IOException;
52
import java.util.ArrayList;
52
import java.util.ArrayList;
53
import java.util.jar.JarFile;
53
import org.netbeans.spi.mobility.cldcplatform.CLDCPlatformDescriptor;
54
import org.netbeans.spi.mobility.cldcplatform.CLDCPlatformDescriptor;
54
import org.netbeans.spi.mobility.cldcplatform.CustomCLDCPlatformConfigurator;
55
import org.netbeans.spi.mobility.cldcplatform.CustomCLDCPlatformConfigurator;
55
import org.openide.ErrorManager;
56
import org.openide.ErrorManager;
Lines 66-75 Link Here
66
    }
67
    }
67
68
68
    private static final String keyFiles[] = new String[] {
69
    private static final String keyFiles[] = new String[] {
69
        "simulator/handhelds.manifest.txt", "bin/rapc.exe", //NOI18N
70
        "bin/rapc.exe", //NOI18N
70
        "bin/preverify.exe", "bin/JavaLoader.exe", "lib/net_rim_api.jar"}; //NOI18N
71
        "bin/preverify.exe", "bin/JavaLoader.exe", "lib/net_rim_api.jar"}; //NOI18N
71
    
72
    //"simulator/handhelds.manifest.txt", 
72
    private static final String BB_PLATFORM_NAME = "BlackBerry Device Simulator 2.3"; //NOI18N
73
    
73
    
74
    private static final String CLASSPATH= "${platform.home}/lib/net_rim_api.jar"; //NOI18N
74
    private static final String CLASSPATH= "${platform.home}/lib/net_rim_api.jar"; //NOI18N
75
    
75
    
Lines 88-97 Link Here
88
        if (!isPossiblePlatform(f)) return null;
88
        if (!isPossiblePlatform(f)) return null;
89
        f = FileUtil.normalizeFile(f);
89
        f = FileUtil.normalizeFile(f);
90
        File docs = FileUtil.normalizeFile(new File(f, "docs/api")); //NOI18N
90
        File docs = FileUtil.normalizeFile(new File(f, "docs/api")); //NOI18N
91
        String platformName = "BlackBerry JDE"; //NOI18N
92
            
91
        BufferedReader br = null;
93
        BufferedReader br = null;
92
        try {
94
        try {
93
            br = new BufferedReader(new FileReader(new File(f, "simulator/handhelds.manifest.txt"))); //NOI18N
95
            File manifest = new File(f, "simulator/handhelds.manifest.txt"); //NOI18N
94
            String devNames[] = br.readLine().split(" ");//NOI18N
96
            String devNames[] = null;
97
            if (manifest.exists())
98
            {
99
                br = new BufferedReader(new FileReader(manifest));
100
                devNames = br.readLine().split(" ");//NOI18N
101
            }
102
            else
103
            {
104
                devNames = new String[]{"BlackBerry Device"};//NOI18N
105
                platformName = "BlackBerry JDE Component Package";
106
            }
107
108
        File rim = new File(f, "lib/net_rim_api.jar");
109
        JarFile rimJar=null;
110
        try {
111
            rimJar = new JarFile(rim);
112
            String version = rimJar.getManifest().getMainAttributes().getValue("MIDlet-Version");
113
            if (version==null || version.length()==0)
114
            {
115
                if (f.getName().toLowerCase().contains(platformName.toLowerCase()))
116
                        platformName = f.getName();
117
                else
118
                        platformName = platformName + " " + f.getName();
119
            }
120
            else
121
            {
122
                version = removeBuildVersion(version);
123
                platformName = platformName + " " + version;
124
            }
125
        } catch (IOException ex) {
126
            //Exceptions.printStackTrace(ex);
127
        }
128
        finally
129
        {
130
            if (rimJar!=null)
131
                try {
132
                rimJar.close();
133
            } catch (IOException ex) {
134
            }
135
        }
136
            
95
            ArrayList<CLDCPlatformDescriptor.Device> devices = new ArrayList<CLDCPlatformDescriptor.Device>();
137
            ArrayList<CLDCPlatformDescriptor.Device> devices = new ArrayList<CLDCPlatformDescriptor.Device>();
96
            ArrayList<CLDCPlatformDescriptor.Profile> profiles = new ArrayList<CLDCPlatformDescriptor.Profile>();
138
            ArrayList<CLDCPlatformDescriptor.Profile> profiles = new ArrayList<CLDCPlatformDescriptor.Profile>();
97
            profiles.add(new CLDCPlatformDescriptor.Profile("CLDC", "1.1", "Connected Limited Device Configuration", CLDCPlatformDescriptor.ProfileType.Configuration, null, CLASSPATH, true)); //NOI18N
139
            profiles.add(new CLDCPlatformDescriptor.Profile("CLDC", "1.1", "Connected Limited Device Configuration", CLDCPlatformDescriptor.ProfileType.Configuration, null, CLASSPATH, true)); //NOI18N
Lines 103-112 Link Here
103
            for (int i=0; i<devNames.length; i++) {
145
            for (int i=0; i<devNames.length; i++) {
104
                devices.add(new CLDCPlatformDescriptor.Device(devNames[i], devNames[i], null, profiles, new CLDCPlatformDescriptor.Screen(240, devNames[i].charAt(1) == '1' ? 260 : 160, 16, true, false)));
146
                devices.add(new CLDCPlatformDescriptor.Device(devNames[i], devNames[i], null, profiles, new CLDCPlatformDescriptor.Screen(240, devNames[i].charAt(1) == '1' ? 260 : 160, 16, true, false)));
105
            }
147
            }
106
            return new CLDCPlatformDescriptor(BB_PLATFORM_NAME, f.getAbsolutePath(), "CUSTOM", null, docs.getAbsolutePath(), 
148
            
107
                    "\"{platformhome}{/}bin{/}preverify\" {classpath|-classpath \"{classpath}\"} -d \"{destdir}\" \"{srcdir}\"",  //NOI18N
149
            ///bin/sh wine "{platformhome}{/}bin{/}preverify.exe" {classpath|-classpath "`" + winepath + " -w  {classpath}`"} -d "`" + winepath + " -w {destdir}`" "`" + winepath + " -w {srcdir}`"
108
                    "cmd /C \"cd /D {platformhome}{/}simulator&{device}\"",  //NOI18N
150
            if (System.getProperty("os.name").toLowerCase().startsWith("windows"))
109
                    "cmd /C \"cd /D {platformhome}{/}bin&jdwp\"", devices); //NOI18N
151
            {
152
                return new CLDCPlatformDescriptor(platformName, f.getAbsolutePath(), "CUSTOM", null, docs.getAbsolutePath(),
153
                        "\"{platformhome}{/}bin{/}preverify\" {classpath|-classpath \"{classpath}\"} -d \"{destdir}\" \"{srcdir}\"", //NOI18N
154
                        "cmd /C \"cd /D {platformhome}{/}simulator&{device}\"", //NOI18N
155
                        "cmd /C \"cd /D {platformhome}{/}bin&jdwp\"", devices); //NOI18N
156
            }
157
            else
158
            {
159
                String sh = findFile("sh", "/bin", "/usr/bin", "/usr/local/bin", System.getProperty("user.home") + File.separator + "bin");
160
                String wine = findFile("wine",  "/usr/bin","/bin", "/usr/local/bin", System.getProperty("user.home") + File.separator + "bin", System.getProperty("user.home") + File.separator + "wine" + File.separator + "bin", "/usr/local/wine/bin", "/opt/wine/bin", "/usr/sfw/bin", "/opt/sfw/bin");
161
                String winepath = findFile("winepath", "/usr/bin","/bin", "/usr/local/bin", System.getProperty("user.home") + File.separator + "bin", System.getProperty("user.home") + File.separator + "wine" + File.separator + "bin", "/usr/local/wine/bin", "/opt/wine/bin", "/usr/sfw/bin", "/opt/sfw/bin");
162
163
                return new CLDCPlatformDescriptor(platformName, f.getAbsolutePath(), "CUSTOM", null, docs.getAbsolutePath(),
164
                        sh + " -c '" + wine + " \"{platformhome}{/}bin{/}preverify.exe\" {classpath|-classpath \"`" + winepath + " -w  \"{classpath}\"`\"} -d \"`" + winepath + " -w \"{destdir}\"`\" \"`" + winepath + " -w \"{srcdir}\"`\"'", //NOI18N
165
                        sh + " -c 'cd   \"{platformhome}{/}simulator{/}\" && " + wine + " cmd /C \"{device}.bat\"'", //NOI18N
166
                        sh + " -c 'cd   \"{platformhome}{/}bin{/}\" && " + wine + " cmd /C \"jdwp.bat\"'", devices); //NOI18N
167
                            
168
            }
110
        } catch (IOException ioe) {
169
        } catch (IOException ioe) {
111
            ErrorManager.getDefault().notify(ioe);
170
            ErrorManager.getDefault().notify(ioe);
112
            return null;
171
            return null;
Lines 114-118 Link Here
114
            if (br != null) try {br.close();} catch (IOException ioe) {}
173
            if (br != null) try {br.close();} catch (IOException ioe) {}
115
        }
174
        }
116
    }
175
    }
176
177
    
178
    private String findFile(String file, String ... paths) {
179
        for(String path:paths)
180
        {
181
            File f = new File(path + File.separator + file);
182
            if (f.exists() && f.canRead())
183
            {
184
                return f.getAbsolutePath();
185
            }
186
        }
187
        return paths[0] + File.separator + file;
188
    }
189
190
    private String removeBuildVersion(String version) {
191
        if (version.split("\\.").length>3)
192
        {
193
            return version.substring(0,version.lastIndexOf("."));
194
        }
195
        return version;
196
    }
117
    
197
    
118
}
198
}
(-)a/mobility.plugins.blackberry/src/org/netbeans/modules/mobility/plugins/blackberry/blackberry-init (-1 / +1 lines)
Lines 1-5 Link Here
1
<xsl:comment>blackberry-init</xsl:comment>
1
<xsl:comment>blackberry-init</xsl:comment>
2
    <target name="blackberry-init">
2
    <target name="blackberry-init">
3
        <available file="${{platform.home}}/bin/rapc.exe" property="blackberry.trigger"/>
3
        <available file="${{platform.home}}/bin/rapc.jar" property="blackberry.trigger"/>
4
        <available file="${{platform.home}}/bin/Settings.rc" property="blackberry.settings.trigger"/>
4
        <available file="${{platform.home}}/bin/Settings.rc" property="blackberry.settings.trigger"/>
5
    </target>
5
    </target>
(-)a/mobility.plugins.blackberry/src/org/netbeans/modules/mobility/plugins/blackberry/create-cod (-1 / +31 lines)
Lines 1-10 Link Here
1
<xsl:comment>create-cod</xsl:comment>
1
<xsl:comment>create-cod</xsl:comment>
2
    <target name="create-cod" if="blackberry.trigger">
2
    <target name="create-cod" if="blackberry.trigger">
3
        <exec dir="${{dist.dir}}" executable="${{platform.home}}/bin/rapc.exe" failonerror="true">
3
        <exec dir="${{dist.dir}}" executable="java" failonerror="true">
4
            <arg value="-cp"/>
5
            <arg value="${{platform.home}}/bin/rapc.jar"/>
6
            <arg value="net.rim.tools.compiler.Compiler"/>            
4
            <arg value="import=${{platform.bootclasspath}}"/>
7
            <arg value="import=${{platform.bootclasspath}}"/>
5
            <arg value="codename=${{name}}"/>
8
            <arg value="codename=${{name}}"/>
6
            <arg value="-midlet"/>
9
            <arg value="-midlet"/>
7
            <arg value="jad=${{basedir}}/${{dist.dir}}/${{dist.jad}}"/>
10
            <arg value="jad=${{basedir}}/${{dist.dir}}/${{dist.jad}}"/>
8
            <arg value="${{basedir}}/${{dist.dir}}/${{dist.jar}}"/>
11
            <arg value="${{basedir}}/${{dist.dir}}/${{dist.jar}}"/>
9
        </exec>
12
        </exec>
13
        <property file="${{dist.dir}}/${{dist.jad}}"/>
14
        <echo file="${{basedir}}/${{dist.dir}}/${{name}}.alx">
15
&lt;loader version="1.0"&gt;
16
    &lt;application id="${name}"&gt;
17
        &lt;name&gt;
18
            ${MIDlet-Name}
19
        &lt;/name&gt;
20
        &lt;description&gt;
21
            ${MIDlet-Description}
22
        &lt;/description&gt;
23
        &lt;version&gt;
24
            ${MIDlet-Version}
25
        &lt;/version&gt;
26
        &lt;vendor&gt;
27
            ${MIDlet-Vendor}
28
        &lt;/vendor&gt;
29
        &lt;copyright&gt;
30
            ${MIDlet-Copyright}
31
        &lt;/copyright&gt;
32
        &lt;fileset Java="1.0"&gt;
33
            &lt;directory/&gt;
34
            &lt;files&gt;${name}.cod&lt;/files&gt;
35
        &lt;/fileset&gt;
36
    &lt;/application&gt;
37
&lt;/loader&gt;
38
        </echo>
39
10
    </target>
40
    </target>

Return to bug 140871