From 2ec27dacd9bb565c01e34c87521c622a20ae435f Mon Sep 17 00:00:00 2001 From: acolyer Date: Thu, 29 Jul 2004 16:35:10 +0000 Subject: [PATCH] fix for Bugzilla Bug 40206 need common isAspectJSourceFile() method --- .../src/org/aspectj/tools/ajbrowser/BrowserManager.java | 3 ++- .../src/org/aspectj/ajde/internal/LstBuildConfigManager.java | 5 ++--- ajde/src/org/aspectj/ajde/ui/BuildConfigNode.java | 5 ++--- taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc10.java | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ajbrowser/src/org/aspectj/tools/ajbrowser/BrowserManager.java b/ajbrowser/src/org/aspectj/tools/ajbrowser/BrowserManager.java index 8227c7fd0..6b487439d 100644 --- a/ajbrowser/src/org/aspectj/tools/ajbrowser/BrowserManager.java +++ b/ajbrowser/src/org/aspectj/tools/ajbrowser/BrowserManager.java @@ -24,6 +24,7 @@ import org.aspectj.ajde.ui.*; import org.aspectj.ajde.ui.internal.UserPreferencesStore; import org.aspectj.ajde.ui.swing.*; import org.aspectj.asm.*; +import org.aspectj.util.FileUtil; //import org.aspectj.asm.internal.*; /** @@ -160,7 +161,7 @@ public class BrowserManager { if (filePath.endsWith(".lst")) { AjdeUIManager.getDefault().getBuildConfigEditor().openFile(filePath); topFrame.setEditorPanel(AjdeUIManager.getDefault().getBuildConfigEditor()); - } else if (filePath.endsWith(".java") || filePath.endsWith(".aj")){ + } else if (FileUtil.hasSourceSuffix(filePath)){ editorManager.showSourceLine(filePath, 0, false); } else { Ajde.getDefault().getErrorHandler().handleError("File: " + filePath diff --git a/ajde/src/org/aspectj/ajde/internal/LstBuildConfigManager.java b/ajde/src/org/aspectj/ajde/internal/LstBuildConfigManager.java index c1b0a3789..862602b13 100644 --- a/ajde/src/org/aspectj/ajde/internal/LstBuildConfigManager.java +++ b/ajde/src/org/aspectj/ajde/internal/LstBuildConfigManager.java @@ -21,6 +21,7 @@ import org.aspectj.ajde.*; import org.aspectj.ajde.ui.*; import org.aspectj.bridge.*; import org.aspectj.util.ConfigParser; +import org.aspectj.util.FileUtil; /** * @author Mik Kersten @@ -34,9 +35,7 @@ public class LstBuildConfigManager implements BuildConfigManager { private static final FilenameFilter SOURCE_FILE_FILTER = new FilenameFilter() { public boolean accept(File dir, String name) { - return name.endsWith(".java") - || name.endsWith(".aj") - || name.endsWith(".lst"); + return FileUtil.hasSourceSuffix(name) || name.endsWith(".lst"); } }; diff --git a/ajde/src/org/aspectj/ajde/ui/BuildConfigNode.java b/ajde/src/org/aspectj/ajde/ui/BuildConfigNode.java index 417e0e795..cea5fe9e1 100644 --- a/ajde/src/org/aspectj/ajde/ui/BuildConfigNode.java +++ b/ajde/src/org/aspectj/ajde/ui/BuildConfigNode.java @@ -18,6 +18,7 @@ import java.io.*; import java.util.*; import org.aspectj.bridge.*; +import org.aspectj.util.FileUtil; /** * @author Mik Kersten @@ -159,9 +160,7 @@ public class BuildConfigNode { } public boolean isValidResource() { - return name.endsWith(".java") - || name.endsWith(".aj") - || name.endsWith(".lst"); + return FileUtil.hasSourceSuffix(name) || name.endsWith(".lst"); } public boolean isActive() { diff --git a/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc10.java b/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc10.java index 39bec81d4..010a3e464 100644 --- a/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc10.java +++ b/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc10.java @@ -26,6 +26,7 @@ import org.aspectj.bridge.IMessageHolder; import org.aspectj.bridge.MessageHandler; import org.aspectj.tools.ajc.Main; import org.aspectj.tools.ajc.Main.MessagePrinter; +import org.aspectj.util.FileUtil; import java.io.File; import java.util.Arrays; @@ -457,8 +458,7 @@ public class Ajc10 extends MatchingTask { String[] files = getDirectoryScanner(dir).getIncludedFiles(); for (int j = 0; j < files.length; j++) { File file = new File(dir, files[j]); - if (file.getName().endsWith(".java") - || file.getName().endsWith(".aj")) { + if (FileUtil.hasSourceSuffix(file)) { cmd.createArgument().setFile(file); numfiles++; } -- 2.39.5