Revision 6644 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/project/DocumentPopupMenu.java
DocumentPopupMenu.java | ||
---|---|---|
12 | 12 |
import javax.swing.JMenuItem; |
13 | 13 |
import javax.swing.JPopupMenu; |
14 | 14 |
|
15 |
import com.iver.cit.gvsig.project.IDocumentAction;
|
|
15 |
import com.iver.cit.gvsig.project.IContextMenuAction;
|
|
16 | 16 |
import com.iver.cit.gvsig.project.ProjectElement; |
17 | 17 |
import com.iver.utiles.extensionPoints.ExtensionPoint; |
18 | 18 |
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton; |
... | ... | |
25 | 25 |
private String option; |
26 | 26 |
private ExtensionPoint extensionPoint; |
27 | 27 |
private ProjectElement[] seleteds; |
28 |
private IDocumentAction[] actions = null;
|
|
28 |
private IContextMenuAction[] actions = null;
|
|
29 | 29 |
|
30 | 30 |
|
31 | 31 |
public DocumentPopupMenu(String option,ProjectElement[] seleteds) { |
... | ... | |
43 | 43 |
} |
44 | 44 |
ArrayList actionArrayList = new ArrayList(); |
45 | 45 |
Iterator iter = this.extensionPoint.keySet().iterator(); |
46 |
IDocumentAction action;
|
|
46 |
IContextMenuAction action;
|
|
47 | 47 |
while (iter.hasNext()) { |
48 | 48 |
action = null; |
49 | 49 |
try { |
50 |
action = (IDocumentAction)this.extensionPoint.create((String)iter.next());
|
|
50 |
action = (IContextMenuAction)this.extensionPoint.create((String)iter.next());
|
|
51 | 51 |
} catch (InstantiationException e) { |
52 | 52 |
// TODO Auto-generated catch block |
53 | 53 |
e.printStackTrace(); |
... | ... | |
62 | 62 |
} |
63 | 63 |
|
64 | 64 |
} |
65 |
this.actions = (IDocumentAction[])Array.newInstance(IDocumentAction.class,actionArrayList.size());
|
|
65 |
this.actions = (IContextMenuAction[])Array.newInstance(IContextMenuAction.class,actionArrayList.size());
|
|
66 | 66 |
System.arraycopy(actionArrayList.toArray(),0,this.actions,0,actionArrayList.size()); |
67 | 67 |
|
68 | 68 |
|
... | ... | |
73 | 73 |
private void createMenuElements() { |
74 | 74 |
String group = null; |
75 | 75 |
for (int i=0;i < actions.length;i++) { |
76 |
IDocumentAction action = this.actions[i];
|
|
76 |
IContextMenuAction action = this.actions[i];
|
|
77 | 77 |
MenuItem item = new MenuItem(action.getText(),action); |
78 | 78 |
item.setEnabled(action.isEnabled(this.seleteds)); |
79 | 79 |
if (!action.getGroup().equals(group)) { |
... | ... | |
94 | 94 |
|
95 | 95 |
public class CompareAction implements Comparator{ |
96 | 96 |
public int compare(Object o1, Object o2) { |
97 |
return this.compare((IDocumentAction)o1,(IDocumentAction)o2);
|
|
97 |
return this.compare((IContextMenuAction)o1,(IContextMenuAction)o2);
|
|
98 | 98 |
} |
99 | 99 |
|
100 |
public int compare(IDocumentAction o1, IDocumentAction o2) {
|
|
100 |
public int compare(IContextMenuAction o1, IContextMenuAction o2) {
|
|
101 | 101 |
//FIXME: flata formatear los enteros!!!! |
102 | 102 |
NumberFormat formater = NumberFormat.getInstance(); |
103 | 103 |
formater.setMinimumIntegerDigits(3); |
... | ... | |
108 | 108 |
} |
109 | 109 |
|
110 | 110 |
public class MenuItem extends JMenuItem implements ActionListener{; |
111 |
private IDocumentAction action;
|
|
112 |
public MenuItem(String text,IDocumentAction documentAction) {
|
|
111 |
private IContextMenuAction action;
|
|
112 |
public MenuItem(String text,IContextMenuAction documentAction) {
|
|
113 | 113 |
super(text); |
114 | 114 |
this.action = documentAction; |
115 | 115 |
String tip = this.action.getDescription(); |
Also available in: Unified diff