diff options
author | Martin Fleck | 2017-03-07 15:31:05 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2017-03-09 08:18:16 +0000 |
commit | 31791257291780c1ddeccfb77cbd1696b3b825eb (patch) | |
tree | bba5fc547f13d0dc5dd953177f1b1399fc046755 | |
parent | 49e853286f93ee2c9413f1cc6a7a51b70904e09b (diff) | |
download | org.eclipse.papyrus-rt-31791257291780c1ddeccfb77cbd1696b3b825eb.tar.gz org.eclipse.papyrus-rt-31791257291780c1ddeccfb77cbd1696b3b825eb.tar.xz org.eclipse.papyrus-rt-31791257291780c1ddeccfb77cbd1696b3b825eb.zip |
Bug 507449: [Tooling][Usability] Superfluous scrollbar always present
Provide custom state compartment figure and edit parts to hide the
superfluous scrollbars after compartment expansion. The original
expansion always sets the scrollbar visibility to AUTOMATIC, independent
of the initial setting.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=507449
Change-Id: Iba90556df86da0af611f87e5942ceea764e0332b
Also-by: Remi Schnekenburger <rschnekenburger@eclipsesource.com>
Signed-off-by: Martin Fleck <mfleck@eclipsesource.com>
5 files changed, 219 insertions, 0 deletions
diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/statemachine/internal/editparts/RTStateCompartmentEditPart.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/statemachine/internal/editparts/RTStateCompartmentEditPart.java new file mode 100644 index 000000000..9c5985577 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/statemachine/internal/editparts/RTStateCompartmentEditPart.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2017 EclipseSource Services GmbH 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: + * Martin Fleck - initial API and implementation + *******************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine.internal.editparts; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part.CustomStateCompartmentEditPart; +import org.eclipse.papyrus.uml.diagram.statemachine.custom.figures.CustomStateCompartmentFigure; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine.internal.figures.RTCustomStateCompartmentFigure; + +/** + * UML-RT implementation of the {@link CustomStateCompartmentEditPart} to use a custom {@link RTCustomStateCompartmentFigure}. + * + * @author Martin Fleck <mfleck@eclipsesource.com> + */ +public class RTStateCompartmentEditPart extends CustomStateCompartmentEditPart { + + /** + * Initializes me with my notation view. + * + * @param view + * my notation view + */ + public RTStateCompartmentEditPart(View view) { + super(view); + } + + /** + * {@inheritDoc} + * + * Specifically, this method creates a {@link RTCustomStateCompartmentFigure} which hides it's scrollbars after expansion. + * + * @return the figure created for this edit part + */ + @Override + public IFigure createFigure() { + CustomStateCompartmentFigure result = new RTCustomStateCompartmentFigure(getCompartmentName(), getMapMode()); + return result; + } +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/statemachine/internal/editparts/RTStateCompartmentEditPartTN.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/statemachine/internal/editparts/RTStateCompartmentEditPartTN.java new file mode 100644 index 000000000..e3b264415 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/statemachine/internal/editparts/RTStateCompartmentEditPartTN.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2017 EclipseSource Services GmbH 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: + * Martin Fleck - initial API and implementation + *******************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine.internal.editparts; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part.CustomStateCompartmentEditPartTN; +import org.eclipse.papyrus.uml.diagram.statemachine.custom.figures.CustomStateCompartmentFigure; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine.internal.figures.RTCustomStateCompartmentFigure; + +/** + * UML-RT implementation of the {@link CustomStateCompartmentEditPartTN} to use a custom {@link RTCustomStateCompartmentFigure}. + * + * @author Martin Fleck <mfleck@eclipsesource.com> + */ +public class RTStateCompartmentEditPartTN extends CustomStateCompartmentEditPartTN { + + /** + * Initializes me with my notation view. + * + * @param view + * my notation view + */ + public RTStateCompartmentEditPartTN(View view) { + super(view); + } + + /** + * {@inheritDoc} + * + * Specifically, this method creates a {@link RTCustomStateCompartmentFigure} which hides it's scrollbars after expansion. + * + * @return the figure created for this edit part + */ + @Override + public IFigure createFigure() { + CustomStateCompartmentFigure result = new RTCustomStateCompartmentFigure(getCompartmentName(), getMapMode()); + return result; + } + +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/statemachine/internal/editparts/RTStateMachineCompartmentEditPart.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/statemachine/internal/editparts/RTStateMachineCompartmentEditPart.java new file mode 100644 index 000000000..2c0a189d1 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/statemachine/internal/editparts/RTStateMachineCompartmentEditPart.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2017 EclipseSource Services GmbH 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: + * Martin Fleck - initial API and implementation + *******************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine.internal.editparts; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.statemachine.custom.edit.part.CustomStateMachineCompartmentEditPart; +import org.eclipse.papyrus.uml.diagram.statemachine.custom.figures.CustomStateCompartmentFigure; +import org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine.internal.figures.RTCustomStateCompartmentFigure; + +/** + * UML-RT implementation of the {@link CustomStateMachineCompartmentEditPart} to use a custom {@link RTCustomStateCompartmentFigure}. + * + * @author Martin Fleck <mfleck@eclipsesource.com> + */ +public class RTStateMachineCompartmentEditPart extends CustomStateMachineCompartmentEditPart { + + /** + * Initializes me with my notation view. + * + * @param view + * my notation view + */ + public RTStateMachineCompartmentEditPart(View view) { + super(view); + } + + /** + * {@inheritDoc} + * + * Specifically, this method creates a {@link RTCustomStateCompartmentFigure} which hides it's scrollbars after expansion. + * + * @return the figure created for this edit part + */ + @Override + public IFigure createFigure() { + CustomStateCompartmentFigure result = new RTCustomStateCompartmentFigure(getCompartmentName(), getMapMode()); + return result; + } + +} diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/statemachine/internal/editparts/RTStateMachineEditPartProvider.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/statemachine/internal/editparts/RTStateMachineEditPartProvider.java index 399147509..9fe4e76fb 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/statemachine/internal/editparts/RTStateMachineEditPartProvider.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/statemachine/internal/editparts/RTStateMachineEditPartProvider.java @@ -28,8 +28,11 @@ import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.PseudostateJuncti import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.PseudostateJunctionFloatingLabelEditPart; import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.RegionCompartmentEditPart; import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.RegionEditPart; +import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.StateCompartmentEditPart; +import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.StateCompartmentEditPartTN; import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.StateEditPart; import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.StateEditPartTN; +import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.StateMachineCompartmentEditPart; import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.StateMachineEditPart; import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.TransitionEditPart; import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.TransitionGuardEditPart; @@ -66,6 +69,9 @@ public class RTStateMachineEditPartProvider extends AbstractRTEditPartProvider { nodeMap.put(RegionCompartmentEditPart.VISUAL_ID, always(RTRegionCompartmentEditPart.class)); nodeMap.put(TransitionNameEditPart.VISUAL_ID, always(RTTransitionNameEditPart.class)); nodeMap.put(TransitionGuardEditPart.VISUAL_ID, always(RTTransitionGuardEditPart.class)); + nodeMap.put(StateCompartmentEditPart.VISUAL_ID, always(RTStateCompartmentEditPart.class)); + nodeMap.put(StateCompartmentEditPartTN.VISUAL_ID, always(RTStateCompartmentEditPartTN.class)); + nodeMap.put(StateMachineCompartmentEditPart.VISUAL_ID, always(RTStateMachineCompartmentEditPart.class)); // Labels nodeMap.put(PseudostateChoiceFloatingLabelEditPart.VISUAL_ID, always(RTPseudostateChoiceLabelEditPart.class)); diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/statemachine/internal/figures/RTCustomStateCompartmentFigure.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/statemachine/internal/figures/RTCustomStateCompartmentFigure.java new file mode 100644 index 000000000..d5ca38f40 --- /dev/null +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine/src/org/eclipse/papyrusrt/umlrt/tooling/diagram/statemachine/internal/figures/RTCustomStateCompartmentFigure.java @@ -0,0 +1,64 @@ +/******************************************************************************* + * Copyright (c) 2017 EclipseSource Services GmbH 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: + * Martin Fleck - initial API and implementation + *******************************************************************************/ + +package org.eclipse.papyrusrt.umlrt.tooling.diagram.statemachine.internal.figures; + +import org.eclipse.draw2d.ScrollPane; +import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode; +import org.eclipse.papyrus.uml.diagram.statemachine.custom.figures.CustomStateCompartmentFigure; + +/** + * UML-RT implementation of the {@link CustomStateCompartmentFigure} to hide the scrollbars after their visibility has been modified through expansion. + * + * @author Martin Fleck <mfleck@eclipsesource.com> + */ +public class RTCustomStateCompartmentFigure extends CustomStateCompartmentFigure { + + /** + * Create a new instance. + * + * @param compartmentTitle + * title of the compartment. + * @param mm + * the <code>IMapMode</code> that is used to initialize the + * default values of of the scrollpane contained inside the figure. This is + * necessary since the figure is not attached at construction time and consequently + * can't get access to the owned IMapMode in the parent containment hierarchy. + */ + public RTCustomStateCompartmentFigure(String compartmentTitle, IMapMode mm) { + super(compartmentTitle, mm); + } + + /** + * {@inheritDoc}. + * After the expansion, the scrollbar visibility is set to {@link ScrollPane#NEVER}. + */ + @Override + public void setExpanded() { + // independent of the initial scrollbar visibility, expansion sets the visibility to AUTOMATIC + super.setExpanded(); + scrollPane.setHorizontalScrollBarVisibility(ScrollPane.NEVER); + scrollPane.setVerticalScrollBarVisibility(ScrollPane.NEVER); + } + + /** + * {@inheritDoc}. + * After the expansion, the scrollbar visibility is set to {@link ScrollPane#NEVER}. + */ + @Override + public void expand() { + // independent of the initial scrollbar visibility, expansion sets the visibility to AUTOMATIC + super.expand(); + scrollPane.setHorizontalScrollBarVisibility(ScrollPane.NEVER); + scrollPane.setVerticalScrollBarVisibility(ScrollPane.NEVER); + } + +} |