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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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 (Iterator<File> iterator = outputDirs.iterator(); iterator.hasNext();) {
  41. File dir = (File) iterator.next();
  42. classpath.append(File.pathSeparator + dir.getAbsolutePath() + File.pathSeparator);
  43. }
  44. classpath.append(System.getProperty("java.class.path", "."));
  45. // System.out.println("classpath: " + classpath.toString());
  46. return classpath.toString();
  47. }
  48. public Map<String,String> getJavaOptionsMap() {
  49. return BrowserManager.getDefault().getJavaBuildOptions().getJavaBuildOptionsMap();
  50. }
  51. public String getNonStandardOptions() {
  52. return preferencesAdapter.getProjectPreference(PreferenceStoreConstants.NONSTANDARD_OPTIONS);
  53. }
  54. public IOutputLocationManager getOutputLocationManager() {
  55. if (locationManager == null) {
  56. locationManager = new BrowserOutputLocationManager(preferencesAdapter);
  57. }
  58. return locationManager;
  59. }
  60. public List<String> getProjectSourceFiles() {
  61. // unimplemented in AjBrowser (uses BuildConfigManager instead)
  62. return null;
  63. }
  64. public List getProjectSourceFilesChanged() {
  65. // unimplemented in AjBrowser (uses BuildConfigManager instead)
  66. return null;
  67. }
  68. public Map getSourcePathResources() {
  69. // unimplemented in AjBrowser
  70. return null;
  71. }
  72. public Set<File> getAspectPath() {
  73. // unimplemented in AjBrowser
  74. return null;
  75. }
  76. public Set<File> getInpath() {
  77. // unimplemented in AjBrowser
  78. return null;
  79. }
  80. public String getOutJar() {
  81. // unimplemented in AjBrowser
  82. return null;
  83. }
  84. public int getConfigurationChanges() {
  85. return ICompilerConfiguration.EVERYTHING;
  86. }
  87. public void configurationRead() {
  88. }
  89. public List getClasspathElementsWithModifiedContents() {
  90. return null;
  91. }
  92. public List<String> getProjectXmlConfigFiles() {
  93. return Collections.emptyList();
  94. }
  95. public String getProjectEncoding() {
  96. return null;
  97. }
  98. public String getProcessor() {
  99. return null;
  100. }
  101. public String getProcessorPath() {
  102. return null;
  103. }
  104. @Override
  105. public String getModulepath() {
  106. return null;
  107. }
  108. @Override
  109. public String getModuleSourcepath() {
  110. return null;
  111. }
  112. }