Skip to content

Commit

Permalink
Diagram generation WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
pvlasov committed Aug 2, 2023
1 parent b943da2 commit 9c656f5
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 16 deletions.
2 changes: 1 addition & 1 deletion generator/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ app-action:
content:
content-text: TODO
children:
- app-action-reference: "target/action-models/test.gz#/"
- app-action-reference: "target/action-models/test.xmi#/"
- app-action:
location: ${base-uri}search.html
icon: fas fa-search
Expand Down
5 changes: 5 additions & 0 deletions generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
<artifactId>processors</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.nasdanika</groupId>
<artifactId>plantuml-diagram-generator</artifactId>
<version>2023.4.1</version>
</dependency>
</dependencies>
</project>

Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@
import org.junit.jupiter.api.Test;
import org.nasdanika.common.Context;
import org.nasdanika.common.Diagnostic;
import org.nasdanika.common.DiagramGenerator;
import org.nasdanika.common.ExecutionException;
import org.nasdanika.common.MutableContext;
import org.nasdanika.common.NasdanikaException;
import org.nasdanika.common.NullProgressMonitor;
import org.nasdanika.common.PrintStreamProgressMonitor;
import org.nasdanika.common.ProgressMonitor;
import org.nasdanika.common.Transformer;
import org.nasdanika.diagramgenerator.plantuml.PlantUMLDiagramGenerator;
import org.nasdanika.exec.ExecPackage;
import org.nasdanika.exec.content.ContentPackage;
import org.nasdanika.exec.resources.ResourcesPackage;
Expand Down Expand Up @@ -215,10 +218,11 @@ protected boolean isPassThrough(Connection connection) {
Transformer<Element,ProcessorConfig> processorConfigTransformer = new Transformer<>(configFactory);
Map<Element, ProcessorConfig> configs = processorConfigTransformer.transform(graph.values(), false, progressMonitor);

Context context = Context.EMPTY_CONTEXT;
MutableContext context = Context.EMPTY_CONTEXT.fork();
context.register(DiagramGenerator.class, new PlantUMLDiagramGenerator());
Consumer<Diagnostic> diagnosticConsumer = d -> d.dump(System.out, 0);
List<Function<URI,Action>> actionProviders = new ArrayList<>();
EcoreGenTestProcessorsFactory ecoreGenTestProcessorFactory = new EcoreGenTestProcessorsFactory();
EcoreGenTestProcessorsFactory ecoreGenTestProcessorFactory = new EcoreGenTestProcessorsFactory(context);
EcoreNodeProcessorFactory ecoreNodeProcessorFactory = new EcoreNodeProcessorFactory(
context,
(uri, pm) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@

@EClassifierNodeProcessorFactory(classifierID = TestPackage.ANIMAL)
public class AnimalProcessorsFactory {
private Context context;

private Context context = Context.EMPTY_CONTEXT; // TODO - from constructor
public AnimalProcessorsFactory(Context context) {
this.context = context;
}

/**
* Test of different ways to configure action prototype.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
@EClassifierNodeProcessorFactory(classifierID = TestPackage.COLOR)
public class ColorProcessorsFactory {

private Context context = Context.EMPTY_CONTEXT; // TODO - from constructor
private Context context;

public ColorProcessorsFactory(Context context) {
this.context = context;
}

/**
* Test of different ways to configure action prototype.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,23 @@

@EPackageNodeProcessorFactory(nsURI = TestPackage.eNS_URI)
public class EcoreGenTestProcessorsFactory {

private Context context = Context.EMPTY_CONTEXT; // TODO - from constructor

@Factory
public final AnimalProcessorsFactory animalProcessorsFactory;

@Factory
public final ColorProcessorsFactory colorProcessorsFactory;

@Factory
public final FoxProcessorsFactory foxProcessorsFactory;

private Context context = Context.EMPTY_CONTEXT; // TODO - from constructor
public EcoreGenTestProcessorsFactory(Context context) {
animalProcessorsFactory = new AnimalProcessorsFactory(context);
colorProcessorsFactory = new ColorProcessorsFactory(context);
foxProcessorsFactory = new FoxProcessorsFactory(context);
}

/**
* Test of different ways to configure action prototype.
Expand Down Expand Up @@ -65,13 +80,4 @@ protected void configureLabel(EObject eObject, Label label, ProgressMonitor prog
};
}

@Factory
public final AnimalProcessorsFactory animalProcessorsFactory = new AnimalProcessorsFactory(); // TODO - in constructor, context

@Factory
public final ColorProcessorsFactory colorProcessorsFactory = new ColorProcessorsFactory(); // TODO - in constructor, context

@Factory
public final FoxProcessorsFactory foxProcessorsFactory = new FoxProcessorsFactory(); // TODO - in constructor, context

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
@EClassifierNodeProcessorFactory(classifierID = TestPackage.FOX)
public class FoxProcessorsFactory {

private Context context = Context.EMPTY_CONTEXT; // TODO - from constructor
private Context context;

public FoxProcessorsFactory(Context context) {
this.context = context;
}

/**
* Test of different ways to configure action prototype.
Expand Down

0 comments on commit 9c656f5

Please sign in to comment.