01: package com.xoetrope.editor.eclipse;
02:
03: import org.eclipse.jface.action.IAction;
04: import org.eclipse.jface.viewers.ISelection;
05: import org.eclipse.ui.IWorkbenchWindowActionDelegate;
06:
07: import com.xoetrope.builder.w3c.html.XHtmlComponentFactory;
08: import com.xoetrope.carousel.builder.XEditorHtmlBuilder;
09: import net.xoetrope.editor.project.ProjectListener;
10: import net.xoetrope.editor.project.XEditorProject;
11: import net.xoetrope.editor.project.XEditorProjectManager;
12: import net.xoetrope.xui.XComponentFactory;
13: import net.xoetrope.xui.style.XStyleFactory;
14:
15: /**
16: * Check the project initialization and set default properties as needed
17: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
18: * the GNU Public License (GPL), please see license.txt for more details. If
19: * you make commercial use of this software you must purchase a commercial
20: * license from Xoetrope.</p>
21: * <p> $Revision: 1.8 $</p>
22: */
23: public class XuiProProjectCheck implements ProjectListener {
24: /**
25: * Creates a new instance of XuiProProjectCheck
26: */
27: public XuiProProjectCheck() {
28: }
29:
30: /**
31: * Check that all extra properties are configured
32: */
33: public void checkProject(XEditorProject proj) {
34: // Hashtable managerObjects = proj.getManagerObjects();
35: // if ( managerObjects.get( Constants.SERVICES ) == null )
36: // managerObjects.put( Constants.SERVICES, new XEditorProjectProperty( "services.xml" ));
37: // if ( managerObjects.get( Constants.ROUTES ) == null )
38: // managerObjects.put( Constants.ROUTES, new XEditorProjectProperty( "routes.xml" ));
39: }
40:
41: /**
42: * Notification of project initialized.
43: * @param project the editor project just initialized
44: */
45: public void projectInitialized(XEditorProject project) {
46: }
47:
48: /**
49: * Update to reflect the new project state
50: */
51: public void projectUpdated(XEditorProject proj) {
52: }
53:
54: /**
55: * A project has just been loaded
56: * @param cp the project that has just been loaded
57: */
58: public void projectLoaded(XEditorProject project) {
59: XComponentFactory.registerComponentFactory(
60: "XHtmlComponentFactory", new XHtmlComponentFactory());
61: project.getPageManager().addSecondaryLoader(
62: new XEditorHtmlBuilder(project, (XStyleFactory) project
63: .getStyleFactory()));
64: }
65:
66: public void saveProject(XEditorProject project) {
67: }
68:
69: // public void saveProject( XEditorProject project )
70: {
71: }
72:
73: public void resetProject(String moduleName, XEditorProject project) {
74: }
75:
76: /**
77: * Selection in the workbench has been changed. We can change the state of the
78: * 'real' action here if we want, but this can only happen after the delegate
79: * has been created.
80: *
81: * @see IWorkbenchWindowActionDelegate#selectionChanged
82: */
83: public void selectionChanged(IAction action, ISelection selection) {
84: action.setEnabled(XEditorProjectManager
85: .isUserRegistered("XUI Pro"));
86: }
87: }
|