diff options
Diffstat (limited to 'bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef')
8 files changed, 0 insertions, 627 deletions
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/editparts/InteractorHelper.java b/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/editparts/InteractorHelper.java deleted file mode 100644 index 4709c16b6..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/editparts/InteractorHelper.java +++ /dev/null @@ -1,99 +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.wsdl.ui.internal.gef.util.editparts; - -import java.util.Iterator; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.LayoutManager; -import org.eclipse.draw2d.MouseEvent; -import org.eclipse.draw2d.MouseListener; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -import org.eclipse.wst.wsdl.ui.internal.gef.util.figures.Interactor; -import org.eclipse.wst.xsd.ui.internal.gef.util.figures.IExpandable; - - -// hooks up an interactor with an edit part and the figure that needs to be expanded and collapsed -// -public class InteractorHelper implements MouseListener -{ - protected boolean needToPerformDefaultExpansion = true; - protected EditPart editPart; - protected Interactor interactor; - protected IExpandable expandable; - - public InteractorHelper(EditPart editPart, Interactor interactor, IExpandable expandable) - { - this.editPart = editPart; - this.interactor = interactor; - this.expandable = expandable; - interactor.addMouseListener(this); - expandable.setExpanded(interactor.isExpanded()); - } - - public void setExpanded(boolean isExpanded) - { - interactor.setExpanded(isExpanded); - interactorExpansionChanged(isExpanded); - } - - protected void interactorExpansionChanged(boolean isInteractorExpanded) - { - expandable.setExpanded(isInteractorExpanded); - expandable.setVisible(isInteractorExpanded); - - editPart.refresh(); - - EditPart root = editPart.getRoot(); - if (root instanceof AbstractGraphicalEditPart) - { - IFigure rootFigure = ((AbstractGraphicalEditPart)root).getFigure(); - invalidateAll(rootFigure); - rootFigure.validate(); - rootFigure.repaint(); - } - } - - - protected void invalidateAll(IFigure figure) - { - figure.invalidate(); - LayoutManager manager = figure.getLayoutManager(); - if (manager != null) - { - manager.invalidate(); - } - for (Iterator i = figure.getChildren().iterator(); i.hasNext(); ) - { - IFigure child = (IFigure)i.next(); - invalidateAll(child); - } - } - - - // implements MouseListener - // - public void mouseDoubleClicked(MouseEvent me) - { - } - - public void mousePressed(MouseEvent me) - { - boolean newExpansionState = !interactor.isExpanded(); - interactor.setExpanded(newExpansionState); - interactorExpansionChanged(newExpansionState); - } - - public void mouseReleased(MouseEvent me) - { - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/editparts/MultiContentPaneEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/editparts/MultiContentPaneEditPart.java deleted file mode 100644 index 115179acb..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/editparts/MultiContentPaneEditPart.java +++ /dev/null @@ -1,129 +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.wsdl.ui.internal.gef.util.editparts; - -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; - - -public abstract class MultiContentPaneEditPart extends AbstractGraphicalEditPart -{ - protected IFigure[] contentPanes; - protected int[] contentPaneIndexAdjustment; - - protected IFigure[] initContentPanes() - { - return null; - } - - protected int getContentPane(Object model) - { - return 0; - } - - protected List sortByContentPane(List list) - { - return list; - } - - - protected void setFigure(IFigure figure) - { - super.setFigure(figure); - contentPanes = initContentPanes(); - if (contentPanes != null) - { - contentPaneIndexAdjustment = new int[contentPanes.length]; - } - } - - - protected void updateContentPaneInfoIndexAdjustment(List list) - { - int index = 0; - int listSize = list.size(); - - for (int j = 0; j < contentPanes.length; j++) - { - contentPaneIndexAdjustment[j] = index; - while (index < listSize) - { - Object model = list.get(index); - if (getContentPane(model) != j) - { - break; - } - index++; - } - } - } - - - protected void refreshChildren() - { - if (contentPanes != null) - { - List sortedList = sortByContentPane(getModelChildren()); - updateContentPaneInfoIndexAdjustment(sortedList); - } - super.refreshChildren(); - } - - - protected void addChildVisual(EditPart childEditPart, int index) - { - if (contentPanes != null) - { - int j = getContentPane(childEditPart.getModel()); - if (contentPaneIndexAdjustment.length > j) - { - int adjustedIndex = index - contentPaneIndexAdjustment[j]; - if (adjustedIndex >= 0) - { - IFigure child = ((GraphicalEditPart)childEditPart).getFigure(); - contentPanes[j].add(child, adjustedIndex); - } - } - } - else - { - super.addChildVisual(childEditPart, index); - } - } - - - protected void removeChildVisual(EditPart childEditPart) - { - if (contentPanes != null) - { - int j = getContentPane(childEditPart.getModel()); - IFigure child = ((GraphicalEditPart)childEditPart).getFigure(); - contentPanes[j].remove(child); - } - else - { - super.removeChildVisual(childEditPart); - } - } - - protected void reorderChild(EditPart editpart, int index) - { - removeChildVisual(editpart); - List children = getChildren(); - children.remove(editpart); - children.add(index, editpart); - addChildVisual(editpart, index); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/editpolicies/IDirectEditPolicyDelegate.java b/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/editpolicies/IDirectEditPolicyDelegate.java deleted file mode 100644 index e2a84e899..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/editpolicies/IDirectEditPolicyDelegate.java +++ /dev/null @@ -1,18 +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.wsdl.ui.internal.gef.util.editpolicies; - -import org.eclipse.jface.viewers.CellEditor; - -public interface IDirectEditPolicyDelegate -{ - public void performEdit(CellEditor cellEditor); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/editpolicies/TextCellEditorManager.java b/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/editpolicies/TextCellEditorManager.java deleted file mode 100644 index 7bac729ac..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/editpolicies/TextCellEditorManager.java +++ /dev/null @@ -1,74 +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.wsdl.ui.internal.gef.util.editpolicies; - -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.tools.CellEditorLocator; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.TextCellEditor; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Text; - -public abstract class TextCellEditorManager extends DirectEditManager implements IDirectEditPolicyDelegate -{ - protected Label label; - - public TextCellEditorManager(GraphicalEditPart source, Label label) - { - super(source, TextCellEditor.class, new InternalCellEditorLocator(label)); - this.label = label; - } - - protected void initCellEditor() - { - String initialLabelText = label.getText(); - getCellEditor().setValue(initialLabelText); - Text text = (Text)getCellEditor().getControl(); - text.setFont(label.getFont()); - text.setForeground(label.getForegroundColor()); - text.setBackground(label.getBackgroundColor()); - text.selectAll(); - } - - protected abstract void performModify(String value); - - public static class InternalCellEditorLocator implements CellEditorLocator - { - protected Label label; - - public InternalCellEditorLocator(Label label) - { - this.label = label; - } - - public void relocate(CellEditor celleditor) - { - Text text = (Text)celleditor.getControl(); - Point sel = text.getSelection(); - Point pref = text.computeSize(-1, -1); - Rectangle rect = label.getTextBounds().getCopy(); - label.translateToAbsolute(rect); - text.setBounds(rect.x-4, rect.y-1, pref.x+1, pref.y+1); - text.setSelection(0); - text.setSelection(sel); - } - } - - // implements DirectEditPolicyDelegate - // - public void performEdit(CellEditor cellEditor) - { - performModify((String)cellEditor.getValue()); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/figures/CenterLayout.java b/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/figures/CenterLayout.java deleted file mode 100644 index f83f38572..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/figures/CenterLayout.java +++ /dev/null @@ -1,155 +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.wsdl.ui.internal.gef.util.figures; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.draw2d.AbstractLayout; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Rectangle; - - -/** - * Figures using the StackLayout as their layout manager have - * their children placed on top of one another. Order of - * placement is determined by the order in which the children - * were added, first child added placed on the bottom. - */ -public class CenterLayout extends AbstractLayout -{ - public static final int ALIGNMENT_TOP = 1; - public static final int ALIGNMENT_CENTER = 2; - public static final int ALIGNMENT_BOTTOM = 3; - - protected int spacing; - protected int verticalAlignment = ALIGNMENT_CENTER; - - public CenterLayout(){} - public CenterLayout(int spacing){ this.spacing = spacing; } - - - /** - * Calculates and returns the preferred size of the input container. - * This is the size of the largest child of the container, as all - * other children fit into this size. - * - * @param figure Container figure for which preferred size is required. - * @return The preferred size of the input figure. - */ -// protected Dimension calculatePreferredSize(IFigure figure) - protected Dimension calculatePreferredSize(IFigure figure, int width, int height) - { - Dimension d = calculatePreferredClientAreaSize(figure); -// d.expand(figure.getInsets().getWidth(), -// figure.getInsets().getHeight()); - d.expand(width, height); - d.union(getBorderPreferredSize(figure)); - return d; - } - - protected Dimension calculatePreferredClientAreaSize(IFigure figure) - { - Dimension d = new Dimension(); - List children = figure.getChildren(); - for (Iterator i = children.iterator(); i.hasNext(); ) - { - IFigure child = (IFigure)i.next(); - Dimension childSize = child.getPreferredSize(); - d.height += childSize.height; - d.width = Math.max(childSize.width, d.width); - } - int childrenSize = children.size(); - if (childrenSize > 0) - { - d.height += spacing * children.size() - 1; - } - return d; - } - - /* - * Returns the minimum size required by the input container. - * This is the size of the largest child of the container, as all - * other children fit into this size. - */ - // TODO GEF PORT - public Dimension getMinimumSize(IFigure figure, int width, int height) - { - Dimension d = new Dimension(); - List children = figure.getChildren(); - IFigure child; - for (int i=0; i < children.size(); i++) - { - child = (IFigure)children.get(i); - d.union(child.getMinimumSize()); - } - d.expand(figure.getInsets().getWidth(), figure.getInsets().getHeight()); - return d; - } - // TODO GEF PORT - public Dimension getPreferredSize(IFigure figure, int width, int height) - { - return calculatePreferredSize(figure, figure.getInsets().getWidth(), figure.getInsets().getHeight()); - } - - - public void layout(IFigure figure) - { - Rectangle r = figure.getClientArea(); - List children = figure.getChildren(); - - Dimension preferredClientAreaSize = calculatePreferredClientAreaSize(figure); - - int x = r.x + (r.width - preferredClientAreaSize.width) / 2; - int y = 0; - - switch (getVerticalAlignment()) - { - case ALIGNMENT_TOP : - { - y = r.y; - break; - } - case ALIGNMENT_CENTER : - { - y = r.y + (r.height - preferredClientAreaSize.height) / 2; - break; - } - case ALIGNMENT_BOTTOM : - { - y = r.y + (r.height - preferredClientAreaSize.height); - break; - } - } - - for (Iterator i = children.iterator(); i.hasNext(); ) - { - IFigure child = (IFigure)i.next(); - Dimension childSize = child.getPreferredSize(); - child.setBounds(new Rectangle(x, y, childSize.width, childSize.height)); - y += childSize.height + spacing; - } - } - - /** - * @param verticalAlignment The verticalAlignment to set. - */ - public void setVerticalAlignment(int verticalAlignment) - { - this.verticalAlignment = verticalAlignment; - } - - protected int getVerticalAlignment() - { - return verticalAlignment; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/figures/IGraphNodeFigure.java b/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/figures/IGraphNodeFigure.java deleted file mode 100644 index bd9d85ad9..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/figures/IGraphNodeFigure.java +++ /dev/null @@ -1,30 +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.wsdl.ui.internal.gef.util.figures; - -import java.util.List; - -import org.eclipse.draw2d.IFigure; - -public interface IGraphNodeFigure extends IFigure -{ - public static final int UP_CONNECTION = 1; - public static final int DOWN_CONNECTION = 2; - public static final int LEFT_CONNECTION = 3; - public static final int RIGHT_CONNECTION = 4; - - public IFigure getSelectionFigure(); - public IFigure getConnectionFigure(); - public List getConnectedFigures(int type); - public int getConnectionType(); - public void addConnectedFigure(IGraphNodeFigure figure); - public void removeConnectedFigure(IGraphNodeFigure figure); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/figures/Interactor.java b/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/figures/Interactor.java deleted file mode 100644 index 3e27c0379..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/figures/Interactor.java +++ /dev/null @@ -1,55 +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.wsdl.ui.internal.gef.util.figures; - -import org.eclipse.draw2d.Graphics; -import org.eclipse.draw2d.RectangleFigure; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Rectangle; - -/** - * Interactor the +/- control commonly found in trees - */ -public class Interactor extends RectangleFigure -{ - protected boolean isExpanded; - - public Interactor() - { - super(); - setPreferredSize(new Dimension(9, 9)); - } - - public void setExpanded(boolean isExpanded) - { - this.isExpanded = isExpanded; - repaint(); - } - - public boolean isExpanded() - { - return isExpanded; - } - - protected void fillShape(Graphics g) - { - super.fillShape(g); - Rectangle r = getBounds(); - int mx = r.x + r.width / 2; - int my = r.y + r.height / 2; - int s = 2; - g.drawLine(r.x + s, my, r.x + r.width - s - 1, my); - if (!isExpanded) - { - g.drawLine(mx, r.y + s, mx, r.y + r.height - s -1); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/figures/RoundedLineBorder.java b/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/figures/RoundedLineBorder.java deleted file mode 100644 index b1bfad47d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src/org/eclipse/wst/wsdl/ui/internal/gef/util/figures/RoundedLineBorder.java +++ /dev/null @@ -1,67 +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.wsdl.ui.internal.gef.util.figures; - -import org.eclipse.draw2d.Graphics; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.LineBorder; -import org.eclipse.draw2d.geometry.Insets; -import org.eclipse.swt.graphics.Color; - -public class RoundedLineBorder extends LineBorder -{ - protected int arcLength; - protected int lineStyle = Graphics.LINE_SOLID; - - public RoundedLineBorder(Color c, int width, int arcLength) - { - super(c, width); - this.arcLength = arcLength; - } - - public RoundedLineBorder(int width, int arcLength) - { - super(width); - this.arcLength = arcLength; - } - - public RoundedLineBorder(Color c, int width, int arcLength, int lineStyle) - { - super(c, width); - this.arcLength = arcLength; - this.lineStyle = lineStyle; - } - - public RoundedLineBorder(int width, int arcLength, int lineStyle) - { - super(width); - this.arcLength = arcLength; - this.lineStyle = lineStyle; - } - - public void paint(IFigure figure, Graphics graphics, Insets insets) - { - tempRect.setBounds(getPaintRectangle(figure, insets)); - int width = getWidth(); - Color color = getColor(); - if (width%2 == 1) - { - tempRect.width--; - tempRect.height--; - } - tempRect.shrink(width/2,width/2); - graphics.setLineWidth(width); - graphics.setLineStyle(lineStyle); - if (color != null) - graphics.setForegroundColor(color); - graphics.drawRoundRectangle(tempRect, arcLength, arcLength); - } -} |