PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/eclipse/org.jil.ide.widget/src/org/jil/ide/libraries/WidgetLibLocationNew.java

http://transit-widget-tools.googlecode.com/
Java | 106 lines | 63 code | 14 blank | 29 comment | 8 complexity | 4af2544aefea4025d8f54e9d3867ccdb MD5 | raw file
  1. package org.jil.ide.libraries;
  2. import org.eclipse.core.resources.IProject;
  3. import org.eclipse.core.runtime.CoreException;
  4. import org.eclipse.wst.jsdt.core.compiler.libraries.LibraryLocation;
  5. import org.eclipse.wst.jsdt.core.compiler.libraries.SystemLibraryLocation;
  6. import org.jil.ide.Activator;
  7. import org.jil.ide.ui.ProjectProperties;
  8. import org.jil.ide.util.JILConstants;
  9. public class WidgetLibLocationNew extends SystemLibraryLocation {
  10. private static LibraryLocation fInstance;
  11. private static int level;
  12. private IProject project;
  13. private ProjectProperties properties;
  14. private WidgetLibLocationNew(IProject project) {
  15. super();
  16. this.project = project;
  17. }
  18. public char[][] getLibraryFileNames() {
  19. char[][] libFiles = null;
  20. String libPath = getLibraryPathInPlugin().toString();
  21. if (project != null) {
  22. try {
  23. System.out.println(" WidgetLibLocation Project Name " + project.getName());
  24. properties = new ProjectProperties(project);
  25. try {
  26. System.out.println(" WidgetLibLocation "
  27. + properties.getAPICategory());
  28. if (JILConstants.GOLD.equals(properties.getAPICategory())) {
  29. libFiles = getAllFilesInPluginDirectory(libPath
  30. .toString());
  31. }else if ( JILConstants.SILVER.equals(properties.getAPICategory())){
  32. libFiles = new char[4][100];
  33. libFiles[0] = "Widget.js".toCharArray() ;
  34. libFiles[1] = "WidgetManager.js".toCharArray();
  35. libFiles[2] = "Exception.js".toCharArray() ;
  36. libFiles[3] = "ExceptionTypes.js".toCharArray();
  37. }else if ( JILConstants.BRONZE.equals(properties.getAPICategory())){
  38. libFiles = new char[2][100];
  39. libFiles[0] = "Exception.js".toCharArray() ;
  40. libFiles[1] = "ExceptionTypes.js".toCharArray();
  41. }
  42. } catch (CoreException e) {
  43. e.printStackTrace();
  44. }
  45. } catch (Exception ex) {
  46. System.out.println(" project get exception ");
  47. ex.printStackTrace();
  48. }
  49. } else {
  50. System.out.println(" Project is null");
  51. }
  52. return getAllFilesInPluginDirectory(libPath.toString());
  53. /*
  54. * char[][] bronze =
  55. * getAllFilesInPluginDirectory(getLibraryPathInPlugin().toString() +
  56. * File.separator + "bronze" );
  57. *
  58. * for (int i = 0; i < bronze.length; i++) { String lib = new
  59. * String(bronze[i]); System.out.println(bronze[i]); lib = "bronze/" +
  60. * lib; bronze[i] = lib.toCharArray(); System.out.println(bronze[i]); }
  61. *
  62. * System.out.println(" ************************ \n\n SILVER \n\n\n");
  63. *
  64. * char[][] silver =
  65. * getAllFilesInPluginDirectory(getLibraryPathInPlugin().toString() +
  66. * File.separator + "silver" );
  67. *
  68. * for (int i = 0; i < silver.length; i++) {
  69. * System.out.println(silver[i]); }
  70. *
  71. * if( level == 1){ System.out.println(" leveis is 1 retrun silver ");
  72. * System.out.println( silver.length); return silver; }else{
  73. * System.out.println(" leveis is 2 retrun bronze ");
  74. * System.out.println( bronze.length); return bronze; }
  75. *
  76. * return bronze; IPath libPath = getLibraryPathInPlugin(); IPath
  77. * silverPath = libPath.append("bronze" );
  78. *
  79. * System.out.println(silverPath.toString()); return
  80. * getAllFilesInPluginDirectory(libPath.toString());
  81. */
  82. }
  83. protected String getPluginId() {
  84. return Activator.PLUGIN_ID;
  85. }
  86. public static LibraryLocation getInstance(IProject project) {
  87. if (fInstance == null) {
  88. fInstance = new WidgetLibLocationNew(project);
  89. }
  90. return fInstance;
  91. }
  92. }