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.settings.Settings;
21
22 public abstract class AbstractGroovyEditorModel implements GroovyEditorModel
23 {
24 private final String[] keywords;
25 private final Settings settings;
26 private Action runAction;
27 private final String name;
28
29 private PropertyChangeSupport propertyChangeSupport;
30
31 public AbstractGroovyEditorModel( String[] keywords, Settings settings, String name )
32 {
33 this.keywords = keywords;
34 this.settings = settings;
35 this.name = name;
36
37 runAction = createRunAction();
38
39 propertyChangeSupport = new PropertyChangeSupport( this );
40 }
41
42 public String[] getKeywords()
43 {
44 return keywords;
45 }
46
47 public Action getRunAction()
48 {
49 return runAction;
50 }
51
52 public Action createRunAction()
53 {
54 return null;
55 }
56
57 public abstract String getScript();
58
59 public Settings getSettings()
60 {
61 return settings;
62 }
63
64 public abstract void setScript( String text );
65
66 public String getScriptName()
67 {
68 return name;
69 }
70
71 public void addPropertyChangeListener( PropertyChangeListener listener )
72 {
73 propertyChangeSupport.addPropertyChangeListener( listener );
74 }
75
76 public void removePropertyChangeListener( PropertyChangeListener listener )
77 {
78 propertyChangeSupport.removePropertyChangeListener( listener );
79 }
80
81 public void notifyPropertyChanged( String name, Object oldValue, Object newValue )
82 {
83 propertyChangeSupport.firePropertyChange( name, oldValue, newValue );
84 }
85 }