You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by ks...@apache.org on 2011/09/01 12:07:42 UTC

svn commit: r1163980 [2/2] - in /cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc: ./ .settings/ META-INF/ icons/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/cayenne/ src/main/java/org/apache/c...

Added: 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=1163980&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/launcher/EditorLauncher.java (added)
+++ cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/launcher/EditorLauncher.java Thu Sep  1 10:07:41 2011
@@ -0,0 +1,39 @@
+/*****************************************************************
+ *   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.launcher;
+
+import org.apache.cayenne.extentions.modeler.PluginMain;
+import org.eclipse.core.runtime.IPath;
+
+import org.eclipse.ui.IEditorLauncher;
+
+public class EditorLauncher implements IEditorLauncher {
+
+	@SuppressWarnings("static-access")
+	public void open(IPath file) {
+		System.out.println("Launch Successful : file Location = "
+				+ file.toString());
+
+		String[] args = new String[] { file.toString() };
+		new PluginMain(args).main(args);
+
+	}
+
+}
\ No newline at end of file

Added: 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=1163980&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/launcher/InternalEditorLauncher.java (added)
+++ cayenne/sandbox/cayenne-modeler-eclipse-plugin-gsoc/src/main/java/org/apache/cayenne/launcher/InternalEditorLauncher.java Thu Sep  1 10:07:41 2011
@@ -0,0 +1,39 @@
+package org.apache.cayenne.launcher;
+
+import java.io.File;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.ui.IEditorLauncher;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+
+public class InternalEditorLauncher implements IEditorLauncher {
+	private static Log logger = LogFactory.getLog(InternalEditorLauncher.class);
+
+	public void open(IPath file) {
+		System.out.println("Launch Successful : file Location = "
+				+ file.toString());
+		File fileToOpen = file.toFile();
+		if (fileToOpen.exists() && fileToOpen.isFile()) {
+			IFileStore fileStore = EFS.getLocalFileSystem().getStore(
+					fileToOpen.toURI());
+			IWorkbenchPage page = PlatformUI.getWorkbench()
+					.getActiveWorkbenchWindow().getActivePage();
+
+			try {
+				IDE.openInternalEditorOnFileStore(page, fileStore);
+			} catch (PartInitException e) {
+				logger.error("error while opening cayenne file");
+			}
+		}
+
+	}
+
+}