Browse files

IDE-873

  • Loading branch information...
1 parent f608596 commit 409e6b064b2d1c9946111b96a62f62485ff46faa @cinnndy9 cinnndy9 committed with gamerson Mar 27, 2013
View
1 tools/plugins/com.liferay.ide.layouttpl.ui/META-INF/MANIFEST.MF
@@ -28,6 +28,7 @@ Require-Bundle: org.eclipse.ui,
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Export-Package: com.liferay.ide.layouttpl.ui,
+ com.liferay.ide.layouttpl.ui.action,
com.liferay.ide.layouttpl.ui.cmd,
com.liferay.ide.layouttpl.ui.draw2d,
com.liferay.ide.layouttpl.ui.editor,
View
56 ....layouttpl.ui/src/com/liferay/ide/layouttpl/ui/action/LayoutTplEditorSelectAllAction.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *******************************************************************************/
+
+package com.liferay.ide.layouttpl.ui.action;
+
+import com.liferay.ide.layouttpl.ui.editor.LayoutTplEditor;
+import com.liferay.ide.layouttpl.ui.parts.PortletColumnEditPart;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.ui.actions.SelectAllAction;
+
+
+/**
+ * @author Cindy Li
+ */
+public class LayoutTplEditorSelectAllAction extends SelectAllAction
+{
+
+ private LayoutTplEditor editor;
+
+ public LayoutTplEditorSelectAllAction( LayoutTplEditor editor )
+ {
+ super( editor );
+ this.editor = editor;
+ }
+
+ @Override
+ public void run()
+ {
+ GraphicalViewer viewer = (GraphicalViewer) this.editor
+ .getAdapter(GraphicalViewer.class);
+ if( viewer != null )
+ {
+ for (Object obj : viewer.getEditPartRegistry().values())
+ {
+ if (obj instanceof PortletColumnEditPart )
+ {
+ viewer.appendSelection((EditPart)obj);
+ }
+ }
+ }
+ }
+
+}
View
13 ...com.liferay.ide.layouttpl.ui/src/com/liferay/ide/layouttpl/ui/editor/LayoutTplEditor.java
@@ -18,6 +18,7 @@
package com.liferay.ide.layouttpl.ui.editor;
import com.liferay.ide.layouttpl.ui.LayoutTplUI;
+import com.liferay.ide.layouttpl.ui.action.LayoutTplEditorSelectAllAction;
import com.liferay.ide.layouttpl.ui.gef.GraphicalEditorWithFlyoutPalette;
import com.liferay.ide.layouttpl.ui.model.LayoutTplDiagram;
import com.liferay.ide.layouttpl.ui.parts.LayoutTplEditPartFactory;
@@ -36,6 +37,7 @@
import org.eclipse.gef.palette.PaletteRoot;
import org.eclipse.gef.requests.CreationFactory;
import org.eclipse.gef.requests.SimpleFactory;
+import org.eclipse.gef.ui.actions.SelectAllAction;
import org.eclipse.gef.ui.palette.PaletteViewer;
import org.eclipse.gef.ui.palette.PaletteViewerProvider;
import org.eclipse.gef.ui.parts.GraphicalViewerImpl;
@@ -49,6 +51,7 @@
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.ide.FileStoreEditorInput;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
@@ -88,6 +91,16 @@ public void commandStackChanged( EventObject event )
}
@Override
+ protected void createActions()
+ {
+ super.createActions();
+
+ getActionRegistry().removeAction( getActionRegistry().getAction( ActionFactory.SELECT_ALL.getId() ) );
+ SelectAllAction action = new LayoutTplEditorSelectAllAction( (LayoutTplEditor) this );
+ getActionRegistry().registerAction(action);
+ }
+
+ @Override
public void dispose()
{
super.dispose();
View
2 ....layouttpl.ui/src/com/liferay/ide/layouttpl/ui/editor/LayoutTplMultiPageEditor.properties
@@ -1,2 +1,2 @@
source=Source
-visual=Visual (Experimental)
+visual=Visual
View
8 ...src/com/liferay/ide/layouttpl/ui/editor/LayoutTplMultiPageEditorActionBarContributor.java
@@ -117,6 +117,10 @@ public void setActivePage( IEditorPart activeEditor )
ActionFactory.UNDO.getId(), getLayoutEditorAction( ActionFactory.UNDO.getId() ) );
actionBars.setGlobalActionHandler(
ActionFactory.REDO.getId(), getLayoutEditorAction( ActionFactory.REDO.getId() ) );
+ actionBars.setGlobalActionHandler(
+ ActionFactory.DELETE.getId(), getLayoutEditorAction( ActionFactory.DELETE.getId() ) );
+ actionBars.setGlobalActionHandler(
+ ActionFactory.SELECT_ALL.getId(), getLayoutEditorAction( ActionFactory.SELECT_ALL.getId() ) );
}
if( layoutTplMultiPageEditor.getSelectedPage() instanceof ITextEditor )
@@ -125,6 +129,10 @@ public void setActivePage( IEditorPart activeEditor )
ActionFactory.UNDO.getId(), getTextEditorAction( ITextEditorActionConstants.UNDO ) );
actionBars.setGlobalActionHandler(
ActionFactory.REDO.getId(), getTextEditorAction( ITextEditorActionConstants.REDO ) );
+ actionBars.setGlobalActionHandler(
+ ActionFactory.DELETE.getId(), getTextEditorAction( ITextEditorActionConstants.DELETE ) );
+ actionBars.setGlobalActionHandler(
+ ActionFactory.SELECT_ALL.getId(), getTextEditorAction( ITextEditorActionConstants.SELECT_ALL ) );
}
// update menu bar and tool bar

0 comments on commit 409e6b0

Please sign in to comment.