1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.panels.teststeps.support;
14
15 import java.beans.PropertyChangeListener;
16 import java.beans.PropertyChangeSupport;
17
18 import javax.swing.Action;
19
20 import com.eviware.soapui.model.ModelItem;
21 import com.eviware.soapui.model.settings.Settings;
22
23 public abstract class AbstractGroovyEditorModel implements GroovyEditorModel
24 {
25 private final String[] keywords;
26 private Action runAction;
27 private final String name;
28
29 private PropertyChangeSupport propertyChangeSupport;
30 private final ModelItem modelItem;
31
32 public AbstractGroovyEditorModel( String[] keywords, ModelItem modelItem, String name )
33 {
34 this.keywords = keywords;
35 this.modelItem = modelItem;
36 this.name = name;
37
38 runAction = createRunAction();
39
40 propertyChangeSupport = new PropertyChangeSupport( this );
41 }
42
43 public String[] getKeywords()
44 {
45 return keywords;
46 }
47
48 public Action getRunAction()
49 {
50 return runAction;
51 }
52
53 public Action createRunAction()
54 {
55 return null;
56 }
57
58 public abstract String getScript();
59
60 public ModelItem getModelItem()
61 {
62 return modelItem;
63 }
64
65 public Settings getSettings()
66 {
67 return modelItem.getSettings();
68 }
69
70 public abstract void setScript( String text );
71
72 public String getScriptName()
73 {
74 return name;
75 }
76
77 public void addPropertyChangeListener( PropertyChangeListener listener )
78 {
79 propertyChangeSupport.addPropertyChangeListener( listener );
80 }
81
82 public void removePropertyChangeListener( PropertyChangeListener listener )
83 {
84 propertyChangeSupport.removePropertyChangeListener( listener );
85 }
86
87 public void notifyPropertyChanged( String name, Object oldValue, Object newValue )
88 {
89 propertyChangeSupport.firePropertyChange( name, oldValue, newValue );
90 }
91 }