/**
* Singleton instance.
*/
- public static StructureModelManager INSTANCE = new StructureModelManager();
+ private static StructureModelManager INSTANCE = new StructureModelManager();
private boolean shouldSaveModel = true;
protected StructureModel model = new StructureModel();
private List structureListeners = new ArrayList();
public void setShouldSaveModel(boolean shouldSaveModel) {
this.shouldSaveModel = shouldSaveModel;
}
+
+ public static StructureModelManager getDefault() {
+ return INSTANCE;
+ }
}
if (batch) {
// System.err.println("XXXX batch: " + buildConfig.getFiles());
if (buildConfig.isEmacsSymMode() || buildConfig.isGenerateModelMode()) {
- bcelWorld.setModel(StructureModelManager.INSTANCE.getStructureModel());
+ bcelWorld.setModel(StructureModelManager.getDefault().getStructureModel());
// in incremental build, only get updated model?
}
performCompilation(buildConfig.getFiles());
// but always returns true
// XXX weaved not in Mik's incremental
if (buildConfig.isGenerateModelMode()) {
- StructureModelManager.INSTANCE.fireModelUpdated();
+ StructureModelManager.getDefault().fireModelUpdated();
}
return !handler.hasErrors();
} finally {
private void setupModel() {
String rootLabel = "<root>";
- StructureModel model = StructureModelManager.INSTANCE.getStructureModel();
+ StructureModel model = StructureModelManager.getDefault().getStructureModel();
ProgramElementNode.Kind kind = ProgramElementNode.Kind.FILE_JAVA;
if (buildConfig.getConfigFile() != null) {
rootLabel = buildConfig.getConfigFile().getName();
}
public void externalizeModel() {
- if (!StructureModelManager.INSTANCE.getStructureModel().isValid()) return;
+ if (!StructureModelManager.getDefault().getStructureModel().isValid()) return;
try {
//Set fileSet = StructureModelManager.INSTANCE.getStructureModel().getFileMap().entrySet();
- Set fileSet = StructureModelManager.INSTANCE.getStructureModel().getFileMapEntrySet();
+ Set fileSet = StructureModelManager.getDefault().getStructureModel().getFileMapEntrySet();
for (Iterator it = fileSet.iterator(); it.hasNext(); ) {
ProgramElementNode peNode = (ProgramElementNode)((Map.Entry)it.next()).getValue();
dumpStructureToFile(peNode);
}, messageWriter);
String err = parser.getOtherMessages(true);
assertTrue(err, null == err);
- manager.setStructureModel(StructureModelManager.INSTANCE.getStructureModel());
+ manager.setStructureModel(StructureModelManager.getDefault().getStructureModel());
MessageHandler handler = new MessageHandler();
manager.batchBuild(buildConfig, handler);
assertCompileMessagesValid(handler);