Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauline DEVILLE2019-04-24 11:40:09 -0400
committerPauline DEVILLE2019-04-24 11:45:42 -0400
commitcf4c2bca9e971efc40871232ae81d7e2ba5924a7 (patch)
treef62aa4b8d522c6f5a5a9f88b7be5bb0408ac65e7
parentda95734a7815c7f45d06fcd9229d7aed4274c82f (diff)
downloadorg.eclipse.papyrus-cf4c2bca9e971efc40871232ae81d7e2ba5924a7.tar.gz
org.eclipse.papyrus-cf4c2bca9e971efc40871232ae81d7e2ba5924a7.tar.xz
org.eclipse.papyrus-cf4c2bca9e971efc40871232ae81d7e2ba5924a7.zip
Bug 546686: [SashEditor] Remove internal dependencies
* Remove unused Class in eclipsecopy (no dependency in papyrus) ** InsertCaret ** DragBorder Change-Id: If92d1c2c398272788dc956ebcfb4639fabb33fbb Signed-off-by: Pauline DEVILLE <pauline.deville@cea.fr>
-rwxr-xr-xplugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/DragBorder.java152
-rwxr-xr-xplugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/InsertCaret.java165
2 files changed, 0 insertions, 317 deletions
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/DragBorder.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/DragBorder.java
deleted file mode 100755
index 9640a2ab730..00000000000
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/DragBorder.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.infra.core.sasheditor.internal.eclipsecopy;
-
-import org.eclipse.jface.util.Geometry;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.themes.ColorUtil;
-
-/**
- * Utility class that wraps a given control with a black 'border'. Moving the
- * border control will cause the given control to move to stay within its bounds.
- *
- * @since 3.2
- *
- */
-public class DragBorder {
- // Controls
- private Composite clientControl = null;
- private Control dragControl = null;
- private Canvas border = null;
-
- // Colors
- private Color baseColor;
- private Color hilightColor;
- private boolean isHighlight;
-
- /**
- * Construct a new DragBorder.
- *
- * @param client
- * The client window that the border must stay within
- * @param toDrag
- * The control to be placed 'inside' the border
- */
- public DragBorder(Composite client, Control toDrag, boolean provideFrame) {
- clientControl = client;
- dragControl = toDrag;
- Point dragSize = toDrag.getSize();
-
- // Create a control large enough to 'contain' the dragged control
- border = new Canvas(dragControl.getParent(), SWT.NONE);
- border.setSize(dragSize.x + 2, dragSize.y + 2);
-
- // Use the SWT 'title' colors since they should always have a proper contrast
- // and are 'related' (i.e. should look good together)
- baseColor = border.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION);
- RGB background = border.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB();
- RGB blended = ColorUtil.blend(baseColor.getRGB(), background);
- hilightColor = new Color(border.getDisplay(), blended);
-
- // Ensure the border is visible and the control is 'above' it...
- border.moveAbove(null);
- dragControl.moveAbove(null);
-
- if (provideFrame) {
- border.addPaintListener(e -> {
- if (isHighlight) {
- e.gc.setForeground(hilightColor);
- } else {
- e.gc.setForeground(baseColor);
- }
-
- // Draw a rectangle as our 'border'
- Rectangle bb = border.getBounds();
- e.gc.drawRectangle(0, 0, bb.width - 1, bb.height - 1);
- });
- }
- }
-
-
- /**
- * Move the border (and its 'contained' control to a new position. The new
- * position will be adjusted to lie entirely within the client area of the
- * <code>clientControl</code>.
- *
- * @param newPos
- * The new position for the border
- * @param alignment
- * The location of the cursor relative to the border being dragged.
- * Current implementation only recognizes SWT.TOP & SWT.BOTTOM (which implies SWT.LEFT)
- * and SWT.CENTER (which centers teh dragged border on the cursor.
- */
- public void setLocation(Point newPos, int alignment) {
- // Move the border but ensure that it is still inside the Client area
- if (alignment == SWT.CENTER) {
- Point size = border.getSize();
- border.setLocation(newPos.x - (size.x / 2), newPos.y - (size.y / 2));
- } else if (alignment == SWT.TOP) {
- border.setLocation(newPos.x, newPos.y);
- } else {
- border.setLocation(newPos.x, newPos.y - border.getSize().y);
- }
-
- // Force the control to remain inside the shell
- Rectangle bb = border.getBounds();
- Rectangle cr = clientControl.getClientArea();
- Geometry.moveInside(bb, cr);
-
- // Ensure that the controls are the 'topmost' controls
- border.moveAbove(null);
- dragControl.moveAbove(null);
-
- // OK, now move the drag control and the border to their new locations
- dragControl.setLocation(bb.x + 1, bb.y + 1);
- border.setBounds(bb);
- }
-
- /**
- * Sets the hilight 'mode' for the control.
- *
- * @param highlight
- * true if the border should be drawn as 'hilighted'
- */
- public void setHighlight(boolean highlight) {
- isHighlight = highlight;
- border.redraw();
- }
-
- /**
- * Dispose the controls owned by the border.
- */
- public void dispose() {
- hilightColor.dispose();
- border.dispose();
- }
-
-
- /**
- * @return The bounds of the border's control.
- */
- public Rectangle getBounds() {
- return border.getBounds();
- }
-}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/InsertCaret.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/InsertCaret.java
deleted file mode 100755
index 7ac821ce3b2..00000000000
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/InsertCaret.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.infra.core.sasheditor.internal.eclipsecopy;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.themes.ColorUtil;
-
-/**
- * This class provides 'insertion' feedback to the User. It can be used to draw a
- * 'bracket' based on the trim area's rectangle.
- *
- * @since 3.2
- */
-public class InsertCaret {
- // Constants
- private static final int width = 6; // the handle's 'thickness'
- private static final int pctInset = 10; // The percentage of the area left at each 'end'
-
- // Control info
- private Canvas caretControl;
- private Canvas end1;
- private Canvas end2;
-
- // Colors
- private Color baseColor;
- private Color hilightColor;
- private boolean isHighlight;
-
- /**
- * Creates an affordance to indicate that the given trim area is a valid location for the
- * trim being dragged.
- *
- * @param windowComposite
- * The window to create the affordance as a child of
- * @param trimRect
- * The rectangle to show the affordance for
- * @param swtSide
- * The 'side' that the rectangle is on
- * @param threshold
- * The amount to offfset the affordance by
- */
- public InsertCaret(Composite parent, Rectangle trimRect, int swtSide, int threshold) {
- // Use the SWT 'title' colors since they should always have a proper contrast
- // and are 'related' (i.e. should look good together)
- baseColor = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION);
- RGB background = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB();
- RGB blended = ColorUtil.blend(baseColor.getRGB(), background);
- hilightColor = new Color(parent.getDisplay(), blended);
-
- // Create the caret control
- createControl(parent, trimRect, swtSide, threshold);
- }
-
- /**
- * Creates a control to show the 'area valid' affordance. The current implementation creates a
- * simple rect half the length of the rect, centered and offset by the 'threshold' value.
- *
- * @param parent
- * The control to used as the parent of the affordance control
- * @param trimRect
- * The trim rectangle
- * @param swtSide
- * The SWT side that the trim is on
- * @param threshold
- * The offset value
- */
- private void createControl(Composite parent, Rectangle trimRect, int swtSide, int threshold) {
- int hDelta = trimRect.width / pctInset;
- int vDelta = trimRect.height / pctInset;
- caretControl = new Canvas(parent.getShell(), SWT.BORDER);
-
- end1 = new Canvas(parent.getShell(), SWT.BORDER);
- end1.setSize(width, width);
- end2 = new Canvas(parent.getShell(), SWT.BORDER);
- end2.setSize(width, width);
-
- Rectangle bb;
- switch (swtSide) {
- case SWT.TOP:
- caretControl.setSize(trimRect.width - (2 * hDelta), width);
- caretControl.setLocation(trimRect.x + hDelta, trimRect.y + trimRect.height + threshold);
- bb = caretControl.getBounds();
- end1.setLocation(bb.x, bb.y - width);
- end2.setLocation((bb.x + bb.width) - width, bb.y - width);
- break;
- case SWT.BOTTOM:
- caretControl.setSize(trimRect.width - (2 * hDelta), width);
- caretControl.setLocation(trimRect.x + hDelta, trimRect.y - threshold);
- bb = caretControl.getBounds();
- end1.setLocation(bb.x, bb.y + width);
- end2.setLocation((bb.x + bb.width) - width, bb.y + width);
- break;
- case SWT.LEFT:
- caretControl.setSize(width, trimRect.height - (2 * vDelta));
- caretControl.setLocation(trimRect.x + trimRect.width + threshold,
- trimRect.y + vDelta);
- bb = caretControl.getBounds();
- end1.setLocation(bb.x - bb.width, bb.y);
- end2.setLocation(bb.x - bb.width, (bb.y + bb.height) - width);
- break;
- case SWT.RIGHT:
- caretControl.setSize(width, trimRect.height - (2 * vDelta));
- caretControl.setLocation(trimRect.x - threshold,
- trimRect.y + vDelta);
- bb = caretControl.getBounds();
- end1.setLocation(bb.x + bb.width, bb.y);
- end2.setLocation(bb.x + bb.width, (bb.y + bb.height) - width);
- break;
- }
-
- // Initially create as not hilighted
- setHighlight(false);
- caretControl.moveAbove(null);
- end1.moveAbove(null);
- end2.moveAbove(null);
- }
-
- /**
- * Sets the hilight 'mode' for the control.
- *
- * @param highlight
- * true if the caret should be drawn as 'hilighted'
- */
- public void setHighlight(boolean highlight) {
- isHighlight = highlight;
-
- // if we're displaying as a 'bar' then set the control's background to the
- // appropriate value
- if (isHighlight) {
- caretControl.setBackground(hilightColor);
- end1.setBackground(hilightColor);
- end2.setBackground(hilightColor);
- } else {
- caretControl.setBackground(baseColor);
- end1.setBackground(baseColor);
- end2.setBackground(baseColor);
- }
- }
-
- public void dispose() {
- // Dispose the control's resources (we don't have to dispose the
- // 'bacseColor' because it's a system color
- hilightColor.dispose();
-
- caretControl.dispose();
- end1.dispose();
- end2.dispose();
- }
-}

Back to the top