Commit 65bc4af0 authored by Dominique Marcadet's avatar Dominique Marcadet

Merge branch '26-console-must-not-be-kept-as-attribute' into 'master'

Resolve "console must not be kept as attribute"

Closes #26

See merge request RiseClipseGroup/RiseClipseMain!26
parents 78b35783 9a30057d
......@@ -21,6 +21,8 @@ package fr.centralesupelec.edf.riseclipse.util;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNull;
/**
* Base class for RiseClipse consoles.
* It implements the Singleton design pattern, handle the level of messages
......@@ -67,7 +69,8 @@ public abstract class AbstractRiseClipseConsole implements IRiseClipseConsole {
*
* @return The unique instance of AbstractRiseClipseConsole
*/
public static synchronized IRiseClipseConsole getConsole() {
@SuppressWarnings( "null" )
public static synchronized @NonNull IRiseClipseConsole getConsole() {
if( console == null ) {
console = new TextRiseClipseConsole();
}
......
......@@ -35,18 +35,10 @@ import fr.centralesupelec.edf.riseclipse.util.IRiseClipseConsole;
public abstract class AbstractRiseClipseModelLoader {
protected IRiseClipseResourceSet resourceSet;
protected IRiseClipseConsole console;
protected AbstractRiseClipseModelLoader( IRiseClipseConsole console ) {
this.console = console;
// reset();
protected AbstractRiseClipseModelLoader() {
}
// public void reset() {
// this.resourceSet = new AbstractRiseClipseResourceSet( true, console );
// }
public void reset( IRiseClipseResourceSet resourceSet ) {
this.resourceSet = resourceSet;
}
......@@ -55,7 +47,7 @@ public abstract class AbstractRiseClipseModelLoader {
return resourceSet;
}
public Resource load( String name ) {
public Resource load( String name, IRiseClipseConsole console ) {
console.verbose( "Loading file " + name + " in RiseClipse" );
int currentSize = resourceSet.getResources().size();
......@@ -134,7 +126,7 @@ public abstract class AbstractRiseClipseModelLoader {
return null;
}
public void finalizeLoad() {
public void finalizeLoad( IRiseClipseConsole console ) {
resourceSet.finalizeLoad( console );
}
......
......@@ -36,7 +36,6 @@ import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
*/
public abstract class AbstractRiseClipseResourceSet extends ResourceSetImpl implements IRiseClipseResourceSet {
protected IRiseClipseConsole console;
// If true, only IRiseClipseResource can be added
protected boolean strictContent;
......@@ -53,8 +52,7 @@ public abstract class AbstractRiseClipseResourceSet extends ResourceSetImpl impl
// a getResource().
private boolean callFinalizeLoadAfterGetResource;
public AbstractRiseClipseResourceSet( boolean strictContent, IRiseClipseConsole console ) {
this.console = console;
public AbstractRiseClipseResourceSet( boolean strictContent ) {
this.strictContent = strictContent;
this.callFinalizeLoadAfterGetResource = false;
}
......@@ -95,7 +93,7 @@ public abstract class AbstractRiseClipseResourceSet extends ResourceSetImpl impl
Resource res = super.getResource( uri, loadOnDemand );
if( callFinalizeLoadAfterGetResource && ( res instanceof IRiseClipseResource )) {
finalizeLoad( console );
finalizeLoad( AbstractRiseClipseConsole.getConsole() );
}
return res;
}
......
......@@ -20,6 +20,6 @@ package fr.centralesupelec.edf.riseclipse.util;
public interface IRiseClipseResourceSetFactory {
public IRiseClipseResourceSet createResourceSet( boolean strictContent, IRiseClipseConsole console );
public IRiseClipseResourceSet createResourceSet( boolean strictContent );
}
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