diff --git a/build-scripts/net.osmand.translator/.classpath b/build-scripts/net.osmand.translator/.classpath index 098194ca4b..43c31e7159 100644 --- a/build-scripts/net.osmand.translator/.classpath +++ b/build-scripts/net.osmand.translator/.classpath @@ -1,7 +1,18 @@ - - - - - - + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/build-scripts/net.osmand.translator/.gitignore b/build-scripts/net.osmand.translator/.gitignore index ba077a4031..d567ba01e1 100644 --- a/build-scripts/net.osmand.translator/.gitignore +++ b/build-scripts/net.osmand.translator/.gitignore @@ -1 +1,2 @@ bin +target diff --git a/build-scripts/net.osmand.translator/.project b/build-scripts/net.osmand.translator/.project index 4bb391ea39..d5af7f4544 100644 --- a/build-scripts/net.osmand.translator/.project +++ b/build-scripts/net.osmand.translator/.project @@ -1,28 +1,27 @@ - - net.osmand.translator - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - + translator + + + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.ui.externaltools.ExternalToolBuilder + full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/org.eclipse.pde.ManifestBuilder.launch + + + + + org.eclipse.pde.SchemaBuilder + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + \ No newline at end of file diff --git a/build-scripts/net.osmand.translator/META-INF/MANIFEST.MF b/build-scripts/net.osmand.translator/META-INF/MANIFEST.MF deleted file mode 100644 index c1e69ef42f..0000000000 --- a/build-scripts/net.osmand.translator/META-INF/MANIFEST.MF +++ /dev/null @@ -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 diff --git a/build-scripts/net.osmand.translator/build.properties b/build-scripts/net.osmand.translator/build.properties deleted file mode 100644 index 0d3d3a745d..0000000000 --- a/build-scripts/net.osmand.translator/build.properties +++ /dev/null @@ -1,6 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = plugin.xml,\ - META-INF/,\ - .,\ - icons/ diff --git a/build-scripts/net.osmand.translator/icons/sample.gif b/build-scripts/net.osmand.translator/icons/sample.gif deleted file mode 100644 index 34fb3c9d8c..0000000000 Binary files a/build-scripts/net.osmand.translator/icons/sample.gif and /dev/null differ diff --git a/build-scripts/net.osmand.translator/plugin.xml b/build-scripts/net.osmand.translator/plugin.xml deleted file mode 100644 index 36aa89600c..0000000000 --- a/build-scripts/net.osmand.translator/plugin.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build-scripts/net.osmand.translator/pom.xml b/build-scripts/net.osmand.translator/pom.xml new file mode 100644 index 0000000000..a828c1f29a --- /dev/null +++ b/build-scripts/net.osmand.translator/pom.xml @@ -0,0 +1,147 @@ + + 4.0.0 + net.osmand.translator + translator + jar + 1 + translator + + + target + target/classes + ${artifactId}-${version} + target/test-classes + src + test/src + + + src/resources + + + + + test/resources + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.5 + + + + maven-plugin-plugin + 2.4.3 + + + maven-eclipse-plugin + 2.5 + + net.osmand.translator + + + + + + + + + com.google.guava + guava + 13.0 + compile + + + com.google.code.findbugs + jsr305 + 2.0.1 + compile + + + org.eclipse.core + org.eclipse.core.contenttype + 3.4.100.v20100505-1235 + + + org.eclipse.equinox + org.eclipse.equinox.registry + + + compile + + + org.eclipse.core + org.eclipse.core.jobs + 3.5.0.v20100515 + compile + + + org.eclipse.core + org.eclipse.core.resources + 3.6.0.v20100526-0737 + + + org.eclipse.core + org.eclipse.core.expressions + + + org.eclipse.core + org.eclipse.core.filesystem + + + compile + + + org.eclipse.core + org.eclipse.core.runtime + 3.6.0.v20100505 + + + org.eclipse.equinox + org.eclipse.equinox.app + + + compile + + + org.eclipse.equinox + org.eclipse.equinox.common + 3.6.0.v20100503 + compile + + + org.eclipse.equinox + org.eclipse.equinox.preferences + 3.3.0.v20100503 + compile + + + org.eclipse.tycho + org.eclipse.jdt.core + 3.8.1.v20120531-0637 + compile + + + org.eclipse.osgi + org.eclipse.osgi + 3.6.0.v20100517 + compile + + + org.jibx.config.3rdparty.org.eclipse + org.eclipse.text + 3.5.100.v20110505-0800 + compile + + + junit + junit + 4.10 + test + + + \ No newline at end of file diff --git a/build-scripts/net.osmand.translator/src/net/osmand/translator/Activator.java b/build-scripts/net.osmand.translator/src/net/osmand/translator/Activator.java deleted file mode 100644 index 635281cae9..0000000000 --- a/build-scripts/net.osmand.translator/src/net/osmand/translator/Activator.java +++ /dev/null @@ -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); - } -} diff --git a/build-scripts/net.osmand.translator/src/net/osmand/translator/TranslatorMain.java b/build-scripts/net.osmand.translator/src/net/osmand/translator/TranslatorMain.java new file mode 100644 index 0000000000..090fa2bd58 --- /dev/null +++ b/build-scripts/net.osmand.translator/src/net/osmand/translator/TranslatorMain.java @@ -0,0 +1,5 @@ +package net.osmand.translator; + +public class TranslatorMain { + +} diff --git a/build-scripts/net.osmand.translator/src/net/osmand/translator/handlers/TranslationHandler.java b/build-scripts/net.osmand.translator/src/net/osmand/translator/handlers/TranslationHandler.java index 2a011dd684..28bd70ab0d 100644 --- a/build-scripts/net.osmand.translator/src/net/osmand/translator/handlers/TranslationHandler.java +++ b/build-scripts/net.osmand.translator/src/net/osmand/translator/handlers/TranslationHandler.java @@ -3,9 +3,6 @@ package net.osmand.translator.handlers; import net.osmand.translator.utils.FieldsHandler; 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.IProject; 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.runtime.CoreException; import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaProject; 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; -public class TranslationHandler extends AbstractHandler { - public Object execute(ExecutionEvent event) throws ExecutionException { - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - IWorkspaceRoot root = workspace.getRoot(); - IPath path = root.getProject("DataExtactionOSM").getFile("src/net/osmand/osm/MapUtils.java").getFullPath(); -// parse "MapUtils.java" -// IPath path = Path.fromOSString("/DataExtractionOSM/src/net/osmand/osm/MapUtils.java"); - IFile iFile = root.getFileForLocation(path); - ICompilationUnit unit = (ICompilationUnit)JavaCore.create(iFile); - CompilationUnit parse = parse(unit); - FieldsHandler.printFieldsInfo(parse); - System.out.println(); - MethodHandler.printMethodsInfo(parse); - return null; - } - +public class TranslationHandler { + + public static void execute() { + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + IWorkspaceRoot root = workspace.getRoot(); + IPath path = root.getProject("DataExtactionOSM").getFile("src/net/osmand/osm/MapUtils.java").getFullPath(); + // parse "MapUtils.java" + // IPath path = Path.fromOSString("/DataExtractionOSM/src/net/osmand/osm/MapUtils.java"); + IFile iFile = root.getFileForLocation(path); + ICompilationUnit unit = (ICompilationUnit) JavaCore.create(iFile); + CompilationUnit parse = parse(unit); + FieldsHandler.printFieldsInfo(parse); + System.out.println(); + MethodHandler.printMethodsInfo(parse); + } + private static CompilationUnit parse(ICompilationUnit unit) { ASTParser parser = ASTParser.newParser(AST.JLS3); parser.setKind(ASTParser.K_COMPILATION_UNIT); @@ -52,21 +48,20 @@ public class TranslationHandler extends AbstractHandler { return (CompilationUnit) parser.createAST(null); // parse } -///////////////////////////////////////////////////////////////////////////// - + // /////////////////////////////////////////////////////////////////////////// + private void getProjects(IWorkspaceRoot root) { IProject[] projects = root.getProjects(); - for (IProject project : projects) { - try { - printProjectInfo(project); - } catch (CoreException e) { - e.printStackTrace(); - } - } + for (IProject project : projects) { + try { + printProjectInfo(project); + } catch (CoreException e) { + e.printStackTrace(); + } + } } - - private void printProjectInfo(IProject project) throws CoreException, - JavaModelException { + + private void printProjectInfo(IProject project) throws CoreException, JavaModelException { System.out.println("Working in project " + project.getName()); // Check if we have a Java project if (project.isNatureEnabled("org.eclipse.jdt.core.javanature")) { @@ -75,34 +70,31 @@ public class TranslationHandler extends AbstractHandler { } } - private void printPackageInfos(IJavaProject javaProject) - throws JavaModelException { - IPackageFragment[] packages = javaProject.getPackageFragments(); - for (IPackageFragment mypackage : packages) { - // Package fragments include all packages in the - // classpath - // We will only look at the package from the source - // folder - // K_BINARY would include also included JARS, e.g. - // rt.jar - if (mypackage.getKind() == IPackageFragmentRoot.K_SOURCE) { - System.out.println("Package " + mypackage.getElementName()); - printICompilationUnitInfo(mypackage); + private void printPackageInfos(IJavaProject javaProject) throws JavaModelException { + IPackageFragment[] packages = javaProject.getPackageFragments(); + for (IPackageFragment mypackage : packages) { + // Package fragments include all packages in the + // classpath + // We will only look at the package from the source + // folder + // K_BINARY would include also included JARS, e.g. + // rt.jar + if (mypackage.getKind() == IPackageFragmentRoot.K_SOURCE) { + System.out.println("Package " + mypackage.getElementName()); + printICompilationUnitInfo(mypackage); - } + } - } - } + } + } - private void printICompilationUnitInfo(IPackageFragment mypackage) - throws JavaModelException { + private void printICompilationUnitInfo(IPackageFragment mypackage) throws JavaModelException { for (ICompilationUnit unit : mypackage.getCompilationUnits()) { printCompilationUnitDetails(unit); } } - private void printCompilationUnitDetails(ICompilationUnit unit) - throws JavaModelException { + private void printCompilationUnitDetails(ICompilationUnit unit) throws JavaModelException { System.out.println("Source file " + unit.getElementName()); Document doc = new Document(unit.getSource()); System.out.println("Has number of lines: " + doc.getNumberOfLines());