Skip to content

Commit

Permalink
Merge pull request #117 from LorenzoBettini/jbasescript-example
Browse files Browse the repository at this point in the history
Jbasescript example
  • Loading branch information
LorenzoBettini committed Jun 22, 2021
2 parents 12d7f4b + 14d4e6f commit 34ee6b6
Show file tree
Hide file tree
Showing 10 changed files with 202 additions and 0 deletions.
8 changes: 8 additions & 0 deletions jbase.example.jbasescript.example.project/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-gen"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
34 changes: 34 additions & 0 deletions jbase.example.jbasescript.example.project/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>jbase.example.jbasescript.example.project</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Lorenzo Bettini
Bundle-SymbolicName: jbase.example.jbasescript.example.project
Bundle-Version: 0.11.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.xtext.xbase.lib;bundle-version="2.13.0"
Automatic-Module-Name: jbase.example.jbasescript.example.project
4 changes: 4 additions & 0 deletions jbase.example.jbasescript.example.project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source.. = src/,\
src-gen/
bin.includes = META-INF/,\
.
62 changes: 62 additions & 0 deletions jbase.example.jbasescript.example.project/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<relativePath>../jbase.parent/pom.xml</relativePath>
<groupId>net.sf.xtext-jbase</groupId>
<artifactId>jbase.parent</artifactId>
<version>0.11.0-SNAPSHOT</version>
</parent>

<artifactId>jbase.example.jbasescript.example.project</artifactId>
<packaging>eclipse-plugin</packaging>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.eclipse.xtext</groupId>
<artifactId>xtext-maven-plugin</artifactId>
<version>${xtext-version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<languages>
<language>
<setup>jbase.example.jbasescript.JbasescriptStandaloneSetup</setup>
<outputConfigurations>
<outputConfiguration>
<outputDirectory>src-gen</outputDirectory>
</outputConfiguration>
</outputConfigurations>
</language>
</languages>
</configuration>
<dependencies>
<dependency>
<groupId>net.sf.xtext-jbase</groupId>
<artifactId>jbase.example.jbasescript</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.sf.xtext-jbase</groupId>
<artifactId>jbase</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package jbasescript;

import java.io.File;
import jbase.example.jbasescript.example.project.ExampleHelper;

@SuppressWarnings("all")
public class Example {
public static void printFileNames(String path) {
File folder = new File(path);
File[] listOfFiles = folder.listFiles();
ExampleHelper helper = new ExampleHelper();
for (int i = 0; (i < listOfFiles.length); i++) {
boolean _isFile = listOfFiles[i].isFile();
if (_isFile) {
String _aFile = helper.aFile();
String _name = listOfFiles[i].getName();
String _plus = (_aFile + _name);
System.out.println(_plus);
} else {
boolean _isDirectory = listOfFiles[i].isDirectory();
if (_isDirectory) {
String _aDir = helper.aDir();
String _name_1 = listOfFiles[i].getName();
String _plus_1 = (_aDir + _name_1);
System.out.println(_plus_1);
}
}
}
}

public static void main(String[] args) throws Throwable {
int _length = args.length;
boolean _greaterThan = (_length > 0);
if (_greaterThan) {
for (int i = 0; (i < args.length); ++i) {
Example.printFileNames(args[i]);
}
} else {
Example.printFileNames(".");
}
}
}
23 changes: 23 additions & 0 deletions jbase.example.jbasescript.example.project/src/Example.jbasescript
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import java.io.File;
import jbase.example.jbasescript.example.project.ExampleHelper;

op printFileNames(String path) {
File folder = new File(path);
File[] listOfFiles = folder.listFiles();
ExampleHelper helper = new ExampleHelper();

for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
System.out.println(helper.aFile() + listOfFiles[i].getName());
} else if (listOfFiles[i].isDirectory()) {
System.out.println(helper.aDir() + listOfFiles[i].getName());
}
}
}

if (args.length > 0) {
for (int i = 0; i < args.length; ++i)
printFileNames(args[i]);
} else {
printFileNames(".");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package jbase.example.jbasescript.example.project;

public class ExampleHelper {

public String aFile() {
return "File: ";
}

public String aDir() {
return "Directory: ";
}
}
1 change: 1 addition & 0 deletions jbase.releng/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<module>../jbase.example.purejbase.tests</module>
<module>../jbase.example.purejbase.ui.tests</module>
<module>../jbase.example.jbasescript</module>
<module>../jbase.example.jbasescript.example.project</module>
<module>../jbase.example.jbasescript.ide</module>
<module>../jbase.example.jbasescript.ui</module>
<module>../jbase.example.jbasescript.tests</module>
Expand Down

0 comments on commit 34ee6b6

Please sign in to comment.