Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2019-11-05 22:32:11 +0000
committerRyan D. Brooks2020-12-15 21:40:56 +0000
commite7317b1f80c3537f3d8dd8d8bbe2caa6512204e4 (patch)
tree7f5fef8eba4813a41948907775d5615cd8bb3378
parent67b11985aca412cd9d232251bdcb62714e09ace7 (diff)
downloadorg.eclipse.osee-e7317b1f80c3537f3d8dd8d8bbe2caa6512204e4.tar.gz
org.eclipse.osee-e7317b1f80c3537f3d8dd8d8bbe2caa6512204e4.tar.xz
org.eclipse.osee-e7317b1f80c3537f3d8dd8d8bbe2caa6512204e4.zip
feature: AST Parser
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java27
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsApi.java2
4 files changed, 32 insertions, 4 deletions
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java
index 20022dade8f..f3331c79700 100644
--- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java
@@ -397,8 +397,7 @@ public final class Lib {
}
public static ChangeSet inputStreamToChangeSet(InputStream in, String charset) throws IOException {
- InputStreamReader reader = new InputStreamReader(in, charset);
- try {
+ try (InputStreamReader reader = new InputStreamReader(in, charset)) {
ChangeSet set = new ChangeSet();
char[] chars = new char[8000];
int readCount = 0;
@@ -406,8 +405,6 @@ public final class Lib {
set.insertBefore(0, chars, 0, readCount, true);
}
return set;
- } finally {
- close(reader);
}
}
diff --git a/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF
index 89a87067bdf..19a324d7f14 100644
--- a/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF
@@ -23,7 +23,9 @@ Import-Package: com.fasterxml.jackson.annotation,
org.eclipse.emf.ecore,
org.eclipse.emf.ecore.util,
org.eclipse.jdt.annotation,
+ org.eclipse.jdt.core,
org.eclipse.osee.activity.api,
+ org.eclipse.jdt.core.dom,
org.eclipse.osee.console.admin,
org.eclipse.osee.framework.core,
org.eclipse.osee.framework.core.access,
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java
index f1c3bae265d..f2748912c66 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java
@@ -16,9 +16,16 @@ package org.eclipse.osee.orcs.core.internal;
import org.eclipse.osee.activity.api.ActivityLog;
import org.eclipse.osee.framework.core.OseeApiBase;
import org.eclipse.osee.framework.core.access.IAccessControlService;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.ITypeRoot;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.executor.ExecutorAdmin;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.jdbc.JdbcService;
import org.eclipse.osee.logger.Log;
@@ -283,4 +290,24 @@ public class OrcsApiImpl extends OseeApiBase implements OrcsApi {
public ActivityLog getActivityLog() {
return activityLog;
}
+ }
+
+ @Override
+ public void ast() {
+ try {
+ ASTParser parser = ASTParser.newParser(AST.JLS8);
+ parser.setSource("package org.eclipse.osee.orcs.core.internal;".toCharArray());
+ parser.setKind(ASTParser.K_COMPILATION_UNIT);
+
+ CompilationUnit unit = (CompilationUnit) parser.createAST(new NullProgressMonitor());
+ AST ast = unit.getAST();
+
+ ITypeRoot typeRoot = unit.getTypeRoot();
+ IMethod[] methods = typeRoot.findPrimaryType().getMethods();
+ for (IMethod method : methods) {
+ System.out.print(method);
+ }
+ } catch (Exception ex) {
+ throw OseeCoreException.wrap(ex);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsApi.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsApi.java
index 146a975e12c..b0be33d6136 100644
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsApi.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsApi.java
@@ -56,4 +56,6 @@ public interface OrcsApi extends OseeApi {
ActivityLog getActivityLog();
+
+ void ast();
} \ No newline at end of file

Back to the top