Author: mareshkau
Date: 2010-11-16 03:06:10 -0500 (Tue, 16 Nov 2010)
New Revision: 26603
Added:
trunk/jst/plugins/org.jboss.tools.neweditor.sidebyside/src/org/
trunk/jst/plugins/org.jboss.tools.neweditor.sidebyside/src/org/jboss/
trunk/jst/plugins/org.jboss.tools.neweditor.sidebyside/src/org/jboss/tools/
trunk/jst/plugins/org.jboss.tools.neweditor.sidebyside/src/org/jboss/tools/sidebyside/
trunk/jst/plugins/org.jboss.tools.neweditor.sidebyside/src/org/jboss/tools/sidebyside/SideBySideActivator.java
trunk/jst/plugins/org.jboss.tools.neweditor.sidebyside/src/org/jboss/tools/sidebyside/handlers/
trunk/jst/plugins/org.jboss.tools.neweditor.sidebyside/src/org/jboss/tools/sidebyside/handlers/SideBySideHandler.java
Log:
fixing missed src folder for side by side editor. the right jira is
https://jira.jboss.org/browse/JBIDE-6083
Added:
trunk/jst/plugins/org.jboss.tools.neweditor.sidebyside/src/org/jboss/tools/sidebyside/SideBySideActivator.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.neweditor.sidebyside/src/org/jboss/tools/sidebyside/SideBySideActivator.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.neweditor.sidebyside/src/org/jboss/tools/sidebyside/SideBySideActivator.java 2010-11-16
08:06:10 UTC (rev 26603)
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.sidebyside;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class SideBySideActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.sidebyside";
//$NON-NLS-1$
+
+ // The shared instance
+ private static SideBySideActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public SideBySideActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static SideBySideActivator getDefault() {
+ return plugin;
+ }
+
+
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.neweditor.sidebyside/src/org/jboss/tools/sidebyside/SideBySideActivator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jst/plugins/org.jboss.tools.neweditor.sidebyside/src/org/jboss/tools/sidebyside/handlers/SideBySideHandler.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.neweditor.sidebyside/src/org/jboss/tools/sidebyside/handlers/SideBySideHandler.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.neweditor.sidebyside/src/org/jboss/tools/sidebyside/handlers/SideBySideHandler.java 2010-11-16
08:06:10 UTC (rev 26603)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.sidebyside.handlers;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.EditorSashContainer;
+import org.eclipse.ui.internal.EditorStack;
+import org.eclipse.ui.internal.ILayoutContainer;
+import org.eclipse.ui.internal.LayoutPart;
+import org.eclipse.ui.internal.PartPane;
+import org.eclipse.ui.internal.PartSashContainer;
+import org.eclipse.ui.internal.PartSite;
+import org.eclipse.ui.internal.PartStack;
+import org.eclipse.ui.internal.WorkbenchPage;
+import org.eclipse.ui.internal.handlers.NewEditorHandler;
+
+/**
+ * Handler which split active editor vertically
+ * @see
https://jira.jboss.org/browse/JBIDE-6083
+ * @author mareshkau
+ */
+public class SideBySideHandler extends NewEditorHandler {
+
+ /**
+ * the command has been executed, so extract extract the needed information
+ * from the application context.
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ super.execute(event);
+ splitEditorArea();
+ return null;
+ }
+
+ private void splitEditorArea() {
+ IWorkbenchPage workbenchPage = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
+ IWorkbenchPart part = workbenchPage.getActivePart();
+ PartPane partPane = ((PartSite) part.getSite()).getPane();
+ LayoutPart layoutPart = partPane.getPart();
+
+ // Get PartPane that correspond to the active editor
+ PartPane currentEditorPartPane = ((PartSite) workbenchPage
+ .getActiveEditor().getSite()).getPane();
+ EditorSashContainer editorSashContainer = null;
+ ILayoutContainer rootLayoutContainer = layoutPart.getContainer();
+ if (rootLayoutContainer instanceof LayoutPart) {
+ ILayoutContainer editorSashLayoutContainer = ((LayoutPart) rootLayoutContainer)
+ .getContainer();
+ if (editorSashLayoutContainer instanceof EditorSashContainer) {
+ editorSashContainer = ((EditorSashContainer) editorSashLayoutContainer);
+ }
+ }
+ /*
+ * Create a new part stack (i.e. a workbook) to home the
+ * currentEditorPartPane which hold the active editor
+ */
+ PartStack newPart = createStack(editorSashContainer);
+
+ editorSashContainer.stack(currentEditorPartPane, newPart);
+ if (rootLayoutContainer instanceof LayoutPart) {
+ ILayoutContainer cont = ((LayoutPart) rootLayoutContainer)
+ .getContainer();
+ if (cont instanceof PartSashContainer) {
+ // "Split" the editor area by adding the new part
+ ((PartSashContainer) cont).add(newPart);
+ }
+ }
+ }
+
+ /**
+ * A method to create a part stack container (a new workbook)
+ *
+ * @param editorSashContainer
+ * the <code>EditorSashContainer</code> to set for the returned
+ * <code>PartStack</code>
+ * @return a new part stack container
+ */
+ private PartStack createStack(EditorSashContainer editorSashContainer) {
+ WorkbenchPage workbenchPage = (WorkbenchPage) PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
+ EditorStack newWorkbook = EditorStack.newEditorWorkbook(
+ editorSashContainer, workbenchPage);
+ return newWorkbook;
+ }
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.neweditor.sidebyside/src/org/jboss/tools/sidebyside/handlers/SideBySideHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain