Skip to content
Snippets Groups Projects
Commit 41f41be0 authored by Daniel Ratiu's avatar Daniel Ratiu
Browse files

tooltips about connecting elements are shown only 2 times

refs 1612
parent e0c938f6
Branches
Tags
No related merge requests found
......@@ -106,7 +106,7 @@ import org.fortiss.tooling.kernel.ui.service.IEditPartFactoryService;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: 4F5E3DD53FCF647674A9830DABDE0593
* @ConQAT.Rating YELLOW Hash: 9E72ED3F824111F92720F85EF823E3DF
*/
public class DiagramEditorBase<T extends EObject> extends GEFEditorBase<T> implements
IPostSelectionProvider, ContextMenuContextProvider {
......@@ -129,6 +129,15 @@ public class DiagramEditorBase<T extends EObject> extends GEFEditorBase<T> imple
/** A container for editor actions */
private final ActionRegistry actionRegistry = new ActionRegistry();
/** A counter for the selection of connectors. */
private int connectorsSelectionCount;
/** A counter for the selection of hierarchic elements. */
private int hierarchicElementssSelectionCount;
/** The number of times the hints about creating connections should be displayed. */
private static final int HINTS_COUNT = 2;
/** Selection listener used to update selection actions. */
private final ISelectionListener selectionListener = new ISelectionListener() {
@Override
......@@ -136,10 +145,13 @@ public class DiagramEditorBase<T extends EObject> extends GEFEditorBase<T> imple
EditPart ep = SelectionUtils.checkAndPickFirstSafe(selection, EditPart.class);
if(ep != null) {
Control control = ep.getViewer().getControl();
if(ep.getModel() instanceof IConnector) {
if(ep.getModel() instanceof IConnector && connectorsSelectionCount < HINTS_COUNT) {
control.setToolTipText("Link two connectors by pressing ALT and dragging from source to target.");
} else if(ep.getModel() instanceof IHierarchicElement) {
connectorsSelectionCount++;
} else if(ep.getModel() instanceof IHierarchicElement &&
hierarchicElementssSelectionCount < HINTS_COUNT) {
control.setToolTipText("Create a connection by pressing ALT and dragging.");
hierarchicElementssSelectionCount++;
}
}
updateActions(selectionActions);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment