28
29
import javax.swing.event.ChangeEvent;
29
30
import javax.swing.event.ChangeListener;
32
import pipe.dataLayer.DataLayer;
31
33
import pipe.dataLayer.Template;
32
34
import pipe.gui.CreateGui;
33
35
import pipe.gui.Pipe;
36
import pipe.gui.graphicElements.PetriNetObject;
37
import pipe.gui.graphicElements.Place;
34
38
import pipe.gui.graphicElements.tapn.TimedPlaceComponent;
35
39
import dk.aau.cs.gui.Context;
36
40
import dk.aau.cs.gui.undo.ChangedInvariantCommand;
37
41
import dk.aau.cs.gui.undo.Command;
38
42
import dk.aau.cs.gui.undo.MakePlaceSharedCommand;
39
43
import dk.aau.cs.gui.undo.MakePlaceNewSharedCommand;
44
import dk.aau.cs.gui.undo.MakePlaceNewSharedMultiCommand;
40
45
import dk.aau.cs.gui.undo.RenameTimedPlaceCommand;
41
46
import dk.aau.cs.gui.undo.TimedPlaceMarkingEdit;
42
47
import dk.aau.cs.gui.undo.UnsharePlaceCommand;
47
52
import dk.aau.cs.model.tapn.LocalTimedPlace;
48
53
import dk.aau.cs.model.tapn.SharedPlace;
49
54
import dk.aau.cs.model.tapn.TimeInvariant;
55
import dk.aau.cs.model.tapn.TimedArcPetriNet;
50
56
import dk.aau.cs.model.tapn.TimedInhibitorArc;
51
57
import dk.aau.cs.model.tapn.TimedInputArc;
52
58
import dk.aau.cs.model.tapn.TimedOutputArc;
701
707
context.nameGenerator().updateIndices(context.activeModel(), newName);
703
709
if(makeNewShared){
704
Command command = new MakePlaceNewSharedCommand(context.activeModel(), newName, place.underlyingPlace(), place, context.tabContent());
710
Command command = new MakePlaceNewSharedCommand(context.activeModel(), newName, place.underlyingPlace(), place, context.tabContent(), false);
705
711
context.undoManager().addEdit(command);
708
714
}catch(RequireException e){
709
715
context.undoManager().undo();
710
JOptionPane.showMessageDialog(this, "A transition or place with the specified name already exists in this or another component, or the specified name is invalid.\n\nAcceptable names for transitions are defined by the regular expression:\n[a-zA-Z][_a-zA-Z0-9]*\n\nNote that \"true\" and \"false\" are reserved keywords.", "Error", JOptionPane.ERROR_MESSAGE);
716
//This is checked as a place cannot be shared if there exists a transition with the same name
717
if(context.activeModel().parentNetwork().isNameUsedForPlacesOnly(newName)) {
718
int dialogResult = JOptionPane.showConfirmDialog(this, "A place with the specified name already exists in one or more components, or the specified name is invalid.\n\nAcceptable names for places are defined by the regular expression:\n[a-zA-Z][_a-zA-Z0-9]*\n\nNote that \"true\" and \"false\" are reserved keywords. \n\nThis place name will be changed into shared one also in all other components.", "Error", JOptionPane.OK_CANCEL_OPTION);
719
if(dialogResult == JOptionPane.OK_OPTION) {
720
Command cmd = new MakePlaceNewSharedMultiCommand(context, newName, place);
722
context.undoManager().addNewEdit(cmd);
727
JOptionPane.showMessageDialog(this, "A transition with the specified name already exists in one or more components, or the specified name is invalid.\n\nAcceptable names for places are defined by the regular expression:\n[a-zA-Z][_a-zA-Z0-9]*\n\nNote that \"true\" and \"false\" are reserved keywords.", "Error", JOptionPane.OK_OPTION);