cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dkazimirc...@apache.org
Subject svn commit: r1174615 - in /cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne: ./ extensions/ extensions/modeler/ extensions/modeler/action/ extensions/modeler/bindings/ extentions/ launcher/
Date Fri, 23 Sep 2011 09:33:14 GMT
Author: dkazimirchyk
Date: Fri Sep 23 09:33:14 2011
New Revision: 1174615

URL: http://svn.apache.org/viewvc?rev=1174615&view=rev
Log:
CAY-1554 Cayenne Modeler integration with Eclipse IDE

package renaming

Added:
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginActionManager.java
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginApplication.java
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginMain.java
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginModelerController.java
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginModelerFrame.java
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginProjectController.java
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginProjectWatchdog.java
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/action/
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/action/PluginExitAction.java
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/action/PluginProjectAction.java
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/bindings/
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/bindings/PluginModelerModule.java
Removed:
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extentions/
Modified:
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/Activator.java
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/launcher/EditorLauncher.java
    cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/launcher/InternalEditorLauncher.java

Modified: cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/Activator.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/Activator.java?rev=1174615&r1=1174614&r2=1174615&view=diff
==============================================================================
--- cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/Activator.java (original)
+++ cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/Activator.java Fri Sep 23 09:33:14 2011
@@ -22,7 +22,7 @@ package org.apache.cayenne;
 import org.apache.cayenne.configuration.server.ServerModule;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
-import org.apache.cayenne.extentions.modeler.bindings.PluginModelerModule;
+import org.apache.cayenne.extensions.modeler.bindings.PluginModelerModule;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.project.CayenneProjectModule;
 import org.apache.commons.logging.Log;

Added: cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginActionManager.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginActionManager.java?rev=1174615&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginActionManager.java (added)
+++ cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginActionManager.java Fri Sep 23 09:33:14 2011
@@ -0,0 +1,66 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.extensions.modeler;
+
+import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.extensions.modeler.action.PluginExitAction;
+import org.apache.cayenne.extensions.modeler.action.PluginProjectAction;
+
+import org.apache.cayenne.modeler.Application;
+
+import org.apache.cayenne.modeler.action.DefaultActionManager;
+
+/**
+ * A <code>PluginActionManager</code> is a subclass of
+ * <code>DefaultActionManager</code> which is more specific for the
+ * <code>CayenneModeler</code> Eclipse PluginActionManager class responsible for
+ * registering and removing actions which is required by the Eclipse Integration
+ * plugin.
+ */
+public class PluginActionManager extends DefaultActionManager {
+
+	/**
+	 * Constructor of <code>PluginActionManager</code>
+	 * 
+	 * @param application
+	 *            Application Instance which is running in the form of
+	 *            PluginApplication.
+	 */
+	public PluginActionManager(@Inject Application application) {
+		super(application);
+		configureActions(application);
+	}
+
+	/**
+	 * Configurations of the DefaultActionManager class's Action Collections is
+	 * done here.
+	 * 
+	 * @param application
+	 *            Application Instance which is running in the form
+	 */
+
+	private void configureActions(Application application) {
+
+		addProjectAction(PluginProjectAction.class.getName());
+		registerAction(new PluginProjectAction(application));
+		registerAction(new PluginExitAction(application)).setAlwaysOn(true);
+
+	}
+}
\ No newline at end of file

Added: cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginApplication.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginApplication.java?rev=1174615&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginApplication.java (added)
+++ cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginApplication.java Fri Sep 23 09:33:14 2011
@@ -0,0 +1,194 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.extensions.modeler;
+
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.Window;
+
+import javax.swing.JFrame;
+import javax.swing.JRootPane;
+
+import org.apache.cayenne.extensions.modeler.PluginActionManager;
+import org.apache.cayenne.modeler.Application;
+import org.apache.cayenne.modeler.CayenneModelerController;
+import org.apache.cayenne.modeler.dialog.LogConsole;
+import org.apache.cayenne.modeler.undo.CayenneUndoManager;
+import org.apache.cayenne.modeler.util.AdapterMapping;
+import org.apache.cayenne.modeler.util.CayenneDialog;
+import org.apache.cayenne.swing.BindingFactory;
+
+import org.scopemvc.controller.basic.ViewContext;
+import org.scopemvc.controller.swing.SwingContext;
+import org.scopemvc.core.View;
+import org.scopemvc.util.UIStrings;
+import org.scopemvc.view.swing.SwingView;
+
+/**
+ * A <code>PluginApplication</code> is a subclass of <code>Application</code>
+ * which is more specific for the <code>CayenneModeler</code> Eclipse
+ * Integration.
+ */
+
+public class PluginApplication extends Application {
+	
+	protected boolean started;
+
+	/**
+	 * <code>CayenneModelerController</code> of the main application frame. In
+	 * this we are referring Eclipse Integration specific implementation of
+	 * <code>CayenneModelerController</code> which is
+	 * <code>PluginModelerController</code>
+	 */
+
+	/**
+	 * Returns Action Manager of PlugingApplication object in the form of
+	 * <code>ActionManager</code>
+	 * 
+	 * @return a <code>ActionManager</code> object that indicates the Action
+	 *         Manager of this component
+	 * @see Application#getInjector
+	 */
+	@Override
+	public PluginActionManager getActionManager() {
+		return injector.getInstance(PluginActionManager.class);
+
+	}
+
+	/**
+	 * Returns CayenneModelerController of PlugingApplication object in the form
+	 * of <code>PluginModelerController</code>
+	 * 
+	 * @return a <code>PluginModelerController</code> object that indicates the
+	 *         CayenneModelerController of this component
+	 */
+	@Override
+	public CayenneModelerController getFrameController() {
+		return frameController;
+	}
+
+	/**
+	 * Specific Implementation of startup method of <code>Application</code> for
+	 * Cayenne Eclipse Integration. Starts the PlugingApplication for
+	 * CayanneModeler.
+	 */
+	@Override
+	public void startup() {
+		if (started) {
+			return;
+		}
+		
+		initPreferences();
+		initClassLoader();
+		this.bindingFactory = new BindingFactory();
+		this.adapterMapping = new AdapterMapping();
+		UIStrings.setPropertiesName(DEFAULT_MESSAGE_BUNDLE);
+		ViewContext.clearThreadContext();
+
+		this.undoManager = new CayenneUndoManager(this);
+		// Assign Eclipse plugin specific implementation
+		this.frameController = new PluginModelerController(this);
+		ViewContext.setGlobalContext(new ModelerContext(frameController
+				.getFrame()));
+		// open up
+		frameController.startupAction();
+		LogConsole.getInstance().showConsoleIfNeeded();
+		getFrameController().getFrame().setVisible(true);
+		started = true;
+	}
+
+	final class ModelerContext extends SwingContext {
+
+		JFrame frame;
+
+		public ModelerContext(JFrame frame) {
+			this.frame = frame;
+		}
+
+		@Override
+		protected void showViewInPrimaryWindow(SwingView view) {
+		}
+
+		/**
+		 * Creates closeable dialogs.
+		 */
+		@Override
+		protected void showViewInDialog(SwingView inView) {
+			Window parentWindow = getDefaultParentWindow();
+
+			final CayenneDialog dialog;
+			if (parentWindow instanceof Dialog) {
+				dialog = new CayenneDialog((Dialog) parentWindow);
+			} else {
+				dialog = new CayenneDialog((Frame) parentWindow);
+			}
+
+			if (inView.getTitle() != null) {
+				dialog.setTitle(inView.getTitle());
+			}
+			if (inView.getDisplayMode() == SwingView.MODAL_DIALOG) {
+				dialog.setModal(true);
+			} else {
+				dialog.setModal(false);
+			}
+			dialog.setResizable(inView.isResizable());
+
+			setupWindow(dialog.getRootPane(), inView, true);
+			dialog.toFront();
+		}
+
+		/**
+		 * Overrides super implementation to allow using Scope together with
+		 * normal Swing code that CayenneModeler already has.
+		 */
+		@Override
+		public JRootPane findRootPaneFor(View view) {
+			JRootPane pane = super.findRootPaneFor(view);
+
+			if (pane != null) {
+				return pane;
+			}
+
+			if (((SwingView) view).getDisplayMode() != SwingView.PRIMARY_WINDOW) {
+				return pane;
+			}
+
+			return frame.getRootPane();
+		}
+
+		@Override
+		protected Window getDefaultParentWindow() {
+			return frame;
+		}
+	}
+	
+	public boolean isStarted() {
+		return started;
+	}
+	
+	public void setStarted(boolean started) {
+		this.started = started;
+	}
+	
+	public void toFront() {
+		getFrameController().getFrame().toFront();
+	}
+
+}
\ No newline at end of file

Added: cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginMain.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginMain.java?rev=1174615&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginMain.java (added)
+++ cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginMain.java Fri Sep 23 09:33:14 2011
@@ -0,0 +1,102 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.extensions.modeler;
+
+import java.io.File;
+
+import javax.swing.SwingUtilities;
+
+import org.apache.cayenne.Activator;
+import org.apache.cayenne.di.Injector;
+import org.apache.cayenne.modeler.Application;
+import org.apache.cayenne.modeler.Main;
+import org.apache.cayenne.modeler.action.OpenProjectAction;
+import org.apache.cayenne.modeler.init.platform.PlatformInitializer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * A <code>PluginMain</code> is a subclass of <code>Main</code> which is more
+ * specific for the <code>CayenneModeler</code> Eclipse Integration.PluginMain
+ * class responsible for starting CayenneModeler.
+ */
+public class PluginMain extends Main {
+
+	private static Log logger = LogFactory.getLog(PluginMain.class);
+
+	/**
+	 * Constructor of <code>PluginMain</code>
+	 * 
+	 * @param args
+	 *            FIle location of Cayenne Project file.
+	 * @see Main#main
+	 */
+	public PluginMain(String[] args) {
+		super(args);
+	}
+
+	/**
+	 * Main method that starts the CayenneModeler.
+	 */
+	public void start() {
+		try {
+			launch();
+		} catch (Exception e) {
+			e.printStackTrace();
+			System.exit(1);
+		}
+	}
+
+	/**
+	 * launch method that starts the CayenneModeler.
+	 */
+	@Override
+	protected void launch() {
+		logger.info("Starting CayenneModeler.");
+		logger.info("JRE v." + System.getProperty("java.version") + " at "
+				+ System.getProperty("java.home"));
+		
+		final File project = initialProjectFromArgs();
+
+		final Injector injector = Activator.getDefault().getInjector(project.getPath());
+		// init look and feel before starting any Swing classes...
+		injector.getInstance(PlatformInitializer.class).initLookAndFeel();
+
+		SwingUtilities.invokeLater(new Runnable() {
+
+			public void run() {
+				PluginApplication application = (PluginApplication) injector
+						.getInstance(Application.class);
+				PluginApplication.setInstance(application);
+
+				if (application.isStarted()) {
+					application.toFront();
+				} else {
+					application.startup();
+
+					if (project != null) {
+						new OpenProjectAction(application).openProject(project);
+					}
+				}
+			}
+		});
+
+	}
+}
\ No newline at end of file

Added: cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginModelerController.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginModelerController.java?rev=1174615&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginModelerController.java (added)
+++ cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginModelerController.java Fri Sep 23 09:33:14 2011
@@ -0,0 +1,237 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.extensions.modeler;
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.dnd.DropTarget;
+import java.awt.dnd.DropTargetAdapter;
+import java.awt.dnd.DropTargetDropEvent;
+import java.awt.event.ActionEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.swing.JOptionPane;
+import javax.swing.WindowConstants;
+import javax.swing.filechooser.FileFilter;
+
+import org.apache.cayenne.Activator;
+import org.apache.cayenne.extensions.modeler.action.PluginExitAction;
+import org.apache.cayenne.gen.ClassGenerationAction;
+import org.apache.cayenne.modeler.Application;
+import org.apache.cayenne.modeler.CayenneModelerController;
+
+import org.apache.cayenne.modeler.ModelerConstants;
+import org.apache.cayenne.modeler.action.OpenProjectAction;
+import org.apache.cayenne.modeler.dialog.codegen.CodeGeneratorController;
+import org.apache.cayenne.modeler.dialog.codegen.GeneratorTabController;
+import org.apache.cayenne.modeler.dialog.validator.ValidatorDialog;
+import org.apache.cayenne.modeler.editor.EditorView;
+import org.apache.cayenne.modeler.init.platform.PlatformInitializer;
+import org.apache.cayenne.modeler.pref.ComponentGeometry;
+import org.apache.cayenne.modeler.util.FileFilters;
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.project.Project;
+import org.apache.cayenne.project.validation.ProjectValidator;
+import org.apache.cayenne.validation.ValidationFailure;
+import org.apache.cayenne.validation.ValidationResult;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * A <code>PluginModelerController</code> is a subclass of
+ * <code>CayenneModelerController</code> which is more specific for the
+ * <code>CayenneModeler</code> Eclipse Integration.PluginMain class responsible
+ * for starting CayenneModeler. This as the Controller of the main application
+ * frame.
+ */
+public class PluginModelerController extends CayenneModelerController {
+
+	/**
+	 * Constructor of <code>PluginModelerController</code>
+	 * 
+	 * @param application
+	 *            PluginApplication object relevant to the controller.
+	 */
+	public PluginModelerController(PluginApplication application) {
+		// since super class constructor is setting application we need to set
+		// it here
+		this.application = application;
+		this.frame = new PluginModelerFrame(
+				application.getActionManager(),
+				application.getInjector());
+
+		application.getInjector().getInstance(PlatformInitializer.class)
+				.setupMenus(frame);
+		this.projectController = new PluginProjectController(this);
+
+	}
+
+	public void setFrame(PluginModelerFrame frame) {
+		this.frame = frame;
+	}
+
+	/**
+	 * In case of saving a Cayenne project from Cayenne modeler this method
+	 * execute java class Generation and Update Eclipse working space.
+	 */
+	@Override
+	public void projectSavedAction() {
+
+		DataMap dataMap = application.getFrameController()
+				.getProjectController().getCurrentDataMap();
+		if (dataMap != null) {
+
+			CodeGeneratorController codeGenerateController = new CodeGeneratorController(
+					getApplication().getFrameController(), dataMap);
+			GeneratorTabController generatorSelector = new GeneratorTabController(
+					codeGenerateController);
+
+			ClassGenerationAction generator = generatorSelector.getGenerator();
+			generator.addEmbeddables(dataMap.getEmbeddables());
+			generator.addEntities(dataMap.getObjEntities());
+
+			if (generator != null) {
+				try {
+					generator.execute();
+					JOptionPane.showMessageDialog(this.getView(),
+							"Java Classes are Successfully Updated ");
+				} catch (Exception e) {
+					JOptionPane.showMessageDialog(this.getView(),
+							"Error generating classes - " + e.getMessage());
+				}
+			}
+		}
+		// Update Eclipse workspace
+		Activator.getDefault().updateWorkspace(
+				new Path(projectController.getProject()
+						.getConfigurationResource().getURL().getPath()));
+		super.projectSavedAction();
+
+	}
+
+	@Override
+	protected void initBindings() {
+
+		frame.addWindowListener(new WindowAdapter() {
+			// PluginExit Action is set for project exit.
+			public void windowClosing(WindowEvent e) {
+				getApplication().getActionManager()
+						.getAction(PluginExitAction.class).exit();
+			}
+		});
+
+		new DropTarget(frame, new DropTargetAdapter() {
+
+			public void drop(DropTargetDropEvent dtde) {
+				dtde.acceptDrop(dtde.getDropAction());
+				Transferable transferable = dtde.getTransferable();
+				dtde.dropComplete(processDropAction(transferable));
+			}
+		});
+
+		ComponentGeometry geometry = new ComponentGeometry(frame.getClass(),
+				null);
+		geometry.bind(frame, 650, 550, 0);
+
+		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+
+	}
+
+	@SuppressWarnings({ "unchecked", "rawtypes" })
+	private boolean processDropAction(Transferable transferable) {
+		List<File> fileList;
+		try {
+			fileList = (List) transferable
+					.getTransferData(DataFlavor.javaFileListFlavor);
+		} catch (Exception e) {
+			return false;
+		}
+
+		File transferFile = fileList.get(0);
+
+		if (transferFile.isFile()) {
+
+			FileFilter filter = FileFilters.getApplicationFilter();
+
+			if (filter.accept(transferFile)) {
+				ActionEvent e = new ActionEvent(transferFile,
+						ActionEvent.ACTION_PERFORMED, "OpenProject");
+				Application.getInstance().getActionManager()
+						.getAction(OpenProjectAction.class).actionPerformed(e);
+				return true;
+			}
+		}
+
+		return false;
+	}
+
+	@Override
+	public void projectOpenedAction(Project project) {
+		projectController.setProject(project);
+		frame.setView(new EditorView(projectController));
+		projectController.projectOpened();
+		application.getActionManager().projectOpened();
+
+		// do status update AFTER the project is actually opened...
+		if (project.getConfigurationResource() == null) {
+			updateStatus("New project created...");
+			frame.setTitle(ModelerConstants.TITLE + "- [New]");
+		} else {
+			updateStatus("Project opened...");
+			frame.setTitle(ModelerConstants.TITLE + " - "
+					+ project.getConfigurationResource().getURL().getPath());
+		}
+
+		// update preferences
+		if (project.getConfigurationResource() != null) {
+			getLastDirectory().setDirectory(
+					new File(project.getConfigurationResource().getURL()
+							.getPath()));
+			frame.fireRecentFileListChanged();
+		}
+
+		// for validation purposes combine load failures with post-load
+		// validation (not
+		// sure if that'll cause duplicate messages?).
+		List<ValidationFailure> allFailures = new ArrayList<ValidationFailure>();
+		Collection<ValidationFailure> loadFailures = project
+				.getConfigurationTree().getLoadFailures();
+
+		if (!loadFailures.isEmpty()) {
+			// mark project as unsaved
+			project.setModified(true);
+			projectController.setDirty(true);
+			allFailures.addAll(loadFailures);
+		}
+
+		ProjectValidator projectValidator = getApplication().getInjector()
+				.getInstance(ProjectValidator.class);
+		ValidationResult validationResult = projectValidator.validate(project
+				.getRootNode());
+		allFailures.addAll(validationResult.getFailures());
+		if (!allFailures.isEmpty()) {
+			ValidatorDialog.showDialog(frame, validationResult.getFailures());
+		}
+	}
+}

Added: cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginModelerFrame.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginModelerFrame.java?rev=1174615&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginModelerFrame.java (added)
+++ cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginModelerFrame.java Fri Sep 23 09:33:14 2011
@@ -0,0 +1,226 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.extensions.modeler;
+
+import java.awt.BorderLayout;
+import java.awt.event.KeyEvent;
+import java.awt.event.WindowEvent;
+
+import javax.swing.Action;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+
+import org.apache.cayenne.di.Injector;
+import org.apache.cayenne.extensions.modeler.action.PluginExitAction;
+import org.apache.cayenne.extensions.modeler.action.PluginProjectAction;
+
+import org.apache.cayenne.modeler.action.ActionManager;
+import org.apache.cayenne.modeler.Application;
+import org.apache.cayenne.modeler.CayenneModelerFrame;
+import org.apache.cayenne.modeler.action.AboutAction;
+import org.apache.cayenne.modeler.action.ConfigurePreferencesAction;
+import org.apache.cayenne.modeler.action.CopyAction;
+import org.apache.cayenne.modeler.action.CreateDataMapAction;
+import org.apache.cayenne.modeler.action.CreateDbEntityAction;
+import org.apache.cayenne.modeler.action.CreateEmbeddableAction;
+import org.apache.cayenne.modeler.action.CreateNodeAction;
+import org.apache.cayenne.modeler.action.CreateObjEntityAction;
+import org.apache.cayenne.modeler.action.CreateProcedureAction;
+import org.apache.cayenne.modeler.action.CreateQueryAction;
+import org.apache.cayenne.modeler.action.CutAction;
+import org.apache.cayenne.modeler.action.DocumentationAction;
+import org.apache.cayenne.modeler.action.GenerateCodeAction;
+import org.apache.cayenne.modeler.action.GenerateDBAction;
+import org.apache.cayenne.modeler.action.ImportDBAction;
+import org.apache.cayenne.modeler.action.ImportDataMapAction;
+import org.apache.cayenne.modeler.action.ImportEOModelAction;
+import org.apache.cayenne.modeler.action.InferRelationshipsAction;
+import org.apache.cayenne.modeler.action.MigrateAction;
+import org.apache.cayenne.modeler.action.NewProjectAction;
+import org.apache.cayenne.modeler.action.ObjEntitySyncAction;
+import org.apache.cayenne.modeler.action.OpenProjectAction;
+import org.apache.cayenne.modeler.action.PasteAction;
+import org.apache.cayenne.modeler.action.ProjectAction;
+import org.apache.cayenne.modeler.action.RedoAction;
+import org.apache.cayenne.modeler.action.RemoveAction;
+import org.apache.cayenne.modeler.action.RevertAction;
+import org.apache.cayenne.modeler.action.SaveAction;
+import org.apache.cayenne.modeler.action.SaveAsAction;
+import org.apache.cayenne.modeler.action.ShowLogConsoleAction;
+import org.apache.cayenne.modeler.action.UndoAction;
+import org.apache.cayenne.modeler.action.ValidateAction;
+import org.apache.cayenne.modeler.dialog.LogConsole;
+
+/**
+ * A <code>PluginModelerFrame</code> is a subclass of
+ * <code>CayenneModelerFrame</code> which is more specific for the
+ * <code>CayenneModeler</code> Eclipse Integration.
+ */
+public class PluginModelerFrame extends CayenneModelerFrame {
+	
+	protected Injector injector;
+
+	/**
+	 * Constructor of <code>PluginModelerFrame</code>
+	 * 
+	 * @param actionManager
+	 *            ActionManager which Stores a map of modeler actions, and deals
+	 *            with those actions
+	 */
+	public PluginModelerFrame(ActionManager actionManager, Injector injector) {
+		super(actionManager);
+		
+		this.injector = injector;
+	}
+
+	/**
+	 * Menu creation Specific to the Eclipse integration project.
+	 */
+	@Override
+	protected void initMenus() {
+		getContentPane().setLayout(new BorderLayout());
+
+		JMenu fileMenu = new JMenu("File");
+		JMenu editMenu = new JMenu("Edit");
+		JMenu projectMenu = new JMenu("Project");
+		JMenu toolMenu = new JMenu("Tools");
+		JMenu helpMenu = new JMenu("Help");
+
+		fileMenu.setMnemonic(KeyEvent.VK_F);
+		editMenu.setMnemonic(KeyEvent.VK_E);
+		projectMenu.setMnemonic(KeyEvent.VK_P);
+		toolMenu.setMnemonic(KeyEvent.VK_T);
+		helpMenu.setMnemonic(KeyEvent.VK_H);
+
+		fileMenu.add(getAction(NewProjectAction.class).buildMenu());
+		fileMenu.add(getAction(OpenProjectAction.class).buildMenu());
+		
+		// Set PluginProjectAction to file menu
+		fileMenu.add(getAction(PluginProjectAction.class).buildMenu());
+		fileMenu.add(getAction(ImportDataMapAction.class).buildMenu());
+		fileMenu.addSeparator();
+		fileMenu.add(getAction(SaveAction.class).buildMenu());
+		fileMenu.add(getAction(SaveAsAction.class).buildMenu());
+		fileMenu.add(getAction(RevertAction.class).buildMenu());
+		fileMenu.addSeparator();
+
+		// Disable Unwanted Actions for Eclipse Plugin project
+		disableUnwantedMenuItems(fileMenu);
+
+		editMenu.add(getAction(UndoAction.class).buildMenu());
+		editMenu.add(getAction(RedoAction.class).buildMenu());
+		editMenu.add(getAction(CutAction.class).buildMenu());
+		editMenu.add(getAction(CopyAction.class).buildMenu());
+		editMenu.add(getAction(PasteAction.class).buildMenu());
+
+		fileMenu.add(getAction(PluginExitAction.class).buildMenu());
+
+		projectMenu.add(getAction(ValidateAction.class).buildMenu());
+		projectMenu.addSeparator();
+		projectMenu.add(getAction(CreateNodeAction.class).buildMenu());
+		projectMenu.add(getAction(CreateDataMapAction.class).buildMenu());
+
+		projectMenu.add(getAction(CreateObjEntityAction.class).buildMenu());
+		projectMenu.add(getAction(CreateEmbeddableAction.class).buildMenu());
+		projectMenu.add(getAction(CreateDbEntityAction.class).buildMenu());
+
+		projectMenu.add(getAction(CreateProcedureAction.class).buildMenu());
+		projectMenu.add(getAction(CreateQueryAction.class).buildMenu());
+
+		projectMenu.addSeparator();
+		projectMenu.add(getAction(ObjEntitySyncAction.class).buildMenu());
+		projectMenu.addSeparator();
+		projectMenu.add(getAction(RemoveAction.class).buildMenu());
+
+		toolMenu.add(getAction(ImportDBAction.class).buildMenu());
+		toolMenu.add(getAction(InferRelationshipsAction.class).buildMenu());
+		toolMenu.add(getAction(ImportEOModelAction.class).buildMenu());
+		toolMenu.addSeparator();
+		toolMenu.add(getAction(GenerateCodeAction.class).buildMenu());
+		toolMenu.add(getAction(GenerateDBAction.class).buildMenu());
+		toolMenu.add(getAction(MigrateAction.class).buildMenu());
+
+		// Menu for opening Log console
+		toolMenu.addSeparator();
+
+		logMenu = getAction(ShowLogConsoleAction.class).buildCheckBoxMenu();
+
+		if (!LogConsole.getInstance().getConsoleProperty(
+				LogConsole.DOCKED_PROPERTY)
+				&& LogConsole.getInstance().getConsoleProperty(
+						LogConsole.SHOW_CONSOLE_PROPERTY)) {
+			LogConsole.getInstance().setConsoleProperty(
+					LogConsole.SHOW_CONSOLE_PROPERTY, false);
+		}
+
+		updateLogConsoleMenu();
+		toolMenu.add(logMenu);
+
+		toolMenu.addSeparator();
+		toolMenu.add(getAction(ConfigurePreferencesAction.class).buildMenu());
+
+		helpMenu.add(getAction(AboutAction.class).buildMenu());
+		helpMenu.add(getAction(DocumentationAction.class).buildMenu());
+
+		JMenuBar menuBar = new JMenuBar();
+
+		menuBar.add(fileMenu);
+		menuBar.add(editMenu);
+		menuBar.add(projectMenu);
+		menuBar.add(toolMenu);
+		menuBar.add(helpMenu);
+
+		setJMenuBar(menuBar);
+
+	}
+
+	private <T extends Action> T getAction(Class<T> type) {
+
+		return actionManager.getAction(type);
+	}
+	
+	@Override
+	protected void processWindowEvent(WindowEvent e) {
+		super.processWindowEvent(e);
+		
+		if (e.getID() == WindowEvent.WINDOW_CLOSED) {
+			PluginApplication app = (PluginApplication)injector.getInstance(
+					Application.class);
+			app.setStarted(false);
+		}
+	}
+
+	private void disableUnwantedMenuItems(JMenu fileMenu) {
+
+		for (int i = 0; i < fileMenu.getItemCount(); i++) {
+			JMenuItem item = fileMenu.getItem(i);
+			if (item != null) {
+				String name = item.getText();
+				if (NewProjectAction.getActionName().equals(name)
+						|| OpenProjectAction.getActionName().equals(name)
+						|| ProjectAction.getActionName().equals(name)
+						|| "Recent Projects".equals(name)) {
+					item.setEnabled(false);
+				}
+			}
+		}
+	}
+}

Added: cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginProjectController.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginProjectController.java?rev=1174615&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginProjectController.java (added)
+++ cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginProjectController.java Fri Sep 23 09:33:14 2011
@@ -0,0 +1,110 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.extensions.modeler;
+
+import java.util.Collection;
+
+import org.apache.cayenne.configuration.DataChannelDescriptor;
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.map.EntityResolver;
+import org.apache.cayenne.modeler.CayenneModelerController;
+import org.apache.cayenne.modeler.ProjectController;
+import org.apache.cayenne.modeler.ProjectWatchdog;
+import org.apache.cayenne.project.Project;
+
+/**
+ * A <code>PluginProjectController</code> is a subclass of
+ * <code>ProjectController</code> which is more specific for the
+ * <code>CayenneModeler</code> Eclipse Integration.
+ */
+public class PluginProjectController extends ProjectController {
+
+	private EntityResolver entityResolver;
+	private PluginProjectWatchdog watchdog;
+
+	/**
+	 * Constructor of <code>PluginProjectController</code>
+	 * 
+	 * @param parent
+	 *            controller for the plugin application frame.
+	 */
+	public PluginProjectController(CayenneModelerController parent) {
+		super(parent);
+	}
+
+	public EntityResolver getEntityResolver() {
+		return entityResolver;
+	}
+
+	/**
+	 * returns instance of PluginProjectWatchdog class is responsible for
+	 * tracking changes in cayenne.xml and other Cayenne project files
+	 */
+	public ProjectWatchdog getProjectWatcher() {
+		return watchdog;
+	}
+
+	/**
+	 * Start PluginProjectWatchdog which is checking the changes in Cayenne
+	 * project when we modify the Cayenne related XML file from Eclipse IDE
+	 */
+	@Override
+	public void setProject(Project currentProject) {
+		if (this.project != currentProject) {
+
+			this.project = currentProject;
+			this.projectControllerPreferences = null;
+
+			if (project == null) {
+				this.entityResolver = null;
+
+				if (watchdog != null) {
+					watchdog.interrupt();
+					watchdog = null;
+				}
+			} else {
+				if (watchdog == null) {
+					watchdog = new PluginProjectWatchdog(this);
+					watchdog.start();
+				}
+
+				watchdog.reconfigure();
+
+				entityResolver = new EntityResolver(
+						((DataChannelDescriptor) currentProject.getRootNode())
+								.getDataMaps());
+
+				updateEntityResolver();
+			}
+		}
+	}
+
+	public void updateEntityResolver() {
+
+		Collection<DataMap> dataMaps = ((DataChannelDescriptor) project
+				.getRootNode()).getDataMaps();
+
+		entityResolver.setDataMaps(dataMaps);
+
+		for (DataMap dataMap : dataMaps) {
+			dataMap.setNamespace(entityResolver);
+		}
+	}
+}

Added: cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginProjectWatchdog.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginProjectWatchdog.java?rev=1174615&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginProjectWatchdog.java (added)
+++ cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/PluginProjectWatchdog.java Fri Sep 23 09:33:14 2011
@@ -0,0 +1,191 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.extensions.modeler;
+
+import java.util.List;
+import java.awt.Frame;
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.swing.JOptionPane;
+
+import org.apache.cayenne.Activator;
+import org.apache.cayenne.configuration.XMLDataMapLoader;
+import org.apache.cayenne.gen.ClassGenerationAction;
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.modeler.Application;
+import org.apache.cayenne.modeler.CayenneModelerController;
+import org.apache.cayenne.modeler.ProjectController;
+import org.apache.cayenne.modeler.ProjectWatchdog;
+import org.apache.cayenne.modeler.action.OpenProjectAction;
+import org.apache.cayenne.modeler.dialog.ErrorDebugDialog;
+import org.apache.cayenne.modeler.dialog.codegen.CodeGeneratorController;
+import org.apache.cayenne.modeler.dialog.codegen.GeneratorTabController;
+import org.apache.cayenne.project.Project;
+import org.apache.cayenne.project.ProjectLoader;
+import org.apache.cayenne.project.validation.ProjectValidator;
+import org.apache.cayenne.resource.Resource;
+import org.apache.cayenne.resource.URLResource;
+import org.apache.cayenne.validation.ValidationFailure;
+import org.apache.cayenne.validation.ValidationResult;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * A <code>PluginProjectWatchdog</code> is a subclass of
+ * <code>ProjectWatchdog</code> which is more specific for the
+ * <code>CayenneModeler</code> Eclipse Integration. ProjectWatchdog class is
+ * responsible for tracking changes in cayenne.xml and other Cayenne project
+ * files.
+ */
+public class PluginProjectWatchdog extends ProjectWatchdog {
+
+	private static Log logger = LogFactory.getLog(PluginProjectWatchdog.class);
+
+	public PluginProjectWatchdog(ProjectController mediator) {
+		super(mediator);
+	}
+
+	/**
+	 * When a external change occurs this method is executed. For eclipse plugin
+	 * we do not show confirmation window and just update the project in cayenne
+	 * modeler
+	 */
+	@Override
+	protected void doOnChange(FileInfo fileInfo) {
+		// Currently we are reloading all project on a change
+		if (mediator.getProject() != null) {
+
+			File fileDirectory = new File(mediator.getProject()
+					.getConfigurationResource().getURL().getPath());
+			Application.getInstance().getActionManager()
+					.getAction(OpenProjectAction.class)
+					.openProject(fileDirectory);
+			if (isValidExternalModifications(fileDirectory)) {
+				generateJavaClasses(fileDirectory);
+			}
+		}
+
+	}
+
+	/**
+	 * If the external modifications (from Eclipse IDE) are valid returns true
+	 * otherwise returns false.
+	 * 
+	 * @param file
+	 *            XML files related to the cayenne project.
+	 */
+	private boolean isValidExternalModifications(File file) {
+
+		try {
+			CayenneModelerController controller = Application.getInstance()
+					.getFrameController();
+			controller.addToLastProjListAction(file.getAbsolutePath());
+
+			URL url = file.toURI().toURL();
+			Resource rootSource = new URLResource(url);
+
+			Project project = Application.getInstance().getInjector()
+					.getInstance(ProjectLoader.class).loadProject(rootSource);
+
+			mediator.setProject(project);
+			List<ValidationFailure> allFailures = new ArrayList<ValidationFailure>();
+			Collection<ValidationFailure> loadFailures = project
+					.getConfigurationTree().getLoadFailures();
+
+			if (!loadFailures.isEmpty()) {
+				allFailures.addAll(loadFailures);
+			}
+
+			ProjectValidator projectValidator = Application.getInstance()
+					.getInjector().getInstance(ProjectValidator.class);
+			ValidationResult validationResult = projectValidator
+					.validate(project.getRootNode());
+			allFailures.addAll(validationResult.getFailures());
+
+			if (!allFailures.isEmpty()) {
+				logger.error("Exernal Modification of Cayenne Project are invalid.");
+				return false;
+			} else {
+				logger.info("Re Generated the java classes acoording to the modifications.");
+				return true;
+			}
+
+		} catch (Exception e) {
+			logger.warn("Error loading project file.", e);
+			ErrorDebugDialog.guiWarning(e, "Error loading project");
+			return false;
+		}
+
+	}
+
+	/**
+	 * Re generate the java classes according to the changes in XML
+	 * files.(Modification are done through the Eclipse IDE). If the
+	 * modifications are invalid we are not re generating java classes and shows
+	 * a proper error window.
+	 */
+	private void generateJavaClasses(File file) {
+
+		XMLDataMapLoader datamapLoader = new XMLDataMapLoader();
+		DataMap dataMap = null;
+		try {
+			dataMap = datamapLoader.load(mediator.getProject()
+					.getConfigurationResource());
+			JOptionPane.showMessageDialog(new Frame(), "THIS IS FOR TESTING..."
+					+ dataMap.getLocation());
+
+		} catch (Exception e) {
+			logger.warn("Error loading project file.", e);
+		}
+
+		if (dataMap != null) {
+
+			CodeGeneratorController codeGenerateController = new CodeGeneratorController(
+					Application.getInstance().getFrameController(), dataMap);
+			GeneratorTabController generatorSelector = new GeneratorTabController(
+					codeGenerateController);
+
+			ClassGenerationAction generator = generatorSelector.getGenerator();
+			generator.addEmbeddables(dataMap.getEmbeddables());
+			generator.addEntities(dataMap.getObjEntities());
+
+			if (generator != null) {
+				try {
+					generator.execute();
+					JOptionPane.showMessageDialog(Application.getInstance()
+							.getFrameController().getView(),
+							"Java Classes are Sucessfuly Updated ");
+				} catch (Exception e) {
+					JOptionPane.showMessageDialog(Application.getInstance()
+							.getFrameController().getView(),
+							"Error generating classes - " + e.getMessage());
+				}
+			}
+		}
+		// Update Eclipse workspace
+		Activator.getDefault().updateWorkspace(
+				new Path(mediator.getProject().getConfigurationResource()
+						.getURL().getPath()));
+	}
+}

Added: cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/action/PluginExitAction.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/action/PluginExitAction.java?rev=1174615&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/action/PluginExitAction.java (added)
+++ cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/action/PluginExitAction.java Fri Sep 23 09:33:14 2011
@@ -0,0 +1,70 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.extensions.modeler.action;
+
+import java.awt.event.ActionEvent;
+
+import org.apache.cayenne.modeler.Application;
+import org.apache.cayenne.modeler.action.ExitAction;
+import org.apache.cayenne.modeler.dialog.LogConsole;
+import org.apache.cayenne.pref.RenamedPreferences;
+
+/**
+ * A <code>PluginExitAction</code> is a subclass of <code>ExitAction</code>
+ * which is more specific for the <code>CayenneModeler</code> Eclipse
+ * Integration.
+ */
+public class PluginExitAction extends ExitAction {
+
+	/**
+	 * Constructor for PluginExitAction.
+	 * 
+	 * @param application
+	 *            PluginApplication object which is running relevant to the
+	 *            PluginExitAction
+	 */
+	public PluginExitAction(Application application) {
+		super(application);
+
+	}
+
+	@Override
+	public void performAction(ActionEvent e) {
+		this.exit();
+	}
+
+	/**
+	 * This method is executed when we close a project.
+	 */
+	@Override
+	public void exit() {
+		System.out.println("Shuting Down Cayenne Modeler");
+
+		if (!checkSaveOnClose()) {
+			return;
+		}
+
+		LogConsole.getInstance().stopLogging();
+		RenamedPreferences.removeNewPreferences();
+
+		application.getFrameController().getView().setVisible(false);
+		closeProject(false);
+	}
+}
\ No newline at end of file

Added: cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/action/PluginProjectAction.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/action/PluginProjectAction.java?rev=1174615&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/action/PluginProjectAction.java (added)
+++ cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/action/PluginProjectAction.java Fri Sep 23 09:33:14 2011
@@ -0,0 +1,49 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.extensions.modeler.action;
+
+import java.awt.event.ActionEvent;
+import org.apache.cayenne.modeler.Application;
+import org.apache.cayenne.modeler.action.ProjectAction;
+
+/**
+ * A <code>PluginProjectAction</code> is a subclass of
+ * <code>ProjectAction</code> which is more specific for the
+ * <code>CayenneModeler</code> Eclipse Integration.
+ */
+public class PluginProjectAction extends ProjectAction {
+
+	/**
+	 * Constructor for PluginExitAction.
+	 * 
+	 * @param application
+	 *            PluginApplication object which is running relevant to the
+	 *            PluginProjectAction
+	 */
+	public PluginProjectAction(Application application) {
+		super(application);
+	}
+
+	@Override
+	public void performAction(ActionEvent e) {
+		super.performAction(e);
+		Application.getInstance().getFrameController().getWindow().dispose();
+	}
+
+}
\ No newline at end of file

Added: cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/bindings/PluginModelerModule.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/bindings/PluginModelerModule.java?rev=1174615&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/bindings/PluginModelerModule.java (added)
+++ cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/extensions/modeler/bindings/PluginModelerModule.java Fri Sep 23 09:33:14 2011
@@ -0,0 +1,53 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.extensions.modeler.bindings;
+
+import org.apache.cayenne.di.Binder;
+import org.apache.cayenne.extensions.modeler.PluginActionManager;
+import org.apache.cayenne.extensions.modeler.PluginApplication;
+import org.apache.cayenne.modeler.Application;
+import org.apache.cayenne.modeler.action.ActionManager;
+import org.apache.cayenne.modeler.init.CayenneModelerModule;
+import org.apache.cayenne.modeler.init.platform.GenericPlatformInitializer;
+import org.apache.cayenne.modeler.init.platform.PlatformInitializer;
+import org.apache.cayenne.modeler.util.DefaultWidgetFactory;
+import org.apache.cayenne.modeler.util.WidgetFactory;
+import org.apache.cayenne.project.validation.DefaultProjectValidator;
+import org.apache.cayenne.project.validation.ProjectValidator;
+
+/**
+ * A DI module for bootstrapping CayenneModeler services.
+ */
+public class PluginModelerModule extends CayenneModelerModule {
+
+	/**
+	 * Bind plugin specific Classes. So Those instances can be obtained from the
+	 * Injector.
+	 */
+	public void configure(Binder binder) {
+		binder.bind(PluginActionManager.class).to(PluginActionManager.class);
+		binder.bind(ActionManager.class).to(PluginActionManager.class);
+		binder.bind(Application.class).to(PluginApplication.class);
+		binder.bind(PlatformInitializer.class).to(
+				GenericPlatformInitializer.class);
+		binder.bind(WidgetFactory.class).to(DefaultWidgetFactory.class);
+		binder.bind(ProjectValidator.class).to(DefaultProjectValidator.class);
+	}
+}

Modified: cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/launcher/EditorLauncher.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/launcher/EditorLauncher.java?rev=1174615&r1=1174614&r2=1174615&view=diff
==============================================================================
--- cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/launcher/EditorLauncher.java (original)
+++ cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/launcher/EditorLauncher.java Fri Sep 23 09:33:14 2011
@@ -19,7 +19,7 @@
 
 package org.apache.cayenne.launcher;
 
-import org.apache.cayenne.extentions.modeler.PluginMain;
+import org.apache.cayenne.extensions.modeler.PluginMain;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.eclipse.core.runtime.IPath;

Modified: cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/launcher/InternalEditorLauncher.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/launcher/InternalEditorLauncher.java?rev=1174615&r1=1174614&r2=1174615&view=diff
==============================================================================
--- cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/launcher/InternalEditorLauncher.java (original)
+++ cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/launcher/InternalEditorLauncher.java Fri Sep 23 09:33:14 2011
@@ -5,7 +5,7 @@ import java.io.FilenameFilter;
 
 import javax.xml.parsers.DocumentBuilderFactory;
 
-import org.apache.cayenne.extentions.modeler.PluginMain;
+import org.apache.cayenne.extensions.modeler.PluginMain;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.eclipse.core.runtime.IPath;



Mime
View raw message