You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BrowserCompilerConfiguration.java 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /********************************************************************
  2. * Copyright (c) 2007 Contributors. All rights reserved.
  3. * This program and the accompanying materials are made available
  4. * under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution and is available at
  6. * http://eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors: IBM Corporation - initial API and implementation
  9. * Helen Hawkins - initial version (bug 148190)
  10. *******************************************************************/
  11. package org.aspectj.tools.ajbrowser.core;
  12. import java.io.File;
  13. import java.util.Collections;
  14. import java.util.Iterator;
  15. import java.util.List;
  16. import java.util.Map;
  17. import java.util.Set;
  18. import org.aspectj.ajde.core.ICompilerConfiguration;
  19. import org.aspectj.ajde.core.IOutputLocationManager;
  20. import org.aspectj.ajde.ui.UserPreferencesAdapter;
  21. import org.aspectj.tools.ajbrowser.BrowserManager;
  22. /**
  23. * AjBrowser implementation of ICompilerConfiguration which returns something for getClasspath(), getJavaOptionsMap(),
  24. * getNonStandardOptions() and getOutputLocationManager() and null for everything else. The reason it doesn't return anything for
  25. * getProjectSourceFiles() is that it uses .lst files to record what is needed to build (via BuildConfigManager).
  26. */
  27. public class BrowserCompilerConfiguration implements ICompilerConfiguration {
  28. private UserPreferencesAdapter preferencesAdapter;
  29. private IOutputLocationManager locationManager;
  30. public BrowserCompilerConfiguration(UserPreferencesAdapter preferencesAdapter) {
  31. this.preferencesAdapter = preferencesAdapter;
  32. }
  33. public String getClasspath() {
  34. StringBuffer classpath = new StringBuffer();
  35. String userPath = preferencesAdapter.getProjectPreference(PreferenceStoreConstants.BUILD_CLASSPATH);
  36. if (userPath != null && userPath.trim().length() != 0) {
  37. classpath.append(userPath);
  38. }
  39. List<File> outputDirs = getOutputLocationManager().getAllOutputLocations();
  40. for (File dir : outputDirs) {
  41. classpath.append(File.pathSeparator + dir.getAbsolutePath() + File.pathSeparator);
  42. }
  43. classpath.append(System.getProperty("java.class.path", "."));
  44. // System.out.println("classpath: " + classpath.toString());
  45. return classpath.toString();
  46. }
  47. public Map<String,String> getJavaOptionsMap() {
  48. return BrowserManager.getDefault().getJavaBuildOptions().getJavaBuildOptionsMap();
  49. }
  50. public String getNonStandardOptions() {
  51. return preferencesAdapter.getProjectPreference(PreferenceStoreConstants.NONSTANDARD_OPTIONS);
  52. }
  53. public IOutputLocationManager getOutputLocationManager() {
  54. if (locationManager == null) {
  55. locationManager = new BrowserOutputLocationManager(preferencesAdapter);
  56. }
  57. return locationManager;
  58. }
  59. public List<String> getProjectSourceFiles() {
  60. // unimplemented in AjBrowser (uses BuildConfigManager instead)
  61. return null;
  62. }
  63. public List getProjectSourceFilesChanged() {
  64. // unimplemented in AjBrowser (uses BuildConfigManager instead)
  65. return null;
  66. }
  67. public Map getSourcePathResources() {
  68. // unimplemented in AjBrowser
  69. return null;
  70. }
  71. public Set<File> getAspectPath() {
  72. // unimplemented in AjBrowser
  73. return null;
  74. }
  75. public Set<File> getInpath() {
  76. // unimplemented in AjBrowser
  77. return null;
  78. }
  79. public String getOutJar() {
  80. // unimplemented in AjBrowser
  81. return null;
  82. }
  83. public int getConfigurationChanges() {
  84. return ICompilerConfiguration.EVERYTHING;
  85. }
  86. public void configurationRead() {
  87. }
  88. public List getClasspathElementsWithModifiedContents() {
  89. return null;
  90. }
  91. public List<String> getProjectXmlConfigFiles() {
  92. return Collections.emptyList();
  93. }
  94. public String getProjectEncoding() {
  95. return null;
  96. }
  97. public String getProcessor() {
  98. return null;
  99. }
  100. public String getProcessorPath() {
  101. return null;
  102. }
  103. @Override
  104. public String getModulepath() {
  105. return null;
  106. }
  107. @Override
  108. public String getModuleSourcepath() {
  109. return null;
  110. }
  111. }