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.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 v 2.0
  5. * which accompanies this distribution and is available at
  6. * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
  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.List;
  15. import java.util.Map;
  16. import java.util.Set;
  17. import org.aspectj.ajde.core.ICompilerConfiguration;
  18. import org.aspectj.ajde.core.IOutputLocationManager;
  19. import org.aspectj.ajde.ui.UserPreferencesAdapter;
  20. import org.aspectj.tools.ajbrowser.BrowserManager;
  21. /**
  22. * AjBrowser implementation of ICompilerConfiguration which returns something for getClasspath(), getJavaOptionsMap(),
  23. * getNonStandardOptions() and getOutputLocationManager() and null for everything else. The reason it doesn't return anything for
  24. * getProjectSourceFiles() is that it uses .lst files to record what is needed to build (via BuildConfigManager).
  25. */
  26. public class BrowserCompilerConfiguration implements ICompilerConfiguration {
  27. private UserPreferencesAdapter preferencesAdapter;
  28. private IOutputLocationManager locationManager;
  29. public BrowserCompilerConfiguration(UserPreferencesAdapter preferencesAdapter) {
  30. this.preferencesAdapter = preferencesAdapter;
  31. }
  32. public String getClasspath() {
  33. StringBuffer classpath = new StringBuffer();
  34. String userPath = preferencesAdapter.getProjectPreference(PreferenceStoreConstants.BUILD_CLASSPATH);
  35. if (userPath != null && userPath.trim().length() != 0) {
  36. classpath.append(userPath);
  37. }
  38. List<File> outputDirs = getOutputLocationManager().getAllOutputLocations();
  39. for (File dir : outputDirs) {
  40. classpath.append(File.pathSeparator + dir.getAbsolutePath() + File.pathSeparator);
  41. }
  42. classpath.append(System.getProperty("java.class.path", "."));
  43. // System.out.println("classpath: " + classpath.toString());
  44. return classpath.toString();
  45. }
  46. public Map<String,String> getJavaOptionsMap() {
  47. return BrowserManager.getDefault().getJavaBuildOptions().getJavaBuildOptionsMap();
  48. }
  49. public String getNonStandardOptions() {
  50. return preferencesAdapter.getProjectPreference(PreferenceStoreConstants.NONSTANDARD_OPTIONS);
  51. }
  52. public IOutputLocationManager getOutputLocationManager() {
  53. if (locationManager == null) {
  54. locationManager = new BrowserOutputLocationManager(preferencesAdapter);
  55. }
  56. return locationManager;
  57. }
  58. public List<String> getProjectSourceFiles() {
  59. // unimplemented in AjBrowser (uses BuildConfigManager instead)
  60. return null;
  61. }
  62. public List getProjectSourceFilesChanged() {
  63. // unimplemented in AjBrowser (uses BuildConfigManager instead)
  64. return null;
  65. }
  66. public Map getSourcePathResources() {
  67. // unimplemented in AjBrowser
  68. return null;
  69. }
  70. public Set<File> getAspectPath() {
  71. // unimplemented in AjBrowser
  72. return null;
  73. }
  74. public Set<File> getInpath() {
  75. // unimplemented in AjBrowser
  76. return null;
  77. }
  78. public String getOutJar() {
  79. // unimplemented in AjBrowser
  80. return null;
  81. }
  82. public int getConfigurationChanges() {
  83. return ICompilerConfiguration.EVERYTHING;
  84. }
  85. public void configurationRead() {
  86. }
  87. public List getClasspathElementsWithModifiedContents() {
  88. return null;
  89. }
  90. public List<String> getProjectXmlConfigFiles() {
  91. return Collections.emptyList();
  92. }
  93. public String getProjectEncoding() {
  94. return null;
  95. }
  96. public String getProcessor() {
  97. return null;
  98. }
  99. public String getProcessorPath() {
  100. return null;
  101. }
  102. @Override
  103. public String getModulepath() {
  104. return null;
  105. }
  106. @Override
  107. public String getModuleSourcepath() {
  108. return null;
  109. }
  110. }