diff --git a/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/actions/NewChannelAction.java b/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/actions/NewChannelAction.java index 58bdfbf..71bbc69 100644 --- a/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/actions/NewChannelAction.java +++ b/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/actions/NewChannelAction.java @@ -2,7 +2,15 @@ import java.awt.event.ActionEvent; +import javax.swing.JOptionPane; + +import algorithms.NecessityOfStoringResourceStates; +import algorithms.SelectableDataTransfers; import graphicalrefactor.editor.Editor; +import models.dataConstraintModel.ChannelGenerator; +import models.dataFlowModel.DataFlowModel; +import models.dataFlowModel.DataflowChannelGenerator; +import models.dataFlowModel.ResourceDependencyGraph; public class NewChannelAction extends AbstractEditorAction { @@ -17,7 +25,18 @@ @Override public void actionPerformed(ActionEvent e) { - + DataFlowModel model = editor.getModel(); + if(model == null) { + model = new DataFlowModel(); + editor.setModel(model); + } + String channelName = JOptionPane.showInputDialog("Channel Name:"); + if (channelName == null) return; + model.addIOChannelGenerator(new DataflowChannelGenerator(channelName)); + ResourceDependencyGraph resourceGraph = NecessityOfStoringResourceStates.doDecide(model); + ResourceDependencyGraph resourceDependecyGraph = SelectableDataTransfers.init(resourceGraph); + editor.setResourceDependencyGraph(resourceDependecyGraph); + editor.constructGraph(model, resourceDependecyGraph); } }