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.

BrowserOutputLocationManager.java 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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.ArrayList;
  14. import java.util.Collections;
  15. import java.util.List;
  16. import java.util.Map;
  17. import org.aspectj.ajde.core.IOutputLocationManager;
  18. import org.aspectj.ajde.ui.UserPreferencesAdapter;
  19. /**
  20. * IOutputLocationManager which returns the same output location for all files and resources.
  21. */
  22. public class BrowserOutputLocationManager implements IOutputLocationManager {
  23. private UserPreferencesAdapter preferencesAdapter;
  24. public BrowserOutputLocationManager(UserPreferencesAdapter preferencesAdapter) {
  25. this.preferencesAdapter = preferencesAdapter;
  26. }
  27. public File getOutputLocationForClass(File compilationUnit) {
  28. return new File(getCommonOutputDir());
  29. }
  30. public File getOutputLocationForResource(File resource) {
  31. return new File(getCommonOutputDir());
  32. }
  33. private String getCommonOutputDir() {
  34. String outputPath = preferencesAdapter.getProjectPreference(PreferenceStoreConstants.BUILD_OUTPUTPATH);
  35. if (outputPath == null) {
  36. return ".";
  37. }
  38. return outputPath;
  39. }
  40. public List<File> getAllOutputLocations() {
  41. List<File> outputDirs = new ArrayList<>();
  42. outputDirs.add(new File(getCommonOutputDir()));
  43. return outputDirs;
  44. }
  45. public File getDefaultOutputLocation() {
  46. return new File(getCommonOutputDir());
  47. }
  48. public String getSourceFolderForFile(File sourceFile) {
  49. return null;
  50. }
  51. public void reportFileWrite(String outputfile, int filetype) {
  52. }
  53. public void reportFileRemove(String outputfile, int filetype) {
  54. }
  55. public int discoverChangesSince(File dir, long buildtime) {
  56. return 0;
  57. }
  58. public Map<File, String> getInpathMap() {
  59. return Collections.emptyMap();
  60. }
  61. }