[251243] [editor] Failed to execute select all
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/InternalXSDMultiPageEditor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/InternalXSDMultiPageEditor.java index 349df58..690849b 100644 --- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/InternalXSDMultiPageEditor.java +++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/InternalXSDMultiPageEditor.java
@@ -75,6 +75,7 @@ import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseDirectEditAction; import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction; import org.eclipse.wst.xsd.ui.internal.adt.actions.DeleteAction; +import org.eclipse.wst.xsd.ui.internal.adt.actions.DesignSelectAll; import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView; import org.eclipse.wst.xsd.ui.internal.adt.actions.ShowPropertiesViewAction; import org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewGraphicalViewer; @@ -623,6 +624,10 @@ action = new DeleteAction(this); action.setSelectionProvider(getSelectionManager()); registry.registerAction(action); + + action = new DesignSelectAll(this); + action.setSelectionProvider(getSelectionManager()); + registry.registerAction(action); action = new AddXSDElementAction(this, AddXSDElementAction.ID, Messages._UI_ACTION_ADD_ELEMENT, false); action.setSelectionProvider(getSelectionManager());
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDMultiPageEditorContributor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDMultiPageEditorContributor.java index 0d7cfa0..5d62af8 100644 --- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDMultiPageEditorContributor.java +++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDMultiPageEditorContributor.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. + * Copyright (c) 2001, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -139,6 +139,7 @@ actionBars.setGlobalActionHandler(GEFActionConstants.ZOOM_IN, registry.getAction(GEFActionConstants.ZOOM_IN)); actionBars.setGlobalActionHandler(GEFActionConstants.ZOOM_OUT, registry.getAction(GEFActionConstants.ZOOM_OUT)); actionBars.setGlobalActionHandler(ActionFactory.PRINT.getId(), registry.getAction(ActionFactory.PRINT.getId())); + actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), registry.getAction(ActionFactory.SELECT_ALL.getId())); zoomInRetargetAction.setEnabled(true); zoomOutRetargetAction.setEnabled(true); captureScreenAction.setEnabled(true);
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/DesignSelectAll.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/DesignSelectAll.java new file mode 100644 index 0000000..61da6b4 --- /dev/null +++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/DesignSelectAll.java
@@ -0,0 +1,75 @@ +/******************************************************************************* + * Copyright (c) 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are 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 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.xsd.ui.internal.adt.actions; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.gef.EditPart; +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gef.GraphicalViewer; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.wst.xsd.ui.internal.adt.editor.CommonMultiPageEditor; +import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages; +import org.eclipse.wst.xsd.ui.internal.design.editparts.CategoryEditPart; +import org.eclipse.wst.xsd.ui.internal.design.editparts.XSDSchemaEditPart; + +public class DesignSelectAll extends BaseSelectionAction +{ + private GraphicalViewer graphicalViewer; + private List selected; + + public DesignSelectAll(IWorkbenchPart part) + { + super(part); + setId(ActionFactory.SELECT_ALL.getId()); + setText(Messages._UI_ACTION_SELECT_ALL); + } + + public void run() + { + super.run(); + + IWorkbenchPart part = getWorkbenchPart(); + selected = new ArrayList(); + if (part instanceof CommonMultiPageEditor) + { + graphicalViewer = (GraphicalViewer) ((CommonMultiPageEditor) part).getAdapter(GraphicalViewer.class); + if (graphicalViewer != null) + { + EditPart editPart = graphicalViewer.getContents(); + doSelectChildren(editPart); + + graphicalViewer.setSelection(new StructuredSelection(selected)); + } + } + } + + private void doSelectChildren(EditPart editPart) + { + List list = editPart.getChildren(); + for (Iterator i = list.iterator(); i.hasNext();) + { + Object o = i.next(); + if (o instanceof GraphicalEditPart) + { + if (!(o instanceof XSDSchemaEditPart) && !(o instanceof CategoryEditPart)) + { + selected.add(o); + } + doSelectChildren((GraphicalEditPart) o); + } + } + } +}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/Messages.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/Messages.java index 6b49d32..fce3ae6 100644 --- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/Messages.java +++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/Messages.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. + * Copyright (c) 2001, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -34,6 +34,7 @@ public static String _UI_ACTION_UPDATE_NAME; public static String _UI_ACTION_UPDATE_TYPE; public static String _UI_ACTION_UPDATE_ELEMENT_REFERENCE; + public static String _UI_ACTION_SELECT_ALL; public static String _UI_LABEL_DESIGN; public static String _UI_LABEL_SOURCE; public static String _UI_LABEL_VIEW;
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/messages.properties b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/messages.properties index 210ec21..ab33e73 100644 --- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/messages.properties +++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/messages.properties
@@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2001, 2007 IBM Corporation and others. +# Copyright (c) 2001, 2009 IBM Corporation and others. # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at @@ -32,3 +32,4 @@ _UI_ACTION_CAPTURE_SCREEN_DEFAULT_FILE_NAME = Diagram _UI_ACTION_CAPTURE_SCREEN_FILE_SAVE_DIALOG_TITLE=Export Diagram as Image _UI_HOVER_BACK_TO_SCHEMA=Show schema index view +_UI_ACTION_SELECT_ALL=Select All