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/src/org/netbeans/modules/mobility/plugins/blackberry/BlackBerryPlatformConfigurator.java (-9 / +79 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
            version = removeBuildVersion(version);
114
            platformName = platformName + " " + version;
115
        } catch (IOException ex) {
116
            //Exceptions.printStackTrace(ex);
117
        }
118
        finally
119
        {
120
            if (rimJar!=null)
121
                try {
122
                rimJar.close();
123
            } catch (IOException ex) {
124
            }
125
        }
126
            
95
            ArrayList<CLDCPlatformDescriptor.Device> devices = new ArrayList<CLDCPlatformDescriptor.Device>();
127
            ArrayList<CLDCPlatformDescriptor.Device> devices = new ArrayList<CLDCPlatformDescriptor.Device>();
96
            ArrayList<CLDCPlatformDescriptor.Profile> profiles = new ArrayList<CLDCPlatformDescriptor.Profile>();
128
            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
129
            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++) {
135
            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)));
136
                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
            }
137
            }
106
            return new CLDCPlatformDescriptor(BB_PLATFORM_NAME, f.getAbsolutePath(), "CUSTOM", null, docs.getAbsolutePath(), 
138
            
107
                    "\"{platformhome}{/}bin{/}preverify\" {classpath|-classpath \"{classpath}\"} -d \"{destdir}\" \"{srcdir}\"",  //NOI18N
139
            ///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
140
            if (System.getProperty("os.name").toLowerCase().startsWith("windows"))
109
                    "cmd /C \"cd /D {platformhome}{/}bin&jdwp\"", devices); //NOI18N
141
            {
142
                return new CLDCPlatformDescriptor(platformName, f.getAbsolutePath(), "CUSTOM", null, docs.getAbsolutePath(),
143
                        "\"{platformhome}{/}bin{/}preverify\" {classpath|-classpath \"{classpath}\"} -d \"{destdir}\" \"{srcdir}\"", //NOI18N
144
                        "cmd /C \"cd /D {platformhome}{/}simulator&{device}\"", //NOI18N
145
                        "cmd /C \"cd /D {platformhome}{/}bin&jdwp\"", devices); //NOI18N
146
            }
147
            else
148
            {
149
                String sh = findFile("sh", "/bin", "/usr/bin", "/usr/local/bin", System.getProperty("user.home") + File.separator + "bin");
150
                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");
151
                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");
152
153
                return new CLDCPlatformDescriptor(platformName, f.getAbsolutePath(), "CUSTOM", null, docs.getAbsolutePath(),
154
                        sh + " -c '" + wine + " \"{platformhome}{/}bin{/}preverify.exe\" {classpath|-classpath \"`" + winepath + " -w  \"{classpath}\"`\"} -d \"`" + winepath + " -w \"{destdir}\"`\" \"`" + winepath + " -w \"{srcdir}\"`\"'", //NOI18N
155
                        sh + " -c 'cd   \"{platformhome}{/}simulator{/}\" && " + wine + " cmd /C \"{device}.bat\"'", //NOI18N
156
                        sh + " -c 'cd   \"{platformhome}{/}bin{/}\" && " + wine + " cmd /C \"jdwp.bat\"'", devices); //NOI18N
157
                            
158
            }
110
        } catch (IOException ioe) {
159
        } catch (IOException ioe) {
111
            ErrorManager.getDefault().notify(ioe);
160
            ErrorManager.getDefault().notify(ioe);
112
            return null;
161
            return null;
Lines 114-118 Link Here
114
            if (br != null) try {br.close();} catch (IOException ioe) {}
163
            if (br != null) try {br.close();} catch (IOException ioe) {}
115
        }
164
        }
116
    }
165
    }
166
167
    
168
    private String findFile(String file, String ... paths) {
169
        for(String path:paths)
170
        {
171
            File f = new File(path + File.separator + file);
172
            if (f.exists() && f.canRead())
173
            {
174
                return f.getAbsolutePath();
175
            }
176
        }
177
        return paths[0] + File.separator + file;
178
    }
179
180
    private String removeBuildVersion(String version) {
181
        if (version.split("\\.").length>3)
182
        {
183
            return version.substring(0,version.lastIndexOf("."));
184
        }
185
        return version;
186
    }
117
    
187
    
118
}
188
}
(-)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