Fix translator configuration
This commit is contained in:
parent
02f2b5211e
commit
d83fa5c3c4
11 changed files with 240 additions and 229 deletions
|
@ -1,7 +1,18 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="var" path="M2_REPO/com/google/guava/guava/13.0/guava-13.0.jar"/>
|
||||||
</classpath>
|
<classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar"/>
|
||||||
|
<classpathentry kind="var" path="M2_REPO/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar"/>
|
||||||
|
<classpathentry kind="var" path="M2_REPO/junit/junit/4.10/junit-4.10.jar"/>
|
||||||
|
<classpathentry kind="var" path="M2_REPO/org/eclipse/core/org.eclipse.core.contenttype/3.4.100.v20100505-1235/org.eclipse.core.contenttype-3.4.100.v20100505-1235.jar"/>
|
||||||
|
<classpathentry kind="var" path="M2_REPO/org/eclipse/core/org.eclipse.core.jobs/3.5.0.v20100515/org.eclipse.core.jobs-3.5.0.v20100515.jar"/>
|
||||||
|
<classpathentry kind="var" path="M2_REPO/org/eclipse/core/org.eclipse.core.resources/3.6.0.v20100526-0737/org.eclipse.core.resources-3.6.0.v20100526-0737.jar"/>
|
||||||
|
<classpathentry kind="var" path="M2_REPO/org/eclipse/core/org.eclipse.core.runtime/3.6.0.v20100505/org.eclipse.core.runtime-3.6.0.v20100505.jar"/>
|
||||||
|
<classpathentry kind="var" path="M2_REPO/org/eclipse/equinox/org.eclipse.equinox.common/3.6.0.v20100503/org.eclipse.equinox.common-3.6.0.v20100503.jar"/>
|
||||||
|
<classpathentry kind="var" path="M2_REPO/org/eclipse/equinox/org.eclipse.equinox.preferences/3.3.0.v20100503/org.eclipse.equinox.preferences-3.3.0.v20100503.jar"/>
|
||||||
|
<classpathentry kind="var" path="M2_REPO/org/eclipse/tycho/org.eclipse.jdt.core/3.8.1.v20120531-0637/org.eclipse.jdt.core-3.8.1.v20120531-0637.jar"/>
|
||||||
|
<classpathentry kind="var" path="M2_REPO/org/eclipse/osgi/org.eclipse.osgi/3.6.0.v20100517/org.eclipse.osgi-3.6.0.v20100517.jar"/>
|
||||||
|
<classpathentry kind="var" path="M2_REPO/org/jibx/config/3rdparty/org/eclipse/org.eclipse.text/3.5.100.v20110505-0800/org.eclipse.text-3.5.100.v20110505-0800.jar"/>
|
||||||
|
</classpath>
|
|
@ -1 +1,2 @@
|
||||||
bin
|
bin
|
||||||
|
target
|
||||||
|
|
|
@ -1,28 +1,27 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
<projectDescription>
|
||||||
<name>net.osmand.translator</name>
|
<name>translator</name>
|
||||||
<comment></comment>
|
<comment/>
|
||||||
<projects>
|
<projects/>
|
||||||
</projects>
|
<buildSpec>
|
||||||
<buildSpec>
|
<buildCommand>
|
||||||
<buildCommand>
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
</buildCommand>
|
||||||
<arguments>
|
<buildCommand>
|
||||||
</arguments>
|
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
|
||||||
</buildCommand>
|
<triggers>full,incremental,</triggers>
|
||||||
<buildCommand>
|
<arguments>
|
||||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
<dictionary>
|
||||||
<arguments>
|
<key>LaunchConfigHandle</key>
|
||||||
</arguments>
|
<value><project>/.externalToolBuilders/org.eclipse.pde.ManifestBuilder.launch</value>
|
||||||
</buildCommand>
|
</dictionary>
|
||||||
<buildCommand>
|
</arguments>
|
||||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
</buildCommand>
|
||||||
<arguments>
|
<buildCommand>
|
||||||
</arguments>
|
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
<nature>org.eclipse.pde.PluginNature</nature>
|
<nature>org.eclipse.pde.PluginNature</nature>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
|
@ -1,15 +0,0 @@
|
||||||
Manifest-Version: 1.0
|
|
||||||
Bundle-ManifestVersion: 2
|
|
||||||
Bundle-Name: Translator
|
|
||||||
Bundle-SymbolicName: net.osmand.translator;singleton:=true
|
|
||||||
Bundle-Version: 1.0.0.qualifier
|
|
||||||
Bundle-Activator: net.osmand.translator.Activator
|
|
||||||
Require-Bundle: org.eclipse.ui,
|
|
||||||
org.eclipse.core.runtime,
|
|
||||||
org.eclipse.jdt;bundle-version="3.7.2",
|
|
||||||
org.eclipse.jdt.core;bundle-version="3.7.3",
|
|
||||||
org.eclipse.jdt.ui;bundle-version="3.7.2",
|
|
||||||
org.eclipse.jface.text;bundle-version="3.7.2",
|
|
||||||
org.eclipse.core.resources;bundle-version="3.7.101"
|
|
||||||
Bundle-ActivationPolicy: lazy
|
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
|
|
@ -1,6 +0,0 @@
|
||||||
source.. = src/
|
|
||||||
output.. = bin/
|
|
||||||
bin.includes = plugin.xml,\
|
|
||||||
META-INF/,\
|
|
||||||
.,\
|
|
||||||
icons/
|
|
Binary file not shown.
Before Width: | Height: | Size: 983 B |
|
@ -1,62 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<?eclipse version="3.4"?>
|
|
||||||
<plugin>
|
|
||||||
|
|
||||||
<extension
|
|
||||||
point="org.eclipse.ui.commands">
|
|
||||||
<category
|
|
||||||
name="Sample Category"
|
|
||||||
id="net.osmand.translator.commands.category">
|
|
||||||
</category>
|
|
||||||
<command
|
|
||||||
name="Sample Command"
|
|
||||||
categoryId="net.osmand.translator.commands.category"
|
|
||||||
id="net.osmand.translator.commands.sampleCommand">
|
|
||||||
</command>
|
|
||||||
</extension>
|
|
||||||
<extension
|
|
||||||
point="org.eclipse.ui.handlers">
|
|
||||||
<handler
|
|
||||||
commandId="net.osmand.translator.commands.sampleCommand"
|
|
||||||
class="net.osmand.translator.handlers.TranslationHandler">
|
|
||||||
</handler>
|
|
||||||
</extension>
|
|
||||||
<extension
|
|
||||||
point="org.eclipse.ui.bindings">
|
|
||||||
<key
|
|
||||||
commandId="net.osmand.translator.commands.sampleCommand"
|
|
||||||
contextId="org.eclipse.ui.contexts.window"
|
|
||||||
sequence="M1+6"
|
|
||||||
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
|
|
||||||
</key>
|
|
||||||
</extension>
|
|
||||||
<extension
|
|
||||||
point="org.eclipse.ui.menus">
|
|
||||||
<menuContribution
|
|
||||||
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
|
|
||||||
<menu
|
|
||||||
label="Translate To C++"
|
|
||||||
mnemonic="M"
|
|
||||||
id="net.osmand.translator.menus.sampleMenu">
|
|
||||||
<command
|
|
||||||
commandId="net.osmand.translator.commands.sampleCommand"
|
|
||||||
mnemonic="S"
|
|
||||||
id="net.osmand.translator.menus.sampleCommand">
|
|
||||||
</command>
|
|
||||||
</menu>
|
|
||||||
</menuContribution>
|
|
||||||
<menuContribution
|
|
||||||
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
|
|
||||||
<toolbar
|
|
||||||
id="net.osmand.translator.toolbars.sampleToolbar">
|
|
||||||
<command
|
|
||||||
commandId="net.osmand.translator.commands.sampleCommand"
|
|
||||||
icon="icons/sample.gif"
|
|
||||||
tooltip="Say hello world"
|
|
||||||
id="net.osmand.translator.toolbars.sampleCommand">
|
|
||||||
</command>
|
|
||||||
</toolbar>
|
|
||||||
</menuContribution>
|
|
||||||
</extension>
|
|
||||||
|
|
||||||
</plugin>
|
|
147
build-scripts/net.osmand.translator/pom.xml
Normal file
147
build-scripts/net.osmand.translator/pom.xml
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
<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/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>net.osmand.translator</groupId>
|
||||||
|
<artifactId>translator</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<version>1</version>
|
||||||
|
<name>translator</name>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<directory>target</directory>
|
||||||
|
<outputDirectory>target/classes</outputDirectory>
|
||||||
|
<finalName>${artifactId}-${version}</finalName>
|
||||||
|
<testOutputDirectory>target/test-classes</testOutputDirectory>
|
||||||
|
<sourceDirectory>src</sourceDirectory>
|
||||||
|
<testSourceDirectory>test/src</testSourceDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/resources</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<testResources>
|
||||||
|
<testResource>
|
||||||
|
<directory>test/resources</directory>
|
||||||
|
</testResource>
|
||||||
|
</testResources>
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<!-- Copy dependent jars -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<version>2.5</version>
|
||||||
|
<!-- <executions> <execution> <id>copy-dependencies</id> <phase>generate-resources</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/lib</outputDirectory> <excludeTransitive>true</excludeTransitive>
|
||||||
|
</configuration> </execution> </executions> -->
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-plugin-plugin</artifactId>
|
||||||
|
<version>2.4.3</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-eclipse-plugin</artifactId>
|
||||||
|
<version>2.5</version>
|
||||||
|
<goals>
|
||||||
|
<project>net.osmand.translator</project>
|
||||||
|
</goals>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<version>13.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.findbugs</groupId>
|
||||||
|
<artifactId>jsr305</artifactId>
|
||||||
|
<version>2.0.1</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.core</groupId>
|
||||||
|
<artifactId>org.eclipse.core.contenttype</artifactId>
|
||||||
|
<version>3.4.100.v20100505-1235</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.eclipse.equinox</groupId>
|
||||||
|
<artifactId>org.eclipse.equinox.registry</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.core</groupId>
|
||||||
|
<artifactId>org.eclipse.core.jobs</artifactId>
|
||||||
|
<version>3.5.0.v20100515</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.core</groupId>
|
||||||
|
<artifactId>org.eclipse.core.resources</artifactId>
|
||||||
|
<version>3.6.0.v20100526-0737</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.eclipse.core</groupId>
|
||||||
|
<artifactId>org.eclipse.core.expressions</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.eclipse.core</groupId>
|
||||||
|
<artifactId>org.eclipse.core.filesystem</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.core</groupId>
|
||||||
|
<artifactId>org.eclipse.core.runtime</artifactId>
|
||||||
|
<version>3.6.0.v20100505</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.eclipse.equinox</groupId>
|
||||||
|
<artifactId>org.eclipse.equinox.app</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.equinox</groupId>
|
||||||
|
<artifactId>org.eclipse.equinox.common</artifactId>
|
||||||
|
<version>3.6.0.v20100503</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.equinox</groupId>
|
||||||
|
<artifactId>org.eclipse.equinox.preferences</artifactId>
|
||||||
|
<version>3.3.0.v20100503</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.tycho</groupId>
|
||||||
|
<artifactId>org.eclipse.jdt.core</artifactId>
|
||||||
|
<version>3.8.1.v20120531-0637</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.osgi</groupId>
|
||||||
|
<artifactId>org.eclipse.osgi</artifactId>
|
||||||
|
<version>3.6.0.v20100517</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jibx.config.3rdparty.org.eclipse</groupId>
|
||||||
|
<artifactId>org.eclipse.text</artifactId>
|
||||||
|
<version>3.5.100.v20110505-0800</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.10</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -1,61 +0,0 @@
|
||||||
package net.osmand.translator;
|
|
||||||
|
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
|
||||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
|
||||||
import org.osgi.framework.BundleContext;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The activator class controls the plug-in life cycle
|
|
||||||
*/
|
|
||||||
public class Activator extends AbstractUIPlugin {
|
|
||||||
|
|
||||||
// The plug-in ID
|
|
||||||
public static final String PLUGIN_ID = "net.osmand.translator"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
// The shared instance
|
|
||||||
private static Activator plugin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The constructor
|
|
||||||
*/
|
|
||||||
public Activator() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
|
|
||||||
*/
|
|
||||||
public void start(BundleContext context) throws Exception {
|
|
||||||
super.start(context);
|
|
||||||
plugin = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
|
|
||||||
*/
|
|
||||||
public void stop(BundleContext context) throws Exception {
|
|
||||||
plugin = null;
|
|
||||||
super.stop(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the shared instance
|
|
||||||
*
|
|
||||||
* @return the shared instance
|
|
||||||
*/
|
|
||||||
public static Activator getDefault() {
|
|
||||||
return plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an image descriptor for the image file at the given
|
|
||||||
* plug-in relative path
|
|
||||||
*
|
|
||||||
* @param path the path
|
|
||||||
* @return the image descriptor
|
|
||||||
*/
|
|
||||||
public static ImageDescriptor getImageDescriptor(String path) {
|
|
||||||
return imageDescriptorFromPlugin(PLUGIN_ID, path);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package net.osmand.translator;
|
||||||
|
|
||||||
|
public class TranslatorMain {
|
||||||
|
|
||||||
|
}
|
|
@ -3,9 +3,6 @@ package net.osmand.translator.handlers;
|
||||||
import net.osmand.translator.utils.FieldsHandler;
|
import net.osmand.translator.utils.FieldsHandler;
|
||||||
import net.osmand.translator.utils.MethodHandler;
|
import net.osmand.translator.utils.MethodHandler;
|
||||||
|
|
||||||
import org.eclipse.core.commands.AbstractHandler;
|
|
||||||
import org.eclipse.core.commands.ExecutionEvent;
|
|
||||||
import org.eclipse.core.commands.ExecutionException;
|
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
|
@ -13,7 +10,6 @@ import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
|
||||||
import org.eclipse.jdt.core.ICompilationUnit;
|
import org.eclipse.jdt.core.ICompilationUnit;
|
||||||
import org.eclipse.jdt.core.IJavaProject;
|
import org.eclipse.jdt.core.IJavaProject;
|
||||||
import org.eclipse.jdt.core.IMethod;
|
import org.eclipse.jdt.core.IMethod;
|
||||||
|
@ -28,22 +24,22 @@ import org.eclipse.jdt.core.dom.CompilationUnit;
|
||||||
import org.eclipse.jface.text.Document;
|
import org.eclipse.jface.text.Document;
|
||||||
//import org.eclipse.jface.text.Document;
|
//import org.eclipse.jface.text.Document;
|
||||||
|
|
||||||
public class TranslationHandler extends AbstractHandler {
|
public class TranslationHandler {
|
||||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
|
||||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
public static void execute() {
|
||||||
IWorkspaceRoot root = workspace.getRoot();
|
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||||
IPath path = root.getProject("DataExtactionOSM").getFile("src/net/osmand/osm/MapUtils.java").getFullPath();
|
IWorkspaceRoot root = workspace.getRoot();
|
||||||
// parse "MapUtils.java"
|
IPath path = root.getProject("DataExtactionOSM").getFile("src/net/osmand/osm/MapUtils.java").getFullPath();
|
||||||
// IPath path = Path.fromOSString("/DataExtractionOSM/src/net/osmand/osm/MapUtils.java");
|
// parse "MapUtils.java"
|
||||||
IFile iFile = root.getFileForLocation(path);
|
// IPath path = Path.fromOSString("/DataExtractionOSM/src/net/osmand/osm/MapUtils.java");
|
||||||
ICompilationUnit unit = (ICompilationUnit)JavaCore.create(iFile);
|
IFile iFile = root.getFileForLocation(path);
|
||||||
CompilationUnit parse = parse(unit);
|
ICompilationUnit unit = (ICompilationUnit) JavaCore.create(iFile);
|
||||||
FieldsHandler.printFieldsInfo(parse);
|
CompilationUnit parse = parse(unit);
|
||||||
System.out.println();
|
FieldsHandler.printFieldsInfo(parse);
|
||||||
MethodHandler.printMethodsInfo(parse);
|
System.out.println();
|
||||||
return null;
|
MethodHandler.printMethodsInfo(parse);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CompilationUnit parse(ICompilationUnit unit) {
|
private static CompilationUnit parse(ICompilationUnit unit) {
|
||||||
ASTParser parser = ASTParser.newParser(AST.JLS3);
|
ASTParser parser = ASTParser.newParser(AST.JLS3);
|
||||||
parser.setKind(ASTParser.K_COMPILATION_UNIT);
|
parser.setKind(ASTParser.K_COMPILATION_UNIT);
|
||||||
|
@ -52,21 +48,20 @@ public class TranslationHandler extends AbstractHandler {
|
||||||
return (CompilationUnit) parser.createAST(null); // parse
|
return (CompilationUnit) parser.createAST(null); // parse
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
// ///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private void getProjects(IWorkspaceRoot root) {
|
private void getProjects(IWorkspaceRoot root) {
|
||||||
IProject[] projects = root.getProjects();
|
IProject[] projects = root.getProjects();
|
||||||
for (IProject project : projects) {
|
for (IProject project : projects) {
|
||||||
try {
|
try {
|
||||||
printProjectInfo(project);
|
printProjectInfo(project);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printProjectInfo(IProject project) throws CoreException,
|
private void printProjectInfo(IProject project) throws CoreException, JavaModelException {
|
||||||
JavaModelException {
|
|
||||||
System.out.println("Working in project " + project.getName());
|
System.out.println("Working in project " + project.getName());
|
||||||
// Check if we have a Java project
|
// Check if we have a Java project
|
||||||
if (project.isNatureEnabled("org.eclipse.jdt.core.javanature")) {
|
if (project.isNatureEnabled("org.eclipse.jdt.core.javanature")) {
|
||||||
|
@ -75,34 +70,31 @@ public class TranslationHandler extends AbstractHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printPackageInfos(IJavaProject javaProject)
|
private void printPackageInfos(IJavaProject javaProject) throws JavaModelException {
|
||||||
throws JavaModelException {
|
IPackageFragment[] packages = javaProject.getPackageFragments();
|
||||||
IPackageFragment[] packages = javaProject.getPackageFragments();
|
for (IPackageFragment mypackage : packages) {
|
||||||
for (IPackageFragment mypackage : packages) {
|
// Package fragments include all packages in the
|
||||||
// Package fragments include all packages in the
|
// classpath
|
||||||
// classpath
|
// We will only look at the package from the source
|
||||||
// We will only look at the package from the source
|
// folder
|
||||||
// folder
|
// K_BINARY would include also included JARS, e.g.
|
||||||
// K_BINARY would include also included JARS, e.g.
|
// rt.jar
|
||||||
// rt.jar
|
if (mypackage.getKind() == IPackageFragmentRoot.K_SOURCE) {
|
||||||
if (mypackage.getKind() == IPackageFragmentRoot.K_SOURCE) {
|
System.out.println("Package " + mypackage.getElementName());
|
||||||
System.out.println("Package " + mypackage.getElementName());
|
printICompilationUnitInfo(mypackage);
|
||||||
printICompilationUnitInfo(mypackage);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printICompilationUnitInfo(IPackageFragment mypackage)
|
private void printICompilationUnitInfo(IPackageFragment mypackage) throws JavaModelException {
|
||||||
throws JavaModelException {
|
|
||||||
for (ICompilationUnit unit : mypackage.getCompilationUnits()) {
|
for (ICompilationUnit unit : mypackage.getCompilationUnits()) {
|
||||||
printCompilationUnitDetails(unit);
|
printCompilationUnitDetails(unit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printCompilationUnitDetails(ICompilationUnit unit)
|
private void printCompilationUnitDetails(ICompilationUnit unit) throws JavaModelException {
|
||||||
throws JavaModelException {
|
|
||||||
System.out.println("Source file " + unit.getElementName());
|
System.out.println("Source file " + unit.getElementName());
|
||||||
Document doc = new Document(unit.getSource());
|
Document doc = new Document(unit.getSource());
|
||||||
System.out.println("Has number of lines: " + doc.getNumberOfLines());
|
System.out.println("Has number of lines: " + doc.getNumberOfLines());
|
||||||
|
|
Loading…
Reference in a new issue