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.

Bug 232748 - ME8SDK-RFE: ME8 SDK directory is not detected as a valid J2ME Platform
Summary: ME8SDK-RFE: ME8 SDK directory is not detected as a valid J2ME Platform
Status: RESOLVED FIXED
Alias: None
Product: javame
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Roman Svitanic
URL:
Keywords: PLAN
Depends on:
Blocks: 232770
  Show dependency tree
 
Reported: 2013-07-15 22:10 UTC by gsshiva
Modified: 2013-08-20 13:29 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gsshiva 2013-07-15 22:10:21 UTC
The ME8 SDK is not detected as J2ME platform, since it does not have preverify tool. Preverification is not supported on ME8 platform and hence will not be present in the SDK's bin directory anymore. The detection logic has to be enhanced to support this scenario. 

The following workaround allows the ME8 SDK to be recognized as a valid J2ME platform.

mobility.cldcplatform/src/org/netbeans/modules/mobility/cldcplatform/J2MEPlatform.java
@@ -100,6 +100,7 @@
     private String displayName;
     private List<URL> javadocs;
     private ClassPath sources;
+    private final boolean isPreME8Platform; // indicates if the platform is pre ME8.
 
     public J2MEPlatform(String name, String home, String type, String displayName, String srcPath, String docPath, String preverifyCmd, String runCmd, String debugCmd, Device[] devices) {
         assert name != null;
@@ -118,6 +119,7 @@
         this.devices = devices;
         this.sources = ClassPathSupport.createClassPath(resolveRelativePathToFileObjects(srcPath).toArray(new FileObject[0]));
         this.javadocs = resolveRelativePathToURLs(docPath);
+        this.isPreME8Platform = isPossiblePreME8Platform(this.home);
     }
 
     public Device[] getDevices() {
@@ -338,7 +340,10 @@
     }
 
     private boolean hasEssentialTools(Collection<FileObject> folders) {
+      if ( this.isPreME8Platform )
         return findTool("emulator", folders)!=null && findTool("preverify", folders)!=null; //NOI18N
+      // else treat it as ME8 for now.
+      return findTool("emulator", folders)!=null; //NOI18N
     }
 
     public Collection<FileObject> getInstallFolders() {
@@ -851,4 +856,14 @@
         firePropertyChange("debugCmd", old, debugCmd); //NOI18N
     }
 
+    public static boolean isPossiblePreME8Platform(final FileObject dir) {
+      return J2MEPlatform.findTool("emulator", Collections.singletonList(dir)) != null // NOI18N
+            && J2MEPlatform.findTool("preverify", Collections.singletonList(dir)) != null;
+    }
+
+    public static boolean isPossibleME8Platform(final FileObject dir) {
+      // preverify.exe is not supported in ME8. Need to check if anyother toolcheck
+      // is needed.
+      return J2MEPlatform.findTool("emulator", Collections.singletonList(dir)) != null; // NOI18N
+    }
 }

mobility.cldcplatform/src/org/netbeans/modules/mobility/cldcplatform/wizard/FindPanel.java
@@ -195,6 +195,17 @@
         }
     }//GEN-LAST:event_jButton1ActionPerformed
 
+  static boolean isPossibleJ2MEPlatform(final File directory,
+          Collection<? extends CustomCLDCPlatformConfigurator> customConfigurators) {
+    for (CustomCLDCPlatformConfigurator pc : customConfigurators) {
+      if (pc.isPossiblePlatform(directory)) {
+        return true;
+      }
+    }
+    final FileObject dir = FileUtil.toFileObject(directory);
+    return dir != null && (J2MEPlatform.isPossiblePreME8Platform(dir) || J2MEPlatform.isPossibleME8Platform(dir));
+  }
+    
     private static final class Badger extends FileFilter implements FileChooserBuilder.BadgeProvider {
         final Icon badge = ImageUtilities.loadImageIcon("org/netbeans/modules/java/platform/resources/platformBadge.gif", false);
 
@@ -246,11 +257,7 @@
 
         public boolean isPossibleJ2MEPlatform(final File directory) {
             Collection <? extends CustomCLDCPlatformConfigurator> customConfigurators = Lookup.getDefault().lookupAll(CustomCLDCPlatformConfigurator.class);
-            for ( CustomCLDCPlatformConfigurator pc : customConfigurators )
-                if (pc.isPossiblePlatform(directory)) return true;
-            final FileObject dir = FileUtil.toFileObject(directory);
-            return dir != null && J2MEPlatform.findTool("emulator", Collections.singletonList(dir)) != null // NOI18N
-                    && J2MEPlatform.findTool("preverify", Collections.singletonList(dir)) != null; //NOI18N
+            return FindPanel.isPossibleJ2MEPlatform(directory, customConfigurators);
         }
 
         private static FileObject convertToValidDir(File f) {

mobility.cldcplatform/src/org/netbeans/modules/mobility/cldcplatform/wizard/SearchRunnable.java
@@ -187,11 +187,7 @@
     }
     
     public boolean isPossibleJ2MEPlatform(final File directory) {
-        for ( CustomCLDCPlatformConfigurator pc : customConfigurators )
-            if (pc.isPossiblePlatform(directory)) return true;
-        final FileObject dir = FileUtil.toFileObject(directory);
-        return dir != null && J2MEPlatform.findTool("emulator", Collections.singletonList(dir)) != null // NOI18N
-                && J2MEPlatform.findTool("preverify", Collections.singletonList(dir)) != null; //NOI18N
+      return FindPanel.isPossibleJ2MEPlatform(directory, customConfigurators);
     }
     
     private void checkForPlatform(final File directory) {
Comment 1 Roman Svitanic 2013-08-20 13:16:38 UTC
ME8 SDK now can be added as a valid J2ME platform. It will be available in NetBeans build from JavaME8  branch.