[ooo-build-commit] ooeclipse: Branch 'master'
Cédric Bosdonnat
cbosdo at kemper.freedesktop.org
Mon Aug 3 08:20:51 PDT 2009
.gitignore | 3
core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java | 9
core/source/org/openoffice/ide/eclipse/core/internal/model/UnoFactory.java | 1
core/source/org/openoffice/ide/eclipse/core/preferences/ISdk.java | 6
cpp/.classpath | 7
cpp/.project | 28 ++
cpp/.settings/org.eclipse.jdt.core.prefs | 7
cpp/META-INF/MANIFEST.MF | 15 +
cpp/build.properties | 5
cpp/plugin.xml | 12
cpp/source/org/openoffice/ide/eclipse/cpp/Activator.java | 50 ++++
cpp/source/org/openoffice/ide/eclipse/cpp/CppBuilder.java | 125 ++++++++++
cpp/source/org/openoffice/ide/eclipse/cpp/CppProjectHandler.java | 123 +++++++++
cpp/source/org/openoffice/ide/eclipse/cpp/CppUI.java | 16 +
cpp/source/org/openoffice/ide/eclipse/cpp/Language.java | 25 ++
15 files changed, 430 insertions(+), 2 deletions(-)
New commits:
commit fdb2e3461314c365af6c35de7d05e599077cd711
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Mon Aug 3 17:18:55 2009 +0200
Started C++ plugin.
This is the beginning of the C++ language implementation. This is
currently not complete. Working now:
* The C++ project creation
* Add the source and include directories to the project
* Generating the implementation skeleton for the new services
* The build chain is running well up to the cppumaker
Still to support:
* Package creation
* Creating a common registration class for all the implemented
services like we have for Java.
diff --git a/.gitignore b/.gitignore
index 9395511..a8047ed 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1 @@
-/core/bin
-/java/bin
+/*/bin
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java b/core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java
index 7b41be3..6ae9a86 100755
--- a/core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java
@@ -91,6 +91,8 @@ public class SDK implements ISdk, ITableElement {
private static final String PATH_SEPARATOR = System.getProperty("path.separator"); //$NON-NLS-1$
+ private static final String INCLUDE = "include"; //$NON-NLS-1$
+
/* SDK Members */
@@ -243,6 +245,13 @@ public class SDK implements ISdk, ITableElement {
}
/**
+ * {@inheritDoc}
+ */
+ public IPath getIncludePath() {
+ return new Path( getHome() ).append( INCLUDE );
+ }
+
+ /**
* Get the path to the executable files of the SDK.
*
* @param pHome the SDK installation path
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/model/UnoFactory.java b/core/source/org/openoffice/ide/eclipse/core/internal/model/UnoFactory.java
index 4c3abb3..41ff267 100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/model/UnoFactory.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/UnoFactory.java
@@ -211,6 +211,7 @@ public final class UnoFactory {
String command = "uno-skeletonmaker" + //$NON-NLS-1$
" " + unorc + //$NON-NLS-1$
" component " + languageOption + //$NON-NLS-1$
+ " --propertysetmixin" + //$NON-NLS-1$
" -o ./" + prj.getSourcePath().toOSString() + //$NON-NLS-1$
" " + typesReg + //$NON-NLS-1$
" -n " + implementationName + //$NON-NLS-1$
diff --git a/core/source/org/openoffice/ide/eclipse/core/preferences/ISdk.java b/core/source/org/openoffice/ide/eclipse/core/preferences/ISdk.java
index 9480b64..c6a7f8c 100644
--- a/core/source/org/openoffice/ide/eclipse/core/preferences/ISdk.java
+++ b/core/source/org/openoffice/ide/eclipse/core/preferences/ISdk.java
@@ -98,6 +98,11 @@ public interface ISdk {
public IPath getBinPath();
/**
+ * @return the path to the includes in the SDK.
+ */
+ public IPath getIncludePath();
+
+ /**
* Create a process for the given shell command. This process will
* be created with the project parameters such as it's SDK and
* location path
@@ -125,4 +130,5 @@ public interface ISdk {
*/
public Process runToolWithEnv(IUnoidlProject pProject,
String pShellCommand, String[] pEnv, IProgressMonitor pMonitor);
+
}
diff --git a/cpp/.classpath b/cpp/.classpath
new file mode 100644
index 0000000..2ed464f
--- /dev/null
+++ b/cpp/.classpath
@@ -0,0 +1,7 @@
+<?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.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="source"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/cpp/.project b/cpp/.project
new file mode 100644
index 0000000..cb637c5
--- /dev/null
+++ b/cpp/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.openoffice.ide.eclipse.cpp</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <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>
+ </natures>
+</projectDescription>
diff --git a/cpp/.settings/org.eclipse.jdt.core.prefs b/cpp/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..fe672f8
--- /dev/null
+++ b/cpp/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Mon Aug 03 10:23:59 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/cpp/META-INF/MANIFEST.MF b/cpp/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..ffdb100
--- /dev/null
+++ b/cpp/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: C++ extensions support for OOo
+Bundle-SymbolicName: org.openoffice.ide.eclipse.cpp;singleton:=true
+Bundle-Version: 0.0.1
+Bundle-Activator: org.openoffice.ide.eclipse.cpp.Activator
+Bundle-Vendor: Cédric Bosdonnat
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.openoffice.ide.eclipse.core;bundle-version="1.1.0",
+ org.eclipse.core.resources;bundle-version="3.4.1",
+ org.eclipse.cdt.core;bundle-version="5.0.1",
+ org.eclipse.cdt.managedbuilder.core;bundle-version="5.0.1"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
diff --git a/cpp/build.properties b/cpp/build.properties
new file mode 100644
index 0000000..3e8b980
--- /dev/null
+++ b/cpp/build.properties
@@ -0,0 +1,5 @@
+source.. = source/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/cpp/plugin.xml b/cpp/plugin.xml
new file mode 100644
index 0000000..a4dcf3f
--- /dev/null
+++ b/cpp/plugin.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.openoffice.ide.eclipse.core.language">
+ <language
+ class="org.openoffice.ide.eclipse.cpp.Language"
+ name="C++">
+ </language>
+ </extension>
+
+</plugin>
diff --git a/cpp/source/org/openoffice/ide/eclipse/cpp/Activator.java b/cpp/source/org/openoffice/ide/eclipse/cpp/Activator.java
new file mode 100644
index 0000000..8f41770
--- /dev/null
+++ b/cpp/source/org/openoffice/ide/eclipse/cpp/Activator.java
@@ -0,0 +1,50 @@
+package org.openoffice.ide.eclipse.cpp;
+
+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 = "org.openoffice.ide.eclipse.cpp";
+
+ // 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;
+ }
+
+}
diff --git a/cpp/source/org/openoffice/ide/eclipse/cpp/CppBuilder.java b/cpp/source/org/openoffice/ide/eclipse/cpp/CppBuilder.java
new file mode 100644
index 0000000..0c52e8e
--- /dev/null
+++ b/cpp/source/org/openoffice/ide/eclipse/cpp/CppBuilder.java
@@ -0,0 +1,125 @@
+package org.openoffice.ide.eclipse.cpp;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.IIncludeEntry;
+import org.eclipse.cdt.core.model.IPathEntry;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.openoffice.ide.eclipse.core.LogLevels;
+import org.openoffice.ide.eclipse.core.PluginLogger;
+import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
+import org.openoffice.ide.eclipse.core.model.ProjectsManager;
+import org.openoffice.ide.eclipse.core.model.UnoPackage;
+import org.openoffice.ide.eclipse.core.model.language.ILanguageBuilder;
+import org.openoffice.ide.eclipse.core.preferences.IOOo;
+import org.openoffice.ide.eclipse.core.preferences.ISdk;
+
+public class CppBuilder implements ILanguageBuilder {
+
+ private Language mLanguage;
+
+ /**
+ * Constructor.
+ *
+ * @param pLanguage the C++ Language object
+ */
+ public CppBuilder( Language pLanguage ) {
+ mLanguage = pLanguage;
+ }
+
+ @Override
+ public IPath createLibrary(IUnoidlProject unoProject) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void fillUnoPackage(UnoPackage unoPackage, IUnoidlProject prj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String[] getBuildEnv(IUnoidlProject unoProject) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void generateFromTypes(ISdk pSdk, IOOo pOoo, IProject pPrj,
+ File pTypesFile, File pBuildFolder, String pRootModule,
+ IProgressMonitor pMonitor) {
+
+ if (pTypesFile.exists()) {
+
+ try {
+
+ if (null != pSdk && null != pOoo) {
+
+ String[] paths = pOoo.getTypesPath();
+ String oooTypesArgs = ""; //$NON-NLS-1$
+ for (String path : paths) {
+ IPath ooTypesPath = new Path (path);
+ oooTypesArgs += " \"" + ooTypesPath.toOSString() + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ String command = "cppumaker -T\"*\"" + //$NON-NLS-1$
+ " -Gc -BUCR " + //$NON-NLS-1$
+ "-O \"" + new File( pBuildFolder, "include" ).getAbsolutePath() + "\" \"" + //$NON-NLS-1$ //$NON-NLS-2$
+ pTypesFile.getAbsolutePath() + "\" " + //$NON-NLS-1$
+ oooTypesArgs;
+
+ IUnoidlProject unoprj = ProjectsManager.getProject(pPrj.getName());
+ Process process = pSdk.runTool(unoprj,command, pMonitor);
+
+ LineNumberReader lineReader = new LineNumberReader(
+ new InputStreamReader(process.getErrorStream()));
+
+ // Only for debugging purpose
+ if (PluginLogger.isLevel(LogLevels.DEBUG)) {
+
+ String line = lineReader.readLine();
+ while (null != line) {
+ System.out.println(line);
+ line = lineReader.readLine();
+ }
+ }
+
+ process.waitFor();
+
+ // Check if the build/include dir is in the includes
+ ICProject cprj = CoreModel.getDefault().create( pPrj );
+ IPath incPath = unoprj.getBuildPath().append( "include" );
+ if ( !cprj.isOnSourceRoot( pPrj.getFolder( incPath ) ) ) {
+ try {
+ IIncludeEntry entry = CoreModel.newIncludeEntry( null, null, incPath );
+ IPathEntry[] entries = cprj.getRawPathEntries();
+ IPathEntry[] newEntries = new IPathEntry[ entries.length + 1 ];
+ System.arraycopy( entries, 0, newEntries, 0, entries.length );
+ newEntries[entries.length] = entry;
+ cprj.setRawPathEntries( newEntries, pMonitor );
+ } catch ( Exception e ) {
+ PluginLogger.warning( "Unable to add the local includes directory to the C++ project",e );
+ }
+
+ }
+ }
+ } catch (InterruptedException e) {
+ PluginLogger.error(
+ "cppumaker code generation failed", e);
+ } catch (IOException e) {
+ PluginLogger.warning(
+ "Unreadable output error");
+ }
+ }
+ }
+}
diff --git a/cpp/source/org/openoffice/ide/eclipse/cpp/CppProjectHandler.java b/cpp/source/org/openoffice/ide/eclipse/cpp/CppProjectHandler.java
new file mode 100644
index 0000000..b7866bc
--- /dev/null
+++ b/cpp/source/org/openoffice/ide/eclipse/cpp/CppProjectHandler.java
@@ -0,0 +1,123 @@
+package org.openoffice.ide.eclipse.cpp;
+
+import org.eclipse.cdt.core.CCProjectNature;
+import org.eclipse.cdt.core.CProjectNature;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.core.model.IIncludeEntry;
+import org.eclipse.cdt.core.model.IPathEntry;
+import org.eclipse.cdt.core.model.ISourceEntry;
+import org.eclipse.cdt.make.core.MakeProjectNature;
+import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigNature;
+import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.openoffice.ide.eclipse.core.PluginLogger;
+import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
+import org.openoffice.ide.eclipse.core.model.UnoFactoryData;
+import org.openoffice.ide.eclipse.core.model.language.IProjectHandler;
+import org.openoffice.ide.eclipse.core.preferences.IOOo;
+import org.openoffice.ide.eclipse.core.preferences.ISdk;
+
+public class CppProjectHandler implements IProjectHandler {
+
+ @Override
+ public void addLanguageDependencies(IUnoidlProject unoproject,
+ IProgressMonitor monitor) throws CoreException {
+
+ ISdk sdk = unoproject.getSdk();
+ ISourceEntry sourceEntry = CoreModel.newSourceEntry( unoproject.getSourcePath() );
+ IIncludeEntry includesEntry = CoreModel.newIncludeEntry( null, null,
+ sdk.getIncludePath(), true );
+ IProject prj = ResourcesPlugin.getWorkspace().getRoot().getProject( unoproject.getName() );
+ ICProject cprj = CoreModel.getDefault().create( prj );
+
+ cprj.setRawPathEntries(new IPathEntry[]{
+ sourceEntry, includesEntry }, monitor);
+ }
+
+ @Override
+ public void addOOoDependencies(IOOo ooo, IProject project) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void addProjectNature(IProject pProject) {
+ try {
+ if (!pProject.exists()) {
+ pProject.create(null);
+ PluginLogger.debug(
+ "Project created during language specific operation"); //$NON-NLS-1$
+ }
+
+ if (!pProject.isOpen()) {
+ pProject.open(null);
+ PluginLogger.debug("Project opened"); //$NON-NLS-1$
+ }
+
+ CProjectNature.addCNature(pProject, null);
+ CCProjectNature.addCCNature( pProject, null );
+ MakeProjectNature.addNature( pProject, null ) ;
+
+ PluginLogger.debug( "C++ project nature set" );
+
+ } catch (CoreException e) {
+ PluginLogger.error( "Failed to set C++ project nature" );
+ }
+ }
+
+ @Override
+ public void configureProject(UnoFactoryData data) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void createRegistrationSystem(IUnoidlProject prj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IPath getImplementationFile(String implementationName) {
+ return new Path( implementationName + ".cxx" ); //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getImplementationName(IUnoidlProject prj, String service)
+ throws Exception {
+ return service.substring( service.lastIndexOf( '.' ) + 1 ) + "Impl"; //$NON-NLS-1$
+ }
+
+ @Override
+ public String getLibraryPath(IUnoidlProject prj) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getSkeletonMakerLanguage(UnoFactoryData data)
+ throws Exception {
+ return "--cpp"; //$NON-NLS-1$
+ }
+
+ @Override
+ public void removeOOoDependencies(IOOo ooo, IProject project) {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/cpp/source/org/openoffice/ide/eclipse/cpp/CppUI.java b/cpp/source/org/openoffice/ide/eclipse/cpp/CppUI.java
new file mode 100644
index 0000000..5382985
--- /dev/null
+++ b/cpp/source/org/openoffice/ide/eclipse/cpp/CppUI.java
@@ -0,0 +1,16 @@
+package org.openoffice.ide.eclipse.cpp;
+
+import org.openoffice.ide.eclipse.core.model.UnoFactoryData;
+import org.openoffice.ide.eclipse.core.model.language.ILanguageUI;
+import org.openoffice.ide.eclipse.core.model.language.LanguageWizardPage;
+
+public class CppUI implements ILanguageUI {
+
+ /**
+ * There is no need for C++ only options: then no page.
+ */
+ @Override
+ public LanguageWizardPage getWizardPage(UnoFactoryData data) {
+ return null;
+ }
+}
diff --git a/cpp/source/org/openoffice/ide/eclipse/cpp/Language.java b/cpp/source/org/openoffice/ide/eclipse/cpp/Language.java
new file mode 100644
index 0000000..ab9be5b
--- /dev/null
+++ b/cpp/source/org/openoffice/ide/eclipse/cpp/Language.java
@@ -0,0 +1,25 @@
+package org.openoffice.ide.eclipse.cpp;
+
+import org.openoffice.ide.eclipse.core.model.language.ILanguage;
+import org.openoffice.ide.eclipse.core.model.language.ILanguageBuilder;
+import org.openoffice.ide.eclipse.core.model.language.ILanguageUI;
+import org.openoffice.ide.eclipse.core.model.language.IProjectHandler;
+
+public class Language implements ILanguage {
+
+ @Override
+ public ILanguageBuilder getLanguageBuidler() {
+ return new CppBuilder( this );
+ }
+
+ @Override
+ public ILanguageUI getLanguageUI() {
+ return new CppUI( );
+ }
+
+ @Override
+ public IProjectHandler getProjectHandler() {
+ return new CppProjectHandler( );
+ }
+
+}
More information about the ooo-build-commit
mailing list