Revision 17770 branches/v10/extensions/extPublish/src/org/gvsig/publish/PublishExtension.java

View differences:

PublishExtension.java
43 43
 */
44 44
package org.gvsig.publish;
45 45

  
46
import java.util.ArrayList;
47
import java.util.Iterator;
48

  
49 46
import org.gvsig.publish.gui.publish.PublishWindow;
50
import org.gvsig.publish.serversmodel.Publication;
51 47

  
52 48
import com.iver.andami.PluginServices;
53 49
import com.iver.andami.plugins.Extension;
54 50
import com.iver.andami.ui.mdiManager.IWindow;
55 51
import com.iver.cit.gvsig.About;
56
import com.iver.cit.gvsig.ProjectExtension;
57 52
import com.iver.cit.gvsig.gui.panels.FPanelAbout;
58
import com.iver.cit.gvsig.project.Project;
59 53

  
60 54
public class PublishExtension extends Extension {
61 55
	/**
......
66 60
	 *  
67 61
	 */
68 62
	public void execute(String actionCommand) {		
69
		if (actionCommand.compareTo("ADD_RESOURCE")==0){
70

  
71
			//gets all the "ProjectPublish"		
72
			ProjectExtension projectExtension = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class);
73
			Project project = projectExtension.getProject();
74
			ArrayList allPrjPub = project.getDocumentsByType(PublicationFactory.registerName);
75

  
76
			//gets the active window
77
			PublishWindow activeWindow = (PublishWindow) PluginServices.getMDIManager().getActiveWindow();
78
			Publication active = activeWindow.getActivePublication();
79

  
80
			//gets the pubication document active
81
			Iterator i = allPrjPub.iterator();
82
			while (i.hasNext()){
83
				ProjectPublication prjPub = (ProjectPublication) i.next();
84
				if (prjPub.getPublication().equals(active)){
85
					prjPub.getAddResourceController().showWindow();
86
				}
87
			}
88

  
89
			//allPrjPub.get(0)
90
			//ProjectPublication projectPublication = project.getDocumentsByType(PublicationFactory.registerName);
91
			//AddResourceController controller = new AddResourceController();
92
			//controller.showWindow();
93
		}         		
63
//		if (actionCommand.compareTo("ADD_RESOURCE")==0){
64
//
65
//			//gets all the "ProjectPublish"		
66
//			ProjectExtension projectExtension = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class);
67
//			Project project = projectExtension.getProject();
68
//			ArrayList allPrjPub = project.getDocumentsByType(PublicationFactory.registerName);
69
//
70
//			//gets the active window
71
//			PublishWindow activeWindow = (PublishWindow) PluginServices.getMDIManager().getActiveWindow();
72
//			Publication active = activeWindow.getActivePublication();
73
//
74
//			//gets the pubication document active
75
//			Iterator i = allPrjPub.iterator();
76
//			while (i.hasNext()){
77
//				ProjectPublication prjPub = (ProjectPublication) i.next();
78
//				if (prjPub.getPublication().equals(active)){
79
//					prjPub.getAddResourceController().showWindow();
80
//				}
81
//			}
82
//
83
//		}         		
94 84
	}
95 85
	/**
96 86
	 * Registers the publication factory 

Also available in: Unified diff