diff options
Diffstat (limited to 'bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDComponentViewer.java')
-rw-r--r-- | bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDComponentViewer.java | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDComponentViewer.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDComponentViewer.java deleted file mode 100644 index c5aa0b2a6d..0000000000 --- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDComponentViewer.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 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.graph; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.wst.xsd.ui.internal.XSDEditor; -import org.eclipse.wst.xsd.ui.internal.graph.editparts.ComponentViewerRootEditPart; -import org.eclipse.xsd.XSDComplexTypeDefinition; -import org.eclipse.xsd.XSDConcreteComponent; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDModelGroup; -import org.eclipse.xsd.XSDModelGroupDefinition; -import org.eclipse.xsd.XSDSchema; - - -public class XSDComponentViewer extends BaseGraphicalViewer -{ - protected ComponentViewerRootEditPart componentViewerRootEditPart; - public XSDComponentViewer(XSDEditor editor, ISelectionProvider menuSelectionProvider) - { - super(editor, menuSelectionProvider); - } - - public void setInput(XSDConcreteComponent component) - { - if (isInputEnabled) - { - input = null; - - if (component instanceof XSDElementDeclaration || - component instanceof XSDSchema || - component instanceof XSDModelGroup || - component instanceof XSDModelGroupDefinition || - component instanceof XSDComplexTypeDefinition) - { - input = component; - } - - componentViewerRootEditPart.setInput(input); - if (!(input instanceof XSDSchema)) - { - editor.getGraphViewer().backButton.setEnabled(true); - } - } - } - - public void setSelection(XSDConcreteComponent component) - { - if (isSelectionEnabled) - { - //System.out.println("XSDComponentViewer.setSelection(" + component + ")"); - List editPartList = new ArrayList(); - StructuredSelection selection = new StructuredSelection(); - if (component instanceof XSDElementDeclaration || - component instanceof XSDSchema || - component instanceof XSDModelGroup || - component instanceof XSDModelGroupDefinition || - component instanceof XSDComplexTypeDefinition) - { - if (component != null) - { - EditPart editPart = getEditPart(componentViewerRootEditPart, component); - if (editPart != null) - { - // TODO ... take a look at this to figure our why a newly added component - // seems to have the wrong bounds at this point... is this a layout issue? - // As a temp hack I'm ignoring the selection of component with bounds (x, y) == (0, 0) - // Perhaps a delayed selection is required? - Rectangle bounds = ((GraphicalEditPart)editPart).getFigure().getBounds(); - if (bounds.x > 0 || bounds.y > 0) - { - editPartList.add(editPart); - } - } - } - } - setSelection(new StructuredSelection(editPartList)); - } - } - /* (non-Javadoc) - * @see org.eclipse.gef.ui.parts.AbstractEditPartViewer#hookControl() - */ - protected void hookControl() - { - super.hookControl(); - componentViewerRootEditPart = new ComponentViewerRootEditPart(); - setContents(componentViewerRootEditPart); - } - -} |