Skip to content

Commit

Permalink
Merge pull request #74 from eMoflon/rkluge-dev
Browse files Browse the repository at this point in the history
Various improvements (gitignore, URI handling)
  • Loading branch information
RolandKluge authored Apr 10, 2018
2 parents eb2e46b + c16dfe2 commit 4d5e45d
Show file tree
Hide file tree
Showing 18 changed files with 229 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,7 @@ public void createFoldersIfNecessary(final IProject project, final IProgressMoni
* the progress monitor
*/
protected void addGitKeepFiles(final IProject project, final IProgressMonitor monitor) {
final SubMonitor subMon = SubMonitor.convert(monitor, "Creating .keep* files for Git within project " + project,
3);

WorkspaceHelper.createKeepFile(WorkspaceHelper.getSourceFolder(project), subMon.split(1));
WorkspaceHelper.createKeepFile(WorkspaceHelper.getGenFolder(project), subMon.split(1));
WorkspaceHelper.createKeepFile(WorkspaceHelper.getModelFolder(project), subMon.split(1));
// Nothing to do in this class
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion org.moflon.core.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="org.moflon.core.feature"
label="eMoflon Core Components Feature"
version="1.1.1.qualifier"
version="1.2.0.qualifier"
provider-name="eMoflon Developers"
plugin="org.moflon.core.branding">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
* @author Roland Kluge - Initial implementation
*/
public class EMoflonPreferencesStorage {
/**
* Indicates unbounded adornment size for {@link #getMaximumAdornmentSize()}
*/

/**
* Indicates unbounded adornment size for {@link #getMaximumAdornmentSize()}
*/
public static final int REACHABILITY_MAX_ADORNMENT_SIZE_INFINITY = 0;

/**
Expand All @@ -26,11 +26,6 @@ public class EMoflonPreferencesStorage {
* Default value for {@link #getReachabilityEnabled()}
*/
public static final boolean DEFAULT_REACHABILITIY_IS_ENABLED = true;

/**
* Default value for {@link #getPreferredGenModelPlatformUriType()}
*/
public static final PlatformUriType DEFAULT_PLATFORM_URI_TYPE = PlatformUriType.RESOURCE;

/**
* Stores the configured validation timeout in milliseconds. 'null' if not set.
Expand All @@ -47,11 +42,6 @@ public class EMoflonPreferencesStorage {
*/
private boolean reachabilityEnabled;

/**
* Stores the preferred {@link PlatformUriType}
*/
private PlatformUriType preferredPlatformUriType = DEFAULT_PLATFORM_URI_TYPE;

/**
* Sets the validation timeout in milliseconds
*
Expand All @@ -64,6 +54,7 @@ public void setValidationTimeout(final int validationTimeout) {

/**
* Returns the timeout for the reachability validation (in milliseconds)
*
* @return the validation timeout
*/
public int getValidationTimeout() {
Expand Down Expand Up @@ -101,32 +92,10 @@ public void setReachabilityEnabled(final boolean reachabilityEnabled) {
}

/**
* @return true if the reachability analysis shall be enabled, false
* otherwise
* @return true if the reachability analysis shall be enabled, false otherwise
* @see #setReachabilityEnabled(boolean)
*/
public boolean getReachabilityEnabled() {
return reachabilityEnabled;
}

/**
* Configures the preferred {@link PlatformUriType}
* @param preferredPlatformUriType the preferred {@link PlatformUriType}. Must not be <code>null</code>.
*/
public void setPreferredPlatformUriType(final PlatformUriType preferredPlatformUriType)
{
if (preferredPlatformUriType == null)
throw new IllegalArgumentException("Only non-null values allowed for preferred platform URI type.");

this.preferredPlatformUriType = preferredPlatformUriType;
}

/**
* Returns the {@link PlatformUriType} that shall be used by the build process to represent resources in workspace projects.
* @return the preferred URI type
*/
public PlatformUriType getPreferredGenModelPlatformUriType()
{
return this.preferredPlatformUriType;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@

/**
* Lists all types of Ecore URIs.
*
* @author Roland Kluge - Initial implementation
*/
public enum PlatformUriType {
/**
* Placeholder for platform:/resource URIs
*/
RESOURCE,
/**
* Placeholder for platform:/plugin URIs
*/
PLUGIN;
/**
* Placeholder for platform:/resource URIs
*/
RESOURCE,
/**
* Placeholder for platform:/plugin URIs
*/
PLUGIN;

/**
* The default URI type to use
*/
public static final PlatformUriType DEFAULT = PLUGIN;
}
2 changes: 1 addition & 1 deletion org.moflon.core.releng.updatesite/category.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature url="features/org.moflon.core.feature_1.1.1.qualifier.jar" id="org.moflon.core.feature" version="1.1.1.qualifier">
<feature url="features/org.moflon.core.feature_1.2.0.qualifier.jar" id="org.moflon.core.feature" version="1.2.0.qualifier">
<category name="org.moflon.core.category"/>
</feature>
<category-def name="org.moflon.core.category" label="eMoflon Core">
Expand Down
14 changes: 11 additions & 3 deletions org.moflon.core.releng.updatesite/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
2018-03-22 eMoflon 1.1.1 released
2018-04-10 eMoflon Core 1.2.0 released

Default URI type switched to platform:/reesource instead of platform:/plugin
Minor improvements:
* Default URI type switched back to platform:/plugin for backward compatibility
* Preferred URI type is now configurable via an extension point.
* More concise .gitignore files
* See also https://github.com/eMoflon/emoflon-core/issues?utf8=✓&q=is%3Aissue closed%3A2018-03-22..2018-04-10

2018-03-22 eMoflon Core 1.1.1 released

Default URI type switched to platform:/resource instead of platform:/plugin

Issue https://github.com/eMoflon/emoflon-core/issues/50

2018-03-21 eMoflon 1.1.0 released
2018-03-21 eMoflon Core 1.1.0 released

This is a minor bugfix release

Expand Down
2 changes: 1 addition & 1 deletion org.moflon.core.releng.updatesite/site.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature url="features/org.moflon.core.feature_1.1.1.qualifier.jar" id="org.moflon.core.feature" version="1.1.1.qualifier">
<feature url="features/org.moflon.core.feature_1.2.0.qualifier.jar" id="org.moflon.core.feature" version="1.2.0.qualifier">
<category name="org.moflon.core.category"/>
</feature>
<category-def name="org.moflon.core.category" label="eMoflon Core">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.moflon.core.preferences.EMoflonPreferencesStorage;
import org.moflon.core.preferences.PlatformUriType;
import org.moflon.core.propertycontainer.AdditionalDependencies;
import org.moflon.core.propertycontainer.AdditionalUsedGenPackages;
Expand Down Expand Up @@ -115,9 +114,9 @@ public List<Dependency> getGenModelResourceDependencies() {
}

/**
* Returns a platform:/ {@link URI} for the given project based on the
* corresponding preferences in {@link EMoflonPreferencesStorage}
* Returns a platform:/ {@link URI} for the given project based on the visible {@link URIPreferenceExtension}s
*
* If multiple extensions exist, the preference of one extension is taken nondeterministically.
* @param project
* the project
* @return the corresponding {@link URI}
Expand All @@ -126,7 +125,7 @@ public static URI determineProjectUriBasedOnPreferences(final IProject project)
final PlatformUriType preferredGenModelPlatformUriType = uriPreferenceExtension.stream()//
.map(URIPreferenceExtension::getPlatformURIType)//
.findAny()//
.orElse(PlatformUriType.PLUGIN);
.orElse(PlatformUriType.DEFAULT);
final URI projectURI = determineProjectUriBasedOnPlatformUriType(project, preferredGenModelPlatformUriType);
return projectURI;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
package org.moflon.emf.codegen;

import org.eclipse.emf.common.util.URI;
import org.moflon.core.preferences.PlatformUriType;

/**
* Interface that allows extensions to declare their preferred platform:/ {@link URI} type
*
* @author Anthony Anjorin - Initial implementation
* @author Roland Kluge - Docu
*/
public interface URIPreferenceExtension {

/**
* Returns the preferred platform:/ {@link URI} type to be used inside the eMoflon build process
* @return the {@link URI} type
*/
public PlatformUriType getPlatformURIType();
}
1 change: 1 addition & 0 deletions org.moflon.emf.ui/.classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="xtend-gen"/>
<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="output" path="bin"/>
Expand Down
3 changes: 2 additions & 1 deletion org.moflon.emf.ui/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.settings/
/bin
/target
/target
/xtend-gen/
6 changes: 6 additions & 0 deletions org.moflon.emf.ui/.project
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
Expand All @@ -24,5 +29,6 @@
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
10 changes: 8 additions & 2 deletions org.moflon.emf.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: IDE/UI components for EMF code generation
Bundle-SymbolicName: org.moflon.emf.ui;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 1.1.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.ui.workbench;bundle-version="3.0.0",
org.eclipse.core.runtime;bundle-version="3.0.0",
Expand All @@ -16,5 +16,11 @@ Require-Bundle: org.eclipse.ui.workbench;bundle-version="3.0.0",
org.moflon.core.utilities;bundle-version="2.0.0",
org.moflon.core.plugins;bundle-version="2.2.0",
org.moflon.core.build;bundle-version="1.0.0",
org.moflon.emf.build;bundle-version="1.0.0"
org.moflon.emf.build;bundle-version="1.0.0",
com.google.guava,
org.eclipse.xtext.xbase.lib,
org.eclipse.xtend.lib,
org.eclipse.xtend.lib.macro,
org.moflon.emf.codegen
Export-Package: org.moflon.emf.ui.wizard

3 changes: 2 additions & 1 deletion org.moflon.emf.ui/build.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
source.. = src/
source.. = src/,\
xtend-gen/
output.. = bin/
bin.includes = META-INF/,\
.,\
Expand Down
22 changes: 22 additions & 0 deletions org.moflon.emf.ui/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<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>
<groupId>org.moflon.core</groupId>
<artifactId>tycho-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>org.moflon.emf.ui</artifactId>
<packaging>eclipse-plugin</packaging>
<version>1.1.0-SNAPSHOT</version>

<build>
<plugins>
<plugin>
<groupId>org.eclipse.xtend</groupId>
<artifactId>xtend-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.moflon.emf.ui.wizard

/**
* This class provides the default content of generated Ecore files
*/
class DefaultEPackageContentGenerator {

/**
* Generates an XMI representation of the EPackage corresponding to the given
* project name
*
* @param projectName the name of the containing project
* @param packageName the name of the EPackage
* @param packageUri the NS URI of the EPackage
* @return the raw XMI file content
*/
public static def String generateDefaultEPackageForProject(String projectName, String packageName, String packageUri) {
'''
<?xml version="1.0" encoding="ASCII"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
name="«packageName»"
nsURI="«packageUri»"
nsPrefix="«projectName»">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="TODO: Add documentation for «packageName». Hint: You may copy this element in the Ecore editor to add documentation to EClasses, EOperations, ..."/>
</eAnnotations>
</ecore:EPackage>
'''
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
public class MoflonEmfProjectCreator extends MoflonProjectCreator {
private static final List<String> GITIGNORE_LINES = Arrays.asList(//
"/bin", //
"/target", //
"/gen/*", //
"!/**/.keep*");
"/gen", //
"/model/*.genmodel");

/**
* Pass-through constructor to {@link MoflonProjectCreator}
Expand Down
Loading

0 comments on commit 4d5e45d

Please sign in to comment.