Skip to content
Snippets Groups Projects
Commit 519e295e authored by Florian Hölzl's avatar Florian Hölzl
Browse files

cleanup => YELLOW

refs 311
parent 0e07a1dc
No related branches found
No related tags found
No related merge requests found
Showing
with 57 additions and 147 deletions
org.fortiss.tooling.base.ui/trunk/icons/overlay/ellipse-reflections.png

6.83 KiB

org.fortiss.tooling.base.ui/trunk/icons/overlay/linear-blend-round.png

4.93 KiB

org.fortiss.tooling.base.ui/trunk/icons/overlay/radial-blend.png

2.93 KiB

...@@ -31,7 +31,7 @@ import org.fortiss.tooling.kernel.service.IConnectionCompositorService; ...@@ -31,7 +31,7 @@ import org.fortiss.tooling.kernel.service.IConnectionCompositorService;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating RED Hash: 014CBB9569896D0AA2554DE850E8F91E * @ConQAT.Rating YELLOW Hash: 24421D2AC104331D9746EEAF90095300
*/ */
public class ReconnectCommand extends ConnectCommand { public class ReconnectCommand extends ConnectCommand {
...@@ -53,10 +53,7 @@ public class ReconnectCommand extends ConnectCommand { ...@@ -53,10 +53,7 @@ public class ReconnectCommand extends ConnectCommand {
return false; return false;
} }
if (context.getSource().getModel() instanceof EObject if (context.getSource().getModel() instanceof EObject
&& context.getTarget().getModel() instanceof EObject && context.getTarget().getModel() instanceof EObject) {
// TODO @review CD: why check source's parent? - C&P from
// Connect?
&& context.getSource().getParent().getModel() instanceof EObject) {
return IConnectionCompositorService.INSTANCE.canReconnect( return IConnectionCompositorService.INSTANCE.canReconnect(
connection, (EObject) context.getSource().getModel(), connection, (EObject) context.getSource().getModel(),
(EObject) context.getTarget().getModel(), context); (EObject) context.getTarget().getModel(), context);
......
...@@ -24,9 +24,7 @@ import org.eclipse.draw2d.geometry.Insets; ...@@ -24,9 +24,7 @@ import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Path; import org.eclipse.swt.graphics.Path;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/** /**
* This shape consists of an ellipse that is surrounded by transparent insets. * This shape consists of an ellipse that is surrounded by transparent insets.
...@@ -40,23 +38,13 @@ import org.eclipse.ui.plugin.AbstractUIPlugin; ...@@ -40,23 +38,13 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating RED Hash: D7A97336995AA26EEDBC95C2B49127FA * @ConQAT.Rating YELLOW Hash: 7E86CA664B6B561EE22AEC45CC29C1E2
*/ */
public class PrettyInsetEllipse extends Shape { public class PrettyInsetEllipse extends Shape {
/** The transparent insets surrounding this shape. */ /** The transparent insets surrounding this shape. */
protected final Insets insets; protected final Insets insets;
// TODO @review CD: overlay images as well as "fancy" look are currently
// omitted. corresponding
// preference seems to have disappeared.
// -> clean up or re-enable
/** A complete set of reflections for 3 dimensional ellipses. */
protected static final Image reflections = AbstractUIPlugin
.imageDescriptorFromPlugin("org.fortiss.tooling.base.ui",
"icons/overlay/ellipse-reflections.png").createImage();
/** Constructor. */ /** Constructor. */
public PrettyInsetEllipse(Insets insets) { public PrettyInsetEllipse(Insets insets) {
this.insets = insets; this.insets = insets;
...@@ -70,49 +58,19 @@ public class PrettyInsetEllipse extends Shape { ...@@ -70,49 +58,19 @@ public class PrettyInsetEllipse extends Shape {
*/ */
@Override @Override
protected void fillShape(Graphics gfx) { protected void fillShape(Graphics gfx) {
EVisualStyle style = EVisualStyle.get();
gfx.pushState(); gfx.pushState();
Rectangle croppedBounds = getCroppedBounds(); Rectangle croppedBounds = getCroppedBounds();
if (style == EVisualStyle.Glossy) {
// Glossy style.
gfx.setBackgroundColor(ColorConstants.black);
gfx.setAntialias(SWT.ON);
gfx.setAlpha(48);
gfx.fillOval(croppedBounds.getCopy().translate(5, 5));
gfx.restoreState();
if (getBackgroundColor().getGreen() < 255) {
gfx.setBackgroundColor(ColorConstants.red);
} else {
gfx.setBackgroundColor(ColorConstants.orange);
}
gfx.fillOval(croppedBounds);
gfx.setForegroundColor(ColorConstants.yellow);
gfx.setAlpha(180);
Path path = new Path(null); // Traditional style is default.
path.addArc(croppedBounds.x, croppedBounds.y, croppedBounds.width, gfx.fillOval(croppedBounds);
croppedBounds.height, 0, 360); gfx.setForegroundColor(ColorConstants.white);
gfx.setClip(path); gfx.setAlpha(200);
gfx.fillGradient(croppedBounds, true);
gfx.restoreState();
path.dispose();
gfx.setAntialias(SWT.ON); Path path = new Path(null);
gfx.setAlpha(220); path.addArc(croppedBounds.x, croppedBounds.y, croppedBounds.width,
gfx.drawImage(reflections, new Rectangle(reflections.getBounds()), croppedBounds.height, 0, 360);
croppedBounds); gfx.setClip(path);
} else { gfx.fillGradient(croppedBounds, true);
// Traditional style is default.
gfx.fillOval(croppedBounds);
gfx.setForegroundColor(ColorConstants.white);
gfx.setAlpha(200);
Path path = new Path(null);
path.addArc(croppedBounds.x, croppedBounds.y, croppedBounds.width,
croppedBounds.height, 0, 360);
gfx.setClip(path);
gfx.fillGradient(croppedBounds, true);
}
gfx.popState(); gfx.popState();
} }
......
...@@ -24,8 +24,6 @@ import org.eclipse.draw2d.geometry.Insets; ...@@ -24,8 +24,6 @@ import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.fortiss.tooling.base.ui.ToolingBaseUIActivator;
/** /**
* This shape consists of a rounded rectangle that is surrounded by transparent * This shape consists of a rounded rectangle that is surrounded by transparent
...@@ -38,7 +36,7 @@ import org.fortiss.tooling.base.ui.ToolingBaseUIActivator; ...@@ -38,7 +36,7 @@ import org.fortiss.tooling.base.ui.ToolingBaseUIActivator;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating RED Hash: 31CAA5E0D8A786AECB929587261F1199 * @ConQAT.Rating YELLOW Hash: 34D4F4B5FBB7A3565AE4065D4D7EFED2
*/ */
public class PrettyRoundedRectangle extends Shape { public class PrettyRoundedRectangle extends Shape {
...@@ -48,20 +46,6 @@ public class PrettyRoundedRectangle extends Shape { ...@@ -48,20 +46,6 @@ public class PrettyRoundedRectangle extends Shape {
/** The transparent insets surrounding this shape. */ /** The transparent insets surrounding this shape. */
protected final Insets insets; protected final Insets insets;
// TODO @review CD: overlay images as well as "fancy" look are currently
// omitted. corresponding
// preference seems to have disappeared.
// -> clean up or re-enable
/** A linear blend applied at the top. */
protected static final Image linearBlend = ToolingBaseUIActivator
.getImageDescriptor("icons/overlay/linear-blend-round.png")
.createImage();
/** A radial blend applied at the bottom. */
protected static final Image radialBlend = ToolingBaseUIActivator
.getImageDescriptor("icons/overlay/radial-blend.png").createImage();
/** Constructor. */ /** Constructor. */
public PrettyRoundedRectangle(int cornerRadius, Insets insets) { public PrettyRoundedRectangle(int cornerRadius, Insets insets) {
this.cornerRadius = cornerRadius; this.cornerRadius = cornerRadius;
...@@ -71,34 +55,12 @@ public class PrettyRoundedRectangle extends Shape { ...@@ -71,34 +55,12 @@ public class PrettyRoundedRectangle extends Shape {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
protected void fillShape(Graphics gfx) { protected void fillShape(Graphics gfx) {
EVisualStyle style = EVisualStyle.get();
gfx.pushState(); gfx.pushState();
if (style == EVisualStyle.Glossy) { // Traditional style is default.
// Glossy style. gfx.fillRoundRectangle(getCroppedBounds(), cornerRadius, cornerRadius);
final Rectangle b = getCroppedBounds(); gfx.setForegroundColor(ColorConstants.white);
gfx.setBackgroundColor(ColorConstants.black); gfx.setAlpha(200);
gfx.setAlpha(48); gfx.fillGradient(getCroppedBounds().resize(0, -cornerRadius), true);
gfx.fillRoundRectangle(b.getCopy().translate(5, 5), cornerRadius,
cornerRadius);
gfx.restoreState();
gfx.fillRoundRectangle(b, cornerRadius, cornerRadius);
gfx.setAlpha(255);
gfx.drawImage(linearBlend, new Rectangle(linearBlend.getBounds()),
b.getCopy().resize(-1, -b.height / 2 - 1));
gfx.setAlpha(200);
gfx.drawImage(
radialBlend,
new Rectangle(radialBlend.getBounds()),
b.getCopy().resize(-1, -b.height / 2 - 1)
.translate(0, b.height / 2));
} else {
// Traditional style is default.
gfx.fillRoundRectangle(getCroppedBounds(), cornerRadius,
cornerRadius);
gfx.setForegroundColor(ColorConstants.white);
gfx.setAlpha(200);
gfx.fillGradient(getCroppedBounds().resize(0, -cornerRadius), true);
}
gfx.popState(); gfx.popState();
} }
......
...@@ -39,7 +39,7 @@ import org.fortiss.tooling.base.ui.editpart.command.MoveWithinDiagramCommand; ...@@ -39,7 +39,7 @@ import org.fortiss.tooling.base.ui.editpart.command.MoveWithinDiagramCommand;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating RED Hash: FF45F874E12A71D06C92F154DF319D98 * @ConQAT.Rating YELLOW Hash: DC3E049397CBC5F1BA2B9181C1B6C9B7
*/ */
public class DiagramLayoutEditPolicy extends RelayCreateCommandEditPolicyBase { public class DiagramLayoutEditPolicy extends RelayCreateCommandEditPolicyBase {
...@@ -63,7 +63,6 @@ public class DiagramLayoutEditPolicy extends RelayCreateCommandEditPolicyBase { ...@@ -63,7 +63,6 @@ public class DiagramLayoutEditPolicy extends RelayCreateCommandEditPolicyBase {
return super.getCommand(request); return super.getCommand(request);
} }
// TODO @review CD: clone with ElementLayoutEditPolicy -> move to superclass
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
protected Command getMoveChildrenCommand(final Request request) { protected Command getMoveChildrenCommand(final Request request) {
......
...@@ -39,7 +39,7 @@ import org.fortiss.tooling.kernel.model.INamedCommentedElement; ...@@ -39,7 +39,7 @@ import org.fortiss.tooling.kernel.model.INamedCommentedElement;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating RED Hash: E074E4EB7529C3D44215580F3AAB6932 * @ConQAT.Rating YELLOW Hash: F419FCA55F52F78F6EB0C7D80AF32627
*/ */
public class ElementLayoutEditPolicy<T extends ILayoutedModelElement & INamedCommentedElement> public class ElementLayoutEditPolicy<T extends ILayoutedModelElement & INamedCommentedElement>
extends RelayCreateCommandEditPolicyBase { extends RelayCreateCommandEditPolicyBase {
...@@ -63,7 +63,6 @@ public class ElementLayoutEditPolicy<T extends ILayoutedModelElement & INamedCom ...@@ -63,7 +63,6 @@ public class ElementLayoutEditPolicy<T extends ILayoutedModelElement & INamedCom
return new NonResizableEditPolicy(); return new NonResizableEditPolicy();
} }
// TODO @review CD: clone with ElementLayoutEditPolicy -> move to superclass
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
protected Command getMoveChildrenCommand(Request request) { protected Command getMoveChildrenCommand(Request request) {
......
...@@ -43,7 +43,7 @@ import org.fortiss.tooling.kernel.ui.dnd.ElementCompositionSource; ...@@ -43,7 +43,7 @@ import org.fortiss.tooling.kernel.ui.dnd.ElementCompositionSource;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating RED Hash: 0D7A3CEE777E39AE87521E2458B76977 * @ConQAT.Rating YELLOW Hash: 66E79A7E8FC55B782B9141E8473B8A7B
*/ */
public abstract class RelayCreateCommandEditPolicyBase extends LayoutEditPolicy { public abstract class RelayCreateCommandEditPolicyBase extends LayoutEditPolicy {
...@@ -69,7 +69,8 @@ public abstract class RelayCreateCommandEditPolicyBase extends LayoutEditPolicy ...@@ -69,7 +69,8 @@ public abstract class RelayCreateCommandEditPolicyBase extends LayoutEditPolicy
* {@link CreateConnectionCompositionRequest}s. * {@link CreateConnectionCompositionRequest}s.
*/ */
private Command getCreateCompositionCommand(CreateRequest request) { private Command getCreateCompositionCommand(CreateRequest request) {
// TODO @review CD: sure? if(NEQ null) return null ? // the request should only contain a position (e.g. mouse clicked not
// dragged)
if (request.getSize() != null) { if (request.getSize() != null) {
return null; return null;
} }
......
...@@ -18,8 +18,8 @@ $Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ ...@@ -18,8 +18,8 @@ $Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
package org.fortiss.tooling.base.ui.properties.view; package org.fortiss.tooling.base.ui.properties.view;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
...@@ -32,10 +32,10 @@ import org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase; ...@@ -32,10 +32,10 @@ import org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase;
* @author ratiu * @author ratiu
* @author $Author: hoelzl $ * @author $Author: hoelzl $
* @version $Rev: 18709 $ * @version $Rev: 18709 $
* @ConQAT.Rating RED Hash: 658C6CE7721FC82AA7DF76FC0A1CE6F0 * @ConQAT.Rating YELLOW Hash: 28164A1500812F5F071D29F4ECBD38B9
*/ */
public abstract class PropertySectionWithCopyPasteBase<T extends IModelElementSpecification> public abstract class PropertySectionWithCopyPasteBase<T extends IModelElementSpecification>
extends PropertySectionBase implements SelectionListener { extends PropertySectionBase {
/** Widget for clip board copy. */ /** Widget for clip board copy. */
protected Button clipboardCopy; protected Button clipboardCopy;
...@@ -53,36 +53,30 @@ public abstract class PropertySectionWithCopyPasteBase<T extends IModelElementSp ...@@ -53,36 +53,30 @@ public abstract class PropertySectionWithCopyPasteBase<T extends IModelElementSp
copyPasteComposite.setLayout(new FillLayout(SWT.HORIZONTAL)); copyPasteComposite.setLayout(new FillLayout(SWT.HORIZONTAL));
clipboardCopy = getWidgetFactory().createButton(copyPasteComposite, clipboardCopy = getWidgetFactory().createButton(copyPasteComposite,
"copy", SWT.PUSH); "copy", SWT.PUSH);
clipboardCopy.addSelectionListener(this); clipboardCopy.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setClipboardSpec(specification);
clipboardPaste.setEnabled(false);
}
});
clipboardPaste = getWidgetFactory().createButton(copyPasteComposite, clipboardPaste = getWidgetFactory().createButton(copyPasteComposite,
"paste", SWT.PUSH); "paste", SWT.PUSH);
clipboardPaste.addSelectionListener(this); clipboardPaste.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (getClipboardSpec() != null
&& getClipboardSpec() != specification) {
doPerformCopy();
setClipboardSpec(null);
clipboardPaste.setEnabled(false);
}
}
});
clipboardPaste.setEnabled(false); clipboardPaste.setEnabled(false);
createFormEntry(copyPasteComposite, "Clipboard"); createFormEntry(copyPasteComposite, "Clipboard");
} }
// TODO @review CD: why not use SelectionAdapter and thus save the empty
// method?
/** {@inheritDoc} */
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// nothing to do
}
/** {@inheritDoc} */
@Override
public void widgetSelected(SelectionEvent e) {
if (e.widget == clipboardCopy) {
setClipboardSpec(specification);
clipboardPaste.setEnabled(false);
} else if (e.widget == clipboardPaste && getClipboardSpec() != null
&& getClipboardSpec() != specification) {
doPerformCopy();
setClipboardSpec(null);
clipboardPaste.setEnabled(false);
}
}
/** Performs the copy. */ /** Performs the copy. */
protected abstract void doPerformCopy(); protected abstract void doPerformCopy();
......
...@@ -38,13 +38,10 @@ import org.eclipse.swt.widgets.Shell; ...@@ -38,13 +38,10 @@ import org.eclipse.swt.widgets.Shell;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating RED Hash: 74220EAB8C4432DC0ABDACC754751490 * @ConQAT.Rating YELLOW Hash: 1879A8B4DD69C9B0CA8F5E9C62920F71
*/ */
// Using drawn images may seem strange, but internet sources could not provide
// TODO @review CD: Very interesting, but is this really necessary? Don't SWT // any other solution to having checkbox in cell editors
// checkboxes work as good or even better? During testing these checkboxes seem
// to react slower and additionally they have an ugly gray background.
public abstract class CheckBoxLabelProvider extends ColumnLabelProvider { public abstract class CheckBoxLabelProvider extends ColumnLabelProvider {
/** {@link JFaceResources} id for checked image. */ /** {@link JFaceResources} id for checked image. */
private static final String CHECKED_KEY = "CHECKED"; private static final String CHECKED_KEY = "CHECKED";
......
...@@ -19,6 +19,7 @@ package org.fortiss.tooling.base.ui.tablecell; ...@@ -19,6 +19,7 @@ package org.fortiss.tooling.base.ui.tablecell;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.CellLabelProvider; import org.eclipse.jface.viewers.CellLabelProvider;
import org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider;
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener; import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.StyledString; import org.eclipse.jface.viewers.StyledString;
...@@ -27,18 +28,16 @@ import org.fortiss.tooling.kernel.model.INamedElement; ...@@ -27,18 +28,16 @@ import org.fortiss.tooling.kernel.model.INamedElement;
import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService; import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService;
/** /**
* {@link CellLabelProvider} for {@link INamedElement} with decoration. Name and * {@link CellLabelProvider} for {@link INamedElement} to be used with
* icon are obtained from {@link IModelElementHandlerService}. * {@link DecoratingStyledCellLabelProvider}. Name and icon are obtained from
* {@link IModelElementHandlerService}.
* *
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating RED Hash: 358A7180C7CC44420271B76CD80E8450 * @ConQAT.Rating YELLOW Hash: CA5333015D50B981971B61CD6B9D5B89
*/ */
public class IconNameLabelProvider implements IStyledLabelProvider {
// TODO @review CD: Imprecise class name. I expected elements with error/warning
// decorations rather than simply an icon.
public class DecoratedIconNameLabelProvider implements IStyledLabelProvider {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public void removeListener(ILabelProviderListener listener) { public void removeListener(ILabelProviderListener listener) {
......
# (c) 2011 ForTISS GmbH
pluginName = Model Model
providerName = www.example.org
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment