-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented a nature, builder and iapplication to create updatesites
- Loading branch information
Showing
18 changed files
with
558 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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-16"/> | ||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>org.emoflon.site.build</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.jdt.core.javanature</nature> | ||
<nature>org.eclipse.pde.PluginNature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=16 | ||
org.eclipse.jdt.core.compiler.compliance=16 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning | ||
org.eclipse.jdt.core.compiler.release=enabled | ||
org.eclipse.jdt.core.compiler.source=16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: SiteXMLBuilder | ||
Bundle-SymbolicName: org.emoflon.site.build;singleton:=true | ||
Bundle-Version: 1.0.0.qualifier | ||
Require-Bundle: org.eclipse.core.runtime, | ||
org.eclipse.core.resources, | ||
org.eclipse.pde.core;visibility:=reexport, | ||
org.eclipse.ant.core;visibility:=reexport, | ||
org.apache.ant, | ||
org.eclipse.debug.core, | ||
org.eclipse.equinox.launcher;bundle-version="1.6.400" | ||
Export-Package: org.emoflon.sitexml | ||
Bundle-ActivationPolicy: lazy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
bin.includes = META-INF/,\ | ||
build.properties,\ | ||
plugin.xml,\ | ||
src/,\ | ||
model/,\ | ||
.project,\ | ||
.classpath,\ | ||
bin/ | ||
jars.compile.order = . | ||
source.. = src/ | ||
output.. = bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<?eclipse version="3.4"?> | ||
<plugin> | ||
<extension | ||
id="org.moflon.emf.build.SiteXMLBuilderNature" | ||
point="org.eclipse.core.resources.natures"> | ||
<runtime> | ||
<run | ||
class="org.emoflon.sitexml.MoflonSiteXMLNature"> | ||
</run> | ||
</runtime> | ||
<builder | ||
id="org.moflon.emf.build.SiteXMLBuilder"> | ||
</builder> | ||
<one-of-nature | ||
id="org.moflon.emf.build.SiteXMLBuilderNature"> | ||
</one-of-nature> | ||
</extension> | ||
<extension | ||
id="org.moflon.emf.build.SiteXMLBuilder" | ||
point="org.eclipse.core.resources.builders"> | ||
<builder | ||
isConfigurable="true"> | ||
<run | ||
class="org.emoflon.sitexml.SiteXMLBuilder"> | ||
</run> | ||
</builder> | ||
</extension> | ||
<extension | ||
id="SiteXMLBuilder" | ||
point="org.eclipse.core.runtime.applications"> | ||
<application | ||
cardinality="singleton-global" | ||
thread="main" | ||
visible="true"> | ||
<run | ||
class="org.emoflon.sitexml.SiteXMLBuilderApp"> | ||
</run> | ||
</application> | ||
</extension> | ||
|
||
</plugin> |
32 changes: 32 additions & 0 deletions
32
org.emoflon.site.build/src/org/emoflon/sitexml/MoflonSiteXMLNature.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.emoflon.sitexml; | ||
|
||
import org.eclipse.core.resources.IProject; | ||
import org.eclipse.core.resources.IProjectNature; | ||
import org.eclipse.core.runtime.CoreException; | ||
|
||
public class MoflonSiteXMLNature implements IProjectNature { | ||
private IProject project; | ||
|
||
@Override | ||
public void configure() throws CoreException { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void deconfigure() throws CoreException { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public IProject getProject() { | ||
return project; | ||
} | ||
|
||
@Override | ||
public void setProject(IProject project) { | ||
this.project = project; | ||
} | ||
|
||
} |
52 changes: 52 additions & 0 deletions
52
org.emoflon.site.build/src/org/emoflon/sitexml/SiteXMLBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.emoflon.sitexml; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Map; | ||
|
||
import org.eclipse.core.resources.IFile; | ||
import org.eclipse.core.resources.IProject; | ||
import org.eclipse.core.resources.IncrementalProjectBuilder; | ||
import org.eclipse.core.runtime.CoreException; | ||
import org.eclipse.core.runtime.IProgressMonitor; | ||
import org.eclipse.core.runtime.jobs.Job; | ||
import org.eclipse.pde.internal.core.PDECore; | ||
import org.eclipse.pde.internal.core.exports.SiteBuildOperation; | ||
import org.eclipse.pde.internal.core.ifeature.IFeatureModel; | ||
import org.eclipse.pde.internal.core.isite.ISiteFeature; | ||
import org.eclipse.pde.internal.core.isite.ISiteModel; | ||
import org.eclipse.pde.internal.core.site.WorkspaceSiteModel; | ||
|
||
public class SiteXMLBuilder extends IncrementalProjectBuilder { | ||
|
||
private static final String SITEXML_ID = "org.moflon.emf.build.SiteXMLBuilder"; | ||
|
||
@Override | ||
protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor) throws CoreException { | ||
if(kind != FULL_BUILD) { | ||
return null; | ||
} | ||
IFile siteFile = getProject().getFile("site.xml"); | ||
ISiteModel buildSiteModel = new WorkspaceSiteModel(siteFile); | ||
buildSiteModel.load(); | ||
System.out.println(); | ||
ISiteFeature[] features = buildSiteModel.getSite().getFeatures(); | ||
IFeatureModel[] featureModels = getFeatureModels(features); | ||
|
||
Job job = new SiteBuildOperation(featureModels, buildSiteModel, ""); | ||
job.setUser(true); | ||
job.schedule(); | ||
return null; | ||
} | ||
|
||
|
||
private IFeatureModel[] getFeatureModels(ISiteFeature[] sFeatures) { | ||
ArrayList<IFeatureModel> list = new ArrayList<>(); | ||
for (ISiteFeature siteFeature : sFeatures) { | ||
IFeatureModel model = PDECore.getDefault().getFeatureModelManager().findFeatureModelRelaxed(siteFeature.getId(), siteFeature.getVersion()); | ||
if (model != null) | ||
list.add(model); | ||
} | ||
return list.toArray(new IFeatureModel[list.size()]); | ||
} | ||
|
||
} |
100 changes: 100 additions & 0 deletions
100
org.emoflon.site.build/src/org/emoflon/sitexml/SiteXMLBuilderApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package org.emoflon.sitexml; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Map; | ||
|
||
import org.eclipse.ant.core.AntCorePlugin; | ||
import org.eclipse.ant.internal.core.AntClassLoader; | ||
import org.eclipse.core.internal.jobs.InternalJob; | ||
import org.eclipse.core.resources.IFile; | ||
import org.eclipse.core.resources.IProject; | ||
import org.eclipse.core.resources.IWorkspace; | ||
import org.eclipse.core.resources.ResourcesPlugin; | ||
import org.eclipse.core.runtime.IProgressMonitor; | ||
import org.eclipse.core.runtime.IStatus; | ||
import org.eclipse.core.runtime.jobs.Job; | ||
import org.eclipse.debug.core.DebugPlugin; | ||
import org.eclipse.equinox.app.IApplication; | ||
import org.eclipse.equinox.app.IApplicationContext; | ||
import org.eclipse.osgi.internal.framework.EquinoxBundle; | ||
import org.eclipse.osgi.internal.framework.EquinoxContainer; | ||
import org.eclipse.osgi.internal.loader.EquinoxClassLoader; | ||
import org.eclipse.osgi.internal.url.EquinoxFactoryManager; | ||
import org.eclipse.osgi.launch.Equinox; | ||
import org.eclipse.pde.internal.core.PDECore; | ||
import org.eclipse.pde.internal.core.exports.SiteBuildOperation; | ||
import org.eclipse.pde.internal.core.ifeature.IFeatureModel; | ||
import org.eclipse.pde.internal.core.isite.ISiteFeature; | ||
import org.eclipse.pde.internal.core.isite.ISiteModel; | ||
import org.eclipse.pde.internal.core.site.WorkspaceSiteModel; | ||
|
||
public class SiteXMLBuilderApp implements IApplication { | ||
|
||
@Override | ||
public Object start(IApplicationContext context) throws Exception { | ||
String[] arguments = (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS); | ||
String projectName = getProject(arguments); | ||
|
||
if(projectName == null) { | ||
throw new RuntimeException("No project was specified!\n Entries: " + arguments); | ||
} | ||
|
||
IWorkspace workspace = ResourcesPlugin.getWorkspace(); | ||
IProject project = workspace.getRoot().getProject(projectName); | ||
if(project == null) | ||
throw new RuntimeException("Project " + projectName + " not found!"); | ||
|
||
AntClassLoader.getSystemClassLoader(); | ||
AntClassLoader.getPlatformClassLoader(); | ||
AntCorePlugin.getPlugin(); | ||
|
||
IFile siteFile = project.getFile("site.xml"); | ||
ISiteModel buildSiteModel = new WorkspaceSiteModel(siteFile); | ||
buildSiteModel.load(); | ||
System.out.println(); | ||
ISiteFeature[] features = buildSiteModel.getSite().getFeatures(); | ||
IFeatureModel[] featureModels = getFeatureModels(features); | ||
|
||
try { | ||
SiteBuildOperation job = new SiteBuildOperation(featureModels, buildSiteModel, ""); | ||
job.setUser(true); | ||
job.schedule(); | ||
job.join(); | ||
} | ||
catch(Exception e) { | ||
|
||
} | ||
|
||
return null; | ||
} | ||
|
||
private String getProject(String[] arguments) { | ||
for(int i=0; i < arguments.length; i++) { | ||
if(arguments[i].equals("-project")) { | ||
if(i+1 >= arguments.length) { | ||
throw new RuntimeException("No project was specified!"); | ||
} | ||
else { | ||
return arguments[i+1]; | ||
} | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
private IFeatureModel[] getFeatureModels(ISiteFeature[] sFeatures) { | ||
ArrayList<IFeatureModel> list = new ArrayList<>(); | ||
for (ISiteFeature siteFeature : sFeatures) { | ||
IFeatureModel model = PDECore.getDefault().getFeatureModelManager().findFeatureModelRelaxed(siteFeature.getId(), siteFeature.getVersion()); | ||
if (model != null) | ||
list.add(model); | ||
} | ||
return list.toArray(new IFeatureModel[list.size()]); | ||
} | ||
|
||
@Override | ||
public void stop() { | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>org.emoflon.site.feature</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.pde.FeatureBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.pde.FeatureNature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bin.includes = feature.xml |
Oops, something went wrong.