From 97166c4fc7c71651d52b17c48cef9cc596d13a44 Mon Sep 17 00:00:00 2001 From: tkuehn <thomas.kuehn3@tu-dresden.de> Date: Wed, 30 May 2018 10:23:54 +0200 Subject: [PATCH] Modified the packagedMarkedAsNotUsed feature to return true, iff a module or file starts with "_". --- .../transformation/TransformationExecutor.java | 4 ++-- .../src/org/framed/iorm/ui/UIUtil.java | 5 +++-- .../iorm/ui/editPolicy/EditPolicyService.java | 18 ++---------------- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/org.framed.iorm.transformation/src/org/framed/iorm/transformation/TransformationExecutor.java b/org.framed.iorm.transformation/src/org/framed/iorm/transformation/TransformationExecutor.java index b10e491b..081af882 100644 --- a/org.framed.iorm.transformation/src/org/framed/iorm/transformation/TransformationExecutor.java +++ b/org.framed.iorm.transformation/src/org/framed/iorm/transformation/TransformationExecutor.java @@ -154,7 +154,7 @@ public class TransformationExecutor extends EpsilonStandalone { public boolean packageMarkedAsNotUsed(String url, String sourceFolder) { url = url.substring(url.indexOf(sourceFolder) + sourceFolder.length()); url = url.substring(0, url.indexOf("/")); - if(url.startsWith("_") && url.endsWith("_")) return true; + if(url.startsWith("_")) return true; return false; } @@ -167,7 +167,7 @@ public class TransformationExecutor extends EpsilonStandalone { public boolean packageETLFilesMarkedAsNotUsed(String url, String sourceFolder) { url = url.substring(url.indexOf(sourceFolder) + sourceFolder.length()); url = url.substring(url.indexOf("/")+1, url.indexOf(".etl")); - if(url.startsWith("_") && url.endsWith("_")) return true; + if(url.startsWith("_")) return true; return false; } diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/UIUtil.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/UIUtil.java index c3c08a5b..11bc95b6 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/UIUtil.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/UIUtil.java @@ -693,8 +693,9 @@ public class UIUtil { */ public static boolean packageMarkedAsNotUsed(String classURL, String sourceFolder) { classURL = classURL.substring(classURL.indexOf(sourceFolder) + sourceFolder.length()); - classURL = classURL.substring(0, classURL.indexOf("/")); - if(classURL.startsWith("_") && classURL.endsWith("_")) return true; + if (classURL.indexOf("/")>-1) + classURL = classURL.substring(0, classURL.indexOf("/")); + if(classURL.startsWith("_")) return true; return false; } diff --git a/org.framed.iorm.ui/src/org/framed/iorm/ui/editPolicy/EditPolicyService.java b/org.framed.iorm.ui/src/org/framed/iorm/ui/editPolicy/EditPolicyService.java index e635211a..954900aa 100644 --- a/org.framed.iorm.ui/src/org/framed/iorm/ui/editPolicy/EditPolicyService.java +++ b/org.framed.iorm.ui/src/org/framed/iorm/ui/editPolicy/EditPolicyService.java @@ -90,20 +90,6 @@ public class EditPolicyService { } } - /** - * checks if the package part of a file url starts and ends with an _ - * - * @param url - * the string url to check against - * @param sourceFolder - * the source folder in which the class is located in - * @return if the package part of a class url starts and ends with an _ - */ - private static boolean isPackageMarkedAsNotUsed(String url) { - url = url.substring(url.lastIndexOf('/')+1, url.length()); - return url.startsWith("_") && url.endsWith("_"); - } - private static void loadAllFiles() { Bundle UIBundle = Platform.getBundle("org.framed.iorm.ui"); @@ -117,14 +103,14 @@ public class EditPolicyService { if (moduleFileURLs != null) { for (URL url : moduleFileURLs) { - if (!isPackageMarkedAsNotUsed(url.toString())) { + if (!UIUtil.packageMarkedAsNotUsed(url.toString(), "modules/")) { loadEditPolicyFile(url.toString()); } } } if (coreFileURLs != null) { for (URL url : coreFileURLs) { - if (!isPackageMarkedAsNotUsed(url.toString())) { + if (!UIUtil.packageMarkedAsNotUsed(url.toString(), "core/")) { loadEditPolicyFile(url.toString()); } } -- GitLab