1 19 20 package org.netbeans.modules.java.j2seplatform; 21 22 import org.openide.filesystems.*; 23 import org.openide.util.Utilities; 24 import org.openide.util.NbBundle; 25 import org.openide.ErrorManager; 26 import org.netbeans.modules.java.j2seplatform.wizard.J2SEWizardIterator; 27 import org.netbeans.modules.java.j2seplatform.platformdefinition.Util; 28 29 import java.io.IOException ; 30 import java.io.File ; 31 import java.util.Collections ; 32 33 import org.openide.WizardDescriptor; 34 35 40 class J2SEInstallImpl extends org.netbeans.spi.java.platform.PlatformInstall { 41 42 private static final String APPLE_JAVAVM_FRAMEWORK_PATH = "/System/Library/Frameworks/JavaVM.framework/Versions/"; 44 private boolean winOS; 45 46 47 J2SEInstallImpl(boolean winOS) { 48 this.winOS = winOS; 49 } 50 51 static J2SEInstallImpl create() { 52 boolean windows = Utilities.isWindows(); 53 54 return new J2SEInstallImpl(windows); 55 } 56 57 62 public boolean accept(FileObject dir) { 63 if (!dir.isFolder()) { 64 return false; 65 } 66 if (Utilities.isMac()) { 67 File f = FileUtil.toFile(dir); 70 if (f == null || !f.getAbsolutePath().startsWith(APPLE_JAVAVM_FRAMEWORK_PATH)) 71 return false; 72 } 73 FileObject tool = Util.findTool("java", Collections.singleton(dir)); if (tool == null) { 75 return false; 76 } 77 tool = Util.findTool("javac", Collections.singleton(dir)); return tool != null; 79 } 80 81 public WizardDescriptor.InstantiatingIterator createIterator(FileObject baseFolder) { 82 try { 83 return new J2SEWizardIterator(baseFolder); 84 } catch (IOException ioe) { 85 ErrorManager.getDefault().notify (ioe); 86 return null; 87 } 88 } 89 90 public String getDisplayName() { 91 return NbBundle.getMessage(J2SEInstallImpl.class,"TXT_J2SEPlatform"); 92 } 93 } 94 | Popular Tags |