Commit 3114e6a0 authored by Dominique Marcadet's avatar Dominique Marcadet

Merge branch '24-utility-classes-should-be-abstract-or-interfaces' into 'master'

Resolve "Utility classes should be abstract or interfaces"

Closes #24

See merge request RiseClipseGroup/RiseClipseMain!24
parents 6bb6bd9b 96ca6657
......@@ -32,20 +32,20 @@ import org.eclipse.emf.ecore.xmi.IllegalValueException;
import fr.centralesupelec.edf.riseclipse.util.IRiseClipseConsole;
public abstract class RiseClipseModelLoader {
public abstract class AbstractRiseClipseModelLoader {
protected IRiseClipseResourceSet resourceSet;
protected IRiseClipseConsole console;
protected RiseClipseModelLoader( IRiseClipseConsole console ) {
protected AbstractRiseClipseModelLoader( IRiseClipseConsole console ) {
this.console = console;
reset();
// reset();
}
public void reset() {
this.resourceSet = new RiseClipseResourceSet( true, console );
}
// public void reset() {
// this.resourceSet = new AbstractRiseClipseResourceSet( true, console );
// }
public void reset( IRiseClipseResourceSet resourceSet ) {
this.resourceSet = resourceSet;
......@@ -94,7 +94,7 @@ public abstract class RiseClipseModelLoader {
@SuppressWarnings("unused")
Resource resource = resourceSet.getResource( resourceURI, true );
}
// This is done by RiseClipseModelLoader in the command line tool
// This is done by AbstractRiseClipseModelLoader in the command line tool
catch( RuntimeException re ) {
Throwable cause = re.getCause();
if( cause instanceof IllegalValueException ) {
......
......@@ -32,7 +32,7 @@ import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
* @author Dominique Marcadet
*
*/
public class RiseClipseResourceSet extends ResourceSetImpl implements IRiseClipseResourceSet {
public abstract class AbstractRiseClipseResourceSet extends ResourceSetImpl implements IRiseClipseResourceSet {
protected IRiseClipseConsole console;
// If true, only IRiseClipseResource can be added
......@@ -51,7 +51,7 @@ public class RiseClipseResourceSet extends ResourceSetImpl implements IRiseClips
// a getResource().
private boolean callFinalizeLoadAfterGetResource;
public RiseClipseResourceSet( boolean strictContent, IRiseClipseConsole console ) {
public AbstractRiseClipseResourceSet( boolean strictContent, IRiseClipseConsole console ) {
this.console = console;
this.strictContent = strictContent;
this.callFinalizeLoadAfterGetResource = false;
......@@ -97,7 +97,7 @@ public class RiseClipseResourceSet extends ResourceSetImpl implements IRiseClips
Resource res = super.getResource( uri, loadOnDemand );
// createResource has been called before, so check is useless
// if(( res != null ) && strictContent && ( ! ( res instanceof IRiseClipseResource ))) {
// throw new RiseClipseFatalException( "RiseClipseResourceSet.getResource(): not an IRiseClipseResource", null );
// throw new RiseClipseFatalException( "AbstractRiseClipseResourceSet.getResource(): not an IRiseClipseResource", null );
// }
if( callFinalizeLoadAfterGetResource && ( res instanceof IRiseClipseResource )) {
......@@ -113,7 +113,7 @@ public class RiseClipseResourceSet extends ResourceSetImpl implements IRiseClips
public Resource createResource( URI uri, String contentType ) {
Resource res = super.createResource( uri, contentType );
if(( res != null ) && strictContent && ( ! ( res instanceof IRiseClipseResource ))) {
throw new RiseClipseFatalException( "RiseClipseResourceSet.getResource(): not an IRiseClipseResource", null );
throw new RiseClipseFatalException( "AbstractRiseClipseResourceSet.getResource(): not an IRiseClipseResource", null );
}
return res;
}
......
......@@ -18,10 +18,8 @@
*/
package fr.centralesupelec.edf.riseclipse.util;
public class RiseClipseResourceSetFactory {
public interface IRiseClipseResourceSetFactory {
public IRiseClipseResourceSet createResourceSet( boolean strictContent, IRiseClipseConsole console ) {
return new RiseClipseResourceSet( strictContent, console );
}
public IRiseClipseResourceSet createResourceSet( boolean strictContent, IRiseClipseConsole console );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment