1 19 27 28 package org.netbeans.modules.websvc.customization.multiview; 29 30 import java.awt.event.KeyAdapter ; 31 import java.awt.event.KeyEvent ; 32 import java.util.StringTokenizer ; 33 import org.openide.DialogDisplayer; 34 import org.openide.NotifyDescriptor; 35 import org.openide.util.Utilities; 36 37 41 public class JavaUtilities{ 42 43 44 public JavaUtilities() { 45 } 46 47 public static boolean isValidPackageName(String str) { 49 if (str.length() > 0 && (str.charAt(0) == '.' || str.endsWith("."))) { 50 return false; 51 } 52 StringTokenizer tukac = new StringTokenizer (str, "."); 53 while (tukac.hasMoreTokens()) { 54 String token = tukac.nextToken(); 55 if ("".equals(token)) 56 return false; 57 if (!Utilities.isJavaIdentifier(token)) 58 return false; 59 } 60 return true; 61 } 62 63 public static boolean isValidTypeIdentifier(String ident) { 64 if (ident == null || "".equals(ident) || !Utilities.isJavaIdentifier( ident ) ) { 65 return false; 66 } 67 else { 68 return true; 69 } 70 } 71 72 } 73 | Popular Tags |